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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 3745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3756 // Call the target. | 3756 // Call the target. |
3757 __ Set(rax, argc); | 3757 __ Set(rax, argc); |
3758 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3758 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3759 // Restore context register. | 3759 // Restore context register. |
3760 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 3760 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
3761 // Discard the function left on TOS. | 3761 // Discard the function left on TOS. |
3762 context()->DropAndPlug(1, rax); | 3762 context()->DropAndPlug(1, rax); |
3763 } | 3763 } |
3764 | 3764 |
3765 | 3765 |
3766 void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) { | |
3767 ZoneList<Expression*>* args = expr->arguments(); | |
3768 DCHECK(args->length() >= 2); | |
3769 | |
3770 int arg_count = args->length() - 2; // 2 ~ receiver and function. | |
3771 for (int i = 0; i < arg_count + 1; i++) { | |
3772 VisitForStackValue(args->at(i)); | |
3773 } | |
3774 VisitForAccumulatorValue(args->last()); // Function. | |
3775 | |
3776 PrepareForBailoutForId(expr->CallId(), TOS_REG); | |
3777 Label runtime, done; | |
3778 // Check for non-function argument (including proxy). | |
3779 __ JumpIfSmi(rax, &runtime); | |
3780 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rbx); | |
3781 __ j(not_equal, &runtime); | |
3782 | |
3783 // InvokeFunction requires the function in rdi. Move it in there. | |
3784 __ movp(rdi, result_register()); | |
3785 ParameterCount count(arg_count); | |
3786 __ InvokeFunction(rdi, count, CALL_FUNCTION, NullCallWrapper()); | |
3787 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | |
3788 __ jmp(&done); | |
3789 | |
3790 __ bind(&runtime); | |
3791 __ Push(rax); | |
3792 __ CallRuntime(Runtime::kCallFunction, args->length()); | |
3793 __ bind(&done); | |
3794 | |
3795 context()->Plug(rax); | |
3796 } | |
3797 | |
3798 | |
3799 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3766 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3800 ZoneList<Expression*>* args = expr->arguments(); | 3767 ZoneList<Expression*>* args = expr->arguments(); |
3801 DCHECK(args->length() == 2); | 3768 DCHECK(args->length() == 2); |
3802 | 3769 |
3803 // Evaluate new.target and super constructor. | 3770 // Evaluate new.target and super constructor. |
3804 VisitForStackValue(args->at(0)); | 3771 VisitForStackValue(args->at(0)); |
3805 VisitForStackValue(args->at(1)); | 3772 VisitForStackValue(args->at(1)); |
3806 | 3773 |
3807 // Check if the calling frame is an arguments adaptor frame. | 3774 // Check if the calling frame is an arguments adaptor frame. |
3808 Label adaptor_frame, args_set_up, runtime; | 3775 Label adaptor_frame, args_set_up, runtime; |
(...skipping 1221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5030 Assembler::target_address_at(call_target_address, | 4997 Assembler::target_address_at(call_target_address, |
5031 unoptimized_code)); | 4998 unoptimized_code)); |
5032 return OSR_AFTER_STACK_CHECK; | 4999 return OSR_AFTER_STACK_CHECK; |
5033 } | 5000 } |
5034 | 5001 |
5035 | 5002 |
5036 } // namespace internal | 5003 } // namespace internal |
5037 } // namespace v8 | 5004 } // namespace v8 |
5038 | 5005 |
5039 #endif // V8_TARGET_ARCH_X64 | 5006 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |