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