| 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 3749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3760 // Call the target. | 3760 // Call the target. |
| 3761 __ mov(eax, Immediate(argc)); | 3761 __ mov(eax, Immediate(argc)); |
| 3762 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3762 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 3763 // Restore context register. | 3763 // Restore context register. |
| 3764 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3764 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3765 // Discard the function left on TOS. | 3765 // Discard the function left on TOS. |
| 3766 context()->DropAndPlug(1, eax); | 3766 context()->DropAndPlug(1, eax); |
| 3767 } | 3767 } |
| 3768 | 3768 |
| 3769 | 3769 |
| 3770 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | |
| 3771 ZoneList<Expression*>* args = expr->arguments(); | |
| 3772 DCHECK(args->length() >= 2); | |
| 3773 | |
| 3774 int arg_count = args->length() - 2; // 2 ~ receiver and function. | |
| 3775 for (int i = 0; i < arg_count + 1; ++i) { | |
| 3776 VisitForStackValue(args->at(i)); | |
| 3777 } | |
| 3778 VisitForAccumulatorValue(args->last()); // Function. | |
| 3779 | |
| 3780 PrepareForBailoutForId(expr->CallId(), NO_REGISTERS); | |
| 3781 Label runtime, done; | |
| 3782 // Check for non-function argument (including proxy). | |
| 3783 __ JumpIfSmi(eax, &runtime); | |
| 3784 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); | |
| 3785 __ j(not_equal, &runtime); | |
| 3786 | |
| 3787 // InvokeFunction requires the function in edi. Move it in there. | |
| 3788 __ mov(edi, result_register()); | |
| 3789 ParameterCount count(arg_count); | |
| 3790 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); | |
| 3791 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | |
| 3792 __ jmp(&done); | |
| 3793 | |
| 3794 __ bind(&runtime); | |
| 3795 __ push(eax); | |
| 3796 __ CallRuntime(Runtime::kCallFunction, args->length()); | |
| 3797 __ bind(&done); | |
| 3798 | |
| 3799 context()->Plug(eax); | |
| 3800 } | |
| 3801 | |
| 3802 | |
| 3803 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3770 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
| 3804 ZoneList<Expression*>* args = expr->arguments(); | 3771 ZoneList<Expression*>* args = expr->arguments(); |
| 3805 DCHECK(args->length() == 2); | 3772 DCHECK(args->length() == 2); |
| 3806 | 3773 |
| 3807 // Evaluate new.target and super constructor. | 3774 // Evaluate new.target and super constructor. |
| 3808 VisitForStackValue(args->at(0)); | 3775 VisitForStackValue(args->at(0)); |
| 3809 VisitForStackValue(args->at(1)); | 3776 VisitForStackValue(args->at(1)); |
| 3810 | 3777 |
| 3811 // Check if the calling frame is an arguments adaptor frame. | 3778 // Check if the calling frame is an arguments adaptor frame. |
| 3812 Label adaptor_frame, args_set_up, runtime; | 3779 Label adaptor_frame, args_set_up, runtime; |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5014 Assembler::target_address_at(call_target_address, | 4981 Assembler::target_address_at(call_target_address, |
| 5015 unoptimized_code)); | 4982 unoptimized_code)); |
| 5016 return OSR_AFTER_STACK_CHECK; | 4983 return OSR_AFTER_STACK_CHECK; |
| 5017 } | 4984 } |
| 5018 | 4985 |
| 5019 | 4986 |
| 5020 } // namespace internal | 4987 } // namespace internal |
| 5021 } // namespace v8 | 4988 } // namespace v8 |
| 5022 | 4989 |
| 5023 #endif // V8_TARGET_ARCH_IA32 | 4990 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |