Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: src/builtins/mips/builtins-mips.cc

Issue 2172233002: [interpreter] Add explicit OSR polling bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-osr-1
Patch Set: Minor cleanups. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 __ Jump(t2); 1716 __ Jump(t2);
1717 1717
1718 // Compatible receiver check failed: throw an Illegal Invocation exception. 1718 // Compatible receiver check failed: throw an Illegal Invocation exception.
1719 __ bind(&receiver_check_failed); 1719 __ bind(&receiver_check_failed);
1720 // Drop the arguments (including the receiver); 1720 // Drop the arguments (including the receiver);
1721 __ Addu(t8, t8, Operand(kPointerSize)); 1721 __ Addu(t8, t8, Operand(kPointerSize));
1722 __ addu(sp, t8, zero_reg); 1722 __ addu(sp, t8, zero_reg);
1723 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); 1723 __ TailCallRuntime(Runtime::kThrowIllegalInvocation);
1724 } 1724 }
1725 1725
1726 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 1726 static void Generate_OnStackReplacementHelper(MacroAssembler* masm,
1727 bool has_handler_frame) {
1727 // Lookup the function in the JavaScript frame. 1728 // Lookup the function in the JavaScript frame.
1728 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1729 if (has_handler_frame) {
1730 __ lw(a0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1731 __ lw(a0, MemOperand(a0, JavaScriptFrameConstants::kFunctionOffset));
1732 } else {
1733 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1734 }
1735
1729 { 1736 {
1730 FrameScope scope(masm, StackFrame::INTERNAL); 1737 FrameScope scope(masm, StackFrame::INTERNAL);
1731 // Pass function as argument. 1738 // Pass function as argument.
1732 __ push(a0); 1739 __ push(a0);
1733 __ CallRuntime(Runtime::kCompileForOnStackReplacement); 1740 __ CallRuntime(Runtime::kCompileForOnStackReplacement);
1734 } 1741 }
1735 1742
1736 // If the code object is null, just return to the unoptimized code. 1743 // If the code object is null, just return to the caller.
1737 __ Ret(eq, v0, Operand(Smi::FromInt(0))); 1744 __ Ret(eq, v0, Operand(Smi::FromInt(0)));
1738 1745
1746 // Drop any potential handler frame that is be sitting on top of the actual
1747 // JavaScript frame. This is the case then OSR is triggered from bytecode.
1748 if (has_handler_frame) {
1749 __ LeaveFrame(StackFrame::STUB);
1750 }
1751
1739 // Load deoptimization data from the code object. 1752 // Load deoptimization data from the code object.
1740 // <deopt_data> = <code>[#deoptimization_data_offset] 1753 // <deopt_data> = <code>[#deoptimization_data_offset]
1741 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag)); 1754 __ lw(a1, MemOperand(v0, Code::kDeoptimizationDataOffset - kHeapObjectTag));
1742 1755
1743 // Load the OSR entrypoint offset from the deoptimization data. 1756 // Load the OSR entrypoint offset from the deoptimization data.
1744 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] 1757 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
1745 __ lw(a1, MemOperand(a1, FixedArray::OffsetOfElementAt( 1758 __ lw(a1, MemOperand(a1, FixedArray::OffsetOfElementAt(
1746 DeoptimizationInputData::kOsrPcOffsetIndex) - 1759 DeoptimizationInputData::kOsrPcOffsetIndex) -
1747 kHeapObjectTag)); 1760 kHeapObjectTag));
1748 __ SmiUntag(a1); 1761 __ SmiUntag(a1);
1749 1762
1750 // Compute the target address = code_obj + header_size + osr_offset 1763 // Compute the target address = code_obj + header_size + osr_offset
1751 // <entry_addr> = <code_obj> + #header_size + <osr_offset> 1764 // <entry_addr> = <code_obj> + #header_size + <osr_offset>
1752 __ addu(v0, v0, a1); 1765 __ addu(v0, v0, a1);
1753 __ addiu(ra, v0, Code::kHeaderSize - kHeapObjectTag); 1766 __ addiu(ra, v0, Code::kHeaderSize - kHeapObjectTag);
1754 1767
1755 // And "return" to the OSR entry point of the function. 1768 // And "return" to the OSR entry point of the function.
1756 __ Ret(); 1769 __ Ret();
1757 } 1770 }
1758 1771
1772 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1773 Generate_OnStackReplacementHelper(masm, false);
1774 }
1775
1776 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
1777 Generate_OnStackReplacementHelper(masm, true);
1778 }
1779
1759 // static 1780 // static
1760 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, 1781 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
1761 int field_index) { 1782 int field_index) {
1762 // ----------- S t a t e ------------- 1783 // ----------- S t a t e -------------
1763 // -- a0 : number of arguments 1784 // -- a0 : number of arguments
1764 // -- a1 : function 1785 // -- a1 : function
1765 // -- cp : context 1786 // -- cp : context
1766 // -- sp[0] : receiver 1787 // -- sp[0] : receiver
1767 // ----------------------------------- 1788 // -----------------------------------
1768 1789
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2980 __ break_(0xCC); 3001 __ break_(0xCC);
2981 } 3002 }
2982 } 3003 }
2983 3004
2984 #undef __ 3005 #undef __
2985 3006
2986 } // namespace internal 3007 } // namespace internal
2987 } // namespace v8 3008 } // namespace v8
2988 3009
2989 #endif // V8_TARGET_ARCH_MIPS 3010 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698