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