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

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

Issue 1837513002: [es6] Add a flag to the Isolate that defines whether ES2015 tail call elimination is enabled or not. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: New changes Created 4 years, 9 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
« no previous file with comments | « src/external-reference-table.cc ('k') | src/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 // | f()'s receiver arg 1879 // | f()'s receiver arg
1880 // | f()'s caller pc <- sp 1880 // | f()'s caller pc <- sp
1881 // ---------------------- 1881 // ----------------------
1882 // 1882 //
1883 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, 1883 void PrepareForTailCall(MacroAssembler* masm, Register args_reg,
1884 Register scratch1, Register scratch2, 1884 Register scratch1, Register scratch2,
1885 Register scratch3) { 1885 Register scratch3) {
1886 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); 1886 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3));
1887 Comment cmnt(masm, "[ PrepareForTailCall"); 1887 Comment cmnt(masm, "[ PrepareForTailCall");
1888 1888
1889 // Prepare for tail call only if ES2015 tail call elimination is enabled.
1890 Label done;
1891 ExternalReference is_tail_call_elimination_enabled =
1892 ExternalReference::is_tail_call_elimination_enabled_address(
1893 masm->isolate());
1894 __ movzx_b(scratch1,
1895 Operand::StaticVariable(is_tail_call_elimination_enabled));
1896 __ cmp(scratch1, Immediate(0));
1897 __ j(equal, &done, Label::kNear);
1898
1889 // Drop possible interpreter handler/stub frame. 1899 // Drop possible interpreter handler/stub frame.
1890 { 1900 {
1891 Label no_interpreter_frame; 1901 Label no_interpreter_frame;
1892 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset), 1902 __ cmp(Operand(ebp, CommonFrameConstants::kContextOrFrameTypeOffset),
1893 Immediate(Smi::FromInt(StackFrame::STUB))); 1903 Immediate(Smi::FromInt(StackFrame::STUB)));
1894 __ j(not_equal, &no_interpreter_frame, Label::kNear); 1904 __ j(not_equal, &no_interpreter_frame, Label::kNear);
1895 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 1905 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
1896 __ bind(&no_interpreter_frame); 1906 __ bind(&no_interpreter_frame);
1897 } 1907 }
1898 1908
(...skipping 20 matching lines...) Expand all
1919 __ mov( 1929 __ mov(
1920 caller_args_count_reg, 1930 caller_args_count_reg,
1921 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset)); 1931 FieldOperand(scratch1, SharedFunctionInfo::kFormalParameterCountOffset));
1922 __ SmiUntag(caller_args_count_reg); 1932 __ SmiUntag(caller_args_count_reg);
1923 1933
1924 __ bind(&formal_parameter_count_loaded); 1934 __ bind(&formal_parameter_count_loaded);
1925 1935
1926 ParameterCount callee_args_count(args_reg); 1936 ParameterCount callee_args_count(args_reg);
1927 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, 1937 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
1928 scratch3, ReturnAddressState::kOnStack, 0); 1938 scratch3, ReturnAddressState::kOnStack, 0);
1939 __ bind(&done);
1929 } 1940 }
1930 } // namespace 1941 } // namespace
1931 1942
1932 // static 1943 // static
1933 void Builtins::Generate_CallFunction(MacroAssembler* masm, 1944 void Builtins::Generate_CallFunction(MacroAssembler* masm,
1934 ConvertReceiverMode mode, 1945 ConvertReceiverMode mode,
1935 TailCallMode tail_call_mode) { 1946 TailCallMode tail_call_mode) {
1936 // ----------- S t a t e ------------- 1947 // ----------- S t a t e -------------
1937 // -- eax : the number of arguments (not including the receiver) 1948 // -- eax : the number of arguments (not including the receiver)
1938 // -- edi : the function to call (checked to be a JSFunction) 1949 // -- edi : the function to call (checked to be a JSFunction)
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 // And "return" to the OSR entry point of the function. 2611 // And "return" to the OSR entry point of the function.
2601 __ ret(0); 2612 __ ret(0);
2602 } 2613 }
2603 2614
2604 2615
2605 #undef __ 2616 #undef __
2606 } // namespace internal 2617 } // namespace internal
2607 } // namespace v8 2618 } // namespace v8
2608 2619
2609 #endif // V8_TARGET_ARCH_IA32 2620 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/external-reference-table.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698