| 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 __ bind(&loop_header); | 724 __ bind(&loop_header); |
| 725 __ Push(Operand(ebx, 0)); | 725 __ Push(Operand(ebx, 0)); |
| 726 __ sub(ebx, Immediate(kPointerSize)); | 726 __ sub(ebx, Immediate(kPointerSize)); |
| 727 __ bind(&loop_check); | 727 __ bind(&loop_check); |
| 728 __ cmp(ebx, array_limit); | 728 __ cmp(ebx, array_limit); |
| 729 __ j(greater, &loop_header, Label::kNear); | 729 __ j(greater, &loop_header, Label::kNear); |
| 730 } | 730 } |
| 731 | 731 |
| 732 // static | 732 // static |
| 733 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 733 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 734 MacroAssembler* masm, TailCallMode tail_call_mode) { | 734 MacroAssembler* masm, TailCallMode tail_call_mode, |
| 735 CallableType function_type) { |
| 735 // ----------- S t a t e ------------- | 736 // ----------- S t a t e ------------- |
| 736 // -- eax : the number of arguments (not including the receiver) | 737 // -- eax : the number of arguments (not including the receiver) |
| 737 // -- ebx : the address of the first argument to be pushed. Subsequent | 738 // -- ebx : the address of the first argument to be pushed. Subsequent |
| 738 // arguments should be consecutive above this, in the same order as | 739 // arguments should be consecutive above this, in the same order as |
| 739 // they are to be pushed onto the stack. | 740 // they are to be pushed onto the stack. |
| 740 // -- edi : the target to call (can be any Object). | 741 // -- edi : the target to call (can be any Object). |
| 741 // ----------------------------------- | 742 // ----------------------------------- |
| 742 | 743 |
| 743 // Pop return address to allow tail-call after pushing arguments. | 744 // Pop return address to allow tail-call after pushing arguments. |
| 744 __ Pop(edx); | 745 __ Pop(edx); |
| 745 | 746 |
| 746 // Find the address of the last argument. | 747 // Find the address of the last argument. |
| 747 __ mov(ecx, eax); | 748 __ mov(ecx, eax); |
| 748 __ add(ecx, Immediate(1)); // Add one for receiver. | 749 __ add(ecx, Immediate(1)); // Add one for receiver. |
| 749 __ shl(ecx, kPointerSizeLog2); | 750 __ shl(ecx, kPointerSizeLog2); |
| 750 __ neg(ecx); | 751 __ neg(ecx); |
| 751 __ add(ecx, ebx); | 752 __ add(ecx, ebx); |
| 752 | 753 |
| 753 Generate_InterpreterPushArgs(masm, ecx); | 754 Generate_InterpreterPushArgs(masm, ecx); |
| 754 | 755 |
| 755 // Call the target. | 756 // Call the target. |
| 756 __ Push(edx); // Re-push return address. | 757 __ Push(edx); // Re-push return address. |
| 757 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 758 |
| 758 tail_call_mode), | 759 if (function_type == CallableType::kJSFunction) { |
| 759 RelocInfo::CODE_TARGET); | 760 __ Jump(masm->isolate()->builtins()->CallFunction(ConvertReceiverMode::kAny, |
| 761 tail_call_mode), |
| 762 RelocInfo::CODE_TARGET); |
| 763 } else { |
| 764 DCHECK_EQ(function_type, CallableType::kAny); |
| 765 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 766 tail_call_mode), |
| 767 RelocInfo::CODE_TARGET); |
| 768 } |
| 760 } | 769 } |
| 761 | 770 |
| 762 | 771 |
| 763 // static | 772 // static |
| 764 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 773 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 765 // ----------- S t a t e ------------- | 774 // ----------- S t a t e ------------- |
| 766 // -- eax : the number of arguments (not including the receiver) | 775 // -- eax : the number of arguments (not including the receiver) |
| 767 // -- edx : the new target | 776 // -- edx : the new target |
| 768 // -- edi : the constructor | 777 // -- edi : the constructor |
| 769 // -- ebx : the address of the first argument to be pushed. Subsequent | 778 // -- ebx : the address of the first argument to be pushed. Subsequent |
| (...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3024 // And "return" to the OSR entry point of the function. | 3033 // And "return" to the OSR entry point of the function. |
| 3025 __ ret(0); | 3034 __ ret(0); |
| 3026 } | 3035 } |
| 3027 | 3036 |
| 3028 | 3037 |
| 3029 #undef __ | 3038 #undef __ |
| 3030 } // namespace internal | 3039 } // namespace internal |
| 3031 } // namespace v8 | 3040 } // namespace v8 |
| 3032 | 3041 |
| 3033 #endif // V8_TARGET_ARCH_IA32 | 3042 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |