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 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | 3145 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
3146 GetVar(eax, new_target_var); | 3146 GetVar(eax, new_target_var); |
3147 __ push(eax); | 3147 __ push(eax); |
3148 | 3148 |
3149 SuperReference* super_ref = expr->expression()->AsSuperReference(); | |
3150 EmitLoadSuperConstructor(); | 3149 EmitLoadSuperConstructor(); |
3151 __ push(result_register()); | 3150 __ push(result_register()); |
3152 | 3151 |
3153 Variable* this_var = super_ref->this_var()->var(); | |
3154 GetVar(eax, this_var); | |
3155 __ cmp(eax, isolate()->factory()->the_hole_value()); | |
3156 Label uninitialized_this; | |
3157 __ j(equal, &uninitialized_this); | |
3158 __ push(Immediate(this_var->name())); | |
3159 __ CallRuntime(Runtime::kThrowReferenceError, 1); | |
3160 __ bind(&uninitialized_this); | |
3161 | |
3162 // Push the arguments ("left-to-right") on the stack. | 3152 // Push the arguments ("left-to-right") on the stack. |
3163 ZoneList<Expression*>* args = expr->arguments(); | 3153 ZoneList<Expression*>* args = expr->arguments(); |
3164 int arg_count = args->length(); | 3154 int arg_count = args->length(); |
3165 for (int i = 0; i < arg_count; i++) { | 3155 for (int i = 0; i < arg_count; i++) { |
3166 VisitForStackValue(args->at(i)); | 3156 VisitForStackValue(args->at(i)); |
3167 } | 3157 } |
3168 | 3158 |
3169 // Call the construct call builtin that handles allocation and | 3159 // Call the construct call builtin that handles allocation and |
3170 // constructor invocation. | 3160 // constructor invocation. |
3171 SetSourcePosition(expr->position()); | 3161 SetSourcePosition(expr->position()); |
(...skipping 15 matching lines...) Expand all Loading... |
3187 __ LoadHeapObject(ebx, FeedbackVector()); | 3177 __ LoadHeapObject(ebx, FeedbackVector()); |
3188 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | 3178 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
3189 | 3179 |
3190 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 3180 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
3191 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3181 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3192 | 3182 |
3193 __ Drop(1); | 3183 __ Drop(1); |
3194 | 3184 |
3195 RecordJSReturnSite(expr); | 3185 RecordJSReturnSite(expr); |
3196 | 3186 |
| 3187 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
| 3188 Variable* this_var = super_ref->this_var()->var(); |
| 3189 GetVar(ecx, this_var); |
| 3190 __ cmp(ecx, isolate()->factory()->the_hole_value()); |
| 3191 Label uninitialized_this; |
| 3192 __ j(equal, &uninitialized_this); |
| 3193 __ push(Immediate(this_var->name())); |
| 3194 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 3195 __ bind(&uninitialized_this); |
| 3196 |
3197 EmitVariableAssignment(this_var, Token::INIT_CONST); | 3197 EmitVariableAssignment(this_var, Token::INIT_CONST); |
3198 context()->Plug(eax); | 3198 context()->Plug(eax); |
3199 } | 3199 } |
3200 | 3200 |
3201 | 3201 |
3202 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3202 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3203 ZoneList<Expression*>* args = expr->arguments(); | 3203 ZoneList<Expression*>* args = expr->arguments(); |
3204 DCHECK(args->length() == 1); | 3204 DCHECK(args->length() == 1); |
3205 | 3205 |
3206 VisitForAccumulatorValue(args->at(0)); | 3206 VisitForAccumulatorValue(args->at(0)); |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5351 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5351 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5352 Assembler::target_address_at(call_target_address, | 5352 Assembler::target_address_at(call_target_address, |
5353 unoptimized_code)); | 5353 unoptimized_code)); |
5354 return OSR_AFTER_STACK_CHECK; | 5354 return OSR_AFTER_STACK_CHECK; |
5355 } | 5355 } |
5356 | 5356 |
5357 | 5357 |
5358 } } // namespace v8::internal | 5358 } } // namespace v8::internal |
5359 | 5359 |
5360 #endif // V8_TARGET_ARCH_IA32 | 5360 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |