| 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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 __ bind(&loop_header); | 669 __ bind(&loop_header); |
| 670 __ Push(Operand(ebx, 0)); | 670 __ Push(Operand(ebx, 0)); |
| 671 __ sub(ebx, Immediate(kPointerSize)); | 671 __ sub(ebx, Immediate(kPointerSize)); |
| 672 __ bind(&loop_check); | 672 __ bind(&loop_check); |
| 673 __ cmp(ebx, array_limit); | 673 __ cmp(ebx, array_limit); |
| 674 __ j(greater, &loop_header, Label::kNear); | 674 __ j(greater, &loop_header, Label::kNear); |
| 675 } | 675 } |
| 676 | 676 |
| 677 | 677 |
| 678 // static | 678 // static |
| 679 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 679 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 680 MacroAssembler* masm, TailCallMode tail_call_mode) { |
| 680 // ----------- S t a t e ------------- | 681 // ----------- S t a t e ------------- |
| 681 // -- eax : the number of arguments (not including the receiver) | 682 // -- eax : the number of arguments (not including the receiver) |
| 682 // -- ebx : the address of the first argument to be pushed. Subsequent | 683 // -- ebx : the address of the first argument to be pushed. Subsequent |
| 683 // arguments should be consecutive above this, in the same order as | 684 // arguments should be consecutive above this, in the same order as |
| 684 // they are to be pushed onto the stack. | 685 // they are to be pushed onto the stack. |
| 685 // -- edi : the target to call (can be any Object). | 686 // -- edi : the target to call (can be any Object). |
| 686 // ----------------------------------- | 687 // ----------------------------------- |
| 687 | 688 |
| 688 // Pop return address to allow tail-call after pushing arguments. | 689 // Pop return address to allow tail-call after pushing arguments. |
| 689 __ Pop(edx); | 690 __ Pop(edx); |
| 690 | 691 |
| 691 // Find the address of the last argument. | 692 // Find the address of the last argument. |
| 692 __ mov(ecx, eax); | 693 __ mov(ecx, eax); |
| 693 __ add(ecx, Immediate(1)); // Add one for receiver. | 694 __ add(ecx, Immediate(1)); // Add one for receiver. |
| 694 __ shl(ecx, kPointerSizeLog2); | 695 __ shl(ecx, kPointerSizeLog2); |
| 695 __ neg(ecx); | 696 __ neg(ecx); |
| 696 __ add(ecx, ebx); | 697 __ add(ecx, ebx); |
| 697 | 698 |
| 698 Generate_InterpreterPushArgs(masm, ecx); | 699 Generate_InterpreterPushArgs(masm, ecx); |
| 699 | 700 |
| 700 // Call the target. | 701 // Call the target. |
| 701 __ Push(edx); // Re-push return address. | 702 __ Push(edx); // Re-push return address. |
| 702 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 703 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 704 tail_call_mode), |
| 705 RelocInfo::CODE_TARGET); |
| 703 } | 706 } |
| 704 | 707 |
| 705 | 708 |
| 706 // static | 709 // static |
| 707 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 710 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 708 // ----------- S t a t e ------------- | 711 // ----------- S t a t e ------------- |
| 709 // -- eax : the number of arguments (not including the receiver) | 712 // -- eax : the number of arguments (not including the receiver) |
| 710 // -- edx : the new target | 713 // -- edx : the new target |
| 711 // -- edi : the constructor | 714 // -- edi : the constructor |
| 712 // -- ebx : the address of the first argument to be pushed. Subsequent | 715 // -- ebx : the address of the first argument to be pushed. Subsequent |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 Comment cmnt(masm, "[ PrepareForTailCall"); | 1985 Comment cmnt(masm, "[ PrepareForTailCall"); |
| 1983 | 1986 |
| 1984 // Prepare for tail call only if the debugger is not active. | 1987 // Prepare for tail call only if the debugger is not active. |
| 1985 Label done; | 1988 Label done; |
| 1986 ExternalReference debug_is_active = | 1989 ExternalReference debug_is_active = |
| 1987 ExternalReference::debug_is_active_address(masm->isolate()); | 1990 ExternalReference::debug_is_active_address(masm->isolate()); |
| 1988 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); | 1991 __ movzx_b(scratch1, Operand::StaticVariable(debug_is_active)); |
| 1989 __ cmp(scratch1, Immediate(0)); | 1992 __ cmp(scratch1, Immediate(0)); |
| 1990 __ j(not_equal, &done, Label::kNear); | 1993 __ j(not_equal, &done, Label::kNear); |
| 1991 | 1994 |
| 1995 // Drop possible interpreter handler/stub frame. |
| 1996 { |
| 1997 Label no_interpreter_frame; |
| 1998 __ cmp(Operand(ebp, StandardFrameConstants::kMarkerOffset), |
| 1999 Immediate(Smi::FromInt(StackFrame::STUB))); |
| 2000 __ j(not_equal, &no_interpreter_frame, Label::kNear); |
| 2001 __ mov(ebp, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 2002 __ bind(&no_interpreter_frame); |
| 2003 } |
| 2004 |
| 1992 // Check if next frame is an arguments adaptor frame. | 2005 // Check if next frame is an arguments adaptor frame. |
| 1993 Label no_arguments_adaptor, formal_parameter_count_loaded; | 2006 Label no_arguments_adaptor, formal_parameter_count_loaded; |
| 1994 __ mov(scratch2, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 2007 __ mov(scratch2, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 1995 __ cmp(Operand(scratch2, StandardFrameConstants::kContextOffset), | 2008 __ cmp(Operand(scratch2, StandardFrameConstants::kContextOffset), |
| 1996 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2009 Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 1997 __ j(not_equal, &no_arguments_adaptor, Label::kNear); | 2010 __ j(not_equal, &no_arguments_adaptor, Label::kNear); |
| 1998 | 2011 |
| 1999 // Drop arguments adaptor frame and load arguments count. | 2012 // Drop arguments adaptor frame and load arguments count. |
| 2000 __ mov(ebp, scratch2); | 2013 __ mov(ebp, scratch2); |
| 2001 __ mov(scratch1, Operand(ebp, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2014 __ mov(scratch1, Operand(ebp, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2769 | 2782 |
| 2770 __ bind(&ok); | 2783 __ bind(&ok); |
| 2771 __ ret(0); | 2784 __ ret(0); |
| 2772 } | 2785 } |
| 2773 | 2786 |
| 2774 #undef __ | 2787 #undef __ |
| 2775 } // namespace internal | 2788 } // namespace internal |
| 2776 } // namespace v8 | 2789 } // namespace v8 |
| 2777 | 2790 |
| 2778 #endif // V8_TARGET_ARCH_IA32 | 2791 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |