| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
| (...skipping 3474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3485 value = BuildHoleCheckSilent(current, value, current); | 3485 value = BuildHoleCheckSilent(current, value, current); |
| 3486 } | 3486 } |
| 3487 } else if (mode == CONST_LEGACY && op != Token::INIT_CONST_LEGACY) { | 3487 } else if (mode == CONST_LEGACY && op != Token::INIT_CONST_LEGACY) { |
| 3488 // Non-initializing assignment to legacy const is | 3488 // Non-initializing assignment to legacy const is |
| 3489 // - exception in strict mode. | 3489 // - exception in strict mode. |
| 3490 // - ignored in sloppy mode. | 3490 // - ignored in sloppy mode. |
| 3491 if (is_strict(language_mode())) { | 3491 if (is_strict(language_mode())) { |
| 3492 return BuildThrowConstAssignError(bailout_id); | 3492 return BuildThrowConstAssignError(bailout_id); |
| 3493 } | 3493 } |
| 3494 return value; | 3494 return value; |
| 3495 } else if (mode == LET && op == Token::INIT_LET) { |
| 3496 // No initialization check needed because scoping guarantees it. Note |
| 3497 // that we still perform a lookup to keep the variable live, because |
| 3498 // baseline code might contain debug code that inspects the variable. |
| 3499 Node* current = environment()->Lookup(variable); |
| 3500 CHECK_NOT_NULL(current); |
| 3495 } else if (mode == LET && op != Token::INIT_LET) { | 3501 } else if (mode == LET && op != Token::INIT_LET) { |
| 3496 // Perform an initialization check for let declared variables. | 3502 // Perform an initialization check for let declared variables. |
| 3497 Node* current = environment()->Lookup(variable); | 3503 Node* current = environment()->Lookup(variable); |
| 3498 if (current->op() == the_hole->op()) { | 3504 if (current->op() == the_hole->op()) { |
| 3499 value = BuildThrowReferenceError(variable, bailout_id); | 3505 return BuildThrowReferenceError(variable, bailout_id); |
| 3500 } else if (current->opcode() == IrOpcode::kPhi) { | 3506 } else if (current->opcode() == IrOpcode::kPhi) { |
| 3501 value = BuildHoleCheckThenThrow(current, variable, value, bailout_id); | 3507 BuildHoleCheckThenThrow(current, variable, value, bailout_id); |
| 3502 } | 3508 } |
| 3503 } else if (mode == CONST && op == Token::INIT_CONST) { | 3509 } else if (mode == CONST && op == Token::INIT_CONST) { |
| 3504 // Perform an initialization check for const {this} variables. | 3510 // Perform an initialization check for const {this} variables. |
| 3505 // Note that the {this} variable is the only const variable being able | 3511 // Note that the {this} variable is the only const variable being able |
| 3506 // to trigger bind operations outside the TDZ, via {super} calls. | 3512 // to trigger bind operations outside the TDZ, via {super} calls. |
| 3507 Node* current = environment()->Lookup(variable); | 3513 Node* current = environment()->Lookup(variable); |
| 3508 if (current->op() != the_hole->op() && variable->is_this()) { | 3514 if (current->op() != the_hole->op() && variable->is_this()) { |
| 3509 value = BuildHoleCheckElseThrow(current, variable, value, bailout_id); | 3515 value = BuildHoleCheckElseThrow(current, variable, value, bailout_id); |
| 3510 } | 3516 } |
| 3511 } else if (mode == CONST && op != Token::INIT_CONST) { | 3517 } else if (mode == CONST && op != Token::INIT_CONST) { |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4288 // Phi does not exist yet, introduce one. | 4294 // Phi does not exist yet, introduce one. |
| 4289 value = NewPhi(inputs, value, control); | 4295 value = NewPhi(inputs, value, control); |
| 4290 value->ReplaceInput(inputs - 1, other); | 4296 value->ReplaceInput(inputs - 1, other); |
| 4291 } | 4297 } |
| 4292 return value; | 4298 return value; |
| 4293 } | 4299 } |
| 4294 | 4300 |
| 4295 } // namespace compiler | 4301 } // namespace compiler |
| 4296 } // namespace internal | 4302 } // namespace internal |
| 4297 } // namespace v8 | 4303 } // namespace v8 |
| OLD | NEW |