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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 __ mtctr(r5); | 1053 __ mtctr(r5); |
1054 __ bind(&loop); | 1054 __ bind(&loop); |
1055 __ push(r6); | 1055 __ push(r6); |
1056 __ bdnz(&loop); | 1056 __ bdnz(&loop); |
1057 __ bind(&no_args); | 1057 __ bind(&no_args); |
1058 } | 1058 } |
1059 | 1059 |
1060 // Load accumulator, register file, bytecode offset, dispatch table into | 1060 // Load accumulator, register file, bytecode offset, dispatch table into |
1061 // registers. | 1061 // registers. |
1062 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1062 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1063 __ addi(kInterpreterRegisterFileRegister, fp, | 1063 __ addi(r7, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); |
1064 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1065 __ mov(kInterpreterBytecodeOffsetRegister, | 1064 __ mov(kInterpreterBytecodeOffsetRegister, |
1066 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1065 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
1067 __ mov(kInterpreterDispatchTableRegister, | 1066 __ mov(kInterpreterDispatchTableRegister, |
1068 Operand(ExternalReference::interpreter_dispatch_table_address( | 1067 Operand(ExternalReference::interpreter_dispatch_table_address( |
1069 masm->isolate()))); | 1068 masm->isolate()))); |
1070 | 1069 |
1071 // Dispatch to the first bytecode handler for the function. | 1070 // Dispatch to the first bytecode handler for the function. |
1072 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, | 1071 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
1073 kInterpreterBytecodeOffsetRegister)); | 1072 kInterpreterBytecodeOffsetRegister)); |
1074 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1073 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
1075 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1074 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1076 __ Call(ip); | 1075 __ Call(ip); |
1077 | 1076 |
1078 // Even though the first bytecode handler was called, we will never return. | 1077 // Even though the first bytecode handler was called, we will never return. |
1079 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 1078 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
1080 } | 1079 } |
1081 | 1080 |
1082 | 1081 |
1083 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1082 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
1084 // TODO(rmcilroy): List of things not currently dealt with here but done in | |
1085 // fullcodegen's EmitReturnSequence. | |
1086 // - Supporting FLAG_trace for Runtime::TraceExit. | |
1087 // - Support profiler (specifically decrementing profiling_counter | |
1088 // appropriately and calling out to HandleInterrupts if necessary). | |
1089 | |
1090 // The return value is in accumulator, which is already in r3. | 1083 // The return value is in accumulator, which is already in r3. |
1091 | 1084 |
1092 // Leave the frame (also dropping the register file). | 1085 // Leave the frame (also dropping the register file). |
1093 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1086 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1094 | 1087 |
1095 // Drop receiver + arguments and return. | 1088 // Drop receiver + arguments and return. |
1096 __ lwz(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1089 __ lwz(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1097 BytecodeArray::kParameterSizeOffset)); | 1090 BytecodeArray::kParameterSizeOffset)); |
1098 __ add(sp, sp, r0); | 1091 __ add(sp, sp, r0); |
1099 __ blr(); | 1092 __ blr(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 __ beq(&skip); | 1148 __ beq(&skip); |
1156 Generate_InterpreterPushArgs(masm, r5, r3, r7); | 1149 Generate_InterpreterPushArgs(masm, r5, r3, r7); |
1157 __ bind(&skip); | 1150 __ bind(&skip); |
1158 | 1151 |
1159 // Call the constructor with r3, r4, and r6 unmodified. | 1152 // Call the constructor with r3, r4, and r6 unmodified. |
1160 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1153 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1161 } | 1154 } |
1162 | 1155 |
1163 | 1156 |
1164 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 1157 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
1165 // Initialize register file register and dispatch table register. | 1158 // Initialize the dispatch table register. |
1166 __ addi(kInterpreterRegisterFileRegister, fp, | |
1167 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1168 __ mov(kInterpreterDispatchTableRegister, | 1159 __ mov(kInterpreterDispatchTableRegister, |
1169 Operand(ExternalReference::interpreter_dispatch_table_address( | 1160 Operand(ExternalReference::interpreter_dispatch_table_address( |
1170 masm->isolate()))); | 1161 masm->isolate()))); |
1171 | 1162 |
1172 // Get the bytecode array pointer from the frame. | 1163 // Get the bytecode array pointer from the frame. |
1173 __ LoadP( | 1164 __ LoadP(kInterpreterBytecodeArrayRegister, |
1174 kInterpreterBytecodeArrayRegister, | 1165 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
1175 MemOperand(kInterpreterRegisterFileRegister, | |
1176 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); | |
1177 | 1166 |
1178 if (FLAG_debug_code) { | 1167 if (FLAG_debug_code) { |
1179 // Check function data field is actually a BytecodeArray object. | 1168 // Check function data field is actually a BytecodeArray object. |
1180 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); | 1169 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); |
1181 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1170 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1182 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg, | 1171 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r4, no_reg, |
1183 BYTECODE_ARRAY_TYPE); | 1172 BYTECODE_ARRAY_TYPE); |
1184 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1173 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1185 } | 1174 } |
1186 | 1175 |
1187 // Get the target bytecode offset from the frame. | 1176 // Get the target bytecode offset from the frame. |
1188 __ LoadP(kInterpreterBytecodeOffsetRegister, | 1177 __ LoadP(kInterpreterBytecodeOffsetRegister, |
1189 MemOperand( | 1178 MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
1190 kInterpreterRegisterFileRegister, | |
1191 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); | |
1192 __ SmiUntag(kInterpreterBytecodeOffsetRegister); | 1179 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
1193 | 1180 |
1194 // Dispatch to the target bytecode. | 1181 // Dispatch to the target bytecode. |
1195 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, | 1182 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
1196 kInterpreterBytecodeOffsetRegister)); | 1183 kInterpreterBytecodeOffsetRegister)); |
1197 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1184 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
1198 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1185 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1199 __ Jump(ip); | 1186 __ Jump(ip); |
1200 } | 1187 } |
1201 | 1188 |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2865 __ bkpt(0); | 2852 __ bkpt(0); |
2866 } | 2853 } |
2867 } | 2854 } |
2868 | 2855 |
2869 | 2856 |
2870 #undef __ | 2857 #undef __ |
2871 } // namespace internal | 2858 } // namespace internal |
2872 } // namespace v8 | 2859 } // namespace v8 |
2873 | 2860 |
2874 #endif // V8_TARGET_ARCH_PPC | 2861 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |