OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 __ Jump(t2); | 1711 __ Jump(t2); |
1712 | 1712 |
1713 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1713 // Compatible receiver check failed: throw an Illegal Invocation exception. |
1714 __ bind(&receiver_check_failed); | 1714 __ bind(&receiver_check_failed); |
1715 // Drop the arguments (including the receiver); | 1715 // Drop the arguments (including the receiver); |
1716 __ Daddu(t8, t8, Operand(kPointerSize)); | 1716 __ Daddu(t8, t8, Operand(kPointerSize)); |
1717 __ daddu(sp, t8, zero_reg); | 1717 __ daddu(sp, t8, zero_reg); |
1718 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); | 1718 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); |
1719 } | 1719 } |
1720 | 1720 |
1721 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1721 static void Generate_OnStackReplacementHelper(MacroAssembler* masm, |
| 1722 bool has_handler_frame) { |
1722 // Lookup the function in the JavaScript frame. | 1723 // Lookup the function in the JavaScript frame. |
1723 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1724 if (has_handler_frame) { |
| 1725 __ ld(a0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 1726 __ ld(a0, MemOperand(a0, JavaScriptFrameConstants::kFunctionOffset)); |
| 1727 } else { |
| 1728 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1729 } |
| 1730 |
1724 { | 1731 { |
1725 FrameScope scope(masm, StackFrame::INTERNAL); | 1732 FrameScope scope(masm, StackFrame::INTERNAL); |
1726 // Pass function as argument. | 1733 // Pass function as argument. |
1727 __ push(a0); | 1734 __ push(a0); |
1728 __ CallRuntime(Runtime::kCompileForOnStackReplacement); | 1735 __ CallRuntime(Runtime::kCompileForOnStackReplacement); |
1729 } | 1736 } |
1730 | 1737 |
1731 // If the code object is null, just return to the unoptimized code. | 1738 // If the code object is null, just return to the caller. |
1732 __ Ret(eq, v0, Operand(Smi::FromInt(0))); | 1739 __ Ret(eq, v0, Operand(Smi::FromInt(0))); |
1733 | 1740 |
| 1741 // Drop any potential handler frame that is be sitting on top of the actual |
| 1742 // JavaScript frame. This is the case then OSR is triggered from bytecode. |
| 1743 if (has_handler_frame) { |
| 1744 __ LeaveFrame(StackFrame::STUB); |
| 1745 } |
| 1746 |
1734 // Load deoptimization data from the code object. | 1747 // Load deoptimization data from the code object. |
1735 // <deopt_data> = <code>[#deoptimization_data_offset] | 1748 // <deopt_data> = <code>[#deoptimization_data_offset] |
1736 __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); | 1749 __ ld(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); |
1737 | 1750 |
1738 // Load the OSR entrypoint offset from the deoptimization data. | 1751 // Load the OSR entrypoint offset from the deoptimization data. |
1739 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] | 1752 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] |
1740 __ ld(a1, MemOperand(a1, FixedArray::OffsetOfElementAt( | 1753 __ ld(a1, MemOperand(a1, FixedArray::OffsetOfElementAt( |
1741 DeoptimizationInputData::kOsrPcOffsetIndex) - | 1754 DeoptimizationInputData::kOsrPcOffsetIndex) - |
1742 kHeapObjectTag)); | 1755 kHeapObjectTag)); |
1743 __ SmiUntag(a1); | 1756 __ SmiUntag(a1); |
1744 | 1757 |
1745 // Compute the target address = code_obj + header_size + osr_offset | 1758 // Compute the target address = code_obj + header_size + osr_offset |
1746 // <entry_addr> = <code_obj> + #header_size + <osr_offset> | 1759 // <entry_addr> = <code_obj> + #header_size + <osr_offset> |
1747 __ daddu(v0, v0, a1); | 1760 __ daddu(v0, v0, a1); |
1748 __ daddiu(ra, v0, Code::kHeaderSize - kHeapObjectTag); | 1761 __ daddiu(ra, v0, Code::kHeaderSize - kHeapObjectTag); |
1749 | 1762 |
1750 // And "return" to the OSR entry point of the function. | 1763 // And "return" to the OSR entry point of the function. |
1751 __ Ret(); | 1764 __ Ret(); |
1752 } | 1765 } |
1753 | 1766 |
| 1767 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1768 Generate_OnStackReplacementHelper(masm, false); |
| 1769 } |
| 1770 |
| 1771 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1772 Generate_OnStackReplacementHelper(masm, true); |
| 1773 } |
| 1774 |
1754 // static | 1775 // static |
1755 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | 1776 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, |
1756 int field_index) { | 1777 int field_index) { |
1757 // ----------- S t a t e ------------- | 1778 // ----------- S t a t e ------------- |
1758 // -- a0 : number of arguments | 1779 // -- a0 : number of arguments |
1759 // -- a1 : function | 1780 // -- a1 : function |
1760 // -- cp : context | 1781 // -- cp : context |
1761 // -- sp[0] : receiver | 1782 // -- sp[0] : receiver |
1762 // ----------------------------------- | 1783 // ----------------------------------- |
1763 | 1784 |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 __ break_(0xCC); | 2997 __ break_(0xCC); |
2977 } | 2998 } |
2978 } | 2999 } |
2979 | 3000 |
2980 #undef __ | 3001 #undef __ |
2981 | 3002 |
2982 } // namespace internal | 3003 } // namespace internal |
2983 } // namespace v8 | 3004 } // namespace v8 |
2984 | 3005 |
2985 #endif // V8_TARGET_ARCH_MIPS64 | 3006 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |