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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 __ push(r9); | 1043 __ push(r9); |
1044 // Continue loop if not done. | 1044 // Continue loop if not done. |
1045 __ bind(&loop_check); | 1045 __ bind(&loop_check); |
1046 __ sub(r4, r4, Operand(kPointerSize), SetCC); | 1046 __ sub(r4, r4, Operand(kPointerSize), SetCC); |
1047 __ b(&loop_header, ge); | 1047 __ b(&loop_header, ge); |
1048 } | 1048 } |
1049 | 1049 |
1050 // Load accumulator, register file, bytecode offset, dispatch table into | 1050 // Load accumulator, register file, bytecode offset, dispatch table into |
1051 // registers. | 1051 // registers. |
1052 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1052 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1053 __ add(kInterpreterRegisterFileRegister, fp, | 1053 __ add(r4, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); |
1054 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1055 __ mov(kInterpreterBytecodeOffsetRegister, | 1054 __ mov(kInterpreterBytecodeOffsetRegister, |
1056 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1055 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
1057 __ mov(kInterpreterDispatchTableRegister, | 1056 __ mov(kInterpreterDispatchTableRegister, |
1058 Operand(ExternalReference::interpreter_dispatch_table_address( | 1057 Operand(ExternalReference::interpreter_dispatch_table_address( |
1059 masm->isolate()))); | 1058 masm->isolate()))); |
1060 | 1059 |
1061 // Dispatch to the first bytecode handler for the function. | 1060 // Dispatch to the first bytecode handler for the function. |
1062 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, | 1061 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, |
1063 kInterpreterBytecodeOffsetRegister)); | 1062 kInterpreterBytecodeOffsetRegister)); |
1064 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, | 1063 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, |
1065 kPointerSizeLog2)); | 1064 kPointerSizeLog2)); |
1066 __ Call(ip); | 1065 __ Call(ip); |
1067 | 1066 |
1068 // Even though the first bytecode handler was called, we will never return. | 1067 // Even though the first bytecode handler was called, we will never return. |
1069 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 1068 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
1070 } | 1069 } |
1071 | 1070 |
1072 | 1071 |
1073 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1072 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
1074 // TODO(rmcilroy): List of things not currently dealt with here but done in | |
1075 // fullcodegen's EmitReturnSequence. | |
1076 // - Supporting FLAG_trace for Runtime::TraceExit. | |
1077 // - Support profiler (specifically decrementing profiling_counter | |
1078 // appropriately and calling out to HandleInterrupts if necessary). | |
1079 | |
1080 // The return value is in accumulator, which is already in r0. | 1073 // The return value is in accumulator, which is already in r0. |
1081 | 1074 |
1082 // Leave the frame (also dropping the register file). | 1075 // Leave the frame (also dropping the register file). |
1083 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1076 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1084 | 1077 |
1085 // Drop receiver + arguments and return. | 1078 // Drop receiver + arguments and return. |
1086 __ ldr(ip, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1079 __ ldr(ip, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1087 BytecodeArray::kParameterSizeOffset)); | 1080 BytecodeArray::kParameterSizeOffset)); |
1088 __ add(sp, sp, ip, LeaveCC); | 1081 __ add(sp, sp, ip, LeaveCC); |
1089 __ Jump(lr); | 1082 __ Jump(lr); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 | 1141 |
1149 // Push the arguments. | 1142 // Push the arguments. |
1150 Generate_InterpreterPushArgs(masm, r2, r4, r5); | 1143 Generate_InterpreterPushArgs(masm, r2, r4, r5); |
1151 | 1144 |
1152 // Call the constructor with r0, r1, and r3 unmodified. | 1145 // Call the constructor with r0, r1, and r3 unmodified. |
1153 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1146 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1154 } | 1147 } |
1155 | 1148 |
1156 | 1149 |
1157 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 1150 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
1158 // Initialize register file register and dispatch table register. | 1151 // Initialize the dispatch table register. |
1159 __ add(kInterpreterRegisterFileRegister, fp, | |
1160 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1161 __ mov(kInterpreterDispatchTableRegister, | 1152 __ mov(kInterpreterDispatchTableRegister, |
1162 Operand(ExternalReference::interpreter_dispatch_table_address( | 1153 Operand(ExternalReference::interpreter_dispatch_table_address( |
1163 masm->isolate()))); | 1154 masm->isolate()))); |
1164 | 1155 |
1165 // Get the bytecode array pointer from the frame. | 1156 // Get the bytecode array pointer from the frame. |
1166 __ ldr( | 1157 __ ldr(kInterpreterBytecodeArrayRegister, |
1167 kInterpreterBytecodeArrayRegister, | 1158 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
1168 MemOperand(kInterpreterRegisterFileRegister, | |
1169 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); | |
1170 | 1159 |
1171 if (FLAG_debug_code) { | 1160 if (FLAG_debug_code) { |
1172 // Check function data field is actually a BytecodeArray object. | 1161 // Check function data field is actually a BytecodeArray object. |
1173 __ SmiTst(kInterpreterBytecodeArrayRegister); | 1162 __ SmiTst(kInterpreterBytecodeArrayRegister); |
1174 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1163 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1175 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r1, no_reg, | 1164 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r1, no_reg, |
1176 BYTECODE_ARRAY_TYPE); | 1165 BYTECODE_ARRAY_TYPE); |
1177 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1166 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1178 } | 1167 } |
1179 | 1168 |
1180 // Get the target bytecode offset from the frame. | 1169 // Get the target bytecode offset from the frame. |
1181 __ ldr(kInterpreterBytecodeOffsetRegister, | 1170 __ ldr(kInterpreterBytecodeOffsetRegister, |
1182 MemOperand( | 1171 MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
1183 kInterpreterRegisterFileRegister, | |
1184 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); | |
1185 __ SmiUntag(kInterpreterBytecodeOffsetRegister); | 1172 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
1186 | 1173 |
1187 // Dispatch to the target bytecode. | 1174 // Dispatch to the target bytecode. |
1188 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, | 1175 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, |
1189 kInterpreterBytecodeOffsetRegister)); | 1176 kInterpreterBytecodeOffsetRegister)); |
1190 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, | 1177 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, |
1191 kPointerSizeLog2)); | 1178 kPointerSizeLog2)); |
1192 __ mov(pc, ip); | 1179 __ mov(pc, ip); |
1193 } | 1180 } |
1194 | 1181 |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2787 } | 2774 } |
2788 } | 2775 } |
2789 | 2776 |
2790 | 2777 |
2791 #undef __ | 2778 #undef __ |
2792 | 2779 |
2793 } // namespace internal | 2780 } // namespace internal |
2794 } // namespace v8 | 2781 } // namespace v8 |
2795 | 2782 |
2796 #endif // V8_TARGET_ARCH_ARM | 2783 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |