OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 Register debug_info = kInterpreterBytecodeArrayRegister; | 1047 Register debug_info = kInterpreterBytecodeArrayRegister; |
1048 DCHECK(!debug_info.is(r0)); | 1048 DCHECK(!debug_info.is(r0)); |
1049 __ ldr(debug_info, FieldMemOperand(r0, SharedFunctionInfo::kDebugInfoOffset)); | 1049 __ ldr(debug_info, FieldMemOperand(r0, SharedFunctionInfo::kDebugInfoOffset)); |
1050 __ cmp(debug_info, Operand(DebugInfo::uninitialized())); | 1050 __ cmp(debug_info, Operand(DebugInfo::uninitialized())); |
1051 // Load original bytecode array or the debug copy. | 1051 // Load original bytecode array or the debug copy. |
1052 __ ldr(kInterpreterBytecodeArrayRegister, | 1052 __ ldr(kInterpreterBytecodeArrayRegister, |
1053 FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset), eq); | 1053 FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset), eq); |
1054 __ ldr(kInterpreterBytecodeArrayRegister, | 1054 __ ldr(kInterpreterBytecodeArrayRegister, |
1055 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex), ne); | 1055 FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex), ne); |
1056 | 1056 |
| 1057 // Check whether we should continue to use the interpreter. |
| 1058 Label switch_to_different_code_kind; |
| 1059 __ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset)); |
| 1060 __ cmp(r0, Operand(masm->CodeObject())); // Self-reference to this code. |
| 1061 __ b(ne, &switch_to_different_code_kind); |
| 1062 |
1057 // Check function data field is actually a BytecodeArray object. | 1063 // Check function data field is actually a BytecodeArray object. |
1058 Label bytecode_array_not_present; | |
1059 __ CompareRoot(kInterpreterBytecodeArrayRegister, | |
1060 Heap::kUndefinedValueRootIndex); | |
1061 __ b(eq, &bytecode_array_not_present); | |
1062 if (FLAG_debug_code) { | 1064 if (FLAG_debug_code) { |
1063 __ SmiTst(kInterpreterBytecodeArrayRegister); | 1065 __ SmiTst(kInterpreterBytecodeArrayRegister); |
1064 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1066 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1065 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r0, no_reg, | 1067 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r0, no_reg, |
1066 BYTECODE_ARRAY_TYPE); | 1068 BYTECODE_ARRAY_TYPE); |
1067 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1069 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1068 } | 1070 } |
1069 | 1071 |
1070 // Load the initial bytecode offset. | 1072 // Load the initial bytecode offset. |
1071 __ mov(kInterpreterBytecodeOffsetRegister, | 1073 __ mov(kInterpreterBytecodeOffsetRegister, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 kInterpreterBytecodeOffsetRegister)); | 1117 kInterpreterBytecodeOffsetRegister)); |
1116 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, | 1118 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, |
1117 kPointerSizeLog2)); | 1119 kPointerSizeLog2)); |
1118 __ Call(ip); | 1120 __ Call(ip); |
1119 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 1121 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
1120 | 1122 |
1121 // The return value is in r0. | 1123 // The return value is in r0. |
1122 LeaveInterpreterFrame(masm, r2); | 1124 LeaveInterpreterFrame(masm, r2); |
1123 __ Jump(lr); | 1125 __ Jump(lr); |
1124 | 1126 |
1125 // If the bytecode array is no longer present, then the underlying function | 1127 // If the shared code is no longer this entry trampoline, then the underlying |
1126 // has been switched to a different kind of code and we heal the closure by | 1128 // function has been switched to a different kind of code and we heal the |
1127 // switching the code entry field over to the new code object as well. | 1129 // closure by switching the code entry field over to the new code as well. |
1128 __ bind(&bytecode_array_not_present); | 1130 __ bind(&switch_to_different_code_kind); |
1129 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1131 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1130 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1132 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1131 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCodeOffset)); | 1133 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCodeOffset)); |
1132 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1134 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1133 __ str(r4, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1135 __ str(r4, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1134 __ RecordWriteCodeEntryField(r1, r4, r5); | 1136 __ RecordWriteCodeEntryField(r1, r4, r5); |
1135 __ Jump(r4); | 1137 __ Jump(r4); |
1136 } | 1138 } |
1137 | 1139 |
1138 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { | 1140 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2921 __ bkpt(0); | 2923 __ bkpt(0); |
2922 } | 2924 } |
2923 } | 2925 } |
2924 | 2926 |
2925 #undef __ | 2927 #undef __ |
2926 | 2928 |
2927 } // namespace internal | 2929 } // namespace internal |
2928 } // namespace v8 | 2930 } // namespace v8 |
2929 | 2931 |
2930 #endif // V8_TARGET_ARCH_ARM | 2932 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |