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

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

Issue 1688283003: [Interpreter] Implements calls through CallICStub in the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removes an unused label declaration. 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
« no previous file with comments | « src/mips64/interface-descriptors-mips64.cc ('k') | src/x64/code-stubs-x64.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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 __ bind(&loop_header); 618 __ bind(&loop_header);
619 __ Push(Operand(rbx, 0)); 619 __ Push(Operand(rbx, 0));
620 __ subp(rbx, Immediate(kPointerSize)); 620 __ subp(rbx, Immediate(kPointerSize));
621 __ bind(&loop_check); 621 __ bind(&loop_check);
622 __ cmpp(rbx, rcx); 622 __ cmpp(rbx, rcx);
623 __ j(greater, &loop_header, Label::kNear); 623 __ j(greater, &loop_header, Label::kNear);
624 } 624 }
625 625
626 626
627 // static 627 // static
628 void Builtins::Generate_InterpreterPushArgsAndCallICImpl(
629 MacroAssembler* masm, TailCallMode tail_call_mode) {
630 // ----------- S t a t e -------------
631 // -- rax : the number of arguments (not including the receiver)
632 // -- rbx : the address of the first argument to be pushed. Subsequent
633 // arguments should be consecutive above this, in the same order as
634 // they are to be pushed onto the stack.
635 // -- rdi : the target to call (can be any Object).
636 // -- rdx : Feedback vector slot-id.
637 // -- r9 : type feedback vector. // TODO(mythria): move to rbx to match
638 // CallICStub expectation.
639 // -----------------------------------
640
641 {
642 FrameScope scope(masm, StackFrame::INTERNAL);
643
644 Generate_InterpreterPushArgs(masm, true);
645
646 __ Move(rbx, r9);
647
648 // Call via the CallIC stub.
649 CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode,
650 true);
651 CallICStub stub(masm->isolate(), call_ic_state);
652 // TODO(mythria): This should be replaced by a TailCallStub, when we
653 // update the code to find the target IC from jump instructions.
654 __ CallStub(&stub);
655 }
656 __ Ret();
657 }
658
659 // static
628 void Builtins::Generate_InterpreterPushArgsAndCallImpl( 660 void Builtins::Generate_InterpreterPushArgsAndCallImpl(
629 MacroAssembler* masm, TailCallMode tail_call_mode) { 661 MacroAssembler* masm, TailCallMode tail_call_mode) {
630 // ----------- S t a t e ------------- 662 // ----------- S t a t e -------------
631 // -- rax : the number of arguments (not including the receiver) 663 // -- rax : the number of arguments (not including the receiver)
632 // -- rbx : the address of the first argument to be pushed. Subsequent 664 // -- rbx : the address of the first argument to be pushed. Subsequent
633 // arguments should be consecutive above this, in the same order as 665 // arguments should be consecutive above this, in the same order as
634 // they are to be pushed onto the stack. 666 // they are to be pushed onto the stack.
635 // -- rdi : the target to call (can be any Object). 667 // -- rdi : the target to call (can be any Object).
636 // ----------------------------------- 668 // -----------------------------------
637 669
638 // Pop return address to allow tail-call after pushing arguments. 670 // Pop return address to allow tail-call after pushing arguments.
639 __ PopReturnAddressTo(kScratchRegister); 671 __ PopReturnAddressTo(kScratchRegister);
640 672
641 Generate_InterpreterPushArgs(masm, true); 673 Generate_InterpreterPushArgs(masm, true);
642 674
643 // Call the target. 675 // Call the target.
644 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address. 676 __ PushReturnAddressFrom(kScratchRegister); // Re-push return address.
645 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, 677 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny,
646 tail_call_mode), 678 tail_call_mode),
647 RelocInfo::CODE_TARGET); 679 RelocInfo::CODE_TARGET);
648 } 680 }
649 681
650
651 // static 682 // static
652 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { 683 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
653 // ----------- S t a t e ------------- 684 // ----------- S t a t e -------------
654 // -- rax : the number of arguments (not including the receiver) 685 // -- rax : the number of arguments (not including the receiver)
655 // -- rdx : the new target (either the same as the constructor or 686 // -- rdx : the new target (either the same as the constructor or
656 // the JSFunction on which new was invoked initially) 687 // the JSFunction on which new was invoked initially)
657 // -- rdi : the constructor to call (can be any Object) 688 // -- rdi : the constructor to call (can be any Object)
658 // -- rbx : the address of the first argument to be pushed. Subsequent 689 // -- rbx : the address of the first argument to be pushed. Subsequent
659 // arguments should be consecutive above this, in the same order as 690 // arguments should be consecutive above this, in the same order as
660 // they are to be pushed onto the stack. 691 // they are to be pushed onto the stack.
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 Comment cmnt(masm, "[ PrepareForTailCall"); 2082 Comment cmnt(masm, "[ PrepareForTailCall");
2052 2083
2053 // Prepare for tail call only if the debugger is not active. 2084 // Prepare for tail call only if the debugger is not active.
2054 Label done; 2085 Label done;
2055 ExternalReference debug_is_active = 2086 ExternalReference debug_is_active =
2056 ExternalReference::debug_is_active_address(masm->isolate()); 2087 ExternalReference::debug_is_active_address(masm->isolate());
2057 __ Move(kScratchRegister, debug_is_active); 2088 __ Move(kScratchRegister, debug_is_active);
2058 __ cmpb(Operand(kScratchRegister, 0), Immediate(0)); 2089 __ cmpb(Operand(kScratchRegister, 0), Immediate(0));
2059 __ j(not_equal, &done); 2090 __ j(not_equal, &done);
2060 2091
2092 // Drop possible internal frame pushed for calling CallICStub.
2093 // TODO(mythria): when we tail call the CallICStub, remove this.
2094 {
2095 Label no_internal_callic_frame;
2096 __ Cmp(Operand(rbp, StandardFrameConstants::kMarkerOffset),
2097 Smi::FromInt(StackFrame::INTERNAL));
2098 __ j(not_equal, &no_internal_callic_frame, Label::kNear);
2099 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2100 __ bind(&no_internal_callic_frame);
2101 }
2102
2061 // Drop possible interpreter handler/stub frame. 2103 // Drop possible interpreter handler/stub frame.
2062 { 2104 {
2063 Label no_interpreter_frame; 2105 Label no_interpreter_frame;
2064 __ Cmp(Operand(rbp, StandardFrameConstants::kMarkerOffset), 2106 __ Cmp(Operand(rbp, StandardFrameConstants::kMarkerOffset),
2065 Smi::FromInt(StackFrame::STUB)); 2107 Smi::FromInt(StackFrame::STUB));
2066 __ j(not_equal, &no_interpreter_frame, Label::kNear); 2108 __ j(not_equal, &no_interpreter_frame, Label::kNear);
2067 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 2109 __ movp(rbp, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2068 __ bind(&no_interpreter_frame); 2110 __ bind(&no_interpreter_frame);
2069 } 2111 }
2070 2112
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 __ ret(0); 2768 __ ret(0);
2727 } 2769 }
2728 2770
2729 2771
2730 #undef __ 2772 #undef __
2731 2773
2732 } // namespace internal 2774 } // namespace internal
2733 } // namespace v8 2775 } // namespace v8
2734 2776
2735 #endif // V8_TARGET_ARCH_X64 2777 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips64/interface-descriptors-mips64.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698