| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 } | 1125 } |
| 1126 break; | 1126 break; |
| 1127 case VariableLocation::CONTEXT: | 1127 case VariableLocation::CONTEXT: |
| 1128 if (hole_init) { | 1128 if (hole_init) { |
| 1129 Node* value = jsgraph()->TheHoleConstant(); | 1129 Node* value = jsgraph()->TheHoleConstant(); |
| 1130 const Operator* op = javascript()->StoreContext(0, variable->index()); | 1130 const Operator* op = javascript()->StoreContext(0, variable->index()); |
| 1131 NewNode(op, current_context(), value); | 1131 NewNode(op, current_context(), value); |
| 1132 } | 1132 } |
| 1133 break; | 1133 break; |
| 1134 case VariableLocation::LOOKUP: { | 1134 case VariableLocation::LOOKUP: { |
| 1135 DCHECK(!hole_init); |
| 1135 Node* name = jsgraph()->Constant(variable->name()); | 1136 Node* name = jsgraph()->Constant(variable->name()); |
| 1136 // For variables we must not push an initial value (such as 'undefined') | 1137 Node* value = jsgraph()->ZeroConstant(); // Indicates no initial value. |
| 1137 // because we may have a (legal) redeclaration and we must not destroy | |
| 1138 // the current value. | |
| 1139 Node* value = | |
| 1140 hole_init ? jsgraph()->TheHoleConstant() | |
| 1141 : jsgraph()->ZeroConstant(); // Indicates no initial value. | |
| 1142 Node* attr = | 1138 Node* attr = |
| 1143 jsgraph()->Constant(variable->DeclarationPropertyAttributes()); | 1139 jsgraph()->Constant(variable->DeclarationPropertyAttributes()); |
| 1144 const Operator* op = | 1140 const Operator* op = |
| 1145 javascript()->CallRuntime(Runtime::kDeclareLookupSlot); | 1141 javascript()->CallRuntime(Runtime::kDeclareLookupSlot); |
| 1146 Node* store = NewNode(op, name, value, attr); | 1142 Node* store = NewNode(op, name, value, attr); |
| 1147 PrepareFrameState(store, decl->proxy()->id()); | 1143 PrepareFrameState(store, decl->proxy()->id()); |
| 1148 break; | 1144 break; |
| 1149 } | 1145 } |
| 1150 } | 1146 } |
| 1151 } | 1147 } |
| (...skipping 3217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4369 // Phi does not exist yet, introduce one. | 4365 // Phi does not exist yet, introduce one. |
| 4370 value = NewPhi(inputs, value, control); | 4366 value = NewPhi(inputs, value, control); |
| 4371 value->ReplaceInput(inputs - 1, other); | 4367 value->ReplaceInput(inputs - 1, other); |
| 4372 } | 4368 } |
| 4373 return value; | 4369 return value; |
| 4374 } | 4370 } |
| 4375 | 4371 |
| 4376 } // namespace compiler | 4372 } // namespace compiler |
| 4377 } // namespace internal | 4373 } // namespace internal |
| 4378 } // namespace v8 | 4374 } // namespace v8 |
| OLD | NEW |