| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 // if (false) { const x; }; var y = x; | 1488 // if (false) { const x; }; var y = x; |
| 1489 // | 1489 // |
| 1490 // The condition on the declaration scopes is a conservative check for | 1490 // The condition on the declaration scopes is a conservative check for |
| 1491 // nested functions that access a binding and are called before the | 1491 // nested functions that access a binding and are called before the |
| 1492 // binding is initialized: | 1492 // binding is initialized: |
| 1493 // function() { f(); let x = 1; function f() { x = 2; } } | 1493 // function() { f(); let x = 1; function f() { x = 2; } } |
| 1494 // | 1494 // |
| 1495 bool skip_init_check; | 1495 bool skip_init_check; |
| 1496 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { | 1496 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
| 1497 skip_init_check = false; | 1497 skip_init_check = false; |
| 1498 } else if (var->is_this()) { |
| 1499 // TODO(dslomov): implement 'this' hole check elimination. |
| 1500 skip_init_check = false; |
| 1498 } else { | 1501 } else { |
| 1499 // Check that we always have valid source position. | 1502 // Check that we always have valid source position. |
| 1500 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); | 1503 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
| 1501 DCHECK(proxy->position() != RelocInfo::kNoPosition); | 1504 DCHECK(proxy->position() != RelocInfo::kNoPosition); |
| 1502 skip_init_check = var->mode() != CONST_LEGACY && | 1505 skip_init_check = var->mode() != CONST_LEGACY && |
| 1503 var->initializer_position() < proxy->position(); | 1506 var->initializer_position() < proxy->position(); |
| 1504 } | 1507 } |
| 1505 | 1508 |
| 1506 if (!skip_init_check) { | 1509 if (!skip_init_check) { |
| 1507 // Let and const need a read barrier. | 1510 // Let and const need a read barrier. |
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3170 | 3173 |
| 3171 __ Move(rbx, FeedbackVector()); | 3174 __ Move(rbx, FeedbackVector()); |
| 3172 __ Move(rdx, SmiFromSlot(expr->CallFeedbackSlot())); | 3175 __ Move(rdx, SmiFromSlot(expr->CallFeedbackSlot())); |
| 3173 | 3176 |
| 3174 // TODO(dslomov): use a different stub and propagate new.target. | 3177 // TODO(dslomov): use a different stub and propagate new.target. |
| 3175 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3178 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3176 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3179 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3177 | 3180 |
| 3178 RecordJSReturnSite(expr); | 3181 RecordJSReturnSite(expr); |
| 3179 | 3182 |
| 3180 // TODO(dslomov): implement TDZ for `this`. | 3183 EmitVariableAssignment(super_ref->this_var()->var(), Token::INIT_CONST); |
| 3181 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); | |
| 3182 context()->Plug(rax); | 3184 context()->Plug(rax); |
| 3183 } | 3185 } |
| 3184 | 3186 |
| 3185 | 3187 |
| 3186 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3188 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 3187 ZoneList<Expression*>* args = expr->arguments(); | 3189 ZoneList<Expression*>* args = expr->arguments(); |
| 3188 DCHECK(args->length() == 1); | 3190 DCHECK(args->length() == 1); |
| 3189 | 3191 |
| 3190 VisitForAccumulatorValue(args->at(0)); | 3192 VisitForAccumulatorValue(args->at(0)); |
| 3191 | 3193 |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5302 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5304 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5303 Assembler::target_address_at(call_target_address, | 5305 Assembler::target_address_at(call_target_address, |
| 5304 unoptimized_code)); | 5306 unoptimized_code)); |
| 5305 return OSR_AFTER_STACK_CHECK; | 5307 return OSR_AFTER_STACK_CHECK; |
| 5306 } | 5308 } |
| 5307 | 5309 |
| 5308 | 5310 |
| 5309 } } // namespace v8::internal | 5311 } } // namespace v8::internal |
| 5310 | 5312 |
| 5311 #endif // V8_TARGET_ARCH_X64 | 5313 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |