OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 Register debug_info = kInterpreterBytecodeArrayRegister; | 1052 Register debug_info = kInterpreterBytecodeArrayRegister; |
1053 Label load_debug_bytecode_array, bytecode_array_loaded; | 1053 Label load_debug_bytecode_array, bytecode_array_loaded; |
1054 DCHECK(!debug_info.is(x0)); | 1054 DCHECK(!debug_info.is(x0)); |
1055 __ Ldr(debug_info, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset)); | 1055 __ Ldr(debug_info, FieldMemOperand(x0, SharedFunctionInfo::kDebugInfoOffset)); |
1056 __ Cmp(debug_info, Operand(DebugInfo::uninitialized())); | 1056 __ Cmp(debug_info, Operand(DebugInfo::uninitialized())); |
1057 __ B(ne, &load_debug_bytecode_array); | 1057 __ B(ne, &load_debug_bytecode_array); |
1058 __ Ldr(kInterpreterBytecodeArrayRegister, | 1058 __ Ldr(kInterpreterBytecodeArrayRegister, |
1059 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); | 1059 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); |
1060 __ Bind(&bytecode_array_loaded); | 1060 __ Bind(&bytecode_array_loaded); |
1061 | 1061 |
| 1062 // Check whether we should continue to use the interpreter. |
| 1063 Label switch_to_different_code_kind; |
| 1064 __ Ldr(x0, FieldMemOperand(x0, SharedFunctionInfo::kCodeOffset)); |
| 1065 __ Cmp(x0, Operand(masm->CodeObject())); // Self-reference to this code. |
| 1066 __ B(ne, &switch_to_different_code_kind); |
| 1067 |
1062 // Check function data field is actually a BytecodeArray object. | 1068 // Check function data field is actually a BytecodeArray object. |
1063 Label bytecode_array_not_present; | |
1064 __ CompareRoot(kInterpreterBytecodeArrayRegister, | |
1065 Heap::kUndefinedValueRootIndex); | |
1066 __ B(eq, &bytecode_array_not_present); | |
1067 if (FLAG_debug_code) { | 1069 if (FLAG_debug_code) { |
1068 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, | 1070 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, |
1069 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1071 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1070 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, | 1072 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, |
1071 BYTECODE_ARRAY_TYPE); | 1073 BYTECODE_ARRAY_TYPE); |
1072 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1074 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1073 } | 1075 } |
1074 | 1076 |
1075 // Load the initial bytecode offset. | 1077 // Load the initial bytecode offset. |
1076 __ Mov(kInterpreterBytecodeOffsetRegister, | 1078 __ Mov(kInterpreterBytecodeOffsetRegister, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 // The return value is in x0. | 1126 // The return value is in x0. |
1125 LeaveInterpreterFrame(masm, x2); | 1127 LeaveInterpreterFrame(masm, x2); |
1126 __ Ret(); | 1128 __ Ret(); |
1127 | 1129 |
1128 // Load debug copy of the bytecode array. | 1130 // Load debug copy of the bytecode array. |
1129 __ Bind(&load_debug_bytecode_array); | 1131 __ Bind(&load_debug_bytecode_array); |
1130 __ Ldr(kInterpreterBytecodeArrayRegister, | 1132 __ Ldr(kInterpreterBytecodeArrayRegister, |
1131 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); | 1133 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex)); |
1132 __ B(&bytecode_array_loaded); | 1134 __ B(&bytecode_array_loaded); |
1133 | 1135 |
1134 // If the bytecode array is no longer present, then the underlying function | 1136 // If the shared code is no longer this entry trampoline, then the underlying |
1135 // has been switched to a different kind of code and we heal the closure by | 1137 // function has been switched to a different kind of code and we heal the |
1136 // switching the code entry field over to the new code object as well. | 1138 // closure by switching the code entry field over to the new code as well. |
1137 __ Bind(&bytecode_array_not_present); | 1139 __ bind(&switch_to_different_code_kind); |
1138 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1140 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1139 __ Ldr(x7, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 1141 __ Ldr(x7, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
1140 __ Ldr(x7, FieldMemOperand(x7, SharedFunctionInfo::kCodeOffset)); | 1142 __ Ldr(x7, FieldMemOperand(x7, SharedFunctionInfo::kCodeOffset)); |
1141 __ Add(x7, x7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1143 __ Add(x7, x7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1142 __ Str(x7, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); | 1144 __ Str(x7, FieldMemOperand(x1, JSFunction::kCodeEntryOffset)); |
1143 __ RecordWriteCodeEntryField(x1, x7, x5); | 1145 __ RecordWriteCodeEntryField(x1, x7, x5); |
1144 __ Jump(x7); | 1146 __ Jump(x7); |
1145 } | 1147 } |
1146 | 1148 |
1147 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { | 1149 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 __ Unreachable(); | 3037 __ Unreachable(); |
3036 } | 3038 } |
3037 } | 3039 } |
3038 | 3040 |
3039 #undef __ | 3041 #undef __ |
3040 | 3042 |
3041 } // namespace internal | 3043 } // namespace internal |
3042 } // namespace v8 | 3044 } // namespace v8 |
3043 | 3045 |
3044 #endif // V8_TARGET_ARCH_ARM | 3046 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |