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