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