Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Upgrade V8 to 3.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Dec 21, 2011
1 parent a82f538 commit 4eaf4ce
Show file tree
Hide file tree
Showing 25 changed files with 296 additions and 108 deletions.
10 changes: 10 additions & 0 deletions deps/v8/ChangeLog
@@ -1,3 +1,13 @@
2011-12-21: Version 3.8.2

Add max optimization flag to v8 gyp build to ensure V8 is always built
fully optimized in Chrome.

MIPS: Bring MIPS to parity with other platforms.

Optimizations and stability improvements on all platforms.


2011-12-19: Version 3.8.1

Fixed GCC 4.7 warnings. Patch from Tobias Burnus.
Expand Down
4 changes: 4 additions & 0 deletions deps/v8/build/common.gypi
Expand Up @@ -84,6 +84,10 @@

# For a shared library build, results in "libv8-<(soname_version).so".
'soname_version%': '',

# We want max optimization for the V8 build (if this is not set, chrome
# defaults to low optimization settings)
'optimize': 'max',
},
'target_defaults': {
'conditions': [
Expand Down
11 changes: 6 additions & 5 deletions deps/v8/src/arm/lithium-arm.cc
Expand Up @@ -1779,11 +1779,12 @@ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {


LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
LOperand* temp = TempRegister();
LOperand* value = UseTempRegister(instr->value());
LInstruction* result = new LStoreGlobalCell(value, temp);
if (instr->RequiresHoleCheck()) result = AssignEnvironment(result);
return result;
LOperand* value = UseRegister(instr->value());
// Use a temp to check the value in the cell in the case where we perform
// a hole check.
return instr->RequiresHoleCheck()
? AssignEnvironment(new LStoreGlobalCell(value, TempRegister()))
: new LStoreGlobalCell(value, NULL);
}


Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/arm/lithium-arm.h
Expand Up @@ -1242,6 +1242,8 @@ class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {

DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)

LOperand* value() { return inputs_[0]; }
};


Expand Down
17 changes: 8 additions & 9 deletions deps/v8/src/arm/lithium-codegen-arm.cc
Expand Up @@ -2262,27 +2262,26 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {


void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
Register value = ToRegister(instr->InputAt(0));
Register scratch = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0));
Register value = ToRegister(instr->value());
Register cell = scratch0();

// Load the cell.
__ mov(scratch, Operand(Handle<Object>(instr->hydrogen()->cell())));
__ mov(cell, Operand(instr->hydrogen()->cell()));

// If the cell we are storing to contains the hole it could have
// been deleted from the property dictionary. In that case, we need
// to update the property details in the property dictionary to mark
// it as no longer deleted.
if (instr->hydrogen()->RequiresHoleCheck()) {
__ ldr(scratch2,
FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
__ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
__ cmp(scratch2, ip);
// We use a temp to check the payload (CompareRoot might clobber ip).
Register payload = ToRegister(instr->TempAt(0));
__ ldr(payload, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
__ CompareRoot(payload, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(eq, instr->environment());
}

// Store the value.
__ str(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
__ str(value, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
// Cells are always rescanned, so no write barrier here.
}

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/assembler.cc
@@ -1,4 +1,4 @@
// Copyright (c) 2011 Sun Microsystems Inc.
// Copyright (c) 1994-2006 Sun Microsystems Inc.
// All Rights Reserved.
//
// Redistribution and use in source and binary forms, with or without
Expand Down
14 changes: 4 additions & 10 deletions deps/v8/src/ia32/lithium-codegen-ia32.cc
Expand Up @@ -2124,26 +2124,20 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {


void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
Register object = ToRegister(instr->TempAt(0));
Register address = ToRegister(instr->TempAt(1));
Register value = ToRegister(instr->InputAt(0));
ASSERT(!value.is(object));
Handle<JSGlobalPropertyCell> cell_handle(instr->hydrogen()->cell());

int offset = JSGlobalPropertyCell::kValueOffset;
__ mov(object, Immediate(cell_handle));
Register value = ToRegister(instr->value());
Handle<JSGlobalPropertyCell> cell_handle = instr->hydrogen()->cell();

// If the cell we are storing to contains the hole it could have
// been deleted from the property dictionary. In that case, we need
// to update the property details in the property dictionary to mark
// it as no longer deleted. We deoptimize in that case.
if (instr->hydrogen()->RequiresHoleCheck()) {
__ cmp(FieldOperand(object, offset), factory()->the_hole_value());
__ cmp(Operand::Cell(cell_handle), factory()->the_hole_value());
DeoptimizeIf(equal, instr->environment());
}

// Store the value.
__ mov(FieldOperand(object, offset), value);
__ mov(Operand::Cell(cell_handle), value);
// Cells are always rescanned, so no write barrier here.
}

Expand Down
4 changes: 1 addition & 3 deletions deps/v8/src/ia32/lithium-ia32.cc
Expand Up @@ -1856,9 +1856,7 @@ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {

LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
LStoreGlobalCell* result =
new(zone()) LStoreGlobalCell(UseTempRegister(instr->value()),
TempRegister(),
TempRegister());
new(zone()) LStoreGlobalCell(UseRegister(instr->value()));
return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
}

Expand Down
8 changes: 4 additions & 4 deletions deps/v8/src/ia32/lithium-ia32.h
Expand Up @@ -1269,16 +1269,16 @@ class LLoadGlobalGeneric: public LTemplateInstruction<1, 2, 0> {
};


class LStoreGlobalCell: public LTemplateInstruction<0, 1, 2> {
class LStoreGlobalCell: public LTemplateInstruction<0, 1, 0> {
public:
explicit LStoreGlobalCell(LOperand* value, LOperand* temp1, LOperand* temp2) {
explicit LStoreGlobalCell(LOperand* value) {
inputs_[0] = value;
temps_[0] = temp1;
temps_[1] = temp2;
}

DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)

LOperand* value() { return inputs_[0]; }
};


Expand Down
10 changes: 8 additions & 2 deletions deps/v8/src/mips/builtins-mips.cc
Expand Up @@ -400,13 +400,19 @@ static void ArrayNativeCode(MacroAssembler* masm,
// sp[0]: last argument

Label loop, entry;
__ Branch(&entry);
__ Branch(USE_DELAY_SLOT, &entry);
__ mov(t3, sp);
__ bind(&loop);
__ pop(a2);
__ lw(a2, MemOperand(t3));
__ Addu(t3, t3, kPointerSize);
if (FLAG_smi_only_arrays) {
__ JumpIfNotSmi(a2, call_generic_code);
}
__ Addu(t1, t1, -kPointerSize);
__ sw(a2, MemOperand(t1));
__ bind(&entry);
__ Branch(&loop, lt, t0, Operand(t1));
__ mov(sp, t3);

// Remove caller arguments and receiver from the stack, setup return value and
// return.
Expand Down
16 changes: 8 additions & 8 deletions deps/v8/src/mips/lithium-codegen-mips.cc
Expand Up @@ -2141,26 +2141,26 @@ void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) {


void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) {
Register value = ToRegister(instr->InputAt(0));
Register scratch = scratch0();
Register scratch2 = ToRegister(instr->TempAt(0));
Register value = ToRegister(instr->value());
Register cell = scratch0();

// Load the cell.
__ li(scratch, Operand(Handle<Object>(instr->hydrogen()->cell())));
__ li(cell, Operand(instr->hydrogen()->cell()));

// If the cell we are storing to contains the hole it could have
// been deleted from the property dictionary. In that case, we need
// to update the property details in the property dictionary to mark
// it as no longer deleted.
if (instr->hydrogen()->RequiresHoleCheck()) {
__ lw(scratch2,
FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
// We use a temp to check the payload.
Register payload = ToRegister(instr->TempAt(0));
__ lw(payload, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
__ LoadRoot(at, Heap::kTheHoleValueRootIndex);
DeoptimizeIf(eq, instr->environment(), scratch2, Operand(at));
DeoptimizeIf(eq, instr->environment(), payload, Operand(at));
}

// Store the value.
__ sw(value, FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
__ sw(value, FieldMemOperand(cell, JSGlobalPropertyCell::kValueOffset));
// Cells are always rescanned, so no write barrier here.
}

Expand Down
11 changes: 6 additions & 5 deletions deps/v8/src/mips/lithium-mips.cc
Expand Up @@ -1782,11 +1782,12 @@ LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) {


LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
LOperand* temp = TempRegister();
LOperand* value = UseTempRegister(instr->value());
LInstruction* result = new LStoreGlobalCell(value, temp);
if (instr->RequiresHoleCheck()) result = AssignEnvironment(result);
return result;
LOperand* value = UseRegister(instr->value());
// Use a temp to check the value in the cell in the case where we perform
// a hole check.
return instr->RequiresHoleCheck()
? AssignEnvironment(new LStoreGlobalCell(value, TempRegister()))
: new LStoreGlobalCell(value, NULL);
}


Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/mips/lithium-mips.h
Expand Up @@ -1242,6 +1242,8 @@ class LStoreGlobalCell: public LTemplateInstruction<0, 1, 1> {

DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell, "store-global-cell")
DECLARE_HYDROGEN_ACCESSOR(StoreGlobalCell)

LOperand* value() { return inputs_[0]; }
};


Expand Down
26 changes: 20 additions & 6 deletions deps/v8/src/runtime.cc
Expand Up @@ -4326,12 +4326,26 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
LookupResult result(isolate);
js_object->LocalLookupRealNamedProperty(*name, &result);

// To be compatible with safari we do not change the value on API objects
// in defineProperty. Firefox disagrees here, and actually changes the value.
if (result.IsProperty() &&
(result.type() == CALLBACKS) &&
result.GetCallbackObject()->IsAccessorInfo()) {
return isolate->heap()->undefined_value();
// Special case for callback properties.
if (result.IsProperty() && result.type() == CALLBACKS) {
Object* callback = result.GetCallbackObject();
// To be compatible with Safari we do not change the value on API objects
// in Object.defineProperty(). Firefox disagrees here, and actually changes
// the value.
if (callback->IsAccessorInfo()) {
return isolate->heap()->undefined_value();
}
// Avoid redefining foreign callback as data property, just use the stored
// setter to update the value instead.
// TODO(mstarzinger): So far this only works if property attributes don't
// change, this should be fixed once we cleanup the underlying code.
if (callback->IsForeign() && result.GetAttributes() == attr) {
return js_object->SetPropertyWithCallback(callback,
*name,
*obj_value,
result.holder(),
kStrictMode);
}
}

// Take special care when attributes are different and there is already
Expand Down
Empty file modified deps/v8/src/scanner.cc 100644 → 100755
Empty file.
55 changes: 37 additions & 18 deletions deps/v8/src/type-info.cc
Expand Up @@ -85,7 +85,8 @@ bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
return code->is_keyed_load_stub() &&
code->ic_state() == MONOMORPHIC &&
Code::ExtractTypeFromFlags(code->flags()) == NORMAL &&
code->FindFirstMap() != NULL;
code->FindFirstMap() != NULL &&
!CanRetainOtherContext(code->FindFirstMap(), *global_context_);
}
return false;
}
Expand All @@ -111,7 +112,9 @@ bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
return code->is_keyed_store_stub() &&
code->ic_state() == MONOMORPHIC &&
Code::ExtractTypeFromFlags(code->flags()) == NORMAL;
Code::ExtractTypeFromFlags(code->flags()) == NORMAL &&
code->FindFirstMap() != NULL &&
!CanRetainOtherContext(code->FindFirstMap(), *global_context_);
}
return false;
}
Expand Down Expand Up @@ -144,7 +147,9 @@ Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
Map* first_map = code->FindFirstMap();
ASSERT(first_map != NULL);
return Handle<Map>(first_map);
return CanRetainOtherContext(first_map, *global_context_)
? Handle<Map>::null()
: Handle<Map>(first_map);
}
return Handle<Map>::cast(map_or_code);
}
Expand All @@ -155,7 +160,11 @@ Handle<Map> TypeFeedbackOracle::StoreMonomorphicReceiverType(Expression* expr) {
Handle<Object> map_or_code = GetInfo(expr->id());
if (map_or_code->IsCode()) {
Handle<Code> code = Handle<Code>::cast(map_or_code);
return Handle<Map>(code->FindFirstMap());
Map* first_map = code->FindFirstMap();
ASSERT(first_map != NULL);
return CanRetainOtherContext(first_map, *global_context_)
? Handle<Map>::null()
: Handle<Map>(first_map);
}
return Handle<Map>::cast(map_or_code);
}
Expand Down Expand Up @@ -288,7 +297,11 @@ Handle<Map> TypeFeedbackOracle::GetCompareMap(CompareOperation* expr) {
if (state != CompareIC::KNOWN_OBJECTS) {
return Handle<Map>::null();
}
return Handle<Map>(code->FindFirstMap());
Map* first_map = code->FindFirstMap();
ASSERT(first_map != NULL);
return CanRetainOtherContext(first_map, *global_context_)
? Handle<Map>::null()
: Handle<Map>(first_map);
}


Expand Down Expand Up @@ -451,20 +464,23 @@ void TypeFeedbackOracle::CollectReceiverTypes(unsigned ast_id,
// retaining objects from different tabs in Chrome via optimized code.
bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
Context* global_context) {
Object* constructor = map->constructor();
ASSERT(constructor != NULL);
while (!constructor->IsJSFunction()) {
// If the constructor is not null or a JSFunction, we have to
// conservatively assume that it may retain a global context.
if (!constructor->IsNull()) return true;

// If both, constructor and prototype are null, we conclude
// that no global context will be retained by this map.
if (map->prototype()->IsNull()) return false;

map = JSObject::cast(map->prototype())->map();
Object* constructor = NULL;
while (!map->prototype()->IsNull()) {
constructor = map->constructor();
if (!constructor->IsNull()) {
// If the constructor is not null or a JSFunction, we have to
// conservatively assume that it may retain a global context.
if (!constructor->IsJSFunction()) return true;
// Check if the constructor directly references a foreign context.
if (CanRetainOtherContext(JSFunction::cast(constructor),
global_context)) {
return true;
}
}
map = HeapObject::cast(map->prototype())->map();
}
constructor = map->constructor();
if (constructor->IsNull()) return false;
JSFunction* function = JSFunction::cast(constructor);
return CanRetainOtherContext(function, global_context);
}
Expand Down Expand Up @@ -498,7 +514,10 @@ void TypeFeedbackOracle::CollectKeyedReceiverTypes(unsigned ast_id,
RelocInfo* info = it.rinfo();
Object* object = info->target_object();
if (object->IsMap()) {
AddMapIfMissing(Handle<Map>(Map::cast(object)), types);
Map* map = Map::cast(object);
if (!CanRetainOtherContext(map, *global_context_)) {
AddMapIfMissing(Handle<Map>(map), types);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/version.cc
Expand Up @@ -34,7 +34,7 @@
// cannot be changed without changing the SCons build script.
#define MAJOR_VERSION 3
#define MINOR_VERSION 8
#define BUILD_NUMBER 1
#define BUILD_NUMBER 2
#define PATCH_LEVEL 0
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down

0 comments on commit 4eaf4ce

Please sign in to comment.