Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index 0afe5157d6742c1128162dcb0ab2842f872d0173..802777aa60c4b2048cd55e1a39faadeea1008b12 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -369,6 +369,67 @@ 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(a1)); |
+ DCHECK(code_entry.is(t0)); |
+ DCHECK(scratch.is(t1)); |
+ AssertNotSmi(js_function); |
+ |
+ if (emit_debug_code()) { |
+ Addu(scratch, js_function, Operand(offset - kHeapObjectTag)); |
+ lw(at, MemOperand(scratch)); |
+ Assert(eq, kWrongAddressOrValuePassedToRecordWrite, at, |
+ Operand(code_entry)); |
+ } |
+ |
+ // 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; |
+ Addu(dst, js_function, Operand(offset - kHeapObjectTag)); |
+ |
+ // Save caller-saved registers. js_function and code_entry are in the |
+ // caller-saved register list. |
+ DCHECK(kJSCallerSaved & js_function.bit()); |
+ DCHECK(kJSCallerSaved & code_entry.bit()); |
+ MultiPush(kJSCallerSaved | ra.bit()); |
+ |
+ int argument_count = 3; |
+ |
+ PrepareCallCFunction(argument_count, 0, code_entry); |
+ |
+ mov(a0, js_function); |
+ mov(a1, dst); |
+ li(a2, Operand(ExternalReference::isolate_address(isolate()))); |
+ |
+ { |
+ AllowExternalCallThatCantCauseGC scope(this); |
+ CallCFunction( |
+ ExternalReference::incremental_marking_record_write_code_entry_function( |
+ isolate()), |
+ argument_count); |
+ } |
+ |
+ // Restore caller-saved registers. |
+ MultiPop(kJSCallerSaved | ra.bit()); |
+ |
+ bind(&done); |
+} |
void MacroAssembler::RememberedSetHelper(Register object, // For debug tests. |
Register address, |