| 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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 __ LoadP(scratch, MemOperand(index, -kPointerSize)); | 1163 __ LoadP(scratch, MemOperand(index, -kPointerSize)); |
| 1164 __ lay(index, MemOperand(index, -kPointerSize)); | 1164 __ lay(index, MemOperand(index, -kPointerSize)); |
| 1165 __ push(scratch); | 1165 __ push(scratch); |
| 1166 __ SubP(r0, Operand(1)); | 1166 __ SubP(r0, Operand(1)); |
| 1167 __ bne(&loop); | 1167 __ bne(&loop); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 // static | 1170 // static |
| 1171 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 1171 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 1172 MacroAssembler* masm, TailCallMode tail_call_mode, | 1172 MacroAssembler* masm, TailCallMode tail_call_mode, |
| 1173 CallableType function_type) { | 1173 InterpreterPushArgsMode mode) { |
| 1174 // ----------- S t a t e ------------- | 1174 // ----------- S t a t e ------------- |
| 1175 // -- r2 : the number of arguments (not including the receiver) | 1175 // -- r2 : the number of arguments (not including the receiver) |
| 1176 // -- r4 : the address of the first argument to be pushed. Subsequent | 1176 // -- r4 : the address of the first argument to be pushed. Subsequent |
| 1177 // arguments should be consecutive above this, in the same order as | 1177 // arguments should be consecutive above this, in the same order as |
| 1178 // they are to be pushed onto the stack. | 1178 // they are to be pushed onto the stack. |
| 1179 // -- r3 : the target to call (can be any Object). | 1179 // -- r3 : the target to call (can be any Object). |
| 1180 // ----------------------------------- | 1180 // ----------------------------------- |
| 1181 Label stack_overflow; | 1181 Label stack_overflow; |
| 1182 | 1182 |
| 1183 // Calculate number of arguments (AddP one for receiver). | 1183 // Calculate number of arguments (AddP one for receiver). |
| 1184 __ AddP(r5, r2, Operand(1)); | 1184 __ AddP(r5, r2, Operand(1)); |
| 1185 | 1185 |
| 1186 // Push the arguments. | 1186 // Push the arguments. |
| 1187 Generate_InterpreterPushArgs(masm, r5, r4, r5, r6, &stack_overflow); | 1187 Generate_InterpreterPushArgs(masm, r5, r4, r5, r6, &stack_overflow); |
| 1188 | 1188 |
| 1189 // Call the target. | 1189 // Call the target. |
| 1190 if (function_type == CallableType::kJSFunction) { | 1190 if (mode == InterpreterPushArgsMode::kJSFunction) { |
| 1191 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, | 1191 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
| 1192 tail_call_mode), | 1192 tail_call_mode), |
| 1193 RelocInfo::CODE_TARGET); | 1193 RelocInfo::CODE_TARGET); |
| 1194 } else { | 1194 } else { |
| 1195 DCHECK_EQ(function_type, CallableType::kAny); | 1195 DCHECK_EQ(mode, InterpreterPushArgsMode::kOther); |
| 1196 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1196 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1197 tail_call_mode), | 1197 tail_call_mode), |
| 1198 RelocInfo::CODE_TARGET); | 1198 RelocInfo::CODE_TARGET); |
| 1199 } | 1199 } |
| 1200 | 1200 |
| 1201 __ bind(&stack_overflow); | 1201 __ bind(&stack_overflow); |
| 1202 { | 1202 { |
| 1203 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 1203 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
| 1204 // Unreachable Code. | 1204 // Unreachable Code. |
| 1205 __ bkpt(0); | 1205 __ bkpt(0); |
| 1206 } | 1206 } |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 // static | 1209 // static |
| 1210 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 1210 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
| 1211 MacroAssembler* masm, PushArgsConstructMode mode) { | 1211 MacroAssembler* masm, InterpreterPushArgsMode mode) { |
| 1212 // ----------- S t a t e ------------- | 1212 // ----------- S t a t e ------------- |
| 1213 // -- r2 : argument count (not including receiver) | 1213 // -- r2 : argument count (not including receiver) |
| 1214 // -- r5 : new target | 1214 // -- r5 : new target |
| 1215 // -- r3 : constructor to call | 1215 // -- r3 : constructor to call |
| 1216 // -- r4 : allocation site feedback if available, undefined otherwise. | 1216 // -- r4 : allocation site feedback if available, undefined otherwise. |
| 1217 // -- r6 : address of the first argument | 1217 // -- r6 : address of the first argument |
| 1218 // ----------------------------------- | 1218 // ----------------------------------- |
| 1219 Label stack_overflow; | 1219 Label stack_overflow; |
| 1220 | 1220 |
| 1221 // Push a slot for the receiver to be constructed. | 1221 // Push a slot for the receiver to be constructed. |
| 1222 __ LoadImmP(r0, Operand::Zero()); | 1222 __ LoadImmP(r0, Operand::Zero()); |
| 1223 __ push(r0); | 1223 __ push(r0); |
| 1224 | 1224 |
| 1225 // Push the arguments (skip if none). | 1225 // Push the arguments (skip if none). |
| 1226 Label skip; | 1226 Label skip; |
| 1227 __ CmpP(r2, Operand::Zero()); | 1227 __ CmpP(r2, Operand::Zero()); |
| 1228 __ beq(&skip); | 1228 __ beq(&skip); |
| 1229 Generate_InterpreterPushArgs(masm, r2, r6, r2, r7, &stack_overflow); | 1229 Generate_InterpreterPushArgs(masm, r2, r6, r2, r7, &stack_overflow); |
| 1230 __ bind(&skip); | 1230 __ bind(&skip); |
| 1231 | 1231 |
| 1232 __ AssertUndefinedOrAllocationSite(r4, r7); | 1232 __ AssertUndefinedOrAllocationSite(r4, r7); |
| 1233 if (mode == PushArgsConstructMode::kJSFunction) { | 1233 if (mode == InterpreterPushArgsMode::kJSFunction) { |
| 1234 __ AssertFunction(r3); | 1234 __ AssertFunction(r3); |
| 1235 | 1235 |
| 1236 // Tail call to the function-specific construct stub (still in the caller | 1236 // Tail call to the function-specific construct stub (still in the caller |
| 1237 // context at this point). | 1237 // context at this point). |
| 1238 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 1238 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); |
| 1239 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); | 1239 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); |
| 1240 // Jump to the construct function. | 1240 // Jump to the construct function. |
| 1241 __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1241 __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1242 __ Jump(ip); | 1242 __ Jump(ip); |
| 1243 } else if (mode == PushArgsConstructMode::kWithFinalSpread) { | 1243 } else if (mode == InterpreterPushArgsMode::kWithFinalSpread) { |
| 1244 // Call the constructor with r2, r3, and r5 unmodified. | 1244 // Call the constructor with r2, r3, and r5 unmodified. |
| 1245 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), | 1245 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), |
| 1246 RelocInfo::CODE_TARGET); | 1246 RelocInfo::CODE_TARGET); |
| 1247 } else { | 1247 } else { |
| 1248 DCHECK_EQ(PushArgsConstructMode::kOther, mode); | 1248 DCHECK_EQ(InterpreterPushArgsMode::kOther, mode); |
| 1249 // Call the constructor with r2, r3, and r5 unmodified. | 1249 // Call the constructor with r2, r3, and r5 unmodified. |
| 1250 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1250 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 __ bind(&stack_overflow); | 1253 __ bind(&stack_overflow); |
| 1254 { | 1254 { |
| 1255 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 1255 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
| 1256 // Unreachable Code. | 1256 // Unreachable Code. |
| 1257 __ bkpt(0); | 1257 __ bkpt(0); |
| 1258 } | 1258 } |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3124 __ bkpt(0); | 3124 __ bkpt(0); |
| 3125 } | 3125 } |
| 3126 } | 3126 } |
| 3127 | 3127 |
| 3128 #undef __ | 3128 #undef __ |
| 3129 | 3129 |
| 3130 } // namespace internal | 3130 } // namespace internal |
| 3131 } // namespace v8 | 3131 } // namespace v8 |
| 3132 | 3132 |
| 3133 #endif // V8_TARGET_ARCH_S390 | 3133 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |