| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
| 10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
| (...skipping 7003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7014 | 7014 |
| 7015 HStoreContextSlot::Mode mode; | 7015 HStoreContextSlot::Mode mode; |
| 7016 | 7016 |
| 7017 switch (var->mode()) { | 7017 switch (var->mode()) { |
| 7018 case LET: | 7018 case LET: |
| 7019 mode = HStoreContextSlot::kCheckDeoptimize; | 7019 mode = HStoreContextSlot::kCheckDeoptimize; |
| 7020 break; | 7020 break; |
| 7021 case CONST: | 7021 case CONST: |
| 7022 return Bailout(kNonInitializerAssignmentToConst); | 7022 return Bailout(kNonInitializerAssignmentToConst); |
| 7023 case CONST_LEGACY: | 7023 case CONST_LEGACY: |
| 7024 return ast_context()->ReturnValue(Pop()); | 7024 if (is_strict(function_language_mode())) { |
| 7025 return Bailout(kNonInitializerAssignmentToConst); |
| 7026 } else { |
| 7027 return ast_context()->ReturnValue(Pop()); |
| 7028 } |
| 7025 default: | 7029 default: |
| 7026 mode = HStoreContextSlot::kNoCheck; | 7030 mode = HStoreContextSlot::kNoCheck; |
| 7027 } | 7031 } |
| 7028 | 7032 |
| 7029 HValue* context = BuildContextChainWalk(var); | 7033 HValue* context = BuildContextChainWalk(var); |
| 7030 HStoreContextSlot* instr = Add<HStoreContextSlot>( | 7034 HStoreContextSlot* instr = Add<HStoreContextSlot>( |
| 7031 context, var->index(), mode, Top()); | 7035 context, var->index(), mode, Top()); |
| 7032 if (instr->HasObservableSideEffects()) { | 7036 if (instr->HasObservableSideEffects()) { |
| 7033 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); | 7037 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); |
| 7034 } | 7038 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7082 if (prop != NULL) { | 7086 if (prop != NULL) { |
| 7083 HandlePropertyAssignment(expr); | 7087 HandlePropertyAssignment(expr); |
| 7084 } else if (proxy != NULL) { | 7088 } else if (proxy != NULL) { |
| 7085 Variable* var = proxy->var(); | 7089 Variable* var = proxy->var(); |
| 7086 | 7090 |
| 7087 if (var->mode() == CONST) { | 7091 if (var->mode() == CONST) { |
| 7088 if (expr->op() != Token::INIT) { | 7092 if (expr->op() != Token::INIT) { |
| 7089 return Bailout(kNonInitializerAssignmentToConst); | 7093 return Bailout(kNonInitializerAssignmentToConst); |
| 7090 } | 7094 } |
| 7091 } else if (var->mode() == CONST_LEGACY) { | 7095 } else if (var->mode() == CONST_LEGACY) { |
| 7092 if (expr->op() != Token::INIT) { | 7096 if (expr->op() != Token::INIT && is_strict(function_language_mode())) { |
| 7097 return Bailout(kNonInitializerAssignmentToConst); |
| 7098 } else if (expr->op() != Token::INIT) { |
| 7093 CHECK_ALIVE(VisitForValue(expr->value())); | 7099 CHECK_ALIVE(VisitForValue(expr->value())); |
| 7094 return ast_context()->ReturnValue(Pop()); | 7100 return ast_context()->ReturnValue(Pop()); |
| 7095 } | 7101 } |
| 7096 | 7102 |
| 7097 if (var->IsStackAllocated()) { | 7103 if (var->IsStackAllocated()) { |
| 7098 // We insert a use of the old value to detect unsupported uses of const | 7104 // We insert a use of the old value to detect unsupported uses of const |
| 7099 // variables (e.g. initialization inside a loop). | 7105 // variables (e.g. initialization inside a loop). |
| 7100 HValue* old_value = environment()->Lookup(var); | 7106 HValue* old_value = environment()->Lookup(var); |
| 7101 Add<HUseConst>(old_value); | 7107 Add<HUseConst>(old_value); |
| 7102 } | 7108 } |
| (...skipping 6468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13571 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13577 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13572 } | 13578 } |
| 13573 | 13579 |
| 13574 #ifdef DEBUG | 13580 #ifdef DEBUG |
| 13575 graph_->Verify(false); // No full verify. | 13581 graph_->Verify(false); // No full verify. |
| 13576 #endif | 13582 #endif |
| 13577 } | 13583 } |
| 13578 | 13584 |
| 13579 } // namespace internal | 13585 } // namespace internal |
| 13580 } // namespace v8 | 13586 } // namespace v8 |
| OLD | NEW |