Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index eda1867e096360ce489da2c5fdb57c2cfcb38fe3..848ec7d1bf6d178ca2156563a2312290b58c4264 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -651,6 +651,69 @@ void MacroAssembler::RecordWrite( |
} |
} |
+void MacroAssembler::RecordWriteCodeEntryField(Register js_function, |
+ Register code_entry, |
+ Register scratch) { |
+ const int offset = JSFunction::kCodeEntryOffset; |
+ |
+ // Since a code entry (value) is always in old space, we don't need to update |
+ // remembered set. If incremental marking is off, there is nothing for us to |
+ // do. |
+ if (!FLAG_incremental_marking) return; |
+ |
+ DCHECK(js_function.is(r1)); |
+ DCHECK(code_entry.is(r4)); |
+ DCHECK(scratch.is(r5)); |
+ AssertNotSmi(js_function); |
+ |
+ if (emit_debug_code()) { |
+ add(scratch, js_function, Operand(offset - kHeapObjectTag)); |
+ ldr(ip, MemOperand(scratch)); |
+ cmp(ip, code_entry); |
+ Check(eq, kWrongAddressOrValuePassedToRecordWrite); |
+ } |
+ |
+ // First, check if a write barrier is even needed. The tests below |
+ // catch stores of Smis and stores into young gen. |
+ Label done; |
+ |
+ CheckPageFlag(code_entry, scratch, |
+ MemoryChunk::kPointersToHereAreInterestingMask, eq, &done); |
+ CheckPageFlag(js_function, scratch, |
+ MemoryChunk::kPointersFromHereAreInterestingMask, eq, &done); |
+ |
+ const Register dst = scratch; |
+ add(dst, js_function, Operand(offset - kHeapObjectTag)); |
+ |
+ push(code_entry); |
+ |
+ // Save caller-saved registers, which includes js_function. |
+ DCHECK((kCallerSaved & js_function.bit()) != 0); |
+ DCHECK_EQ(kCallerSaved & code_entry.bit(), 0); |
+ stm(db_w, sp, (kCallerSaved | lr.bit())); |
+ |
+ int argument_count = 3; |
+ PrepareCallCFunction(argument_count, code_entry); |
+ |
+ mov(r0, js_function); |
+ mov(r1, dst); |
+ mov(r2, Operand(ExternalReference::isolate_address(isolate()))); |
+ |
+ { |
+ AllowExternalCallThatCantCauseGC scope(this); |
+ CallCFunction( |
+ ExternalReference::incremental_marking_record_write_code_entry_function( |
+ isolate()), |
+ argument_count); |
+ } |
+ |
+ // Restore caller-saved registers (including js_function and code_entry). |
+ ldm(ia_w, sp, (kCallerSaved | lr.bit())); |
+ |
+ pop(code_entry); |
+ |
+ bind(&done); |
+} |
void MacroAssembler::RememberedSetHelper(Register object, // For debug tests. |
Register address, |