Index: src/ia32/macro-assembler-ia32.cc |
=================================================================== |
--- src/ia32/macro-assembler-ia32.cc (revision 4975) |
+++ src/ia32/macro-assembler-ia32.cc (working copy) |
@@ -98,11 +98,6 @@ |
} |
-// For page containing |object| mark region covering [object+offset] dirty. |
-// object is the object being stored into, value is the object being stored. |
-// If offset is zero, then the scratch register contains the array index into |
-// the elements array represented as a Smi. |
-// All registers are clobbered by the operation. |
void MacroAssembler::RecordWrite(Register object, int offset, |
Register value, Register scratch) { |
// The compiled code assumes that record write doesn't change the |
@@ -153,6 +148,39 @@ |
} |
+void MacroAssembler::RecordWrite(Register object, |
+ Register address, |
+ Register value) { |
+ // The compiled code assumes that record write doesn't change the |
+ // context register, so we check that none of the clobbered |
+ // registers are esi. |
+ ASSERT(!object.is(esi) && !value.is(esi) && !address.is(esi)); |
+ |
+ // First, check if a write barrier is even needed. The tests below |
+ // catch stores of Smis and stores into young gen. |
+ Label done; |
+ |
+ // Skip barrier if writing a smi. |
+ ASSERT_EQ(0, kSmiTag); |
+ test(value, Immediate(kSmiTagMask)); |
+ j(zero, &done); |
+ |
+ InNewSpace(object, value, equal, &done); |
+ |
+ RecordWriteHelper(object, address, value); |
+ |
+ bind(&done); |
+ |
+ // Clobber all input registers when running with the debug-code flag |
+ // turned on to provoke errors. |
+ if (FLAG_debug_code) { |
+ mov(object, Immediate(BitCast<int32_t>(kZapValue))); |
+ mov(address, Immediate(BitCast<int32_t>(kZapValue))); |
+ mov(value, Immediate(BitCast<int32_t>(kZapValue))); |
+ } |
+} |
+ |
+ |
void MacroAssembler::StackLimitCheck(Label* on_stack_overflow) { |
cmp(esp, |
Operand::StaticVariable(ExternalReference::address_of_stack_limit())); |