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

Side by Side Diff: src/builtins/arm/builtins-arm.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_ARM 5 #if V8_TARGET_ARCH_ARM
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(r4); 1716 __ Jump(r4);
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 __ add(r0, r0, Operand(1)); 1721 __ add(r0, r0, Operand(1));
1722 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2)); 1722 __ add(sp, sp, Operand(r0, LSL, kPointerSizeLog2));
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 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1729 if (has_handler_frame) {
1730 __ ldr(r0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
1731 __ ldr(r0, MemOperand(r0, JavaScriptFrameConstants::kFunctionOffset));
1732 } else {
1733 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1734 }
1735
1729 { 1736 {
1730 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1737 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1731 // Pass function as argument. 1738 // Pass function as argument.
1732 __ push(r0); 1739 __ push(r0);
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 Label skip; 1744 Label skip;
1738 __ cmp(r0, Operand(Smi::FromInt(0))); 1745 __ cmp(r0, Operand(Smi::FromInt(0)));
1739 __ b(ne, &skip); 1746 __ b(ne, &skip);
1740 __ Ret(); 1747 __ Ret();
1741 1748
1742 __ bind(&skip); 1749 __ bind(&skip);
1743 1750
1751 // Drop any potential handler frame that is be sitting on top of the actual
1752 // JavaScript frame. This is the case then OSR is triggered from bytecode.
1753 if (has_handler_frame) {
1754 __ LeaveFrame(StackFrame::STUB);
1755 }
1756
1744 // Load deoptimization data from the code object. 1757 // Load deoptimization data from the code object.
1745 // <deopt_data> = <code>[#deoptimization_data_offset] 1758 // <deopt_data> = <code>[#deoptimization_data_offset]
1746 __ ldr(r1, FieldMemOperand(r0, Code::kDeoptimizationDataOffset)); 1759 __ ldr(r1, FieldMemOperand(r0, Code::kDeoptimizationDataOffset));
1747 1760
1748 { 1761 {
1749 ConstantPoolUnavailableScope constant_pool_unavailable(masm); 1762 ConstantPoolUnavailableScope constant_pool_unavailable(masm);
1750 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start 1763 __ add(r0, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start
1751 1764
1752 if (FLAG_enable_embedded_constant_pool) { 1765 if (FLAG_enable_embedded_constant_pool) {
1753 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r0); 1766 __ LoadConstantPoolPointerRegisterFromCodeTargetAddress(r0);
1754 } 1767 }
1755 1768
1756 // Load the OSR entrypoint offset from the deoptimization data. 1769 // Load the OSR entrypoint offset from the deoptimization data.
1757 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset] 1770 // <osr_offset> = <deopt_data>[#header_size + #osr_pc_offset]
1758 __ ldr(r1, FieldMemOperand( 1771 __ ldr(r1, FieldMemOperand(
1759 r1, FixedArray::OffsetOfElementAt( 1772 r1, FixedArray::OffsetOfElementAt(
1760 DeoptimizationInputData::kOsrPcOffsetIndex))); 1773 DeoptimizationInputData::kOsrPcOffsetIndex)));
1761 1774
1762 // Compute the target address = code start + osr_offset 1775 // Compute the target address = code start + osr_offset
1763 __ add(lr, r0, Operand::SmiUntag(r1)); 1776 __ add(lr, r0, Operand::SmiUntag(r1));
1764 1777
1765 // And "return" to the OSR entry point of the function. 1778 // And "return" to the OSR entry point of the function.
1766 __ Ret(); 1779 __ Ret();
1767 } 1780 }
1768 } 1781 }
1769 1782
1783 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1784 Generate_OnStackReplacementHelper(masm, false);
1785 }
1786
1787 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
1788 Generate_OnStackReplacementHelper(masm, true);
1789 }
1790
1770 // static 1791 // static
1771 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, 1792 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
1772 int field_index) { 1793 int field_index) {
1773 // ----------- S t a t e ------------- 1794 // ----------- S t a t e -------------
1774 // -- r0 : number of arguments 1795 // -- r0 : number of arguments
1775 // -- r1 : function 1796 // -- r1 : function
1776 // -- cp : context 1797 // -- cp : context
1777 // -- lr : return address 1798 // -- lr : return address
1778 // -- sp[0] : receiver 1799 // -- sp[0] : receiver
1779 // ----------------------------------- 1800 // -----------------------------------
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 __ bkpt(0); 2919 __ bkpt(0);
2899 } 2920 }
2900 } 2921 }
2901 2922
2902 #undef __ 2923 #undef __
2903 2924
2904 } // namespace internal 2925 } // namespace internal
2905 } // namespace v8 2926 } // namespace v8
2906 2927
2907 #endif // V8_TARGET_ARCH_ARM 2928 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/builtins/arm64/builtins-arm64.cc » ('j') | src/interpreter/bytecode-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698