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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
797 } | 797 } |
798 | 798 |
799 | 799 |
800 // Generate code for entering a JS function with the interpreter. | 800 // Generate code for entering a JS function with the interpreter. |
801 // On entry to the function the receiver and arguments have been pushed on the | 801 // On entry to the function the receiver and arguments have been pushed on the |
802 // stack left to right. The actual argument count matches the formal parameter | 802 // stack left to right. The actual argument count matches the formal parameter |
803 // count expected by the function. | 803 // count expected by the function. |
804 // | 804 // |
805 // The live registers are: | 805 // The live registers are: |
806 // - x1: the JS function object being called. | 806 // - x1: the JS function object being called. |
807 // - x3: the new target | |
807 // - cp: our context. | 808 // - cp: our context. |
808 // - fp: our caller's frame pointer. | 809 // - fp: our caller's frame pointer. |
809 // - jssp: stack pointer. | 810 // - jssp: stack pointer. |
810 // - lr: return address. | 811 // - lr: return address. |
811 // | 812 // |
812 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 813 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
813 // frames-arm64.h for its layout. | 814 // frames-arm64.h for its layout. |
814 // TODO(rmcilroy): We will need to include the current bytecode pointer in the | 815 // TODO(rmcilroy): We will need to include the current bytecode pointer in the |
815 // frame. | 816 // frame. |
816 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 817 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
817 // Open a frame scope to indicate that there is a frame on the stack. The | 818 // Open a frame scope to indicate that there is a frame on the stack. The |
818 // MANUAL indicates that the scope shouldn't actually generate code to set up | 819 // MANUAL indicates that the scope shouldn't actually generate code to set up |
819 // the frame (that is done below). | 820 // the frame (that is done below). |
820 FrameScope frame_scope(masm, StackFrame::MANUAL); | 821 FrameScope frame_scope(masm, StackFrame::MANUAL); |
821 __ Push(lr, fp, cp, x1); | 822 __ Push(lr, fp, cp, x1); |
822 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); | 823 __ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp); |
824 __ Push(x3); | |
Michael Starzinger
2015/11/24 12:40:41
Not sure whether this is the best way to construct
| |
823 | 825 |
824 // Get the bytecode array from the function object and load the pointer to the | 826 // Get the bytecode array from the function object and load the pointer to the |
825 // first entry into kInterpreterBytecodeRegister. | 827 // first entry into kInterpreterBytecodeRegister. |
826 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); | 828 __ Ldr(x0, FieldMemOperand(x1, JSFunction::kSharedFunctionInfoOffset)); |
827 __ Ldr(kInterpreterBytecodeArrayRegister, | 829 __ Ldr(kInterpreterBytecodeArrayRegister, |
828 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); | 830 FieldMemOperand(x0, SharedFunctionInfo::kFunctionDataOffset)); |
829 | 831 |
830 if (FLAG_debug_code) { | 832 if (FLAG_debug_code) { |
831 // Check function data field is actually a BytecodeArray object. | 833 // Check function data field is actually a BytecodeArray object. |
832 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, | 834 __ AssertNotSmi(kInterpreterBytecodeArrayRegister, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 __ Push(kInterpreterBytecodeArrayRegister); | 880 __ Push(kInterpreterBytecodeArrayRegister); |
879 __ CallRuntime(Runtime::kStackGuard, 0); | 881 __ CallRuntime(Runtime::kStackGuard, 0); |
880 __ Pop(kInterpreterBytecodeArrayRegister); | 882 __ Pop(kInterpreterBytecodeArrayRegister); |
881 __ Bind(&ok); | 883 __ Bind(&ok); |
882 } | 884 } |
883 | 885 |
884 // Load accumulator, register file, bytecode offset, dispatch table into | 886 // Load accumulator, register file, bytecode offset, dispatch table into |
885 // registers. | 887 // registers. |
886 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 888 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
887 __ Sub(kInterpreterRegisterFileRegister, fp, | 889 __ Sub(kInterpreterRegisterFileRegister, fp, |
888 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); | 890 Operand(2 * kPointerSize + |
891 StandardFrameConstants::kFixedFrameSizeFromFp)); | |
889 __ Mov(kInterpreterBytecodeOffsetRegister, | 892 __ Mov(kInterpreterBytecodeOffsetRegister, |
890 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 893 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
891 __ LoadRoot(kInterpreterDispatchTableRegister, | 894 __ LoadRoot(kInterpreterDispatchTableRegister, |
892 Heap::kInterpreterTableRootIndex); | 895 Heap::kInterpreterTableRootIndex); |
893 __ Add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, | 896 __ Add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
894 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 897 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
895 | 898 |
896 // Dispatch to the first bytecode handler for the function. | 899 // Dispatch to the first bytecode handler for the function. |
897 __ Ldrb(x1, MemOperand(kInterpreterBytecodeArrayRegister, | 900 __ Ldrb(x1, MemOperand(kInterpreterBytecodeArrayRegister, |
898 kInterpreterBytecodeOffsetRegister)); | 901 kInterpreterBytecodeOffsetRegister)); |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1934 } | 1937 } |
1935 } | 1938 } |
1936 | 1939 |
1937 | 1940 |
1938 #undef __ | 1941 #undef __ |
1939 | 1942 |
1940 } // namespace internal | 1943 } // namespace internal |
1941 } // namespace v8 | 1944 } // namespace v8 |
1942 | 1945 |
1943 #endif // V8_TARGET_ARCH_ARM | 1946 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |