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-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 7056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7067 HandleCompoundAssignment(expr); | 7067 HandleCompoundAssignment(expr); |
7068 return; | 7068 return; |
7069 } | 7069 } |
7070 | 7070 |
7071 if (prop != NULL) { | 7071 if (prop != NULL) { |
7072 HandlePropertyAssignment(expr); | 7072 HandlePropertyAssignment(expr); |
7073 } else if (proxy != NULL) { | 7073 } else if (proxy != NULL) { |
7074 Variable* var = proxy->var(); | 7074 Variable* var = proxy->var(); |
7075 | 7075 |
7076 if (var->mode() == CONST) { | 7076 if (var->mode() == CONST) { |
7077 if (expr->op() != Token::INIT_CONST) { | 7077 if (expr->op() != Token::INIT) { |
7078 return Bailout(kNonInitializerAssignmentToConst); | 7078 return Bailout(kNonInitializerAssignmentToConst); |
7079 } | 7079 } |
7080 } else if (var->mode() == CONST_LEGACY) { | 7080 } else if (var->mode() == CONST_LEGACY) { |
7081 if (expr->op() != Token::INIT_CONST_LEGACY) { | 7081 if (expr->op() != Token::INIT) { |
7082 CHECK_ALIVE(VisitForValue(expr->value())); | 7082 CHECK_ALIVE(VisitForValue(expr->value())); |
7083 return ast_context()->ReturnValue(Pop()); | 7083 return ast_context()->ReturnValue(Pop()); |
7084 } | 7084 } |
7085 | 7085 |
7086 if (var->IsStackAllocated()) { | 7086 if (var->IsStackAllocated()) { |
7087 // We insert a use of the old value to detect unsupported uses of const | 7087 // We insert a use of the old value to detect unsupported uses of const |
7088 // variables (e.g. initialization inside a loop). | 7088 // variables (e.g. initialization inside a loop). |
7089 HValue* old_value = environment()->Lookup(var); | 7089 HValue* old_value = environment()->Lookup(var); |
7090 Add<HUseConst>(old_value); | 7090 Add<HUseConst>(old_value); |
7091 } | 7091 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7145 break; | 7145 break; |
7146 case CONST: | 7146 case CONST: |
7147 // This case is checked statically so no need to | 7147 // This case is checked statically so no need to |
7148 // perform checks here | 7148 // perform checks here |
7149 UNREACHABLE(); | 7149 UNREACHABLE(); |
7150 case CONST_LEGACY: | 7150 case CONST_LEGACY: |
7151 return ast_context()->ReturnValue(Pop()); | 7151 return ast_context()->ReturnValue(Pop()); |
7152 default: | 7152 default: |
7153 mode = HStoreContextSlot::kNoCheck; | 7153 mode = HStoreContextSlot::kNoCheck; |
7154 } | 7154 } |
7155 } else if (expr->op() == Token::INIT_VAR || | |
7156 expr->op() == Token::INIT_LET || | |
7157 expr->op() == Token::INIT_CONST) { | |
7158 mode = HStoreContextSlot::kNoCheck; | |
7159 } else { | 7155 } else { |
7160 DCHECK(expr->op() == Token::INIT_CONST_LEGACY); | 7156 DCHECK_EQ(Token::INIT, expr->op()); |
7161 | 7157 if (var->mode() == CONST_LEGACY) { |
7162 mode = HStoreContextSlot::kCheckIgnoreAssignment; | 7158 mode = HStoreContextSlot::kCheckIgnoreAssignment; |
| 7159 } else { |
| 7160 mode = HStoreContextSlot::kNoCheck; |
| 7161 } |
7163 } | 7162 } |
7164 | 7163 |
7165 HValue* context = BuildContextChainWalk(var); | 7164 HValue* context = BuildContextChainWalk(var); |
7166 HStoreContextSlot* instr = Add<HStoreContextSlot>( | 7165 HStoreContextSlot* instr = Add<HStoreContextSlot>( |
7167 context, var->index(), mode, Top()); | 7166 context, var->index(), mode, Top()); |
7168 if (instr->HasObservableSideEffects()) { | 7167 if (instr->HasObservableSideEffects()) { |
7169 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); | 7168 Add<HSimulate>(expr->AssignmentId(), REMOVABLE_SIMULATE); |
7170 } | 7169 } |
7171 return ast_context()->ReturnValue(Pop()); | 7170 return ast_context()->ReturnValue(Pop()); |
7172 } | 7171 } |
(...skipping 6465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13638 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13637 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13639 } | 13638 } |
13640 | 13639 |
13641 #ifdef DEBUG | 13640 #ifdef DEBUG |
13642 graph_->Verify(false); // No full verify. | 13641 graph_->Verify(false); // No full verify. |
13643 #endif | 13642 #endif |
13644 } | 13643 } |
13645 | 13644 |
13646 } // namespace internal | 13645 } // namespace internal |
13647 } // namespace v8 | 13646 } // namespace v8 |
OLD | NEW |