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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1453 // if (false) { const x; }; var y = x; | 1453 // if (false) { const x; }; var y = x; |
1454 // | 1454 // |
1455 // The condition on the declaration scopes is a conservative check for | 1455 // The condition on the declaration scopes is a conservative check for |
1456 // nested functions that access a binding and are called before the | 1456 // nested functions that access a binding and are called before the |
1457 // binding is initialized: | 1457 // binding is initialized: |
1458 // function() { f(); let x = 1; function f() { x = 2; } } | 1458 // function() { f(); let x = 1; function f() { x = 2; } } |
1459 // | 1459 // |
1460 bool skip_init_check; | 1460 bool skip_init_check; |
1461 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { | 1461 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
1462 skip_init_check = false; | 1462 skip_init_check = false; |
| 1463 } else if (var->is_this()) { |
| 1464 // TODO(dslomov): implement 'this' hole check elimination. |
| 1465 skip_init_check = false; |
1463 } else { | 1466 } else { |
1464 // Check that we always have valid source position. | 1467 // Check that we always have valid source position. |
1465 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); | 1468 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
1466 DCHECK(proxy->position() != RelocInfo::kNoPosition); | 1469 DCHECK(proxy->position() != RelocInfo::kNoPosition); |
1467 skip_init_check = var->mode() != CONST_LEGACY && | 1470 skip_init_check = var->mode() != CONST_LEGACY && |
1468 var->initializer_position() < proxy->position(); | 1471 var->initializer_position() < proxy->position(); |
1469 } | 1472 } |
1470 | 1473 |
1471 if (!skip_init_check) { | 1474 if (!skip_init_check) { |
1472 // Let and const need a read barrier. | 1475 // Let and const need a read barrier. |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3166 | 3169 |
3167 __ LoadHeapObject(ebx, FeedbackVector()); | 3170 __ LoadHeapObject(ebx, FeedbackVector()); |
3168 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); | 3171 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); |
3169 | 3172 |
3170 // TODO(dslomov): use a different stub and propagate new.target. | 3173 // TODO(dslomov): use a different stub and propagate new.target. |
3171 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3174 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3172 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3175 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3173 | 3176 |
3174 RecordJSReturnSite(expr); | 3177 RecordJSReturnSite(expr); |
3175 | 3178 |
3176 // TODO(dslomov): implement TDZ for `this`. | 3179 EmitVariableAssignment(super_ref->this_var()->var(), Token::INIT_CONST); |
3177 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); | |
3178 context()->Plug(eax); | 3180 context()->Plug(eax); |
3179 } | 3181 } |
3180 | 3182 |
3181 | 3183 |
3182 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3184 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3183 ZoneList<Expression*>* args = expr->arguments(); | 3185 ZoneList<Expression*>* args = expr->arguments(); |
3184 DCHECK(args->length() == 1); | 3186 DCHECK(args->length() == 1); |
3185 | 3187 |
3186 VisitForAccumulatorValue(args->at(0)); | 3188 VisitForAccumulatorValue(args->at(0)); |
3187 | 3189 |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5282 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5284 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5283 Assembler::target_address_at(call_target_address, | 5285 Assembler::target_address_at(call_target_address, |
5284 unoptimized_code)); | 5286 unoptimized_code)); |
5285 return OSR_AFTER_STACK_CHECK; | 5287 return OSR_AFTER_STACK_CHECK; |
5286 } | 5288 } |
5287 | 5289 |
5288 | 5290 |
5289 } } // namespace v8::internal | 5291 } } // namespace v8::internal |
5290 | 5292 |
5291 #endif // V8_TARGET_ARCH_IA32 | 5293 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |