Index: src/builtins/mips/builtins-mips.cc |
diff --git a/src/builtins/mips/builtins-mips.cc b/src/builtins/mips/builtins-mips.cc |
index bd0e7e252da8726bdc454d895334cc9e9fc3931b..003eeb22e01db4b13bbb10e14380944083d4bc36 100644 |
--- a/src/builtins/mips/builtins-mips.cc |
+++ b/src/builtins/mips/builtins-mips.cc |
@@ -1045,10 +1045,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); |
__ bind(&bytecode_array_loaded); |
+ // Check whether we should continue to use the interpreter. |
+ Label switch_to_different_code_kind; |
+ __ lw(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset)); |
+ __ Branch(&switch_to_different_code_kind, ne, a0, |
+ Operand(masm->CodeObject())); // Self-reference to this code. |
+ |
// Check function data field is actually a BytecodeArray object. |
- Label bytecode_array_not_present; |
- __ JumpIfRoot(kInterpreterBytecodeArrayRegister, |
- Heap::kUndefinedValueRootIndex, &bytecode_array_not_present); |
if (FLAG_debug_code) { |
__ SmiTst(kInterpreterBytecodeArrayRegister, t0); |
__ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, |
@@ -1119,10 +1122,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); |
__ Branch(&bytecode_array_loaded); |
- // If the bytecode array is no longer present, then the underlying function |
- // has been switched to a different kind of code and we heal the closure by |
- // switching the code entry field over to the new code object as well. |
- __ bind(&bytecode_array_not_present); |
+ // If the shared code is no longer this entry trampoline, then the underlying |
+ // function has been switched to a different kind of code and we heal the |
+ // closure by switching the code entry field over to the new code as well. |
+ __ bind(&switch_to_different_code_kind); |
__ LeaveFrame(StackFrame::JAVA_SCRIPT); |
__ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
__ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kCodeOffset)); |