| 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 // The function builds an interpreter frame. See InterpreterFrameConstants in | 971 // The function builds an interpreter frame. See InterpreterFrameConstants in |
| 972 // frames.h for its layout. | 972 // frames.h for its layout. |
| 973 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { | 973 void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) { |
| 974 // Open a frame scope to indicate that there is a frame on the stack. The | 974 // Open a frame scope to indicate that there is a frame on the stack. The |
| 975 // MANUAL indicates that the scope shouldn't actually generate code to set up | 975 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 976 // the frame (that is done below). | 976 // the frame (that is done below). |
| 977 FrameScope frame_scope(masm, StackFrame::MANUAL); | 977 FrameScope frame_scope(masm, StackFrame::MANUAL); |
| 978 __ PushFixedFrame(r4); | 978 __ PushFixedFrame(r4); |
| 979 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); | 979 __ addi(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp)); |
| 980 | 980 |
| 981 // Push new.target, dispatch table pointer and zero for bytecode array offset. | |
| 982 __ li(r3, Operand::Zero()); | |
| 983 __ mov(r5, Operand(ExternalReference::interpreter_dispatch_table_address( | |
| 984 masm->isolate()))); | |
| 985 __ Push(r6, r5, r3); | |
| 986 | |
| 987 // Get the bytecode array from the function object and load the pointer to the | 981 // Get the bytecode array from the function object and load the pointer to the |
| 988 // first entry into kInterpreterBytecodeRegister. | 982 // first entry into kInterpreterBytecodeRegister. |
| 989 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 983 __ LoadP(r3, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 990 __ LoadP(kInterpreterBytecodeArrayRegister, | 984 __ LoadP(kInterpreterBytecodeArrayRegister, |
| 991 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); | 985 FieldMemOperand(r3, SharedFunctionInfo::kFunctionDataOffset)); |
| 992 | 986 |
| 993 if (FLAG_debug_code) { | 987 if (FLAG_debug_code) { |
| 994 // Check function data field is actually a BytecodeArray object. | 988 // Check function data field is actually a BytecodeArray object. |
| 995 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); | 989 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
| 996 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 990 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 997 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, | 991 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, |
| 998 BYTECODE_ARRAY_TYPE); | 992 BYTECODE_ARRAY_TYPE); |
| 999 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 993 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 1000 } | 994 } |
| 1001 | 995 |
| 996 // Push new.target, bytecode array and zero for bytecode array offset. |
| 997 __ li(r3, Operand::Zero()); |
| 998 __ Push(r6, kInterpreterBytecodeArrayRegister, r3); |
| 999 |
| 1002 // Allocate the local and temporary register file on the stack. | 1000 // Allocate the local and temporary register file on the stack. |
| 1003 { | 1001 { |
| 1004 // Load frame size (word) from the BytecodeArray object. | 1002 // Load frame size (word) from the BytecodeArray object. |
| 1005 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1003 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
| 1006 BytecodeArray::kFrameSizeOffset)); | 1004 BytecodeArray::kFrameSizeOffset)); |
| 1007 | 1005 |
| 1008 // Do a stack check to ensure we don't go over the limit. | 1006 // Do a stack check to ensure we don't go over the limit. |
| 1009 Label ok; | 1007 Label ok; |
| 1010 __ sub(r6, sp, r5); | 1008 __ sub(r6, sp, r5); |
| 1011 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex); | 1009 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1033 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. | 1031 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. |
| 1034 // - Code aging of the BytecodeArray object. | 1032 // - Code aging of the BytecodeArray object. |
| 1035 | 1033 |
| 1036 // Load accumulator, register file, bytecode offset, dispatch table into | 1034 // Load accumulator, register file, bytecode offset, dispatch table into |
| 1037 // registers. | 1035 // registers. |
| 1038 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1036 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 1039 __ addi(kInterpreterRegisterFileRegister, fp, | 1037 __ addi(kInterpreterRegisterFileRegister, fp, |
| 1040 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | 1038 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); |
| 1041 __ mov(kInterpreterBytecodeOffsetRegister, | 1039 __ mov(kInterpreterBytecodeOffsetRegister, |
| 1042 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1040 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 1043 __ LoadP(kInterpreterDispatchTableRegister, | 1041 __ mov(kInterpreterDispatchTableRegister, |
| 1044 MemOperand(fp, InterpreterFrameConstants::kDispatchTableFromFp)); | 1042 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1043 masm->isolate()))); |
| 1045 | 1044 |
| 1046 // Dispatch to the first bytecode handler for the function. | 1045 // Dispatch to the first bytecode handler for the function. |
| 1047 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, | 1046 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
| 1048 kInterpreterBytecodeOffsetRegister)); | 1047 kInterpreterBytecodeOffsetRegister)); |
| 1049 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1048 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
| 1050 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1049 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
| 1051 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 1050 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
| 1052 // and header removal. | 1051 // and header removal. |
| 1053 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1052 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1054 __ Call(ip); | 1053 __ Call(ip); |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 __ bkpt(0); | 2749 __ bkpt(0); |
| 2751 } | 2750 } |
| 2752 } | 2751 } |
| 2753 | 2752 |
| 2754 | 2753 |
| 2755 #undef __ | 2754 #undef __ |
| 2756 } // namespace internal | 2755 } // namespace internal |
| 2757 } // namespace v8 | 2756 } // namespace v8 |
| 2758 | 2757 |
| 2759 #endif // V8_TARGET_ARCH_PPC | 2758 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |