| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 __ mov(kInterpreterDispatchTableRegister, | 1142 __ mov(kInterpreterDispatchTableRegister, |
| 1144 Operand(ExternalReference::interpreter_dispatch_table_address( | 1143 Operand(ExternalReference::interpreter_dispatch_table_address( |
| 1145 masm->isolate()))); | 1144 masm->isolate()))); |
| 1146 | 1145 |
| 1147 // Get the context from the frame. | 1146 // Get the context from the frame. |
| 1148 __ LoadP(kContextRegister, | 1147 __ LoadP(kContextRegister, |
| 1149 MemOperand(kInterpreterRegisterFileRegister, | 1148 MemOperand(kInterpreterRegisterFileRegister, |
| 1150 InterpreterFrameConstants::kContextFromRegisterPointer)); | 1149 InterpreterFrameConstants::kContextFromRegisterPointer)); |
| 1151 | 1150 |
| 1152 // Get the bytecode array pointer from the frame. | 1151 // Get the bytecode array pointer from the frame. |
| 1153 __ LoadP(r4, | 1152 __ LoadP( |
| 1154 MemOperand(kInterpreterRegisterFileRegister, | 1153 kInterpreterBytecodeArrayRegister, |
| 1155 InterpreterFrameConstants::kFunctionFromRegisterPointer)); | 1154 MemOperand(kInterpreterRegisterFileRegister, |
| 1156 __ LoadP(r4, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1155 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); |
| 1157 __ LoadP(kInterpreterBytecodeArrayRegister, | |
| 1158 FieldMemOperand(r4, SharedFunctionInfo::kFunctionDataOffset)); | |
| 1159 | 1156 |
| 1160 if (FLAG_debug_code) { | 1157 if (FLAG_debug_code) { |
| 1161 // Check function data field is actually a BytecodeArray object. | 1158 // Check function data field is actually a BytecodeArray object. |
| 1162 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); | 1159 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
| 1163 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1160 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 1164 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg, | 1161 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg, |
| 1165 BYTECODE_ARRAY_TYPE); | 1162 BYTECODE_ARRAY_TYPE); |
| 1166 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1163 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
| 1167 } | 1164 } |
| 1168 | 1165 |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2750 __ bkpt(0); | 2747 __ bkpt(0); |
| 2751 } | 2748 } |
| 2752 } | 2749 } |
| 2753 | 2750 |
| 2754 | 2751 |
| 2755 #undef __ | 2752 #undef __ |
| 2756 } // namespace internal | 2753 } // namespace internal |
| 2757 } // namespace v8 | 2754 } // namespace v8 |
| 2758 | 2755 |
| 2759 #endif // V8_TARGET_ARCH_PPC | 2756 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |