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.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Dec 28, 2011
1 parent b037c16 commit b7c05e1
Show file tree
Hide file tree
Showing 28 changed files with 270 additions and 87 deletions.
8 changes: 8 additions & 0 deletions deps/v8/ChangeLog
@@ -1,3 +1,11 @@
2011-12-27: Version 3.8.3

Avoid embedding new space objects into code objects in the lithium gap
resolver. (chromium:108296)

Bug fixes and performance optimizations on all platforms.


2011-12-21: Version 3.8.2

Add max optimization flag to v8 gyp build to ensure V8 is always built
Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/arm/lithium-arm.cc
Expand Up @@ -1938,8 +1938,7 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
LOperand* key = needs_write_barrier
? UseTempRegister(instr->key())
: UseRegisterOrConstantAtStart(instr->key());

return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val));
return new LStoreKeyedFastElement(obj, key, val);
}


Expand Down
19 changes: 12 additions & 7 deletions deps/v8/src/arm/lithium-codegen-arm.cc
Expand Up @@ -385,6 +385,18 @@ DoubleRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op,
}


Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const {
Handle<Object> literal = chunk_->LookupLiteral(op);
ASSERT(chunk_->LookupLiteralRepresentation(op).IsTagged());
return literal;
}


bool LCodeGen::IsInteger32(LConstantOperand* op) const {
return chunk_->LookupLiteralRepresentation(op).IsInteger32();
}


int LCodeGen::ToInteger32(LConstantOperand* op) const {
Handle<Object> value = chunk_->LookupLiteral(op);
ASSERT(chunk_->LookupLiteralRepresentation(op).IsInteger32());
Expand Down Expand Up @@ -3404,13 +3416,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
Register scratch = scratch0();

// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
// conversion, so it deopts in that case.
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
__ tst(value, Operand(kSmiTagMask));
DeoptimizeIf(ne, instr->environment());
}

// Do the store.
if (instr->key()->IsConstantOperand()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
Expand Down
3 changes: 3 additions & 0 deletions deps/v8/src/arm/lithium-codegen-arm.h
Expand Up @@ -93,6 +93,9 @@ class LCodeGen BASE_EMBEDDED {
// Returns a MemOperand pointing to the high word of a DoubleStackSlot.
MemOperand ToHighMemOperand(LOperand* op) const;

bool IsInteger32(LConstantOperand* op) const;
Handle<Object> ToHandle(LConstantOperand* op) const;

// Try to generate code for the entire chunk, but it may fail if the
// chunk contains constructs we cannot handle. Returns true if the
// code generation attempt succeeded.
Expand Down
17 changes: 14 additions & 3 deletions deps/v8/src/arm/lithium-gap-resolver-arm.cc
Expand Up @@ -248,13 +248,24 @@ void LGapResolver::EmitMove(int index) {
}

} else if (source->IsConstantOperand()) {
Operand source_operand = cgen_->ToOperand(source);
LConstantOperand* constant_source = LConstantOperand::cast(source);
if (destination->IsRegister()) {
__ mov(cgen_->ToRegister(destination), source_operand);
Register dst = cgen_->ToRegister(destination);
if (cgen_->IsInteger32(constant_source)) {
__ mov(dst, Operand(cgen_->ToInteger32(constant_source)));
} else {
__ LoadObject(dst, cgen_->ToHandle(constant_source));
}
} else {
ASSERT(destination->IsStackSlot());
ASSERT(!in_cycle_); // Constant moves happen after all cycles are gone.
__ mov(kSavedValueRegister, source_operand);
if (cgen_->IsInteger32(constant_source)) {
__ mov(kSavedValueRegister,
Operand(cgen_->ToInteger32(constant_source)));
} else {
__ LoadObject(kSavedValueRegister,
cgen_->ToHandle(constant_source));
}
__ str(kSavedValueRegister, cgen_->ToMemOperand(destination));
}

Expand Down
8 changes: 8 additions & 0 deletions deps/v8/src/arm/macro-assembler-arm.h
Expand Up @@ -168,6 +168,14 @@ class MacroAssembler: public Assembler {

void LoadHeapObject(Register dst, Handle<HeapObject> object);

void LoadObject(Register result, Handle<Object> object) {
if (object->IsHeapObject()) {
LoadHeapObject(result, Handle<HeapObject>::cast(object));
} else {
Move(result, object);
}
}

// ---------------------------------------------------------------------------
// GC Support

Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/debug.cc
Expand Up @@ -1146,7 +1146,7 @@ void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,

Handle<DebugInfo> debug_info = GetDebugInfo(shared);
// Source positions starts with zero.
ASSERT(source_position >= 0);
ASSERT(*source_position >= 0);

// Find the break point and change it.
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
Expand Down
4 changes: 3 additions & 1 deletion deps/v8/src/flag-definitions.h
Expand Up @@ -564,8 +564,10 @@ DEFINE_implication(print_all_code, print_unopt_code)
DEFINE_implication(print_all_code, print_code_verbose)
DEFINE_implication(print_all_code, print_builtin_code)
DEFINE_implication(print_all_code, print_code_stubs)
DEFINE_implication(print_all_code, trace_codegen)
DEFINE_implication(print_all_code, code_comments)
#ifdef DEBUG
DEFINE_implication(print_all_code, trace_codegen)
#endif
#endif

// Cleanup...
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/heap.cc
Expand Up @@ -463,6 +463,8 @@ void Heap::CollectAllAvailableGarbage() {
}
mark_compact_collector()->SetFlags(kNoGCFlags);
new_space_.Shrink();
UncommitFromSpace();
Shrink();
incremental_marking()->UncommitMarkingDeque();
}

Expand Down
4 changes: 0 additions & 4 deletions deps/v8/src/hydrogen-instructions.h
Expand Up @@ -3933,10 +3933,6 @@ class HStoreKeyedFastElement: public HTemplateInstruction<3> {
}
}

bool ValueNeedsSmiCheck() {
return value_is_smi();
}

virtual void PrintDataTo(StringStream* stream);

DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement)
Expand Down
26 changes: 17 additions & 9 deletions deps/v8/src/hydrogen.cc
Expand Up @@ -3513,6 +3513,9 @@ void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {

switch (boilerplate_elements_kind) {
case FAST_SMI_ONLY_ELEMENTS:
// Smi-only arrays need a smi check.
AddInstruction(new(zone()) HCheckSmi(value));
// Fall through.
case FAST_ELEMENTS:
AddInstruction(new(zone()) HStoreKeyedFastElement(
elements,
Expand Down Expand Up @@ -4223,12 +4226,20 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements,
bool is_store) {
if (is_store) {
ASSERT(val != NULL);
if (elements_kind == FAST_DOUBLE_ELEMENTS) {
return new(zone()) HStoreKeyedFastDoubleElement(
elements, checked_key, val);
} else { // FAST_ELEMENTS or FAST_SMI_ONLY_ELEMENTS.
return new(zone()) HStoreKeyedFastElement(
elements, checked_key, val, elements_kind);
switch (elements_kind) {
case FAST_DOUBLE_ELEMENTS:
return new(zone()) HStoreKeyedFastDoubleElement(
elements, checked_key, val);
case FAST_SMI_ONLY_ELEMENTS:
// Smi-only arrays need a smi check.
AddInstruction(new(zone()) HCheckSmi(val));
// Fall through.
case FAST_ELEMENTS:
return new(zone()) HStoreKeyedFastElement(
elements, checked_key, val, elements_kind);
default:
UNREACHABLE();
return NULL;
}
}
// It's an element load (!is_store).
Expand Down Expand Up @@ -4399,9 +4410,6 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
if (elements_kind == FAST_SMI_ONLY_ELEMENTS ||
elements_kind == FAST_ELEMENTS ||
elements_kind == FAST_DOUBLE_ELEMENTS) {
if (is_store && elements_kind == FAST_SMI_ONLY_ELEMENTS) {
AddInstruction(new(zone()) HCheckSmi(val));
}
if (is_store && elements_kind != FAST_DOUBLE_ELEMENTS) {
AddInstruction(new(zone()) HCheckMap(
elements, isolate()->factory()->fixed_array_map(),
Expand Down
31 changes: 7 additions & 24 deletions deps/v8/src/ia32/lithium-codegen-ia32.cc
Expand Up @@ -354,18 +354,8 @@ double LCodeGen::ToDouble(LConstantOperand* op) const {
}


Immediate LCodeGen::ToImmediate(LOperand* op) {
LConstantOperand* const_op = LConstantOperand::cast(op);
Handle<Object> literal = chunk_->LookupLiteral(const_op);
Representation r = chunk_->LookupLiteralRepresentation(const_op);
if (r.IsInteger32()) {
ASSERT(literal->IsNumber());
return Immediate(static_cast<int32_t>(literal->Number()));
} else if (r.IsDouble()) {
Abort("unsupported double immediate");
}
ASSERT(r.IsTagged());
return Immediate(literal);
bool LCodeGen::IsInteger32(LConstantOperand* op) const {
return chunk_->LookupLiteralRepresentation(op).IsInteger32();
}


Expand Down Expand Up @@ -1167,7 +1157,7 @@ void LCodeGen::DoSubI(LSubI* instr) {
ASSERT(left->Equals(instr->result()));

if (right->IsConstantOperand()) {
__ sub(ToOperand(left), ToImmediate(right));
__ sub(ToOperand(left), ToInteger32Immediate(right));
} else {
__ sub(ToRegister(left), ToOperand(right));
}
Expand Down Expand Up @@ -1306,7 +1296,7 @@ void LCodeGen::DoAddI(LAddI* instr) {
ASSERT(left->Equals(instr->result()));

if (right->IsConstantOperand()) {
__ add(ToOperand(left), ToImmediate(right));
__ add(ToOperand(left), ToInteger32Immediate(right));
} else {
__ add(ToRegister(left), ToOperand(right));
}
Expand Down Expand Up @@ -1578,9 +1568,9 @@ void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) {
__ j(parity_even, chunk_->GetAssemblyLabel(false_block));
} else {
if (right->IsConstantOperand()) {
__ cmp(ToRegister(left), ToImmediate(right));
__ cmp(ToRegister(left), ToInteger32Immediate(right));
} else if (left->IsConstantOperand()) {
__ cmp(ToOperand(right), ToImmediate(left));
__ cmp(ToOperand(right), ToInteger32Immediate(left));
// We transposed the operands. Reverse the condition.
cc = ReverseCondition(cc);
} else {
Expand Down Expand Up @@ -3261,7 +3251,7 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
if (instr->index()->IsConstantOperand()) {
__ cmp(ToOperand(instr->length()),
ToImmediate(LConstantOperand::cast(instr->index())));
Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
DeoptimizeIf(below_equal, instr->environment());
} else {
__ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
Expand Down Expand Up @@ -3315,13 +3305,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
Register elements = ToRegister(instr->object());
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;

// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
// conversion, so it deopts in that case.
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
__ test(value, Immediate(kSmiTagMask));
DeoptimizeIf(not_zero, instr->environment());
}

// Do the store.
if (instr->key()->IsConstantOperand()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
Expand Down
10 changes: 8 additions & 2 deletions deps/v8/src/ia32/lithium-codegen-ia32.h
Expand Up @@ -78,7 +78,13 @@ class LCodeGen BASE_EMBEDDED {
Operand ToOperand(LOperand* op) const;
Register ToRegister(LOperand* op) const;
XMMRegister ToDoubleRegister(LOperand* op) const;
Immediate ToImmediate(LOperand* op);

bool IsInteger32(LConstantOperand* op) const;
Immediate ToInteger32Immediate(LOperand* op) const {
return Immediate(ToInteger32(LConstantOperand::cast(op)));
}

Handle<Object> ToHandle(LConstantOperand* op) const;

// The operand denoting the second word (the one with a higher address) of
// a double stack slot.
Expand Down Expand Up @@ -225,7 +231,7 @@ class LCodeGen BASE_EMBEDDED {
Register ToRegister(int index) const;
XMMRegister ToDoubleRegister(int index) const;
int ToInteger32(LConstantOperand* op) const;
Handle<Object> ToHandle(LConstantOperand* op) const;

double ToDouble(LConstantOperand* op) const;
Operand BuildFastArrayOperand(LOperand* elements_pointer,
LOperand* key,
Expand Down
18 changes: 14 additions & 4 deletions deps/v8/src/ia32/lithium-gap-resolver-ia32.cc
Expand Up @@ -303,14 +303,24 @@ void LGapResolver::EmitMove(int index) {
}

} else if (source->IsConstantOperand()) {
ASSERT(destination->IsRegister() || destination->IsStackSlot());
Immediate src = cgen_->ToImmediate(source);
LConstantOperand* constant_source = LConstantOperand::cast(source);
if (destination->IsRegister()) {
Register dst = cgen_->ToRegister(destination);
__ Set(dst, src);
if (cgen_->IsInteger32(constant_source)) {
__ Set(dst, cgen_->ToInteger32Immediate(constant_source));
} else {
__ LoadObject(dst, cgen_->ToHandle(constant_source));
}
} else {
ASSERT(destination->IsStackSlot());
Operand dst = cgen_->ToOperand(destination);
__ Set(dst, src);
if (cgen_->IsInteger32(constant_source)) {
__ Set(dst, cgen_->ToInteger32Immediate(constant_source));
} else {
Register tmp = EnsureTempRegister();
__ LoadObject(tmp, cgen_->ToHandle(constant_source));
__ mov(dst, tmp);
}
}

} else if (source->IsDoubleRegister()) {
Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/ia32/lithium-ia32.cc
Expand Up @@ -2023,8 +2023,7 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
LOperand* key = needs_write_barrier
? UseTempRegister(instr->key())
: UseRegisterOrConstantAtStart(instr->key());

return AssignEnvironment(new(zone()) LStoreKeyedFastElement(obj, key, val));
return new(zone()) LStoreKeyedFastElement(obj, key, val);
}


Expand Down
8 changes: 8 additions & 0 deletions deps/v8/src/ia32/macro-assembler-ia32.h
Expand Up @@ -240,6 +240,14 @@ class MacroAssembler: public Assembler {
void LoadHeapObject(Register result, Handle<HeapObject> object);
void PushHeapObject(Handle<HeapObject> object);

void LoadObject(Register result, Handle<Object> object) {
if (object->IsHeapObject()) {
LoadHeapObject(result, Handle<HeapObject>::cast(object));
} else {
Set(result, Immediate(object));
}
}

// ---------------------------------------------------------------------------
// JavaScript invokes

Expand Down
12 changes: 8 additions & 4 deletions deps/v8/src/mips/ic-mips.cc
Expand Up @@ -868,22 +868,26 @@ void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
// -- lr : return address
// -----------------------------------
Label slow, notin;
// Store address is returned in register (of MemOperand) mapped_location.
MemOperand mapped_location =
GenerateMappedArgumentsLookup(masm, a2, a1, a3, t0, t1, &notin, &slow);
__ sw(a0, mapped_location);
__ Addu(t2, a3, t1);
__ mov(t5, a0);
__ RecordWrite(a3, t2, t5, kRAHasNotBeenSaved, kDontSaveFPRegs);
ASSERT_EQ(mapped_location.offset(), 0);
__ RecordWrite(a3, mapped_location.rm(), t5,
kRAHasNotBeenSaved, kDontSaveFPRegs);
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0); // (In delay slot) return the value stored in v0.
__ bind(&notin);
// The unmapped lookup expects that the parameter map is in a3.
// Store address is returned in register (of MemOperand) unmapped_location.
MemOperand unmapped_location =
GenerateUnmappedArgumentsLookup(masm, a1, a3, t0, &slow);
__ sw(a0, unmapped_location);
__ Addu(t2, a3, t0);
__ mov(t5, a0);
__ RecordWrite(a3, t2, t5, kRAHasNotBeenSaved, kDontSaveFPRegs);
ASSERT_EQ(unmapped_location.offset(), 0);
__ RecordWrite(a3, unmapped_location.rm(), t5,
kRAHasNotBeenSaved, kDontSaveFPRegs);
__ Ret(USE_DELAY_SLOT);
__ mov(v0, a0); // (In delay slot) return the value stored in v0.
__ bind(&slow);
Expand Down
7 changes: 0 additions & 7 deletions deps/v8/src/mips/lithium-codegen-mips.cc
Expand Up @@ -3311,13 +3311,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
Register scratch = scratch0();

// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
// conversion, so it deopts in that case.
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
__ And(at, value, Operand(kSmiTagMask));
DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
}

// Do the store.
if (instr->key()->IsConstantOperand()) {
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
Expand Down

0 comments on commit b7c05e1

Please sign in to comment.