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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 // The function builds an interpreter frame. See InterpreterFrameConstants in | 982 // The function builds an interpreter frame. See InterpreterFrameConstants in |
983 // frames.h for its layout. | 983 // frames.h for its layout. |
984 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 984 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
985 // Open a frame scope to indicate that there is a frame on the stack. The | 985 // Open a frame scope to indicate that there is a frame on the stack. The |
986 // MANUAL indicates that the scope shouldn't actually generate code to set up | 986 // MANUAL indicates that the scope shouldn't actually generate code to set up |
987 // the frame (that is done below). | 987 // the frame (that is done below). |
988 FrameScope frame_scope(masm, StackFrame::MANUAL); | 988 FrameScope frame_scope(masm, StackFrame::MANUAL); |
989 __ PushFixedFrame(r1); | 989 __ PushFixedFrame(r1); |
990 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 990 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
991 | 991 |
992 // Push new.target, dispatch table pointer and zero for bytecode array offset. | |
993 __ mov(r0, Operand(0)); | |
994 __ mov(r2, Operand(ExternalReference::interpreter_dispatch_table_address( | |
995 masm->isolate()))); | |
996 __ Push(r3, r2, r0); | |
997 | |
998 // Get the bytecode array from the function object and load the pointer to the | 992 // Get the bytecode array from the function object and load the pointer to the |
999 // first entry into kInterpreterBytecodeRegister. | 993 // first entry into kInterpreterBytecodeRegister. |
1000 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 994 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1001 __ ldr(kInterpreterBytecodeArrayRegister, | 995 __ ldr(kInterpreterBytecodeArrayRegister, |
1002 FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset)); | 996 FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset)); |
1003 | 997 |
1004 if (FLAG_debug_code) { | 998 if (FLAG_debug_code) { |
1005 // Check function data field is actually a BytecodeArray object. | 999 // Check function data field is actually a BytecodeArray object. |
1006 __ SmiTst(kInterpreterBytecodeArrayRegister); | 1000 __ SmiTst(kInterpreterBytecodeArrayRegister); |
1007 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1001 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1008 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r0, no_reg, | 1002 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r0, no_reg, |
1009 BYTECODE_ARRAY_TYPE); | 1003 BYTECODE_ARRAY_TYPE); |
1010 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1004 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1011 } | 1005 } |
1012 | 1006 |
| 1007 // Push new.target, bytecode array and zero for bytecode array offset. |
| 1008 __ mov(r0, Operand(0)); |
| 1009 __ Push(r3, kInterpreterBytecodeArrayRegister, r0); |
| 1010 |
1013 // Allocate the local and temporary register file on the stack. | 1011 // Allocate the local and temporary register file on the stack. |
1014 { | 1012 { |
1015 // Load frame size from the BytecodeArray object. | 1013 // Load frame size from the BytecodeArray object. |
1016 __ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1014 __ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1017 BytecodeArray::kFrameSizeOffset)); | 1015 BytecodeArray::kFrameSizeOffset)); |
1018 | 1016 |
1019 // Do a stack check to ensure we don't go over the limit. | 1017 // Do a stack check to ensure we don't go over the limit. |
1020 Label ok; | 1018 Label ok; |
1021 __ sub(r9, sp, Operand(r4)); | 1019 __ sub(r9, sp, Operand(r4)); |
1022 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); | 1020 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); |
(...skipping 22 matching lines...) Expand all Loading... |
1045 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. | 1043 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. |
1046 // - Code aging of the BytecodeArray object. | 1044 // - Code aging of the BytecodeArray object. |
1047 | 1045 |
1048 // Load accumulator, register file, bytecode offset, dispatch table into | 1046 // Load accumulator, register file, bytecode offset, dispatch table into |
1049 // registers. | 1047 // registers. |
1050 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1048 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1051 __ add(kInterpreterRegisterFileRegister, fp, | 1049 __ add(kInterpreterRegisterFileRegister, fp, |
1052 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 1050 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
1053 __ mov(kInterpreterBytecodeOffsetRegister, | 1051 __ mov(kInterpreterBytecodeOffsetRegister, |
1054 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1052 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
1055 __ ldr(kInterpreterDispatchTableRegister, | 1053 __ mov(kInterpreterDispatchTableRegister, |
1056 MemOperand(fp, InterpreterFrameConstants::kDispatchTableFromFp)); | 1054 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1055 masm->isolate()))); |
1057 | 1056 |
1058 // Dispatch to the first bytecode handler for the function. | 1057 // Dispatch to the first bytecode handler for the function. |
1059 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, | 1058 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, |
1060 kInterpreterBytecodeOffsetRegister)); | 1059 kInterpreterBytecodeOffsetRegister)); |
1061 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, | 1060 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, |
1062 kPointerSizeLog2)); | 1061 kPointerSizeLog2)); |
1063 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 1062 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
1064 // and header removal. | 1063 // and header removal. |
1065 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1064 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1066 __ Call(ip); | 1065 __ Call(ip); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 __ mov(kInterpreterDispatchTableRegister, | 1157 __ mov(kInterpreterDispatchTableRegister, |
1159 Operand(ExternalReference::interpreter_dispatch_table_address( | 1158 Operand(ExternalReference::interpreter_dispatch_table_address( |
1160 masm->isolate()))); | 1159 masm->isolate()))); |
1161 | 1160 |
1162 // Get the context from the frame. | 1161 // Get the context from the frame. |
1163 __ ldr(kContextRegister, | 1162 __ ldr(kContextRegister, |
1164 MemOperand(kInterpreterRegisterFileRegister, | 1163 MemOperand(kInterpreterRegisterFileRegister, |
1165 InterpreterFrameConstants::kContextFromRegisterPointer)); | 1164 InterpreterFrameConstants::kContextFromRegisterPointer)); |
1166 | 1165 |
1167 // Get the bytecode array pointer from the frame. | 1166 // Get the bytecode array pointer from the frame. |
1168 __ ldr(r1, | 1167 __ ldr( |
1169 MemOperand(kInterpreterRegisterFileRegister, | 1168 kInterpreterBytecodeArrayRegister, |
1170 InterpreterFrameConstants::kFunctionFromRegisterPointer)); | 1169 MemOperand(kInterpreterRegisterFileRegister, |
1171 __ ldr(r1, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1170 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); |
1172 __ ldr(kInterpreterBytecodeArrayRegister, | |
1173 FieldMemOperand(r1, SharedFunctionInfo::kFunctionDataOffset)); | |
1174 | 1171 |
1175 if (FLAG_debug_code) { | 1172 if (FLAG_debug_code) { |
1176 // Check function data field is actually a BytecodeArray object. | 1173 // Check function data field is actually a BytecodeArray object. |
1177 __ SmiTst(kInterpreterBytecodeArrayRegister); | 1174 __ SmiTst(kInterpreterBytecodeArrayRegister); |
1178 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1175 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1179 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r1, no_reg, | 1176 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r1, no_reg, |
1180 BYTECODE_ARRAY_TYPE); | 1177 BYTECODE_ARRAY_TYPE); |
1181 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1178 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1182 } | 1179 } |
1183 | 1180 |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 } | 2678 } |
2682 } | 2679 } |
2683 | 2680 |
2684 | 2681 |
2685 #undef __ | 2682 #undef __ |
2686 | 2683 |
2687 } // namespace internal | 2684 } // namespace internal |
2688 } // namespace v8 | 2685 } // namespace v8 |
2689 | 2686 |
2690 #endif // V8_TARGET_ARCH_ARM | 2687 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |