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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1458 |
1459 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { | 1459 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { |
1460 // ----------- S t a t e ------------- | 1460 // ----------- S t a t e ------------- |
1461 // -- r2 : argument count (preserved for callee) | 1461 // -- r2 : argument count (preserved for callee) |
1462 // -- r3 : new target (preserved for callee) | 1462 // -- r3 : new target (preserved for callee) |
1463 // -- r5 : target function (preserved for callee) | 1463 // -- r5 : target function (preserved for callee) |
1464 // ----------------------------------- | 1464 // ----------------------------------- |
1465 Label failed; | 1465 Label failed; |
1466 { | 1466 { |
1467 FrameScope scope(masm, StackFrame::INTERNAL); | 1467 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1468 // Preserve argument count for later compare. |
| 1469 __ Move(r4, r2); |
1468 // Push a copy of the target function and the new target. | 1470 // Push a copy of the target function and the new target. |
1469 __ SmiTag(r2); | 1471 __ SmiTag(r2); |
1470 // Push another copy as a parameter to the runtime call. | 1472 // Push another copy as a parameter to the runtime call. |
1471 __ Push(r2, r3, r5, r3); | 1473 __ Push(r2, r3, r5, r3); |
1472 | 1474 |
1473 // Copy arguments from caller (stdlib, foreign, heap). | 1475 // Copy arguments from caller (stdlib, foreign, heap). |
1474 for (int i = 2; i >= 0; --i) { | 1476 Label args_done; |
1475 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + | 1477 for (int j = 0; j < 4; ++j) { |
1476 i * kPointerSize)); | 1478 Label over; |
1477 __ push(r4); | 1479 if (j < 3) { |
| 1480 __ CmpP(r4, Operand(j)); |
| 1481 __ b(ne, &over); |
| 1482 } |
| 1483 for (int i = j - 1; i >= 0; --i) { |
| 1484 __ LoadP(r9, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1485 i * kPointerSize)); |
| 1486 __ push(r9); |
| 1487 } |
| 1488 for (int i = 0; i < 3 - j; ++i) { |
| 1489 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 1490 } |
| 1491 if (j < 3) { |
| 1492 __ jmp(&args_done); |
| 1493 __ bind(&over); |
| 1494 } |
1478 } | 1495 } |
| 1496 __ bind(&args_done); |
| 1497 |
1479 // Call runtime, on success unwind frame, and parent frame. | 1498 // Call runtime, on success unwind frame, and parent frame. |
1480 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); | 1499 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); |
1481 // A smi 0 is returned on failure, an object on success. | 1500 // A smi 0 is returned on failure, an object on success. |
1482 __ JumpIfSmi(r2, &failed); | 1501 __ JumpIfSmi(r2, &failed); |
| 1502 |
| 1503 __ Drop(2); |
| 1504 __ pop(r4); |
| 1505 __ SmiUntag(r4); |
1483 scope.GenerateLeaveFrame(); | 1506 scope.GenerateLeaveFrame(); |
1484 __ Drop(4); | 1507 |
| 1508 __ AddP(r4, r4, Operand(1)); |
| 1509 __ Drop(r4, r7); |
1485 __ Ret(); | 1510 __ Ret(); |
1486 | 1511 |
1487 __ bind(&failed); | 1512 __ bind(&failed); |
1488 // Restore target function and new target. | 1513 // Restore target function and new target. |
1489 __ Pop(r2, r3, r5); | 1514 __ Pop(r2, r3, r5); |
1490 __ SmiUntag(r2); | 1515 __ SmiUntag(r2); |
1491 } | 1516 } |
1492 // On failure, tail call back to regular js. | 1517 // On failure, tail call back to regular js. |
1493 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); | 1518 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
1494 } | 1519 } |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 __ bkpt(0); | 3020 __ bkpt(0); |
2996 } | 3021 } |
2997 } | 3022 } |
2998 | 3023 |
2999 #undef __ | 3024 #undef __ |
3000 | 3025 |
3001 } // namespace internal | 3026 } // namespace internal |
3002 } // namespace v8 | 3027 } // namespace v8 |
3003 | 3028 |
3004 #endif // V8_TARGET_ARCH_S390 | 3029 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |