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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 Heap::kUndefinedValueRootIndex); | 1008 Heap::kUndefinedValueRootIndex); |
1009 __ B(eq, &bytecode_array_not_present); | 1009 __ B(eq, &bytecode_array_not_present); |
1010 if (FLAG_debug_code) { | 1010 if (FLAG_debug_code) { |
1011 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, | 1011 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, |
1012 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1012 kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1013 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, | 1013 __ CompareObjectType(kInterpreterBytecodeArrayRegister, x0, x0, |
1014 BYTECODE_ARRAY_TYPE); | 1014 BYTECODE_ARRAY_TYPE); |
1015 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1015 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1016 } | 1016 } |
1017 | 1017 |
1018 // Push new.target, bytecode array and zero for bytecode array offset. | 1018 // Load the initial bytecode offset. |
1019 __ Mov(x0, Operand(0)); | 1019 __ Mov(kInterpreterBytecodeOffsetRegister, |
| 1020 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 1021 |
| 1022 // Push new.target, bytecode array and Smi tagged bytecode array offset. |
| 1023 __ SmiTag(x0, kInterpreterBytecodeOffsetRegister); |
1020 __ Push(x3, kInterpreterBytecodeArrayRegister, x0); | 1024 __ Push(x3, kInterpreterBytecodeArrayRegister, x0); |
1021 | 1025 |
1022 // Allocate the local and temporary register file on the stack. | 1026 // Allocate the local and temporary register file on the stack. |
1023 { | 1027 { |
1024 // Load frame size from the BytecodeArray object. | 1028 // Load frame size from the BytecodeArray object. |
1025 __ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1029 __ Ldr(w11, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1026 BytecodeArray::kFrameSizeOffset)); | 1030 BytecodeArray::kFrameSizeOffset)); |
1027 | 1031 |
1028 // Do a stack check to ensure we don't go over the limit. | 1032 // Do a stack check to ensure we don't go over the limit. |
1029 Label ok; | 1033 Label ok; |
1030 DCHECK(jssp.Is(__ StackPointer())); | 1034 DCHECK(jssp.Is(__ StackPointer())); |
1031 __ Sub(x10, jssp, Operand(x11)); | 1035 __ Sub(x10, jssp, Operand(x11)); |
1032 __ CompareRoot(x10, Heap::kRealStackLimitRootIndex); | 1036 __ CompareRoot(x10, Heap::kRealStackLimitRootIndex); |
1033 __ B(hs, &ok); | 1037 __ B(hs, &ok); |
1034 __ CallRuntime(Runtime::kThrowStackOverflow); | 1038 __ CallRuntime(Runtime::kThrowStackOverflow); |
1035 __ Bind(&ok); | 1039 __ Bind(&ok); |
1036 | 1040 |
1037 // If ok, push undefined as the initial value for all register file entries. | 1041 // If ok, push undefined as the initial value for all register file entries. |
1038 // Note: there should always be at least one stack slot for the return | 1042 // Note: there should always be at least one stack slot for the return |
1039 // register in the register file. | 1043 // register in the register file. |
1040 Label loop_header; | 1044 Label loop_header; |
1041 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); | 1045 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); |
1042 // TODO(rmcilroy): Ensure we always have an even number of registers to | 1046 // TODO(rmcilroy): Ensure we always have an even number of registers to |
1043 // allow stack to be 16 bit aligned (and remove need for jssp). | 1047 // allow stack to be 16 bit aligned (and remove need for jssp). |
1044 __ Lsr(x11, x11, kPointerSizeLog2); | 1048 __ Lsr(x11, x11, kPointerSizeLog2); |
1045 __ PushMultipleTimes(x10, x11); | 1049 __ PushMultipleTimes(x10, x11); |
1046 __ Bind(&loop_header); | 1050 __ Bind(&loop_header); |
1047 } | 1051 } |
1048 | 1052 |
1049 // Load accumulator, register file, bytecode offset, dispatch table into | 1053 // Load accumulator and dispatch table into registers. |
1050 // registers. | |
1051 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1054 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1052 __ Add(x18, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); | |
1053 __ Mov(kInterpreterBytecodeOffsetRegister, | |
1054 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | |
1055 __ Mov(kInterpreterDispatchTableRegister, | 1055 __ Mov(kInterpreterDispatchTableRegister, |
1056 Operand(ExternalReference::interpreter_dispatch_table_address( | 1056 Operand(ExternalReference::interpreter_dispatch_table_address( |
1057 masm->isolate()))); | 1057 masm->isolate()))); |
1058 | 1058 |
1059 // Dispatch to the first bytecode handler for the function. | 1059 // Dispatch to the first bytecode handler for the function. |
1060 __ Ldrb(x1, MemOperand(kInterpreterBytecodeArrayRegister, | 1060 __ Ldrb(x1, MemOperand(kInterpreterBytecodeArrayRegister, |
1061 kInterpreterBytecodeOffsetRegister)); | 1061 kInterpreterBytecodeOffsetRegister)); |
1062 __ Mov(x1, Operand(x1, LSL, kPointerSizeLog2)); | 1062 __ Mov(x1, Operand(x1, LSL, kPointerSizeLog2)); |
1063 __ Ldr(ip0, MemOperand(kInterpreterDispatchTableRegister, x1)); | 1063 __ Ldr(ip0, MemOperand(kInterpreterDispatchTableRegister, x1)); |
1064 __ Call(ip0); | 1064 __ Call(ip0); |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2933 } | 2933 } |
2934 } | 2934 } |
2935 | 2935 |
2936 | 2936 |
2937 #undef __ | 2937 #undef __ |
2938 | 2938 |
2939 } // namespace internal | 2939 } // namespace internal |
2940 } // namespace v8 | 2940 } // namespace v8 |
2941 | 2941 |
2942 #endif // V8_TARGET_ARCH_ARM | 2942 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |