Index: src/builtins/arm64/builtins-arm64.cc |
diff --git a/src/builtins/arm64/builtins-arm64.cc b/src/builtins/arm64/builtins-arm64.cc |
index 6e6e802636df6ea474917aec1f97ad9665099bf2..57395d835b6d432fb3d59f4e6d2c5976cda256d5 100644 |
--- a/src/builtins/arm64/builtins-arm64.cc |
+++ b/src/builtins/arm64/builtins-arm64.cc |
@@ -1059,11 +1059,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); |
__ Bind(&bytecode_array_loaded); |
+ // Check whether we should continue to use the interpreter. |
+ Label switch_to_different_code_kind; |
+ __ Ldr(x0, FieldMemOperand(x0, SharedFunctionInfo::kCodeOffset)); |
+ __ Cmp(x0, Operand(masm->CodeObject())); // Self-reference to this code. |
+ __ B(ne, &switch_to_different_code_kind); |
+ |
// Check function data field is actually a BytecodeArray object. |
- Label bytecode_array_not_present; |
- __ CompareRoot(kInterpreterBytecodeArrayRegister, |
- Heap::kUndefinedValueRootIndex); |
- __ B(eq, &bytecode_array_not_present); |
if (FLAG_debug_code) { |
__ AssertNotSmi(kInterpreterBytecodeArrayRegister, |
kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
@@ -1131,10 +1133,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); |
__ B(&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); |
__ Ldr(x7, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
__ Ldr(x7, FieldMemOperand(x7, SharedFunctionInfo::kCodeOffset)); |