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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 __ bind(&loop); | 1043 __ bind(&loop); |
1044 __ push(r5); | 1044 __ push(r5); |
1045 __ SubP(r1, Operand(1)); | 1045 __ SubP(r1, Operand(1)); |
1046 __ bne(&loop); | 1046 __ bne(&loop); |
1047 __ bind(&no_args); | 1047 __ bind(&no_args); |
1048 } | 1048 } |
1049 | 1049 |
1050 // Load accumulator, register file, bytecode offset, dispatch table into | 1050 // Load accumulator, register file, bytecode offset, dispatch table into |
1051 // registers. | 1051 // registers. |
1052 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1052 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1053 __ AddP(kInterpreterRegisterFileRegister, fp, | 1053 __ AddP(r4, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); |
1054 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1055 __ mov(kInterpreterBytecodeOffsetRegister, | 1054 __ mov(kInterpreterBytecodeOffsetRegister, |
1056 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 1055 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
1057 __ mov(kInterpreterDispatchTableRegister, | 1056 __ mov(kInterpreterDispatchTableRegister, |
1058 Operand(ExternalReference::interpreter_dispatch_table_address( | 1057 Operand(ExternalReference::interpreter_dispatch_table_address( |
1059 masm->isolate()))); | 1058 masm->isolate()))); |
1060 | 1059 |
1061 // Dispatch to the first bytecode handler for the function. | 1060 // Dispatch to the first bytecode handler for the function. |
1062 __ LoadlB(r3, MemOperand(kInterpreterBytecodeArrayRegister, | 1061 __ LoadlB(r3, MemOperand(kInterpreterBytecodeArrayRegister, |
1063 kInterpreterBytecodeOffsetRegister)); | 1062 kInterpreterBytecodeOffsetRegister)); |
1064 __ ShiftLeftP(ip, r3, Operand(kPointerSizeLog2)); | 1063 __ ShiftLeftP(ip, r3, Operand(kPointerSizeLog2)); |
1065 __ LoadP(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1064 __ LoadP(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1066 __ Call(ip); | 1065 __ Call(ip); |
1067 | 1066 |
1068 // Even though the first bytecode handler was called, we will never return. | 1067 // Even though the first bytecode handler was called, we will never return. |
1069 __ Abort(kUnexpectedReturnFromBytecodeHandler); | 1068 __ Abort(kUnexpectedReturnFromBytecodeHandler); |
1070 } | 1069 } |
1071 | 1070 |
1072 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1071 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
1073 // TODO(rmcilroy): List of things not currently dealt with here but done in | |
1074 // fullcodegen's EmitReturnSequence. | |
1075 // - Supporting FLAG_trace for Runtime::TraceExit. | |
1076 // - Support profiler (specifically decrementing profiling_counter | |
1077 // appropriately and calling out to HandleInterrupts if necessary). | |
1078 | |
1079 // The return value is in accumulator, which is already in r2. | 1072 // The return value is in accumulator, which is already in r2. |
1080 | 1073 |
1081 // Leave the frame (also dropping the register file). | 1074 // Leave the frame (also dropping the register file). |
1082 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1075 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1083 | 1076 |
1084 // Drop receiver + arguments and return. | 1077 // Drop receiver + arguments and return. |
1085 __ LoadlW(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1078 __ LoadlW(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1086 BytecodeArray::kParameterSizeOffset)); | 1079 BytecodeArray::kParameterSizeOffset)); |
1087 __ AddP(sp, sp, r0); | 1080 __ AddP(sp, sp, r0); |
1088 __ Ret(); | 1081 __ Ret(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 __ CmpP(r2, Operand::Zero()); | 1135 __ CmpP(r2, Operand::Zero()); |
1143 __ beq(&skip); | 1136 __ beq(&skip); |
1144 Generate_InterpreterPushArgs(masm, r4, r2, r6); | 1137 Generate_InterpreterPushArgs(masm, r4, r2, r6); |
1145 __ bind(&skip); | 1138 __ bind(&skip); |
1146 | 1139 |
1147 // Call the constructor with r2, r3, and r5 unmodified. | 1140 // Call the constructor with r2, r3, and r5 unmodified. |
1148 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1141 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1149 } | 1142 } |
1150 | 1143 |
1151 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { | 1144 static void Generate_EnterBytecodeDispatch(MacroAssembler* masm) { |
1152 // Initialize register file register and dispatch table register. | 1145 // Initialize the dispatch table register. |
1153 __ AddP(kInterpreterRegisterFileRegister, fp, | |
1154 Operand(InterpreterFrameConstants::kRegisterFilePointerFromFp)); | |
1155 __ mov(kInterpreterDispatchTableRegister, | 1146 __ mov(kInterpreterDispatchTableRegister, |
1156 Operand(ExternalReference::interpreter_dispatch_table_address( | 1147 Operand(ExternalReference::interpreter_dispatch_table_address( |
1157 masm->isolate()))); | 1148 masm->isolate()))); |
1158 | 1149 |
1159 // Get the bytecode array pointer from the frame. | 1150 // Get the bytecode array pointer from the frame. |
1160 __ LoadP( | 1151 __ LoadP(kInterpreterBytecodeArrayRegister, |
1161 kInterpreterBytecodeArrayRegister, | 1152 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
1162 MemOperand(kInterpreterRegisterFileRegister, | |
1163 InterpreterFrameConstants::kBytecodeArrayFromRegisterPointer)); | |
1164 | 1153 |
1165 if (FLAG_debug_code) { | 1154 if (FLAG_debug_code) { |
1166 // Check function data field is actually a BytecodeArray object. | 1155 // Check function data field is actually a BytecodeArray object. |
1167 __ TestIfSmi(kInterpreterBytecodeArrayRegister); | 1156 __ TestIfSmi(kInterpreterBytecodeArrayRegister); |
1168 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1157 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1169 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, | 1158 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, |
1170 BYTECODE_ARRAY_TYPE); | 1159 BYTECODE_ARRAY_TYPE); |
1171 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); | 1160 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); |
1172 } | 1161 } |
1173 | 1162 |
1174 // Get the target bytecode offset from the frame. | 1163 // Get the target bytecode offset from the frame. |
1175 __ LoadP(kInterpreterBytecodeOffsetRegister, | 1164 __ LoadP(kInterpreterBytecodeOffsetRegister, |
1176 MemOperand( | 1165 MemOperand(fp, InterpreterFrameConstants::kBytecodeOffsetFromFp)); |
1177 kInterpreterRegisterFileRegister, | |
1178 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); | |
1179 __ SmiUntag(kInterpreterBytecodeOffsetRegister); | 1166 __ SmiUntag(kInterpreterBytecodeOffsetRegister); |
1180 | 1167 |
1181 // Dispatch to the target bytecode. | 1168 // Dispatch to the target bytecode. |
1182 __ LoadlB(r3, MemOperand(kInterpreterBytecodeArrayRegister, | 1169 __ LoadlB(r3, MemOperand(kInterpreterBytecodeArrayRegister, |
1183 kInterpreterBytecodeOffsetRegister)); | 1170 kInterpreterBytecodeOffsetRegister)); |
1184 __ ShiftLeftP(ip, r3, Operand(kPointerSizeLog2)); | 1171 __ ShiftLeftP(ip, r3, Operand(kPointerSizeLog2)); |
1185 __ LoadP(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1172 __ LoadP(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1186 __ Jump(ip); | 1173 __ Jump(ip); |
1187 } | 1174 } |
1188 | 1175 |
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2818 __ bkpt(0); | 2805 __ bkpt(0); |
2819 } | 2806 } |
2820 } | 2807 } |
2821 | 2808 |
2822 #undef __ | 2809 #undef __ |
2823 | 2810 |
2824 } // namespace internal | 2811 } // namespace internal |
2825 } // namespace v8 | 2812 } // namespace v8 |
2826 | 2813 |
2827 #endif // V8_TARGET_ARCH_S390 | 2814 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |