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

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

Issue 1698273003: [es6] [interpreter] Add tail calls support to Ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@tco-turbo-2
Patch Set: Decreased number of iterations to fix timeouts Created 4 years, 10 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_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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 __ bind(&loop_header); 749 __ bind(&loop_header);
750 __ Push(Operand(rbx, 0)); 750 __ Push(Operand(rbx, 0));
751 __ subp(rbx, Immediate(kPointerSize)); 751 __ subp(rbx, Immediate(kPointerSize));
752 __ bind(&loop_check); 752 __ bind(&loop_check);
753 __ cmpp(rbx, rcx); 753 __ cmpp(rbx, rcx);
754 __ j(greater, &loop_header, Label::kNear); 754 __ j(greater, &loop_header, Label::kNear);
755 } 755 }
756 756
757 757
758 // static 758 // static
759 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { 759 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
760 MacroAssembler* masm, TailCallMode tail_call_mode) {
760 // ----------- S t a t e ------------- 761 // ----------- S t a t e -------------
761 // -- rax : the number of arguments (not including the receiver) 762 // -- rax : the number of arguments (not including the receiver)
762 // -- rbx : the address of the first argument to be pushed. Subsequent 763 // -- rbx : the address of the first argument to be pushed. Subsequent
763 // arguments should be consecutive above this, in the same order as 764 // arguments should be consecutive above this, in the same order as
764 // they are to be pushed onto the stack. 765 // they are to be pushed onto the stack.
765 // -- rdi : the target to call (can be any Object). 766 // -- rdi : the target to call (can be any Object).
766 // ----------------------------------- 767 // -----------------------------------
767 768
768 // Pop return address to allow tail-call after pushing arguments. 769 // Pop return address to allow tail-call after pushing arguments.
769 __ PopReturnAddressTo(kScratchRegister); 770 __ PopReturnAddressTo(kScratchRegister);
770 771
771 Generate_InterpreterPushArgs(masm, true); 772 Generate_InterpreterPushArgs(masm, true);
772 773
773 // Call the target. 774 // Call the target.
774 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. 775 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address.
775 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 776 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
777 tail_call_mode),
778 RelocInfo::CODE_TARGET);
776 } 779 }
777 780
778 781
779 // static 782 // static
780 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { 783 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
781 // ----------- S t a t e ------------- 784 // ----------- S t a t e -------------
782 // -- rax : the number of arguments (not including the receiver) 785 // -- rax : the number of arguments (not including the receiver)
783 // -- rdx : the new target (either the same as the constructor or 786 // -- rdx : the new target (either the same as the constructor or
784 // the JSFunction on which new was invoked initially) 787 // the JSFunction on which new was invoked initially)
785 // -- rdi : the constructor to call (can be any Object) 788 // -- rdi : the constructor to call (can be any Object)
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 Register scratch3) { 2186 Register scratch3) {
2184 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3)); 2187 DCHECK(!AreAliased(args_reg, scratch1, scratch2, scratch3));
2185 Comment cmnt(masm, "[ PrepareForTailCall"); 2188 Comment cmnt(masm, "[ PrepareForTailCall");
2186 2189
2187 // Prepare for tail call only if the debugger is not active. 2190 // Prepare for tail call only if the debugger is not active.
2188 Label done; 2191 Label done;
2189 ExternalReference debug_is_active = 2192 ExternalReference debug_is_active =
2190 ExternalReference::debug_is_active_address(masm->isolate()); 2193 ExternalReference::debug_is_active_address(masm->isolate());
2191 __ Move(kScratchRegister, debug_is_active); 2194 __ Move(kScratchRegister, debug_is_active);
2192 __ cmpb(Operand(kScratchRegister, 0), Immediate(0)); 2195 __ cmpb(Operand(kScratchRegister, 0), Immediate(0));
2193 __ j(not_equal, &done, Label::kNear); 2196 __ j(not_equal, &done);
2197
2198 // Drop possible interpreter handler/stub frame.
2199 {
2200 Label no_interpreter_frame;
2201 __ Cmp(Operand(rbp, StandardFrameConstants::kMarkerOffset),
2202 Smi::FromInt(StackFrame::STUB));
2203 __ j(not_equal, &no_interpreter_frame, Label::kNear);
2204 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2205 __ bind(&no_interpreter_frame);
2206 }
2194 2207
2195 // Check if next frame is an arguments adaptor frame. 2208 // Check if next frame is an arguments adaptor frame.
2196 Label no_arguments_adaptor, formal_parameter_count_loaded; 2209 Label no_arguments_adaptor, formal_parameter_count_loaded;
2197 __ movp(scratch2, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 2210 __ movp(scratch2, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2198 __ Cmp(Operand(scratch2, StandardFrameConstants::kContextOffset), 2211 __ Cmp(Operand(scratch2, StandardFrameConstants::kContextOffset),
2199 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 2212 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
2200 __ j(not_equal, &no_arguments_adaptor, Label::kNear); 2213 __ j(not_equal, &no_arguments_adaptor, Label::kNear);
2201 2214
2202 // Drop arguments adaptor frame and load arguments count. 2215 // Drop arguments adaptor frame and load arguments count.
2203 __ movp(rbp, scratch2); 2216 __ movp(rbp, scratch2);
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
2850 __ ret(0); 2863 __ ret(0);
2851 } 2864 }
2852 2865
2853 2866
2854 #undef __ 2867 #undef __
2855 2868
2856 } // namespace internal 2869 } // namespace internal
2857 } // namespace v8 2870 } // namespace v8
2858 2871
2859 #endif // V8_TARGET_ARCH_X64 2872 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698