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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 // Push function as argument and compile for baseline. | 1184 // Push function as argument and compile for baseline. |
1185 __ push(r3); | 1185 __ push(r3); |
1186 __ CallRuntime(Runtime::kCompileBaseline); | 1186 __ CallRuntime(Runtime::kCompileBaseline); |
1187 | 1187 |
1188 // Restore return value. | 1188 // Restore return value. |
1189 __ pop(r2); | 1189 __ pop(r2); |
1190 } | 1190 } |
1191 __ Ret(); | 1191 __ Ret(); |
1192 } | 1192 } |
1193 | 1193 |
1194 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, | 1194 static void Generate_InterpreterPushArgs(MacroAssembler* masm, |
| 1195 Register num_args, Register index, |
1195 Register count, Register scratch) { | 1196 Register count, Register scratch) { |
| 1197 // TODO(mythria): Add a stack check before pushing arguments. |
1196 Label loop; | 1198 Label loop; |
1197 __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU | 1199 __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU |
1198 __ LoadRR(r0, count); | 1200 __ LoadRR(r0, count); |
1199 __ bind(&loop); | 1201 __ bind(&loop); |
1200 __ LoadP(scratch, MemOperand(index, -kPointerSize)); | 1202 __ LoadP(scratch, MemOperand(index, -kPointerSize)); |
1201 __ lay(index, MemOperand(index, -kPointerSize)); | 1203 __ lay(index, MemOperand(index, -kPointerSize)); |
1202 __ push(scratch); | 1204 __ push(scratch); |
1203 __ SubP(r0, Operand(1)); | 1205 __ SubP(r0, Operand(1)); |
1204 __ bne(&loop); | 1206 __ bne(&loop); |
1205 } | 1207 } |
1206 | 1208 |
1207 // static | 1209 // static |
1208 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 1210 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
1209 MacroAssembler* masm, TailCallMode tail_call_mode, | 1211 MacroAssembler* masm, TailCallMode tail_call_mode, |
1210 CallableType function_type) { | 1212 CallableType function_type) { |
1211 // ----------- S t a t e ------------- | 1213 // ----------- S t a t e ------------- |
1212 // -- r2 : the number of arguments (not including the receiver) | 1214 // -- r2 : the number of arguments (not including the receiver) |
1213 // -- r4 : the address of the first argument to be pushed. Subsequent | 1215 // -- r4 : the address of the first argument to be pushed. Subsequent |
1214 // arguments should be consecutive above this, in the same order as | 1216 // arguments should be consecutive above this, in the same order as |
1215 // they are to be pushed onto the stack. | 1217 // they are to be pushed onto the stack. |
1216 // -- r3 : the target to call (can be any Object). | 1218 // -- r3 : the target to call (can be any Object). |
1217 // ----------------------------------- | 1219 // ----------------------------------- |
1218 | 1220 |
1219 // Calculate number of arguments (AddP one for receiver). | 1221 // Calculate number of arguments (AddP one for receiver). |
1220 __ AddP(r5, r2, Operand(1)); | 1222 __ AddP(r5, r2, Operand(1)); |
1221 | 1223 |
1222 // Push the arguments. | 1224 // Push the arguments. |
1223 Generate_InterpreterPushArgs(masm, r4, r5, r6); | 1225 Generate_InterpreterPushArgs(masm, r5, r4, r5, r6); |
1224 | 1226 |
1225 // Call the target. | 1227 // Call the target. |
1226 if (function_type == CallableType::kJSFunction) { | 1228 if (function_type == CallableType::kJSFunction) { |
1227 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, | 1229 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
1228 tail_call_mode), | 1230 tail_call_mode), |
1229 RelocInfo::CODE_TARGET); | 1231 RelocInfo::CODE_TARGET); |
1230 } else { | 1232 } else { |
1231 DCHECK_EQ(function_type, CallableType::kAny); | 1233 DCHECK_EQ(function_type, CallableType::kAny); |
1232 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1234 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
1233 tail_call_mode), | 1235 tail_call_mode), |
(...skipping 13 matching lines...) Expand all Loading... |
1247 // ----------------------------------- | 1249 // ----------------------------------- |
1248 | 1250 |
1249 // Push a slot for the receiver to be constructed. | 1251 // Push a slot for the receiver to be constructed. |
1250 __ LoadImmP(r0, Operand::Zero()); | 1252 __ LoadImmP(r0, Operand::Zero()); |
1251 __ push(r0); | 1253 __ push(r0); |
1252 | 1254 |
1253 // Push the arguments (skip if none). | 1255 // Push the arguments (skip if none). |
1254 Label skip; | 1256 Label skip; |
1255 __ CmpP(r2, Operand::Zero()); | 1257 __ CmpP(r2, Operand::Zero()); |
1256 __ beq(&skip); | 1258 __ beq(&skip); |
1257 Generate_InterpreterPushArgs(masm, r6, r2, r7); | 1259 Generate_InterpreterPushArgs(masm, r2, r6, r2, r7); |
1258 __ bind(&skip); | 1260 __ bind(&skip); |
1259 | 1261 |
1260 __ AssertUndefinedOrAllocationSite(r4, r7); | 1262 __ AssertUndefinedOrAllocationSite(r4, r7); |
1261 if (construct_type == CallableType::kJSFunction) { | 1263 if (construct_type == CallableType::kJSFunction) { |
1262 __ AssertFunction(r3); | 1264 __ AssertFunction(r3); |
1263 | 1265 |
1264 // Tail call to the function-specific construct stub (still in the caller | 1266 // Tail call to the function-specific construct stub (still in the caller |
1265 // context at this point). | 1267 // context at this point). |
1266 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 1268 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); |
1267 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); | 1269 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); |
1268 // Jump to the construct function. | 1270 // Jump to the construct function. |
1269 __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1271 __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1270 __ Jump(ip); | 1272 __ Jump(ip); |
1271 | 1273 |
1272 } else { | 1274 } else { |
1273 DCHECK_EQ(construct_type, CallableType::kAny); | 1275 DCHECK_EQ(construct_type, CallableType::kAny); |
1274 // Call the constructor with r2, r3, and r5 unmodified. | 1276 // Call the constructor with r2, r3, and r5 unmodified. |
1275 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1277 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1276 } | 1278 } |
1277 } | 1279 } |
1278 | 1280 |
| 1281 // static |
| 1282 void Builtins::Generate_InterpreterPushArgsAndConstructArray( |
| 1283 MacroAssembler* masm) { |
| 1284 // ----------- S t a t e ------------- |
| 1285 // -- r2 : argument count (not including receiver) |
| 1286 // -- r3 : target to call verified to be Array function |
| 1287 // -- r4 : allocation site feedback if available, undefined otherwise. |
| 1288 // -- r5 : address of the first argument |
| 1289 // ----------------------------------- |
| 1290 |
| 1291 __ AddP(r6, r2, Operand(1)); // Add one for receiver. |
| 1292 |
| 1293 // TODO(mythria): Add a stack check before pushing arguments. |
| 1294 // Push the arguments. r6, r8, r3 will be modified. |
| 1295 Generate_InterpreterPushArgs(masm, r6, r5, r6, r7); |
| 1296 |
| 1297 // Array constructor expects constructor in r5. It is same as r3 here. |
| 1298 __ LoadRR(r5, r3); |
| 1299 |
| 1300 ArrayConstructorStub stub(masm->isolate()); |
| 1301 __ TailCallStub(&stub); |
| 1302 } |
| 1303 |
1279 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1304 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1280 // Set the return address to the correct point in the interpreter entry | 1305 // Set the return address to the correct point in the interpreter entry |
1281 // trampoline. | 1306 // trampoline. |
1282 Smi* interpreter_entry_return_pc_offset( | 1307 Smi* interpreter_entry_return_pc_offset( |
1283 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1308 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1284 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1309 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
1285 __ Move(r4, masm->isolate()->builtins()->InterpreterEntryTrampoline()); | 1310 __ Move(r4, masm->isolate()->builtins()->InterpreterEntryTrampoline()); |
1286 __ AddP(r14, r4, Operand(interpreter_entry_return_pc_offset->value() + | 1311 __ AddP(r14, r4, Operand(interpreter_entry_return_pc_offset->value() + |
1287 Code::kHeaderSize - kHeapObjectTag)); | 1312 Code::kHeaderSize - kHeapObjectTag)); |
1288 | 1313 |
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3048 __ bkpt(0); | 3073 __ bkpt(0); |
3049 } | 3074 } |
3050 } | 3075 } |
3051 | 3076 |
3052 #undef __ | 3077 #undef __ |
3053 | 3078 |
3054 } // namespace internal | 3079 } // namespace internal |
3055 } // namespace v8 | 3080 } // namespace v8 |
3056 | 3081 |
3057 #endif // V8_TARGET_ARCH_S390 | 3082 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |