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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 // if (false) { const x; }; var y = x; | 1531 // if (false) { const x; }; var y = x; |
1532 // | 1532 // |
1533 // The condition on the declaration scopes is a conservative check for | 1533 // The condition on the declaration scopes is a conservative check for |
1534 // nested functions that access a binding and are called before the | 1534 // nested functions that access a binding and are called before the |
1535 // binding is initialized: | 1535 // binding is initialized: |
1536 // function() { f(); let x = 1; function f() { x = 2; } } | 1536 // function() { f(); let x = 1; function f() { x = 2; } } |
1537 // | 1537 // |
1538 bool skip_init_check; | 1538 bool skip_init_check; |
1539 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { | 1539 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
1540 skip_init_check = false; | 1540 skip_init_check = false; |
| 1541 } else if (var->is_this()) { |
| 1542 CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); |
| 1543 // TODO(dslomov): implement 'this' hole check elimination. |
| 1544 skip_init_check = false; |
1541 } else { | 1545 } else { |
1542 // Check that we always have valid source position. | 1546 // Check that we always have valid source position. |
1543 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); | 1547 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
1544 DCHECK(proxy->position() != RelocInfo::kNoPosition); | 1548 DCHECK(proxy->position() != RelocInfo::kNoPosition); |
1545 skip_init_check = var->mode() != CONST_LEGACY && | 1549 skip_init_check = var->mode() != CONST_LEGACY && |
1546 var->initializer_position() < proxy->position(); | 1550 var->initializer_position() < proxy->position(); |
1547 } | 1551 } |
1548 | 1552 |
1549 if (!skip_init_check) { | 1553 if (!skip_init_check) { |
1550 // Let and const need a read barrier. | 1554 // Let and const need a read barrier. |
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3242 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3246 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3243 context()->Plug(r0); | 3247 context()->Plug(r0); |
3244 } | 3248 } |
3245 | 3249 |
3246 | 3250 |
3247 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3251 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
3248 SuperReference* super_ref = expr->expression()->AsSuperReference(); | 3252 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
3249 EmitLoadSuperConstructor(super_ref); | 3253 EmitLoadSuperConstructor(super_ref); |
3250 __ push(result_register()); | 3254 __ push(result_register()); |
3251 | 3255 |
| 3256 Variable* this_var = super_ref->this_var()->var(); |
| 3257 |
| 3258 GetVar(r0, this_var); |
| 3259 __ CompareRoot(r0, Heap::kTheHoleValueRootIndex); |
| 3260 Label uninitialized_this; |
| 3261 __ b(eq, &uninitialized_this); |
| 3262 __ mov(r0, Operand(this_var->name())); |
| 3263 __ Push(r0); |
| 3264 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 3265 __ bind(&uninitialized_this); |
| 3266 |
3252 // Push the arguments ("left-to-right") on the stack. | 3267 // Push the arguments ("left-to-right") on the stack. |
3253 ZoneList<Expression*>* args = expr->arguments(); | 3268 ZoneList<Expression*>* args = expr->arguments(); |
3254 int arg_count = args->length(); | 3269 int arg_count = args->length(); |
3255 for (int i = 0; i < arg_count; i++) { | 3270 for (int i = 0; i < arg_count; i++) { |
3256 VisitForStackValue(args->at(i)); | 3271 VisitForStackValue(args->at(i)); |
3257 } | 3272 } |
3258 | 3273 |
3259 // Call the construct call builtin that handles allocation and | 3274 // Call the construct call builtin that handles allocation and |
3260 // constructor invocation. | 3275 // constructor invocation. |
3261 SetSourcePosition(expr->position()); | 3276 SetSourcePosition(expr->position()); |
(...skipping 14 matching lines...) Expand all Loading... |
3276 | 3291 |
3277 __ Move(r2, FeedbackVector()); | 3292 __ Move(r2, FeedbackVector()); |
3278 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); | 3293 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); |
3279 | 3294 |
3280 // TODO(dslomov): use a different stub and propagate new.target. | 3295 // TODO(dslomov): use a different stub and propagate new.target. |
3281 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3296 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3282 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3297 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3283 | 3298 |
3284 RecordJSReturnSite(expr); | 3299 RecordJSReturnSite(expr); |
3285 | 3300 |
3286 // TODO(dslomov): implement TDZ for `this`. | 3301 EmitVariableAssignment(this_var, Token::INIT_CONST); |
3287 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); | |
3288 context()->Plug(r0); | 3302 context()->Plug(r0); |
3289 } | 3303 } |
3290 | 3304 |
3291 | 3305 |
3292 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3306 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3293 ZoneList<Expression*>* args = expr->arguments(); | 3307 ZoneList<Expression*>* args = expr->arguments(); |
3294 DCHECK(args->length() == 1); | 3308 DCHECK(args->length() == 1); |
3295 | 3309 |
3296 VisitForAccumulatorValue(args->at(0)); | 3310 VisitForAccumulatorValue(args->at(0)); |
3297 | 3311 |
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5405 | 5419 |
5406 DCHECK(interrupt_address == | 5420 DCHECK(interrupt_address == |
5407 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5421 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5408 return OSR_AFTER_STACK_CHECK; | 5422 return OSR_AFTER_STACK_CHECK; |
5409 } | 5423 } |
5410 | 5424 |
5411 | 5425 |
5412 } } // namespace v8::internal | 5426 } } // namespace v8::internal |
5413 | 5427 |
5414 #endif // V8_TARGET_ARCH_ARM | 5428 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |