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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 } | 774 } |
775 | 775 |
776 | 776 |
777 // Generate code for entering a JS function with the interpreter. | 777 // Generate code for entering a JS function with the interpreter. |
778 // On entry to the function the receiver and arguments have been pushed on the | 778 // On entry to the function the receiver and arguments have been pushed on the |
779 // stack left to right. The actual argument count matches the formal parameter | 779 // stack left to right. The actual argument count matches the formal parameter |
780 // count expected by the function. | 780 // count expected by the function. |
781 // | 781 // |
782 // The live registers are: | 782 // The live registers are: |
783 // o r1: the JS function object being called. | 783 // o r1: the JS function object being called. |
| 784 // o r3: the new target |
784 // o cp: our context | 785 // o cp: our context |
785 // o pp: the caller's constant pool pointer (if enabled) | 786 // o pp: the caller's constant pool pointer (if enabled) |
786 // o fp: the caller's frame pointer | 787 // o fp: the caller's frame pointer |
787 // o sp: stack pointer | 788 // o sp: stack pointer |
788 // o lr: return address | 789 // o lr: return address |
789 // | 790 // |
790 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 791 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
791 // frames-arm.h for its layout. | 792 // frames-arm.h for its layout. |
792 // TODO(rmcilroy): We will need to include the current bytecode pointer in the | 793 // TODO(rmcilroy): We will need to include the current bytecode pointer in the |
793 // frame. | 794 // frame. |
794 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 795 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
795 // Open a frame scope to indicate that there is a frame on the stack. The | 796 // Open a frame scope to indicate that there is a frame on the stack. The |
796 // MANUAL indicates that the scope shouldn't actually generate code to set up | 797 // MANUAL indicates that the scope shouldn't actually generate code to set up |
797 // the frame (that is done below). | 798 // the frame (that is done below). |
798 FrameScope frame_scope(masm, StackFrame::MANUAL); | 799 FrameScope frame_scope(masm, StackFrame::MANUAL); |
799 __ PushFixedFrame(r1); | 800 __ PushFixedFrame(r1); |
800 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 801 __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 802 __ push(r3); |
801 | 803 |
802 // Get the bytecode array from the function object and load the pointer to the | 804 // Get the bytecode array from the function object and load the pointer to the |
803 // first entry into kInterpreterBytecodeRegister. | 805 // first entry into kInterpreterBytecodeRegister. |
804 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 806 __ ldr(r0, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
805 __ ldr(kInterpreterBytecodeArrayRegister, | 807 __ ldr(kInterpreterBytecodeArrayRegister, |
806 FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset)); | 808 FieldMemOperand(r0, SharedFunctionInfo::kFunctionDataOffset)); |
807 | 809 |
808 if (FLAG_debug_code) { | 810 if (FLAG_debug_code) { |
809 // Check function data field is actually a BytecodeArray object. | 811 // Check function data field is actually a BytecodeArray object. |
810 __ SmiTst(kInterpreterBytecodeArrayRegister); | 812 __ SmiTst(kInterpreterBytecodeArrayRegister); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 __ push(kInterpreterBytecodeArrayRegister); | 861 __ push(kInterpreterBytecodeArrayRegister); |
860 __ CallRuntime(Runtime::kStackGuard, 0); | 862 __ CallRuntime(Runtime::kStackGuard, 0); |
861 __ pop(kInterpreterBytecodeArrayRegister); | 863 __ pop(kInterpreterBytecodeArrayRegister); |
862 __ bind(&ok); | 864 __ bind(&ok); |
863 } | 865 } |
864 | 866 |
865 // Load accumulator, register file, bytecode offset, dispatch table into | 867 // Load accumulator, register file, bytecode offset, dispatch table into |
866 // registers. | 868 // registers. |
867 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 869 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
868 __ sub(kInterpreterRegisterFileRegister, fp, | 870 __ sub(kInterpreterRegisterFileRegister, fp, |
869 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); | 871 Operand(2 * kPointerSize + |
| 872 StandardFrameConstants::kFixedFrameSizeFromFp)); |
870 __ mov(kInterpreterBytecodeOffsetRegister, | 873 __ mov(kInterpreterBytecodeOffsetRegister, |
871 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 874 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
872 __ LoadRoot(kInterpreterDispatchTableRegister, | 875 __ LoadRoot(kInterpreterDispatchTableRegister, |
873 Heap::kInterpreterTableRootIndex); | 876 Heap::kInterpreterTableRootIndex); |
874 __ add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, | 877 __ add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
875 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 878 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
876 | 879 |
877 // Dispatch to the first bytecode handler for the function. | 880 // Dispatch to the first bytecode handler for the function. |
878 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, | 881 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, |
879 kInterpreterBytecodeOffsetRegister)); | 882 kInterpreterBytecodeOffsetRegister)); |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 } | 1852 } |
1850 } | 1853 } |
1851 | 1854 |
1852 | 1855 |
1853 #undef __ | 1856 #undef __ |
1854 | 1857 |
1855 } // namespace internal | 1858 } // namespace internal |
1856 } // namespace v8 | 1859 } // namespace v8 |
1857 | 1860 |
1858 #endif // V8_TARGET_ARCH_ARM | 1861 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |