 Chromium Code Reviews
 Chromium Code Reviews Issue 1688283003:
  [Interpreter] Implements calls through CallICStub in the interpreter.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master
    
  
    Issue 1688283003:
  [Interpreter] Implements calls through CallICStub in the interpreter.  (Closed) 
  Base URL: https://chromium.googlesource.com/v8/v8.git@master| OLD | NEW | 
|---|---|
| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 Label loop_header, loop_check; | 668 Label loop_header, loop_check; | 
| 669 __ jmp(&loop_check); | 669 __ jmp(&loop_check); | 
| 670 __ bind(&loop_header); | 670 __ bind(&loop_header); | 
| 671 __ Push(Operand(ebx, 0)); | 671 __ Push(Operand(ebx, 0)); | 
| 672 __ sub(ebx, Immediate(kPointerSize)); | 672 __ sub(ebx, Immediate(kPointerSize)); | 
| 673 __ bind(&loop_check); | 673 __ bind(&loop_check); | 
| 674 __ cmp(ebx, array_limit); | 674 __ cmp(ebx, array_limit); | 
| 675 __ j(greater, &loop_header, Label::kNear); | 675 __ j(greater, &loop_header, Label::kNear); | 
| 676 } | 676 } | 
| 677 | 677 | 
| 678 static void Generate_InterpreterComputeLastArgumentAddress( | |
| 679 MacroAssembler* masm) { | |
| 680 // Find the address of the last argument. | |
| 681 // ----------- S t a t e ------------- | |
| 682 // input: ebx : Address of the first argument. | |
| 683 // output: ecx: Address of the last argument. | |
| 684 // ----------------------------------- | |
| 685 __ mov(ecx, eax); | |
| 686 __ add(ecx, Immediate(1)); // Add one for receiver. | |
| 687 __ shl(ecx, kPointerSizeLog2); | |
| 688 __ neg(ecx); | |
| 689 __ add(ecx, ebx); | |
| 690 } | |
| 678 | 691 | 
| 679 // static | 692 // static | 
| 680 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 693 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 
| 681 // ----------- S t a t e ------------- | 694 // ----------- S t a t e ------------- | 
| 682 // -- eax : the number of arguments (not including the receiver) | 695 // -- eax : the number of arguments (not including the receiver) | 
| 683 // -- ebx : the address of the first argument to be pushed. Subsequent | 696 // -- ebx : the address of the first argument to be pushed. Subsequent | 
| 684 // arguments should be consecutive above this, in the same order as | 697 // arguments should be consecutive above this, in the same order as | 
| 685 // they are to be pushed onto the stack. | 698 // they are to be pushed onto the stack. | 
| 686 // -- edi : the target to call (can be any Object). | 699 // -- edi : the target to call (can be any Object). | 
| 687 // ----------------------------------- | 700 // ----------------------------------- | 
| 688 | 701 | 
| 689 // Pop return address to allow tail-call after pushing arguments. | 702 // Pop return address to allow tail-call after pushing arguments. | 
| 690 __ Pop(edx); | 703 __ Pop(edx); | 
| 691 | 704 | 
| 692 // Find the address of the last argument. | 705 Generate_InterpreterComputeLastArgumentAddress(masm); | 
| 693 __ mov(ecx, eax); | |
| 694 __ add(ecx, Immediate(1)); // Add one for receiver. | |
| 695 __ shl(ecx, kPointerSizeLog2); | |
| 696 __ neg(ecx); | |
| 697 __ add(ecx, ebx); | |
| 698 | |
| 699 Generate_InterpreterPushArgs(masm, ecx); | 706 Generate_InterpreterPushArgs(masm, ecx); | 
| 700 | 707 | 
| 701 // Call the target. | 708 // Call the target. | 
| 702 __ Push(edx); // Re-push return address. | 709 __ Push(edx); // Re-push return address. | 
| 703 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 710 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 
| 704 } | 711 } | 
| 705 | 712 | 
| 706 | 713 | 
| 707 // static | 714 // static | 
| 715 void Builtins::Generate_InterpreterPushArgsAndCallIC(MacroAssembler* masm) { | |
| 716 // ----------- S t a t e ------------- | |
| 717 // -- eax : the number of arguments (not including the receiver) | |
| 718 // -- ebx : the address of the first argument to be pushed. Subsequent | |
| 719 // arguments should be consecutive above this, in the same order as | |
| 720 // they are to be pushed onto the stack. | |
| 721 // -- edi : the target to call (can be any Object). | |
| 722 // -- edx : feedback slot id. | |
| 723 // -- ecx : type feedback vector. | |
| 724 // ----------------------------------- | |
| 725 | |
| 726 { | |
| 727 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 728 // Store type feedback vector in a virtual register. | |
| 729 ExternalReference virtual_register = | |
| 
mvstanton
2016/02/15 11:13:45
I'd love it if we don't have to expand the usage o
 
rmcilroy
2016/02/15 11:20:50
Sorry, this was my fault suggesting it as I though
 
mvstanton
2016/02/15 11:32:04
LOL, I know, I am tempted too..! I think the virtu
 
mythria
2016/02/17 11:02:48
Done.
 | |
| 730 ExternalReference::virtual_handler_register(masm->isolate()); | |
| 731 __ mov(Operand::StaticVariable(virtual_register), ecx); | |
| 732 | |
| 733 Generate_InterpreterComputeLastArgumentAddress(masm); | |
| 
mvstanton
2016/02/15 11:13:45
It would be nice if InterpreterComputeLastArgument
 
mythria
2016/02/17 11:02:48
We just clobber ecx, though we use eax and ebx as
 | |
| 734 Generate_InterpreterPushArgs(masm, ecx); | |
| 735 | |
| 736 // Restore feedback vector to ebx from the virtual register. | |
| 737 __ mov(ebx, Operand::StaticVariable(virtual_register)); | |
| 738 | |
| 739 // Call via the CallIC stub. | |
| 740 CallICState call_ic_state(0, ConvertReceiverMode::kAny, | |
| 741 TailCallMode::kDisallow, true); | |
| 742 CallICStub stub(masm->isolate(), call_ic_state); | |
| 743 // TODO(mythria): This should be replaced by a TailCallStub, when we | |
| 744 // update the code to find the target IC from jump instructions. | |
| 745 __ CallStub(&stub); | |
| 746 } | |
| 747 __ Ret(); | |
| 748 } | |
| 749 | |
| 750 // static | |
| 708 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 751 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 
| 709 // ----------- S t a t e ------------- | 752 // ----------- S t a t e ------------- | 
| 710 // -- eax : the number of arguments (not including the receiver) | 753 // -- eax : the number of arguments (not including the receiver) | 
| 711 // -- edx : the new target | 754 // -- edx : the new target | 
| 712 // -- edi : the constructor | 755 // -- edi : the constructor | 
| 713 // -- ebx : the address of the first argument to be pushed. Subsequent | 756 // -- ebx : the address of the first argument to be pushed. Subsequent | 
| 714 // arguments should be consecutive above this, in the same order as | 757 // arguments should be consecutive above this, in the same order as | 
| 715 // they are to be pushed onto the stack. | 758 // they are to be pushed onto the stack. | 
| 716 // ----------------------------------- | 759 // ----------------------------------- | 
| 717 | 760 | 
| (...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2772 | 2815 | 
| 2773 __ bind(&ok); | 2816 __ bind(&ok); | 
| 2774 __ ret(0); | 2817 __ ret(0); | 
| 2775 } | 2818 } | 
| 2776 | 2819 | 
| 2777 #undef __ | 2820 #undef __ | 
| 2778 } // namespace internal | 2821 } // namespace internal | 
| 2779 } // namespace v8 | 2822 } // namespace v8 | 
| 2780 | 2823 | 
| 2781 #endif // V8_TARGET_ARCH_IA32 | 2824 #endif // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |