| 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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
| 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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 } | 777 } |
| 778 | 778 |
| 779 | 779 |
| 780 // Generate code for entering a JS function with the interpreter. | 780 // Generate code for entering a JS function with the interpreter. |
| 781 // On entry to the function the receiver and arguments have been pushed on the | 781 // On entry to the function the receiver and arguments have been pushed on the |
| 782 // stack left to right. The actual argument count matches the formal parameter | 782 // stack left to right. The actual argument count matches the formal parameter |
| 783 // count expected by the function. | 783 // count expected by the function. |
| 784 // | 784 // |
| 785 // The live registers are: | 785 // The live registers are: |
| 786 // o a1: the JS function object being called. | 786 // o a1: the JS function object being called. |
| 787 // o a3: the new target |
| 787 // o cp: our context | 788 // o cp: our context |
| 788 // o fp: the caller's frame pointer | 789 // o fp: the caller's frame pointer |
| 789 // o sp: stack pointer | 790 // o sp: stack pointer |
| 790 // o ra: return address | 791 // o ra: return address |
| 791 // | 792 // |
| 792 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 793 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 793 // frames-mips.h for its layout. | 794 // frames-mips.h for its layout. |
| 794 // TODO(rmcilroy): We will need to include the current bytecode pointer in the | 795 // TODO(rmcilroy): We will need to include the current bytecode pointer in the |
| 795 // frame. | 796 // frame. |
| 796 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 797 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
| 797 // Open a frame scope to indicate that there is a frame on the stack. The | 798 // Open a frame scope to indicate that there is a frame on the stack. The |
| 798 // MANUAL indicates that the scope shouldn't actually generate code to set up | 799 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 799 // the frame (that is done below). | 800 // the frame (that is done below). |
| 800 FrameScope frame_scope(masm, StackFrame::MANUAL); | 801 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 801 | 802 |
| 802 __ Push(ra, fp, cp, a1); | 803 __ Push(ra, fp, cp, a1); |
| 803 __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 804 __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 805 __ Push(a3); |
| 804 | 806 |
| 805 // Get the bytecode array from the function object and load the pointer to the | 807 // Get the bytecode array from the function object and load the pointer to the |
| 806 // first entry into kInterpreterBytecodeRegister. | 808 // first entry into kInterpreterBytecodeRegister. |
| 807 __ lw(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 809 __ lw(a0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 808 __ lw(kInterpreterBytecodeArrayRegister, | 810 __ lw(kInterpreterBytecodeArrayRegister, |
| 809 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); | 811 FieldMemOperand(a0, SharedFunctionInfo::kFunctionDataOffset)); |
| 810 | 812 |
| 811 if (FLAG_debug_code) { | 813 if (FLAG_debug_code) { |
| 812 // Check function data field is actually a BytecodeArray object. | 814 // Check function data field is actually a BytecodeArray object. |
| 813 __ SmiTst(kInterpreterBytecodeArrayRegister, t0); | 815 __ SmiTst(kInterpreterBytecodeArrayRegister, t0); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 861 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
| 860 __ Branch(&ok, hs, sp, Operand(at)); | 862 __ Branch(&ok, hs, sp, Operand(at)); |
| 861 __ push(kInterpreterBytecodeArrayRegister); | 863 __ push(kInterpreterBytecodeArrayRegister); |
| 862 __ CallRuntime(Runtime::kStackGuard, 0); | 864 __ CallRuntime(Runtime::kStackGuard, 0); |
| 863 __ pop(kInterpreterBytecodeArrayRegister); | 865 __ pop(kInterpreterBytecodeArrayRegister); |
| 864 __ bind(&ok); | 866 __ bind(&ok); |
| 865 } | 867 } |
| 866 | 868 |
| 867 // Load bytecode offset and dispatch table into registers. | 869 // Load bytecode offset and dispatch table into registers. |
| 868 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 870 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 869 __ Subu( | 871 __ Subu(kInterpreterRegisterFileRegister, fp, |
| 870 kInterpreterRegisterFileRegister, fp, | 872 Operand(2 * kPointerSize + |
| 871 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); | 873 StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 872 __ li(kInterpreterBytecodeOffsetRegister, | 874 __ li(kInterpreterBytecodeOffsetRegister, |
| 873 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 875 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 874 __ LoadRoot(kInterpreterDispatchTableRegister, | 876 __ LoadRoot(kInterpreterDispatchTableRegister, |
| 875 Heap::kInterpreterTableRootIndex); | 877 Heap::kInterpreterTableRootIndex); |
| 876 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, | 878 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
| 877 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 879 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 878 | 880 |
| 879 // Dispatch to the first bytecode handler for the function. | 881 // Dispatch to the first bytecode handler for the function. |
| 880 __ Addu(a0, kInterpreterBytecodeArrayRegister, | 882 __ Addu(a0, kInterpreterBytecodeArrayRegister, |
| 881 kInterpreterBytecodeOffsetRegister); | 883 kInterpreterBytecodeOffsetRegister); |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 } | 1883 } |
| 1882 } | 1884 } |
| 1883 | 1885 |
| 1884 | 1886 |
| 1885 #undef __ | 1887 #undef __ |
| 1886 | 1888 |
| 1887 } // namespace internal | 1889 } // namespace internal |
| 1888 } // namespace v8 | 1890 } // namespace v8 |
| 1889 | 1891 |
| 1890 #endif // V8_TARGET_ARCH_MIPS | 1892 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |