Index: src/ia32/full-codegen-ia32.cc |
=================================================================== |
--- src/ia32/full-codegen-ia32.cc (revision 9327) |
+++ src/ia32/full-codegen-ia32.cc (working copy) |
@@ -205,11 +205,12 @@ |
// Store it in the context. |
int context_offset = Context::SlotOffset(var->index()); |
__ mov(Operand(esi, context_offset), eax); |
- // Update the write barrier. This clobbers all involved |
- // registers, so we have use a third register to avoid |
- // clobbering esi. |
- __ mov(ecx, esi); |
- __ RecordWrite(ecx, context_offset, eax, ebx); |
+ // Update the write barrier. This clobbers eax and ebx. |
+ __ RecordWriteContextSlot(esi, |
+ context_offset, |
+ eax, |
+ ebx, |
+ kDontSaveFPRegs); |
} |
} |
} |
@@ -666,11 +667,12 @@ |
ASSERT(!scratch1.is(src)); |
MemOperand location = VarOperand(var, scratch0); |
__ mov(location, src); |
+ |
// Emit the write barrier code if the location is in the heap. |
if (var->IsContextSlot()) { |
int offset = Context::SlotOffset(var->index()); |
ASSERT(!scratch0.is(esi) && !src.is(esi) && !scratch1.is(esi)); |
- __ RecordWrite(scratch0, offset, src, scratch1); |
+ __ RecordWriteContextSlot(scratch0, offset, src, scratch1, kDontSaveFPRegs); |
} |
} |
@@ -743,9 +745,14 @@ |
Comment cmnt(masm_, "[ Declaration"); |
VisitForAccumulatorValue(function); |
__ mov(ContextOperand(esi, variable->index()), result_register()); |
- int offset = Context::SlotOffset(variable->index()); |
- __ mov(ebx, esi); |
- __ RecordWrite(ebx, offset, result_register(), ecx); |
+ // We know that we have written a function, which is not a smi. |
+ __ RecordWriteContextSlot(esi, |
+ Context::SlotOffset(variable->index()), |
+ result_register(), |
+ ecx, |
+ kDontSaveFPRegs, |
+ EMIT_REMEMBERED_SET, |
+ OMIT_SMI_CHECK); |
PrepareForBailoutForId(proxy->id(), NO_REGISTERS); |
} else if (mode == Variable::CONST || mode == Variable::LET) { |
Comment cmnt(masm_, "[ Declaration"); |
@@ -1486,7 +1493,7 @@ |
__ mov(FieldOperand(ebx, offset), result_register()); |
// Update the write barrier for the array store. |
- __ RecordWrite(ebx, offset, result_register(), ecx); |
+ __ RecordWriteField(ebx, offset, result_register(), ecx, kDontSaveFPRegs); |
PrepareForBailoutForId(expr->GetIdForElement(i), NO_REGISTERS); |
} |
@@ -1864,7 +1871,8 @@ |
__ mov(location, eax); |
if (var->IsContextSlot()) { |
__ mov(edx, eax); |
- __ RecordWrite(ecx, Context::SlotOffset(var->index()), edx, ebx); |
+ int offset = Context::SlotOffset(var->index()); |
+ __ RecordWriteContextSlot(ecx, offset, edx, ebx, kDontSaveFPRegs); |
} |
} |
@@ -1882,7 +1890,8 @@ |
__ mov(location, eax); |
if (var->IsContextSlot()) { |
__ mov(edx, eax); |
- __ RecordWrite(ecx, Context::SlotOffset(var->index()), edx, ebx); |
+ int offset = Context::SlotOffset(var->index()); |
+ __ RecordWriteContextSlot(ecx, offset, edx, ebx, kDontSaveFPRegs); |
} |
} else { |
ASSERT(var->IsLookupSlot()); |
@@ -2848,10 +2857,11 @@ |
// Store the value. |
__ mov(FieldOperand(ebx, JSValue::kValueOffset), eax); |
+ |
// Update the write barrier. Save the value as it will be |
// overwritten by the write barrier code and is needed afterward. |
__ mov(edx, eax); |
- __ RecordWrite(ebx, JSValue::kValueOffset, edx, ecx); |
+ __ RecordWriteField(ebx, JSValue::kValueOffset, edx, ecx, kDontSaveFPRegs); |
__ bind(&done); |
context()->Plug(eax); |
@@ -3144,14 +3154,27 @@ |
__ mov(Operand(index_2, 0), object); |
__ mov(Operand(index_1, 0), temp); |
- Label new_space; |
- __ InNewSpace(elements, temp, equal, &new_space); |
+ Label no_remembered_set; |
+ __ CheckPageFlag(elements, |
+ temp, |
+ 1 << MemoryChunk::SCAN_ON_SCAVENGE, |
+ not_zero, |
+ &no_remembered_set, |
+ Label::kNear); |
+ // Possible optimization: do a check that both values are Smis |
+ // (or them and test against Smi mask.) |
- __ mov(object, elements); |
- __ RecordWriteHelper(object, index_1, temp); |
- __ RecordWriteHelper(elements, index_2, temp); |
+ // We are swapping two objects in an array and the incremental marker never |
+ // pauses in the middle of scanning a single object. Therefore the |
+ // incremental marker is not disturbed, so we don't need to call the |
+ // RecordWrite stub that notifies the incremental marker. |
+ __ RememberedSetHelper( |
+ index_1, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); |
+ __ RememberedSetHelper( |
+ index_2, temp, kDontSaveFPRegs, MacroAssembler::kFallThroughAtEnd); |
- __ bind(&new_space); |
+ __ bind(&no_remembered_set); |
+ |
// We are done. Drop elements from the stack, and return undefined. |
__ add(Operand(esp), Immediate(3 * kPointerSize)); |
__ mov(eax, isolate()->factory()->undefined_value()); |