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 2948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 | 2959 |
2960 // Push the arguments ("left-to-right") on the stack. | 2960 // Push the arguments ("left-to-right") on the stack. |
2961 ZoneList<Expression*>* args = expr->arguments(); | 2961 ZoneList<Expression*>* args = expr->arguments(); |
2962 int arg_count = args->length(); | 2962 int arg_count = args->length(); |
2963 for (int i = 0; i < arg_count; i++) { | 2963 for (int i = 0; i < arg_count; i++) { |
2964 VisitForStackValue(args->at(i)); | 2964 VisitForStackValue(args->at(i)); |
2965 } | 2965 } |
2966 | 2966 |
2967 // Call the construct call builtin that handles allocation and | 2967 // Call the construct call builtin that handles allocation and |
2968 // constructor invocation. | 2968 // constructor invocation. |
2969 SetConstructCallPosition(expr); | 2969 SetConstructCallPosition(expr, arg_count); |
2970 | 2970 |
2971 // Load function and argument count into rdi and rax. | 2971 // Load function and argument count into rdi and rax. |
2972 __ Set(rax, arg_count); | 2972 __ Set(rax, arg_count); |
2973 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); | 2973 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); |
2974 | 2974 |
2975 // Record call targets in unoptimized code, but not in the snapshot. | 2975 // Record call targets in unoptimized code, but not in the snapshot. |
2976 __ EmitLoadTypeFeedbackVector(rbx); | 2976 __ EmitLoadTypeFeedbackVector(rbx); |
2977 __ Move(rdx, SmiFromSlot(expr->CallNewFeedbackSlot())); | 2977 __ Move(rdx, SmiFromSlot(expr->CallNewFeedbackSlot())); |
2978 | 2978 |
2979 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 2979 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
(...skipping 15 matching lines...) Expand all Loading... |
2995 | 2995 |
2996 // Push the arguments ("left-to-right") on the stack. | 2996 // Push the arguments ("left-to-right") on the stack. |
2997 ZoneList<Expression*>* args = expr->arguments(); | 2997 ZoneList<Expression*>* args = expr->arguments(); |
2998 int arg_count = args->length(); | 2998 int arg_count = args->length(); |
2999 for (int i = 0; i < arg_count; i++) { | 2999 for (int i = 0; i < arg_count; i++) { |
3000 VisitForStackValue(args->at(i)); | 3000 VisitForStackValue(args->at(i)); |
3001 } | 3001 } |
3002 | 3002 |
3003 // Call the construct call builtin that handles allocation and | 3003 // Call the construct call builtin that handles allocation and |
3004 // constructor invocation. | 3004 // constructor invocation. |
3005 SetConstructCallPosition(expr); | 3005 SetConstructCallPosition(expr, arg_count); |
3006 | 3006 |
3007 // Load new target into rcx. | 3007 // Load new target into rcx. |
3008 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 3008 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
3009 __ movp(rcx, result_register()); | 3009 __ movp(rcx, result_register()); |
3010 | 3010 |
3011 // Load function and argument count into rdi and rax. | 3011 // Load function and argument count into rdi and rax. |
3012 __ Set(rax, arg_count); | 3012 __ Set(rax, arg_count); |
3013 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); | 3013 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); |
3014 | 3014 |
3015 // Record call targets in unoptimized code. | 3015 // Record call targets in unoptimized code. |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 | 3741 |
3742 | 3742 |
3743 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3743 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3744 ZoneList<Expression*>* args = expr->arguments(); | 3744 ZoneList<Expression*>* args = expr->arguments(); |
3745 DCHECK(args->length() == 2); | 3745 DCHECK(args->length() == 2); |
3746 | 3746 |
3747 // Evaluate new.target and super constructor. | 3747 // Evaluate new.target and super constructor. |
3748 VisitForStackValue(args->at(0)); | 3748 VisitForStackValue(args->at(0)); |
3749 VisitForStackValue(args->at(1)); | 3749 VisitForStackValue(args->at(1)); |
3750 | 3750 |
| 3751 // Call the construct call builtin that handles allocation and |
| 3752 // constructor invocation. |
| 3753 SetConstructCallPosition(expr, 0); |
| 3754 |
3751 // Check if the calling frame is an arguments adaptor frame. | 3755 // Check if the calling frame is an arguments adaptor frame. |
3752 Label adaptor_frame, args_set_up, runtime; | 3756 Label adaptor_frame, args_set_up, runtime; |
3753 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 3757 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
3754 __ movp(rbx, Operand(rdx, StandardFrameConstants::kContextOffset)); | 3758 __ movp(rbx, Operand(rdx, StandardFrameConstants::kContextOffset)); |
3755 __ Cmp(rbx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 3759 __ Cmp(rbx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
3756 __ j(equal, &adaptor_frame); | 3760 __ j(equal, &adaptor_frame); |
3757 // default constructor has no arguments, so no adaptor frame means no args. | 3761 // default constructor has no arguments, so no adaptor frame means no args. |
3758 __ movp(rax, Immediate(0)); | 3762 __ movp(rax, Immediate(0)); |
3759 __ jmp(&args_set_up); | 3763 __ jmp(&args_set_up); |
3760 | 3764 |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4975 Assembler::target_address_at(call_target_address, | 4979 Assembler::target_address_at(call_target_address, |
4976 unoptimized_code)); | 4980 unoptimized_code)); |
4977 return OSR_AFTER_STACK_CHECK; | 4981 return OSR_AFTER_STACK_CHECK; |
4978 } | 4982 } |
4979 | 4983 |
4980 | 4984 |
4981 } // namespace internal | 4985 } // namespace internal |
4982 } // namespace v8 | 4986 } // namespace v8 |
4983 | 4987 |
4984 #endif // V8_TARGET_ARCH_X64 | 4988 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |