| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 r4: the JS function object being called. | 786 // o r4: the JS function object being called. |
| 787 // o r6: the new target |
| 787 // o cp: our context | 788 // o cp: our context |
| 788 // o pp: the caller's constant pool pointer (if enabled) | 789 // o pp: the caller's constant pool pointer (if enabled) |
| 789 // o fp: the caller's frame pointer | 790 // o fp: the caller's frame pointer |
| 790 // o sp: stack pointer | 791 // o sp: stack pointer |
| 791 // o lr: return address | 792 // o lr: return address |
| 792 // | 793 // |
| 793 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 794 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 794 // frames-ppc.h for its layout. | 795 // frames-ppc.h for its layout. |
| 795 // TODO(rmcilroy): We will need to include the current bytecode pointer in the | 796 // TODO(rmcilroy): We will need to include the current bytecode pointer in the |
| 796 // frame. | 797 // frame. |
| 797 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 798 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
| 798 // Open a frame scope to indicate that there is a frame on the stack. The | 799 // Open a frame scope to indicate that there is a frame on the stack. The |
| 799 // MANUAL indicates that the scope shouldn't actually generate code to set up | 800 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 800 // the frame (that is done below). | 801 // the frame (that is done below). |
| 801 FrameScope frame_scope(masm, StackFrame::MANUAL); | 802 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 802 __ PushFixedFrame(r4); | 803 __ PushFixedFrame(r4); |
| 803 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 804 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 805 __ push(r6); |
| 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 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 809 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 808 __ LoadP(kInterpreterBytecodeArrayRegister, | 810 __ LoadP(kInterpreterBytecodeArrayRegister, |
| 809 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); | 811 FieldMemOperand(r3, 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 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); | 815 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 __ bge(&ok); | 862 __ bge(&ok); |
| 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 accumulator, register file, bytecode offset, dispatch table into | 869 // Load accumulator, register file, bytecode offset, dispatch table into |
| 868 // registers. | 870 // registers. |
| 869 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 871 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 870 __ subi( | 872 __ subi(kInterpreterRegisterFileRegister, fp, |
| 871 kInterpreterRegisterFileRegister, fp, | 873 Operand(2 * kPointerSize + |
| 872 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); | 874 StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 873 __ mov(kInterpreterBytecodeOffsetRegister, | 875 __ mov(kInterpreterBytecodeOffsetRegister, |
| 874 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 876 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 875 __ LoadRoot(kInterpreterDispatchTableRegister, | 877 __ LoadRoot(kInterpreterDispatchTableRegister, |
| 876 Heap::kInterpreterTableRootIndex); | 878 Heap::kInterpreterTableRootIndex); |
| 877 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, | 879 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
| 878 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 880 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
| 879 | 881 |
| 880 // Dispatch to the first bytecode handler for the function. | 882 // Dispatch to the first bytecode handler for the function. |
| 881 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, | 883 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
| 882 kInterpreterBytecodeOffsetRegister)); | 884 kInterpreterBytecodeOffsetRegister)); |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2008 __ bkpt(0); | 2010 __ bkpt(0); |
| 2009 } | 2011 } |
| 2010 } | 2012 } |
| 2011 | 2013 |
| 2012 | 2014 |
| 2013 #undef __ | 2015 #undef __ |
| 2014 } // namespace internal | 2016 } // namespace internal |
| 2015 } // namespace v8 | 2017 } // namespace v8 |
| 2016 | 2018 |
| 2017 #endif // V8_TARGET_ARCH_PPC | 2019 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |