OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 __ Jump(x4); | 1728 __ Jump(x4); |
1729 | 1729 |
1730 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1730 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1731 __ Bind(&receiver_check_failed); | 1731 __ Bind(&receiver_check_failed); |
1732 // Drop the arguments (including the receiver) | 1732 // Drop the arguments (including the receiver) |
1733 __ add(x0, x0, Operand(1)); | 1733 __ add(x0, x0, Operand(1)); |
1734 __ Drop(x0); | 1734 __ Drop(x0); |
1735 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); | 1735 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); |
1736 } | 1736 } |
1737 | 1737 |
1738 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1738 static void Generate_OnStackReplacementHelper(MacroAssembler* masm, |
| 1739 bool has_handler_frame) { |
1739 // Lookup the function in the JavaScript frame. | 1740 // Lookup the function in the JavaScript frame. |
1740 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1741 if (has_handler_frame) { |
| 1742 __ Ldr(x0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1743 __ Ldr(x0, MemOperand(x0, JavaScriptFrameConstants::kFunctionOffset)); |
| 1744 } else { |
| 1745 __ Ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1746 } |
| 1747 |
1741 { | 1748 { |
1742 FrameScope scope(masm, StackFrame::INTERNAL); | 1749 FrameScope scope(masm, StackFrame::INTERNAL); |
1743 // Pass function as argument. | 1750 // Pass function as argument. |
1744 __ Push(x0); | 1751 __ Push(x0); |
1745 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1752 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
1746 } | 1753 } |
1747 | 1754 |
1748 // If the code object is null, just return to the unoptimized code. | 1755 // If the code object is null, just return to the caller. |
1749 Label skip; | 1756 Label skip; |
1750 __ CompareAndBranch(x0, Smi::FromInt(0), ne, &skip); | 1757 __ CompareAndBranch(x0, Smi::FromInt(0), ne, &skip); |
1751 __ Ret(); | 1758 __ Ret(); |
1752 | 1759 |
1753 __ Bind(&skip); | 1760 __ Bind(&skip); |
1754 | 1761 |
| 1762 // Drop any potential handler frame that is be sitting on top of the actual |
| 1763 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1764 if (has_handler_frame) { |
| 1765 __ LeaveFrame(StackFrame::STUB); |
| 1766 } |
| 1767 |
1755 // Load deoptimization data from the code object. | 1768 // Load deoptimization data from the code object. |
1756 // <deopt_data> = <code>[#deoptimization_data_offset] | 1769 // <deopt_data> = <code>[#deoptimization_data_offset] |
1757 __ Ldr(x1, MemOperand(x0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 1770 __ Ldr(x1, MemOperand(x0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
1758 | 1771 |
1759 // Load the OSR entrypoint offset from the deoptimization data. | 1772 // Load the OSR entrypoint offset from the deoptimization data. |
1760 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] | 1773 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] |
1761 __ Ldrsw(w1, UntagSmiFieldMemOperand( | 1774 __ Ldrsw(w1, UntagSmiFieldMemOperand( |
1762 x1, FixedArray::OffsetOfElementAt( | 1775 x1, FixedArray::OffsetOfElementAt( |
1763 DeoptimizationInputData::kOsrPcOffsetIndex))); | 1776 DeoptimizationInputData::kOsrPcOffsetIndex))); |
1764 | 1777 |
1765 // Compute the target address = code_obj + header_size + osr_offset | 1778 // Compute the target address = code_obj + header_size + osr_offset |
1766 // <entry_addr> = <code_obj> + #header_size + <osr_offset> | 1779 // <entry_addr> = <code_obj> + #header_size + <osr_offset> |
1767 __ Add(x0, x0, x1); | 1780 __ Add(x0, x0, x1); |
1768 __ Add(lr, x0, Code::kHeaderSize - kHeapObjectTag); | 1781 __ Add(lr, x0, Code::kHeaderSize - kHeapObjectTag); |
1769 | 1782 |
1770 // And "return" to the OSR entry point of the function. | 1783 // And "return" to the OSR entry point of the function. |
1771 __ Ret(); | 1784 __ Ret(); |
1772 } | 1785 } |
1773 | 1786 |
| 1787 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1788 Generate_OnStackReplacementHelper(masm, false); |
| 1789 } |
| 1790 |
| 1791 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1792 Generate_OnStackReplacementHelper(masm, true); |
| 1793 } |
| 1794 |
1774 // static | 1795 // static |
1775 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | 1796 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
1776 int field_index) { | 1797 int field_index) { |
1777 // ----------- S t a t e ------------- | 1798 // ----------- S t a t e ------------- |
1778 // -- x0 : number of arguments | 1799 // -- x0 : number of arguments |
1779 // -- x1 : function | 1800 // -- x1 : function |
1780 // -- cp : context | 1801 // -- cp : context |
1781 // -- lr : return address | 1802 // -- lr : return address |
1782 // -- jssp[0] : receiver | 1803 // -- jssp[0] : receiver |
1783 // ----------------------------------- | 1804 // ----------------------------------- |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 __ Unreachable(); | 3033 __ Unreachable(); |
3013 } | 3034 } |
3014 } | 3035 } |
3015 | 3036 |
3016 #undef __ | 3037 #undef __ |
3017 | 3038 |
3018 } // namespace internal | 3039 } // namespace internal |
3019 } // namespace v8 | 3040 } // namespace v8 |
3020 | 3041 |
3021 #endif // V8_TARGET_ARCH_ARM | 3042 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |