| 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 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 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 __ JumpToJSEntry(ip); | 1750 __ JumpToJSEntry(ip); |
| 1751 | 1751 |
| 1752 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1752 // Compatible receiver check failed: throw an Illegal Invocation exception. |
| 1753 __ bind(&receiver_check_failed); | 1753 __ bind(&receiver_check_failed); |
| 1754 // Drop the arguments (including the receiver); | 1754 // Drop the arguments (including the receiver); |
| 1755 __ AddP(r1, r1, Operand(kPointerSize)); | 1755 __ AddP(r1, r1, Operand(kPointerSize)); |
| 1756 __ AddP(sp, sp, r1); | 1756 __ AddP(sp, sp, r1); |
| 1757 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); | 1757 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1760 static void Generate_OnStackReplacementHelper(MacroAssembler* masm, |
| 1761 bool has_handler_frame) { |
| 1761 // Lookup the function in the JavaScript frame. | 1762 // Lookup the function in the JavaScript frame. |
| 1762 __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1763 if (has_handler_frame) { |
| 1764 __ LoadP(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1765 __ LoadP(r2, MemOperand(r2, JavaScriptFrameConstants::kFunctionOffset)); |
| 1766 } else { |
| 1767 __ LoadP(r2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1768 } |
| 1769 |
| 1763 { | 1770 { |
| 1764 FrameScope scope(masm, StackFrame::INTERNAL); | 1771 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1765 // Pass function as argument. | 1772 // Pass function as argument. |
| 1766 __ push(r2); | 1773 __ push(r2); |
| 1767 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1774 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
| 1768 } | 1775 } |
| 1769 | 1776 |
| 1770 // If the code object is null, just return to the unoptimized code. | 1777 // If the code object is null, just return to the caller. |
| 1771 Label skip; | 1778 Label skip; |
| 1772 __ CmpSmiLiteral(r2, Smi::FromInt(0), r0); | 1779 __ CmpSmiLiteral(r2, Smi::FromInt(0), r0); |
| 1773 __ bne(&skip); | 1780 __ bne(&skip); |
| 1774 __ Ret(); | 1781 __ Ret(); |
| 1775 | 1782 |
| 1776 __ bind(&skip); | 1783 __ bind(&skip); |
| 1777 | 1784 |
| 1785 // Drop any potential handler frame that is be sitting on top of the actual |
| 1786 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1787 if (has_handler_frame) { |
| 1788 __ LeaveFrame(StackFrame::STUB); |
| 1789 } |
| 1790 |
| 1778 // Load deoptimization data from the code object. | 1791 // Load deoptimization data from the code object. |
| 1779 // <deopt_data> = <code>[#deoptimization_data_offset] | 1792 // <deopt_data> = <code>[#deoptimization_data_offset] |
| 1780 __ LoadP(r3, FieldMemOperand(r2, Code::kDeoptimizationDataOffset)); | 1793 __ LoadP(r3, FieldMemOperand(r2, Code::kDeoptimizationDataOffset)); |
| 1781 | 1794 |
| 1782 // Load the OSR entrypoint offset from the deoptimization data. | 1795 // Load the OSR entrypoint offset from the deoptimization data. |
| 1783 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] | 1796 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] |
| 1784 __ LoadP( | 1797 __ LoadP( |
| 1785 r3, FieldMemOperand(r3, FixedArray::OffsetOfElementAt( | 1798 r3, FieldMemOperand(r3, FixedArray::OffsetOfElementAt( |
| 1786 DeoptimizationInputData::kOsrPcOffsetIndex))); | 1799 DeoptimizationInputData::kOsrPcOffsetIndex))); |
| 1787 __ SmiUntag(r3); | 1800 __ SmiUntag(r3); |
| 1788 | 1801 |
| 1789 // Compute the target address = code_obj + header_size + osr_offset | 1802 // Compute the target address = code_obj + header_size + osr_offset |
| 1790 // <entry_addr> = <code_obj> + #header_size + <osr_offset> | 1803 // <entry_addr> = <code_obj> + #header_size + <osr_offset> |
| 1791 __ AddP(r2, r3); | 1804 __ AddP(r2, r3); |
| 1792 __ AddP(r0, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1805 __ AddP(r0, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1793 __ LoadRR(r14, r0); | 1806 __ LoadRR(r14, r0); |
| 1794 | 1807 |
| 1795 // And "return" to the OSR entry point of the function. | 1808 // And "return" to the OSR entry point of the function. |
| 1796 __ Ret(); | 1809 __ Ret(); |
| 1797 } | 1810 } |
| 1798 | 1811 |
| 1812 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1813 Generate_OnStackReplacementHelper(masm, false); |
| 1814 } |
| 1815 |
| 1816 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1817 Generate_OnStackReplacementHelper(masm, true); |
| 1818 } |
| 1819 |
| 1799 // static | 1820 // static |
| 1800 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | 1821 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
| 1801 int field_index) { | 1822 int field_index) { |
| 1802 // ----------- S t a t e ------------- | 1823 // ----------- S t a t e ------------- |
| 1803 // -- r2 : number of arguments | 1824 // -- r2 : number of arguments |
| 1804 // -- r3 : function | 1825 // -- r3 : function |
| 1805 // -- cp : context | 1826 // -- cp : context |
| 1806 | 1827 |
| 1807 // -- lr : return address | 1828 // -- lr : return address |
| 1808 // -- sp[0] : receiver | 1829 // -- sp[0] : receiver |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2997 __ bkpt(0); | 3018 __ bkpt(0); |
| 2998 } | 3019 } |
| 2999 } | 3020 } |
| 3000 | 3021 |
| 3001 #undef __ | 3022 #undef __ |
| 3002 | 3023 |
| 3003 } // namespace internal | 3024 } // namespace internal |
| 3004 } // namespace v8 | 3025 } // namespace v8 |
| 3005 | 3026 |
| 3006 #endif // V8_TARGET_ARCH_S390 | 3027 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |