| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 // Restore cp otherwise. | 1622 // Restore cp otherwise. |
| 1623 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | 1623 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); |
| 1624 if (kDebug && FLAG_debug_code) __ mov(lr, Operand(pc)); | 1624 if (kDebug && FLAG_debug_code) __ mov(lr, Operand(pc)); |
| 1625 __ pop(pc); | 1625 __ pop(pc); |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 | 1628 |
| 1629 void CEntryStub::GenerateCore(MacroAssembler* masm, | 1629 void CEntryStub::GenerateCore(MacroAssembler* masm, |
| 1630 Label* throw_normal_exception, | 1630 Label* throw_normal_exception, |
| 1631 Label* throw_out_of_memory_exception, | 1631 Label* throw_out_of_memory_exception, |
| 1632 bool do_gc, | 1632 StackFrame::Type frame_type, |
| 1633 bool do_restore) { | 1633 bool do_gc) { |
| 1634 // r0: result parameter for PerformGC, if any | 1634 // r0: result parameter for PerformGC, if any |
| 1635 // r4: number of arguments including receiver (C callee-saved) | 1635 // r4: number of arguments including receiver (C callee-saved) |
| 1636 // r5: pointer to builtin function (C callee-saved) | 1636 // r5: pointer to builtin function (C callee-saved) |
| 1637 // r6: pointer to the first argument (C callee-saved) | 1637 // r6: pointer to the first argument (C callee-saved) |
| 1638 | 1638 |
| 1639 if (do_gc) { | 1639 if (do_gc) { |
| 1640 // Passing r0. | 1640 // Passing r0. |
| 1641 __ Call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); | 1641 __ Call(FUNCTION_ADDR(Runtime::PerformGC), RelocInfo::RUNTIME_ENTRY); |
| 1642 } | 1642 } |
| 1643 | 1643 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1664 // result is in r0 or r0:r1 - do not destroy these registers! | 1664 // result is in r0 or r0:r1 - do not destroy these registers! |
| 1665 | 1665 |
| 1666 // check for failure result | 1666 // check for failure result |
| 1667 Label failure_returned; | 1667 Label failure_returned; |
| 1668 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); | 1668 ASSERT(((kFailureTag + 1) & kFailureTagMask) == 0); |
| 1669 // Lower 2 bits of r2 are 0 iff r0 has failure tag. | 1669 // Lower 2 bits of r2 are 0 iff r0 has failure tag. |
| 1670 __ add(r2, r0, Operand(1)); | 1670 __ add(r2, r0, Operand(1)); |
| 1671 __ tst(r2, Operand(kFailureTagMask)); | 1671 __ tst(r2, Operand(kFailureTagMask)); |
| 1672 __ b(eq, &failure_returned); | 1672 __ b(eq, &failure_returned); |
| 1673 | 1673 |
| 1674 // Restore the memory copy of the registers by digging them out from | 1674 // Exit C frame and return. |
| 1675 // the stack. | |
| 1676 if (do_restore) { | |
| 1677 // Ok to clobber r2 and r3. | |
| 1678 const int kCallerSavedSize = kNumJSCallerSaved * kPointerSize; | |
| 1679 const int kOffset = ExitFrameConstants::kDebugMarkOffset - kCallerSavedSize; | |
| 1680 __ add(r3, fp, Operand(kOffset)); | |
| 1681 __ CopyRegistersFromStackToMemory(r3, r2, kJSCallerSaved); | |
| 1682 } | |
| 1683 | |
| 1684 // Exit C frame and return | |
| 1685 // r0:r1: result | 1675 // r0:r1: result |
| 1686 // sp: stack pointer | 1676 // sp: stack pointer |
| 1687 // fp: frame pointer | 1677 // fp: frame pointer |
| 1688 // pp: caller's parameter pointer pp (restored as C callee-saved) | 1678 // pp: caller's parameter pointer pp (restored as C callee-saved) |
| 1689 __ LeaveExitFrame(); | 1679 __ LeaveExitFrame(frame_type); |
| 1690 | 1680 |
| 1691 // check if we should retry or throw exception | 1681 // check if we should retry or throw exception |
| 1692 Label retry; | 1682 Label retry; |
| 1693 __ bind(&failure_returned); | 1683 __ bind(&failure_returned); |
| 1694 ASSERT(Failure::RETRY_AFTER_GC == 0); | 1684 ASSERT(Failure::RETRY_AFTER_GC == 0); |
| 1695 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); | 1685 __ tst(r0, Operand(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); |
| 1696 __ b(eq, &retry); | 1686 __ b(eq, &retry); |
| 1697 | 1687 |
| 1698 Label continue_exception; | 1688 Label continue_exception; |
| 1699 // If the returned failure is EXCEPTION then promote Top::pending_exception(). | 1689 // If the returned failure is EXCEPTION then promote Top::pending_exception(). |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 // this by performing a garbage collection and retrying the | 1724 // this by performing a garbage collection and retrying the |
| 1735 // builtin once. | 1725 // builtin once. |
| 1736 | 1726 |
| 1737 StackFrame::Type frame_type = is_debug_break | 1727 StackFrame::Type frame_type = is_debug_break |
| 1738 ? StackFrame::EXIT_DEBUG | 1728 ? StackFrame::EXIT_DEBUG |
| 1739 : StackFrame::EXIT; | 1729 : StackFrame::EXIT; |
| 1740 | 1730 |
| 1741 // Enter the exit frame that transitions from JavaScript to C++. | 1731 // Enter the exit frame that transitions from JavaScript to C++. |
| 1742 __ EnterExitFrame(frame_type); | 1732 __ EnterExitFrame(frame_type); |
| 1743 | 1733 |
| 1744 if (is_debug_break) { | 1734 // r4: number of arguments (C callee-saved) |
| 1745 // Save the state of all registers to the stack from the memory location. | 1735 // r5: pointer to builtin function (C callee-saved) |
| 1746 // Use sp as base to push. | 1736 // r6: pointer to first argument (C callee-saved) |
| 1747 __ CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); | |
| 1748 } | |
| 1749 | |
| 1750 // r4: number of arguments | |
| 1751 // r5: pointer to builtin function (C callee-saved) | |
| 1752 | |
| 1753 Label entry; | |
| 1754 __ bind(&entry); | |
| 1755 | 1737 |
| 1756 Label throw_out_of_memory_exception; | 1738 Label throw_out_of_memory_exception; |
| 1757 Label throw_normal_exception; | 1739 Label throw_normal_exception; |
| 1758 | 1740 |
| 1759 #ifdef DEBUG | 1741 #ifdef DEBUG |
| 1760 if (FLAG_gc_greedy) { | 1742 if (FLAG_gc_greedy) { |
| 1761 Failure* failure = Failure::RetryAfterGC(0, NEW_SPACE); | 1743 Failure* failure = Failure::RetryAfterGC(0, NEW_SPACE); |
| 1762 __ mov(r0, Operand(reinterpret_cast<intptr_t>(failure))); | 1744 __ mov(r0, Operand(reinterpret_cast<intptr_t>(failure))); |
| 1763 } | 1745 } |
| 1764 GenerateCore(masm, | 1746 GenerateCore(masm, |
| 1765 &throw_normal_exception, | 1747 &throw_normal_exception, |
| 1766 &throw_out_of_memory_exception, | 1748 &throw_out_of_memory_exception, |
| 1767 FLAG_gc_greedy, | 1749 frame_type, |
| 1768 is_debug_break); | 1750 FLAG_gc_greedy); |
| 1769 #else | 1751 #else |
| 1770 GenerateCore(masm, | 1752 GenerateCore(masm, |
| 1771 &throw_normal_exception, | 1753 &throw_normal_exception, |
| 1772 &throw_out_of_memory_exception, | 1754 &throw_out_of_memory_exception, |
| 1773 false, | 1755 frame_type, |
| 1774 is_debug_break); | 1756 false); |
| 1775 #endif | 1757 #endif |
| 1776 GenerateCore(masm, | 1758 GenerateCore(masm, |
| 1777 &throw_normal_exception, | 1759 &throw_normal_exception, |
| 1778 &throw_out_of_memory_exception, | 1760 &throw_out_of_memory_exception, |
| 1779 true, | 1761 frame_type, |
| 1780 is_debug_break); | 1762 true); |
| 1781 | 1763 |
| 1782 __ bind(&throw_out_of_memory_exception); | 1764 __ bind(&throw_out_of_memory_exception); |
| 1783 GenerateThrowOutOfMemory(masm); | 1765 GenerateThrowOutOfMemory(masm); |
| 1784 // control flow for generated will not return. | 1766 // control flow for generated will not return. |
| 1785 | 1767 |
| 1786 __ bind(&throw_normal_exception); | 1768 __ bind(&throw_normal_exception); |
| 1787 GenerateThrowTOS(masm); | 1769 GenerateThrowTOS(masm); |
| 1788 } | 1770 } |
| 1789 | 1771 |
| 1790 | 1772 |
| (...skipping 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4549 bool is_eval) { | 4531 bool is_eval) { |
| 4550 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval); | 4532 Handle<Code> code = ArmCodeGenerator::MakeCode(fun, script, is_eval); |
| 4551 if (!code.is_null()) { | 4533 if (!code.is_null()) { |
| 4552 Counters::total_compiled_code_size.Increment(code->instruction_size()); | 4534 Counters::total_compiled_code_size.Increment(code->instruction_size()); |
| 4553 } | 4535 } |
| 4554 return code; | 4536 return code; |
| 4555 } | 4537 } |
| 4556 | 4538 |
| 4557 | 4539 |
| 4558 } } // namespace v8::internal | 4540 } } // namespace v8::internal |
| OLD | NEW |