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

Side by Side Diff: src/x64/builtins-x64.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, 8 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/s390/builtins-s390.cc ('k') | src/x87/builtins-x87.cc » ('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_X64 5 #if V8_TARGET_ARCH_X64
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 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 // | f()'s receiver arg 2045 // | f()'s receiver arg
2046 // | f()'s caller pc <- sp 2046 // | f()'s caller pc <- sp
2047 // ---------------------- 2047 // ----------------------
2048 // 2048 //
2049 void PrepareForTailCall(MacroAssembler* masm, Register args_reg, 2049 void PrepareForTailCall(MacroAssembler* masm, Register args_reg,
2050 Register scratch1, Register scratch2, 2050 Register scratch1, Register scratch2,
2051 Register scratch3) { 2051 Register scratch3) {
2052 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); 2052 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3));
2053 Comment cmnt(masm, "[ PrepareForTailCall"); 2053 Comment cmnt(masm, "[ PrepareForTailCall");
2054 2054
2055 // Prepare for tail call only if ES2015 tail call elimination is active.
2056 Label done;
2057 ExternalReference is_tail_call_elimination_enabled =
2058 ExternalReference::is_tail_call_elimination_enabled_address(
2059 masm->isolate());
2060 __ Move(kScratchRegister, is_tail_call_elimination_enabled);
2061 __ cmpb(Operand(kScratchRegister, 0), Immediate(0));
2062 __ j(equal, &done);
2063
2055 // Drop possible interpreter handler/stub frame. 2064 // Drop possible interpreter handler/stub frame.
2056 { 2065 {
2057 Label no_interpreter_frame; 2066 Label no_interpreter_frame;
2058 __ Cmp(Operand(rbp, CommonFrameConstants::kContextOrFrameTypeOffset), 2067 __ Cmp(Operand(rbp, CommonFrameConstants::kContextOrFrameTypeOffset),
2059 Smi::FromInt(StackFrame::STUB)); 2068 Smi::FromInt(StackFrame::STUB));
2060 __ j(not_equal, &no_interpreter_frame, Label::kNear); 2069 __ j(not_equal, &no_interpreter_frame, Label::kNear);
2061 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 2070 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2062 __ bind(&no_interpreter_frame); 2071 __ bind(&no_interpreter_frame);
2063 } 2072 }
2064 2073
(...skipping 19 matching lines...) Expand all
2084 FieldOperand(scratch1, JSFunction::kSharedFunctionInfoOffset)); 2093 FieldOperand(scratch1, JSFunction::kSharedFunctionInfoOffset));
2085 __ LoadSharedFunctionInfoSpecialField( 2094 __ LoadSharedFunctionInfoSpecialField(
2086 caller_args_count_reg, scratch1, 2095 caller_args_count_reg, scratch1,
2087 SharedFunctionInfo::kFormalParameterCountOffset); 2096 SharedFunctionInfo::kFormalParameterCountOffset);
2088 2097
2089 __ bind(&formal_parameter_count_loaded); 2098 __ bind(&formal_parameter_count_loaded);
2090 2099
2091 ParameterCount callee_args_count(args_reg); 2100 ParameterCount callee_args_count(args_reg);
2092 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2, 2101 __ PrepareForTailCall(callee_args_count, caller_args_count_reg, scratch2,
2093 scratch3, ReturnAddressState::kOnStack); 2102 scratch3, ReturnAddressState::kOnStack);
2103 __ bind(&done);
2094 } 2104 }
2095 } // namespace 2105 } // namespace
2096 2106
2097 // static 2107 // static
2098 void Builtins::Generate_CallFunction(MacroAssembler* masm, 2108 void Builtins::Generate_CallFunction(MacroAssembler* masm,
2099 ConvertReceiverMode mode, 2109 ConvertReceiverMode mode,
2100 TailCallMode tail_call_mode) { 2110 TailCallMode tail_call_mode) {
2101 // ----------- S t a t e ------------- 2111 // ----------- S t a t e -------------
2102 // -- rax : the number of arguments (not including the receiver) 2112 // -- rax : the number of arguments (not including the receiver)
2103 // -- rdi : the function to call (checked to be a JSFunction) 2113 // -- rdi : the function to call (checked to be a JSFunction)
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 __ ret(0); 2675 __ ret(0);
2666 } 2676 }
2667 2677
2668 2678
2669 #undef __ 2679 #undef __
2670 2680
2671 } // namespace internal 2681 } // namespace internal
2672 } // namespace v8 2682 } // namespace v8
2673 2683
2674 #endif // V8_TARGET_ARCH_X64 2684 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/s390/builtins-s390.cc ('k') | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698