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 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1739 __ JumpToJSEntry(ip); | 1739 __ JumpToJSEntry(ip); |
1740 | 1740 |
1741 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1741 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1742 __ bind(&receiver_check_failed); | 1742 __ bind(&receiver_check_failed); |
1743 // Drop the arguments (including the receiver); | 1743 // Drop the arguments (including the receiver); |
1744 __ addi(r11, r11, Operand(kPointerSize)); | 1744 __ addi(r11, r11, Operand(kPointerSize)); |
1745 __ add(sp, sp, r11); | 1745 __ add(sp, sp, r11); |
1746 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); | 1746 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); |
1747 } | 1747 } |
1748 | 1748 |
1749 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1749 static void Generate_OnStackReplacementHelper(MacroAssembler* masm, |
| 1750 bool has_handler_frame) { |
1750 // Lookup the function in the JavaScript frame. | 1751 // Lookup the function in the JavaScript frame. |
1751 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1752 if (has_handler_frame) { |
| 1753 __ LoadP(r3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1754 __ LoadP(r3, MemOperand(r3, JavaScriptFrameConstants::kFunctionOffset)); |
| 1755 } else { |
| 1756 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1757 } |
| 1758 |
1752 { | 1759 { |
1753 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1760 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1754 // Pass function as argument. | 1761 // Pass function as argument. |
1755 __ push(r3); | 1762 __ push(r3); |
1756 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1763 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
1757 } | 1764 } |
1758 | 1765 |
1759 // If the code object is null, just return to the unoptimized code. | 1766 // If the code object is null, just return to the caller. |
1760 Label skip; | 1767 Label skip; |
1761 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0); | 1768 __ CmpSmiLiteral(r3, Smi::FromInt(0), r0); |
1762 __ bne(&skip); | 1769 __ bne(&skip); |
1763 __ Ret(); | 1770 __ Ret(); |
1764 | 1771 |
1765 __ bind(&skip); | 1772 __ bind(&skip); |
1766 | 1773 |
| 1774 // Drop any potential handler frame that is be sitting on top of the actual |
| 1775 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1776 if (has_handler_frame) { |
| 1777 __ LeaveFrame(StackFrame::STUB); |
| 1778 } |
| 1779 |
1767 // Load deoptimization data from the code object. | 1780 // Load deoptimization data from the code object. |
1768 // <deopt_data> = <code>[#deoptimization_data_offset] | 1781 // <deopt_data> = <code>[#deoptimization_data_offset] |
1769 __ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); | 1782 __ LoadP(r4, FieldMemOperand(r3, Code::kDeoptimizationDataOffset)); |
1770 | 1783 |
1771 { | 1784 { |
1772 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | 1785 ConstantPoolUnavailableScope constant_pool_unavailable(masm); |
1773 __ addi(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start | 1786 __ addi(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start |
1774 | 1787 |
1775 if (FLAG_enable_embedded_constant_pool) { | 1788 if (FLAG_enable_embedded_constant_pool) { |
1776 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r3); | 1789 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r3); |
1777 } | 1790 } |
1778 | 1791 |
1779 // Load the OSR entrypoint offset from the deoptimization data. | 1792 // Load the OSR entrypoint offset from the deoptimization data. |
1780 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] | 1793 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] |
1781 __ LoadP(r4, FieldMemOperand( | 1794 __ LoadP(r4, FieldMemOperand( |
1782 r4, FixedArray::OffsetOfElementAt( | 1795 r4, FixedArray::OffsetOfElementAt( |
1783 DeoptimizationInputData::kOsrPcOffsetIndex))); | 1796 DeoptimizationInputData::kOsrPcOffsetIndex))); |
1784 __ SmiUntag(r4); | 1797 __ SmiUntag(r4); |
1785 | 1798 |
1786 // Compute the target address = code start + osr_offset | 1799 // Compute the target address = code start + osr_offset |
1787 __ add(r0, r3, r4); | 1800 __ add(r0, r3, r4); |
1788 | 1801 |
1789 // And "return" to the OSR entry point of the function. | 1802 // And "return" to the OSR entry point of the function. |
1790 __ mtlr(r0); | 1803 __ mtlr(r0); |
1791 __ blr(); | 1804 __ blr(); |
1792 } | 1805 } |
1793 } | 1806 } |
1794 | 1807 |
| 1808 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1809 Generate_OnStackReplacementHelper(masm, false); |
| 1810 } |
| 1811 |
| 1812 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1813 Generate_OnStackReplacementHelper(masm, true); |
| 1814 } |
| 1815 |
1795 // static | 1816 // static |
1796 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | 1817 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
1797 int field_index) { | 1818 int field_index) { |
1798 // ----------- S t a t e ------------- | 1819 // ----------- S t a t e ------------- |
1799 // -- r3 : number of arguments | 1820 // -- r3 : number of arguments |
1800 // -- r4 : function | 1821 // -- r4 : function |
1801 // -- cp : context | 1822 // -- cp : context |
1802 // -- lr : return address | 1823 // -- lr : return address |
1803 // -- sp[0] : receiver | 1824 // -- sp[0] : receiver |
1804 // ----------------------------------- | 1825 // ----------------------------------- |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 __ CallRuntime(Runtime::kThrowStackOverflow); | 3002 __ CallRuntime(Runtime::kThrowStackOverflow); |
2982 __ bkpt(0); | 3003 __ bkpt(0); |
2983 } | 3004 } |
2984 } | 3005 } |
2985 | 3006 |
2986 #undef __ | 3007 #undef __ |
2987 } // namespace internal | 3008 } // namespace internal |
2988 } // namespace v8 | 3009 } // namespace v8 |
2989 | 3010 |
2990 #endif // V8_TARGET_ARCH_PPC | 3011 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |