| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 3124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3135 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3135 __ mov(edx, Immediate(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
| 3136 | 3136 |
| 3137 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3137 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3138 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3138 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3139 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3139 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 3140 context()->Plug(eax); | 3140 context()->Plug(eax); |
| 3141 } | 3141 } |
| 3142 | 3142 |
| 3143 | 3143 |
| 3144 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3144 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| 3145 if (!ValidateSuperCall(expr)) return; |
| 3146 |
| 3145 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | 3147 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
| 3146 GetVar(eax, new_target_var); | 3148 GetVar(eax, new_target_var); |
| 3147 __ push(eax); | 3149 __ push(eax); |
| 3148 | 3150 |
| 3149 EmitLoadSuperConstructor(); | 3151 EmitLoadSuperConstructor(); |
| 3150 __ push(result_register()); | 3152 __ push(result_register()); |
| 3151 | 3153 |
| 3152 // Push the arguments ("left-to-right") on the stack. | 3154 // Push the arguments ("left-to-right") on the stack. |
| 3153 ZoneList<Expression*>* args = expr->arguments(); | 3155 ZoneList<Expression*>* args = expr->arguments(); |
| 3154 int arg_count = args->length(); | 3156 int arg_count = args->length(); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4071 | 4073 |
| 4072 | 4074 |
| 4073 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 4075 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
| 4074 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | 4076 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
| 4075 GetVar(eax, new_target_var); | 4077 GetVar(eax, new_target_var); |
| 4076 __ push(eax); | 4078 __ push(eax); |
| 4077 | 4079 |
| 4078 EmitLoadSuperConstructor(); | 4080 EmitLoadSuperConstructor(); |
| 4079 __ push(result_register()); | 4081 __ push(result_register()); |
| 4080 | 4082 |
| 4083 SetSourcePosition(expr->position()); |
| 4084 |
| 4081 // Check if the calling frame is an arguments adaptor frame. | 4085 // Check if the calling frame is an arguments adaptor frame. |
| 4082 Label adaptor_frame, args_set_up, runtime; | 4086 Label adaptor_frame, args_set_up, runtime; |
| 4083 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); | 4087 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); |
| 4084 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); | 4088 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); |
| 4085 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4089 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 4086 __ j(equal, &adaptor_frame); | 4090 __ j(equal, &adaptor_frame); |
| 4087 // default constructor has no arguments, so no adaptor frame means no args. | 4091 // default constructor has no arguments, so no adaptor frame means no args. |
| 4088 __ mov(eax, Immediate(0)); | 4092 __ mov(eax, Immediate(0)); |
| 4089 __ jmp(&args_set_up); | 4093 __ jmp(&args_set_up); |
| 4090 | 4094 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4101 StandardFrameConstants::kCallerSPOffset)); | 4105 StandardFrameConstants::kCallerSPOffset)); |
| 4102 Label loop; | 4106 Label loop; |
| 4103 __ bind(&loop); | 4107 __ bind(&loop); |
| 4104 __ push(Operand(edx, -1 * kPointerSize)); | 4108 __ push(Operand(edx, -1 * kPointerSize)); |
| 4105 __ sub(edx, Immediate(kPointerSize)); | 4109 __ sub(edx, Immediate(kPointerSize)); |
| 4106 __ dec(ecx); | 4110 __ dec(ecx); |
| 4107 __ j(not_zero, &loop); | 4111 __ j(not_zero, &loop); |
| 4108 } | 4112 } |
| 4109 | 4113 |
| 4110 __ bind(&args_set_up); | 4114 __ bind(&args_set_up); |
| 4115 |
| 4111 __ mov(edi, Operand(esp, eax, times_pointer_size, 0)); | 4116 __ mov(edi, Operand(esp, eax, times_pointer_size, 0)); |
| 4112 | 4117 |
| 4113 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | 4118 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); |
| 4114 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 4119 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 4115 | 4120 |
| 4116 __ Drop(1); | 4121 __ Drop(1); |
| 4117 | 4122 |
| 4118 context()->Plug(eax); | 4123 context()->Plug(eax); |
| 4119 } | 4124 } |
| 4120 | 4125 |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5351 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5356 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5352 Assembler::target_address_at(call_target_address, | 5357 Assembler::target_address_at(call_target_address, |
| 5353 unoptimized_code)); | 5358 unoptimized_code)); |
| 5354 return OSR_AFTER_STACK_CHECK; | 5359 return OSR_AFTER_STACK_CHECK; |
| 5355 } | 5360 } |
| 5356 | 5361 |
| 5357 | 5362 |
| 5358 } } // namespace v8::internal | 5363 } } // namespace v8::internal |
| 5359 | 5364 |
| 5360 #endif // V8_TARGET_ARCH_IA32 | 5365 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |