| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 isolate->set_fp_stubs_generated(true); | 1494 isolate->set_fp_stubs_generated(true); |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 | 1497 |
| 1498 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { | 1498 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { |
| 1499 CEntryStub stub(1, kDontSaveFPRegs); | 1499 CEntryStub stub(1, kDontSaveFPRegs); |
| 1500 stub.GetCode(isolate); | 1500 stub.GetCode(isolate); |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 | 1503 |
| 1504 static void JumpIfOOM(MacroAssembler* masm, | |
| 1505 Register value, | |
| 1506 Register scratch, | |
| 1507 Label* oom_label) { | |
| 1508 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3); | |
| 1509 STATIC_ASSERT(kFailureTag == 3); | |
| 1510 __ and_(scratch, value, Operand(0xf)); | |
| 1511 __ cmp(scratch, Operand(0xf)); | |
| 1512 __ b(eq, oom_label); | |
| 1513 } | |
| 1514 | |
| 1515 | |
| 1516 void CEntryStub::GenerateCore(MacroAssembler* masm, | 1504 void CEntryStub::GenerateCore(MacroAssembler* masm, |
| 1517 Label* throw_normal_exception, | 1505 Label* throw_normal_exception, |
| 1518 Label* throw_termination_exception, | 1506 Label* throw_termination_exception, |
| 1519 Label* throw_out_of_memory_exception, | |
| 1520 bool do_gc, | 1507 bool do_gc, |
| 1521 bool always_allocate) { | 1508 bool always_allocate) { |
| 1522 // r0: result parameter for PerformGC, if any | 1509 // r0: result parameter for PerformGC, if any |
| 1523 // r4: number of arguments including receiver (C callee-saved) | 1510 // r4: number of arguments including receiver (C callee-saved) |
| 1524 // r5: pointer to builtin function (C callee-saved) | 1511 // r5: pointer to builtin function (C callee-saved) |
| 1525 // r6: pointer to the first argument (C callee-saved) | 1512 // r6: pointer to the first argument (C callee-saved) |
| 1526 Isolate* isolate = masm->isolate(); | 1513 Isolate* isolate = masm->isolate(); |
| 1527 | 1514 |
| 1528 if (do_gc) { | 1515 if (do_gc) { |
| 1529 // Passing r0. | 1516 // Passing r0. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 __ LeaveExitFrame(save_doubles_, r4, true); | 1594 __ LeaveExitFrame(save_doubles_, r4, true); |
| 1608 __ mov(pc, lr); | 1595 __ mov(pc, lr); |
| 1609 | 1596 |
| 1610 // check if we should retry or throw exception | 1597 // check if we should retry or throw exception |
| 1611 Label retry; | 1598 Label retry; |
| 1612 __ bind(&failure_returned); | 1599 __ bind(&failure_returned); |
| 1613 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); | 1600 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); |
| 1614 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 1601 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
| 1615 __ b(eq, &retry); | 1602 __ b(eq, &retry); |
| 1616 | 1603 |
| 1617 // Special handling of out of memory exceptions. | |
| 1618 JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception); | |
| 1619 | |
| 1620 // Retrieve the pending exception. | 1604 // Retrieve the pending exception. |
| 1621 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1605 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 1622 isolate))); | 1606 isolate))); |
| 1623 __ ldr(r0, MemOperand(ip)); | 1607 __ ldr(r0, MemOperand(ip)); |
| 1624 | 1608 |
| 1625 // See if we just retrieved an OOM exception. | |
| 1626 JumpIfOOM(masm, r0, ip, throw_out_of_memory_exception); | |
| 1627 | |
| 1628 // Clear the pending exception. | 1609 // Clear the pending exception. |
| 1629 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex); | 1610 __ LoadRoot(r3, Heap::kTheHoleValueRootIndex); |
| 1630 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 1611 __ mov(ip, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
| 1631 isolate))); | 1612 isolate))); |
| 1632 __ str(r3, MemOperand(ip)); | 1613 __ str(r3, MemOperand(ip)); |
| 1633 | 1614 |
| 1634 // Special handling of termination exceptions which are uncatchable | 1615 // Special handling of termination exceptions which are uncatchable |
| 1635 // by javascript code. | 1616 // by javascript code. |
| 1636 __ LoadRoot(r3, Heap::kTerminationExceptionRootIndex); | 1617 __ LoadRoot(r3, Heap::kTerminationExceptionRootIndex); |
| 1637 __ cmp(r0, r3); | 1618 __ cmp(r0, r3); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 // Set up argc and the builtin function in callee-saved registers. | 1653 // Set up argc and the builtin function in callee-saved registers. |
| 1673 __ mov(r4, Operand(r0)); | 1654 __ mov(r4, Operand(r0)); |
| 1674 __ mov(r5, Operand(r1)); | 1655 __ mov(r5, Operand(r1)); |
| 1675 | 1656 |
| 1676 // r4: number of arguments (C callee-saved) | 1657 // r4: number of arguments (C callee-saved) |
| 1677 // r5: pointer to builtin function (C callee-saved) | 1658 // r5: pointer to builtin function (C callee-saved) |
| 1678 // r6: pointer to first argument (C callee-saved) | 1659 // r6: pointer to first argument (C callee-saved) |
| 1679 | 1660 |
| 1680 Label throw_normal_exception; | 1661 Label throw_normal_exception; |
| 1681 Label throw_termination_exception; | 1662 Label throw_termination_exception; |
| 1682 Label throw_out_of_memory_exception; | |
| 1683 | 1663 |
| 1684 // Call into the runtime system. | 1664 // Call into the runtime system. |
| 1685 GenerateCore(masm, | 1665 GenerateCore(masm, |
| 1686 &throw_normal_exception, | 1666 &throw_normal_exception, |
| 1687 &throw_termination_exception, | 1667 &throw_termination_exception, |
| 1688 &throw_out_of_memory_exception, | |
| 1689 false, | 1668 false, |
| 1690 false); | 1669 false); |
| 1691 | 1670 |
| 1692 // Do space-specific GC and retry runtime call. | 1671 // Do space-specific GC and retry runtime call. |
| 1693 GenerateCore(masm, | 1672 GenerateCore(masm, |
| 1694 &throw_normal_exception, | 1673 &throw_normal_exception, |
| 1695 &throw_termination_exception, | 1674 &throw_termination_exception, |
| 1696 &throw_out_of_memory_exception, | |
| 1697 true, | 1675 true, |
| 1698 false); | 1676 false); |
| 1699 | 1677 |
| 1700 // Do full GC and retry runtime call one final time. | 1678 // Do full GC and retry runtime call one final time. |
| 1701 Failure* failure = Failure::InternalError(); | 1679 Failure* failure = Failure::InternalError(); |
| 1702 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); | 1680 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); |
| 1703 GenerateCore(masm, | 1681 GenerateCore(masm, |
| 1704 &throw_normal_exception, | 1682 &throw_normal_exception, |
| 1705 &throw_termination_exception, | 1683 &throw_termination_exception, |
| 1706 &throw_out_of_memory_exception, | |
| 1707 true, | 1684 true, |
| 1708 true); | 1685 true); |
| 1709 | 1686 |
| 1710 __ bind(&throw_out_of_memory_exception); | |
| 1711 // Set external caught exception to false. | |
| 1712 Isolate* isolate = masm->isolate(); | |
| 1713 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, | |
| 1714 isolate); | |
| 1715 __ mov(r0, Operand(false, RelocInfo::NONE32)); | |
| 1716 __ mov(r2, Operand(external_caught)); | |
| 1717 __ str(r0, MemOperand(r2)); | |
| 1718 | |
| 1719 // Set pending exception and r0 to out of memory exception. | |
| 1720 Label already_have_failure; | |
| 1721 JumpIfOOM(masm, r0, ip, &already_have_failure); | |
| 1722 Failure* out_of_memory = Failure::OutOfMemoryException(0x1); | |
| 1723 __ mov(r0, Operand(reinterpret_cast<int32_t>(out_of_memory))); | |
| 1724 __ bind(&already_have_failure); | |
| 1725 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | |
| 1726 isolate))); | |
| 1727 __ str(r0, MemOperand(r2)); | |
| 1728 // Fall through to the next label. | |
| 1729 | |
| 1730 __ bind(&throw_termination_exception); | 1687 __ bind(&throw_termination_exception); |
| 1731 __ ThrowUncatchable(r0); | 1688 __ ThrowUncatchable(r0); |
| 1732 | 1689 |
| 1733 __ bind(&throw_normal_exception); | 1690 __ bind(&throw_normal_exception); |
| 1734 __ Throw(r0); | 1691 __ Throw(r0); |
| 1735 } | 1692 } |
| 1736 | 1693 |
| 1737 | 1694 |
| 1738 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { | 1695 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { |
| 1739 // r0: code entry | 1696 // r0: code entry |
| (...skipping 3755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5495 MemOperand(fp, 6 * kPointerSize), | 5452 MemOperand(fp, 6 * kPointerSize), |
| 5496 NULL); | 5453 NULL); |
| 5497 } | 5454 } |
| 5498 | 5455 |
| 5499 | 5456 |
| 5500 #undef __ | 5457 #undef __ |
| 5501 | 5458 |
| 5502 } } // namespace v8::internal | 5459 } } // namespace v8::internal |
| 5503 | 5460 |
| 5504 #endif // V8_TARGET_ARCH_ARM | 5461 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |