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 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2947 SetConstructCallPosition(expr, arg_count); | 2947 SetConstructCallPosition(expr, arg_count); |
2948 | 2948 |
2949 // Load function and argument count into edi and eax. | 2949 // Load function and argument count into edi and eax. |
2950 __ Move(eax, Immediate(arg_count)); | 2950 __ Move(eax, Immediate(arg_count)); |
2951 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2951 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2952 | 2952 |
2953 // Record call targets in unoptimized code. | 2953 // Record call targets in unoptimized code. |
2954 __ EmitLoadTypeFeedbackVector(ebx); | 2954 __ EmitLoadTypeFeedbackVector(ebx); |
2955 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 2955 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
2956 | 2956 |
2957 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 2957 CallConstructStub stub(isolate()); |
2958 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2958 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
2959 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2959 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2960 // Restore context register. | 2960 // Restore context register. |
2961 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2961 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2962 context()->Plug(eax); | 2962 context()->Plug(eax); |
2963 } | 2963 } |
2964 | 2964 |
2965 | 2965 |
2966 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 2966 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
2967 SuperCallReference* super_call_ref = | 2967 SuperCallReference* super_call_ref = |
2968 expr->expression()->AsSuperCallReference(); | 2968 expr->expression()->AsSuperCallReference(); |
2969 DCHECK_NOT_NULL(super_call_ref); | 2969 DCHECK_NOT_NULL(super_call_ref); |
2970 | 2970 |
2971 EmitLoadSuperConstructor(super_call_ref); | 2971 EmitLoadSuperConstructor(super_call_ref); |
2972 __ push(result_register()); | 2972 __ push(result_register()); |
2973 | 2973 |
2974 // Push the arguments ("left-to-right") on the stack. | 2974 // Push the arguments ("left-to-right") on the stack. |
2975 ZoneList<Expression*>* args = expr->arguments(); | 2975 ZoneList<Expression*>* args = expr->arguments(); |
2976 int arg_count = args->length(); | 2976 int arg_count = args->length(); |
2977 for (int i = 0; i < arg_count; i++) { | 2977 for (int i = 0; i < arg_count; i++) { |
2978 VisitForStackValue(args->at(i)); | 2978 VisitForStackValue(args->at(i)); |
2979 } | 2979 } |
2980 | 2980 |
2981 // Call the construct call builtin that handles allocation and | 2981 // Call the construct call builtin that handles allocation and |
2982 // constructor invocation. | 2982 // constructor invocation. |
2983 SetConstructCallPosition(expr, arg_count); | 2983 SetConstructCallPosition(expr, arg_count); |
2984 | 2984 |
2985 // Load new target into ecx. | 2985 // Load new target into edx. |
2986 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 2986 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
2987 __ mov(ecx, result_register()); | 2987 __ mov(edx, result_register()); |
2988 | 2988 |
2989 // Load function and argument count into edi and eax. | 2989 // Load function and argument count into edi and eax. |
2990 __ Move(eax, Immediate(arg_count)); | 2990 __ Move(eax, Immediate(arg_count)); |
2991 __ mov(edi, Operand(esp, arg_count * kPointerSize)); | 2991 __ mov(edi, Operand(esp, arg_count * kPointerSize)); |
2992 | 2992 |
2993 // Record call targets in unoptimized code. | 2993 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
2994 __ EmitLoadTypeFeedbackVector(ebx); | |
2995 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | |
2996 | |
2997 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | |
2998 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
2999 | 2994 |
3000 RecordJSReturnSite(expr); | 2995 RecordJSReturnSite(expr); |
3001 | 2996 |
3002 // Restore context register. | 2997 // Restore context register. |
3003 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2998 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
3004 context()->Plug(eax); | 2999 context()->Plug(eax); |
3005 } | 3000 } |
3006 | 3001 |
3007 | 3002 |
3008 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3003 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4924 Assembler::target_address_at(call_target_address, | 4919 Assembler::target_address_at(call_target_address, |
4925 unoptimized_code)); | 4920 unoptimized_code)); |
4926 return OSR_AFTER_STACK_CHECK; | 4921 return OSR_AFTER_STACK_CHECK; |
4927 } | 4922 } |
4928 | 4923 |
4929 | 4924 |
4930 } // namespace internal | 4925 } // namespace internal |
4931 } // namespace v8 | 4926 } // namespace v8 |
4932 | 4927 |
4933 #endif // V8_TARGET_ARCH_IA32 | 4928 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |