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