| 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/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 | 2841 |
| 2842 | 2842 |
| 2843 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { | 2843 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
| 2844 // Load the arguments. | 2844 // Load the arguments. |
| 2845 ZoneList<Expression*>* args = expr->arguments(); | 2845 ZoneList<Expression*>* args = expr->arguments(); |
| 2846 int arg_count = args->length(); | 2846 int arg_count = args->length(); |
| 2847 for (int i = 0; i < arg_count; i++) { | 2847 for (int i = 0; i < arg_count; i++) { |
| 2848 VisitForStackValue(args->at(i)); | 2848 VisitForStackValue(args->at(i)); |
| 2849 } | 2849 } |
| 2850 | 2850 |
| 2851 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 2851 SetCallPosition(expr, arg_count); | 2852 SetCallPosition(expr, arg_count); |
| 2852 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); | 2853 Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
| 2853 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); | 2854 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); |
| 2854 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2855 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
| 2855 // Don't assign a type feedback id to the IC, since type feedback is provided | 2856 // Don't assign a type feedback id to the IC, since type feedback is provided |
| 2856 // by the vector above. | 2857 // by the vector above. |
| 2857 CallIC(ic); | 2858 CallIC(ic); |
| 2858 | 2859 |
| 2859 RecordJSReturnSite(expr); | 2860 RecordJSReturnSite(expr); |
| 2860 | 2861 |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3790 } | 3791 } |
| 3791 | 3792 |
| 3792 | 3793 |
| 3793 void FullCodeGenerator::EmitCall(CallRuntime* expr) { | 3794 void FullCodeGenerator::EmitCall(CallRuntime* expr) { |
| 3794 ZoneList<Expression*>* args = expr->arguments(); | 3795 ZoneList<Expression*>* args = expr->arguments(); |
| 3795 DCHECK_LE(2, args->length()); | 3796 DCHECK_LE(2, args->length()); |
| 3796 // Push target, receiver and arguments onto the stack. | 3797 // Push target, receiver and arguments onto the stack. |
| 3797 for (Expression* const arg : *args) { | 3798 for (Expression* const arg : *args) { |
| 3798 VisitForStackValue(arg); | 3799 VisitForStackValue(arg); |
| 3799 } | 3800 } |
| 3801 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 3800 // Move target to edi. | 3802 // Move target to edi. |
| 3801 int const argc = args->length() - 2; | 3803 int const argc = args->length() - 2; |
| 3802 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize)); | 3804 __ mov(edi, Operand(esp, (argc + 1) * kPointerSize)); |
| 3803 // Call the target. | 3805 // Call the target. |
| 3804 __ mov(eax, Immediate(argc)); | 3806 __ mov(eax, Immediate(argc)); |
| 3805 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3807 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 3806 // Restore context register. | 3808 // Restore context register. |
| 3807 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3809 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3808 // Discard the function left on TOS. | 3810 // Discard the function left on TOS. |
| 3809 context()->DropAndPlug(1, eax); | 3811 context()->DropAndPlug(1, eax); |
| 3810 } | 3812 } |
| 3811 | 3813 |
| 3812 | 3814 |
| 3813 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | 3815 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { |
| 3814 ZoneList<Expression*>* args = expr->arguments(); | 3816 ZoneList<Expression*>* args = expr->arguments(); |
| 3815 DCHECK(args->length() >= 2); | 3817 DCHECK(args->length() >= 2); |
| 3816 | 3818 |
| 3817 int arg_count = args->length() - 2; // 2 ~ receiver and function. | 3819 int arg_count = args->length() - 2; // 2 ~ receiver and function. |
| 3818 for (int i = 0; i < arg_count + 1; ++i) { | 3820 for (int i = 0; i < arg_count + 1; ++i) { |
| 3819 VisitForStackValue(args->at(i)); | 3821 VisitForStackValue(args->at(i)); |
| 3820 } | 3822 } |
| 3821 VisitForAccumulatorValue(args->last()); // Function. | 3823 VisitForAccumulatorValue(args->last()); // Function. |
| 3822 | 3824 |
| 3825 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); |
| 3823 Label runtime, done; | 3826 Label runtime, done; |
| 3824 // Check for non-function argument (including proxy). | 3827 // Check for non-function argument (including proxy). |
| 3825 __ JumpIfSmi(eax, &runtime); | 3828 __ JumpIfSmi(eax, &runtime); |
| 3826 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); | 3829 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); |
| 3827 __ j(not_equal, &runtime); | 3830 __ j(not_equal, &runtime); |
| 3828 | 3831 |
| 3829 // InvokeFunction requires the function in edi. Move it in there. | 3832 // InvokeFunction requires the function in edi. Move it in there. |
| 3830 __ mov(edi, result_register()); | 3833 __ mov(edi, result_register()); |
| 3831 ParameterCount count(arg_count); | 3834 ParameterCount count(arg_count); |
| 3832 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); | 3835 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); |
| (...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5056 Assembler::target_address_at(call_target_address, | 5059 Assembler::target_address_at(call_target_address, |
| 5057 unoptimized_code)); | 5060 unoptimized_code)); |
| 5058 return OSR_AFTER_STACK_CHECK; | 5061 return OSR_AFTER_STACK_CHECK; |
| 5059 } | 5062 } |
| 5060 | 5063 |
| 5061 | 5064 |
| 5062 } // namespace internal | 5065 } // namespace internal |
| 5063 } // namespace v8 | 5066 } // namespace v8 |
| 5064 | 5067 |
| 5065 #endif // V8_TARGET_ARCH_IA32 | 5068 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |