| 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/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 3898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3909 | 3909 |
| 3910 | 3910 |
| 3911 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3911 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
| 3912 ZoneList<Expression*>* args = expr->arguments(); | 3912 ZoneList<Expression*>* args = expr->arguments(); |
| 3913 DCHECK(args->length() == 2); | 3913 DCHECK(args->length() == 2); |
| 3914 | 3914 |
| 3915 // Evaluate new.target and super constructor. | 3915 // Evaluate new.target and super constructor. |
| 3916 VisitForStackValue(args->at(0)); | 3916 VisitForStackValue(args->at(0)); |
| 3917 VisitForStackValue(args->at(1)); | 3917 VisitForStackValue(args->at(1)); |
| 3918 | 3918 |
| 3919 // Load original constructor into ecx. | |
| 3920 __ mov(ecx, Operand(esp, 1 * kPointerSize)); | |
| 3921 | |
| 3922 // Check if the calling frame is an arguments adaptor frame. | 3919 // Check if the calling frame is an arguments adaptor frame. |
| 3923 Label adaptor_frame, args_set_up, runtime; | 3920 Label adaptor_frame, args_set_up, runtime; |
| 3924 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 3921 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 3925 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); | 3922 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); |
| 3926 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 3923 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 3927 __ j(equal, &adaptor_frame); | 3924 __ j(equal, &adaptor_frame); |
| 3928 // default constructor has no arguments, so no adaptor frame means no args. | 3925 // default constructor has no arguments, so no adaptor frame means no args. |
| 3929 __ mov(eax, Immediate(0)); | 3926 __ mov(eax, Immediate(0)); |
| 3930 __ jmp(&args_set_up); | 3927 __ jmp(&args_set_up); |
| 3931 | 3928 |
| 3932 // Copy arguments from adaptor frame. | 3929 // Copy arguments from adaptor frame. |
| 3933 { | 3930 { |
| 3934 __ bind(&adaptor_frame); | 3931 __ bind(&adaptor_frame); |
| 3935 __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 3932 __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 3936 __ SmiUntag(ebx); | 3933 __ SmiUntag(ebx); |
| 3937 | 3934 |
| 3938 __ mov(eax, ebx); | 3935 __ mov(eax, ebx); |
| 3939 __ lea(edx, Operand(edx, ebx, times_pointer_size, | 3936 __ lea(edx, Operand(edx, ebx, times_pointer_size, |
| 3940 StandardFrameConstants::kCallerSPOffset)); | 3937 StandardFrameConstants::kCallerSPOffset)); |
| 3941 Label loop; | 3938 Label loop; |
| 3942 __ bind(&loop); | 3939 __ bind(&loop); |
| 3943 __ push(Operand(edx, -1 * kPointerSize)); | 3940 __ push(Operand(edx, -1 * kPointerSize)); |
| 3944 __ sub(edx, Immediate(kPointerSize)); | 3941 __ sub(edx, Immediate(kPointerSize)); |
| 3945 __ dec(ebx); | 3942 __ dec(ebx); |
| 3946 __ j(not_zero, &loop); | 3943 __ j(not_zero, &loop); |
| 3947 } | 3944 } |
| 3948 | 3945 |
| 3949 __ bind(&args_set_up); | 3946 __ bind(&args_set_up); |
| 3950 | 3947 |
| 3951 __ mov(edi, Operand(esp, eax, times_pointer_size, 0)); | 3948 __ mov(edx, Operand(esp, eax, times_pointer_size, 1 * kPointerSize)); |
| 3952 __ mov(ebx, Immediate(isolate()->factory()->undefined_value())); | 3949 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize)); |
| 3953 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | 3950 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
| 3954 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
| 3955 | 3951 |
| 3956 // Restore context register. | 3952 // Restore context register. |
| 3957 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3953 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3958 | 3954 |
| 3959 context()->DropAndPlug(1, eax); | 3955 context()->DropAndPlug(1, eax); |
| 3960 } | 3956 } |
| 3961 | 3957 |
| 3962 | 3958 |
| 3963 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 3959 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
| 3964 // Load the arguments on the stack and call the stub. | 3960 // Load the arguments on the stack and call the stub. |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5136 Assembler::target_address_at(call_target_address, | 5132 Assembler::target_address_at(call_target_address, |
| 5137 unoptimized_code)); | 5133 unoptimized_code)); |
| 5138 return OSR_AFTER_STACK_CHECK; | 5134 return OSR_AFTER_STACK_CHECK; |
| 5139 } | 5135 } |
| 5140 | 5136 |
| 5141 | 5137 |
| 5142 } // namespace internal | 5138 } // namespace internal |
| 5143 } // namespace v8 | 5139 } // namespace v8 |
| 5144 | 5140 |
| 5145 #endif // V8_TARGET_ARCH_IA32 | 5141 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |