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 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(); | 3149 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
3150 EmitLoadSuperConstructor(); | 3150 EmitLoadSuperConstructor(); |
3151 __ push(result_register()); | 3151 __ push(result_register()); |
3152 | 3152 |
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. | 3153 // Push the arguments ("left-to-right") on the stack. |
3163 ZoneList<Expression*>* args = expr->arguments(); | 3154 ZoneList<Expression*>* args = expr->arguments(); |
3164 int arg_count = args->length(); | 3155 int arg_count = args->length(); |
3165 for (int i = 0; i < arg_count; i++) { | 3156 for (int i = 0; i < arg_count; i++) { |
3166 VisitForStackValue(args->at(i)); | 3157 VisitForStackValue(args->at(i)); |
3167 } | 3158 } |
3168 | 3159 |
3169 // Call the construct call builtin that handles allocation and | 3160 // Call the construct call builtin that handles allocation and |
3170 // constructor invocation. | 3161 // constructor invocation. |
3171 SetSourcePosition(expr->position()); | 3162 SetSourcePosition(expr->position()); |
(...skipping 15 matching lines...) Expand all Loading... | |
3187 __ LoadHeapObject(ebx, FeedbackVector()); | 3178 __ LoadHeapObject(ebx, FeedbackVector()); |
3188 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | 3179 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
3189 | 3180 |
3190 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 3181 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
3191 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3182 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3192 | 3183 |
3193 __ Drop(1); | 3184 __ Drop(1); |
3194 | 3185 |
3195 RecordJSReturnSite(expr); | 3186 RecordJSReturnSite(expr); |
3196 | 3187 |
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 | |
arv (Not doing code reviews)
2015/02/11 19:36:24
remove one empty line
Dmitry Lomov (no reviews)
2015/02/11 19:55:56
Done.
| |
3197 EmitVariableAssignment(this_var, Token::INIT_CONST); | 3198 EmitVariableAssignment(this_var, Token::INIT_CONST); |
3198 context()->Plug(eax); | 3199 context()->Plug(eax); |
3199 } | 3200 } |
3200 | 3201 |
3201 | 3202 |
3202 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3203 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3203 ZoneList<Expression*>* args = expr->arguments(); | 3204 ZoneList<Expression*>* args = expr->arguments(); |
3204 DCHECK(args->length() == 1); | 3205 DCHECK(args->length() == 1); |
3205 | 3206 |
3206 VisitForAccumulatorValue(args->at(0)); | 3207 VisitForAccumulatorValue(args->at(0)); |
(...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5351 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5352 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5352 Assembler::target_address_at(call_target_address, | 5353 Assembler::target_address_at(call_target_address, |
5353 unoptimized_code)); | 5354 unoptimized_code)); |
5354 return OSR_AFTER_STACK_CHECK; | 5355 return OSR_AFTER_STACK_CHECK; |
5355 } | 5356 } |
5356 | 5357 |
5357 | 5358 |
5358 } } // namespace v8::internal | 5359 } } // namespace v8::internal |
5359 | 5360 |
5360 #endif // V8_TARGET_ARCH_IA32 | 5361 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |