| 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 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 DCHECK(!hole_init); |
| 1136 Node* name = jsgraph()->Constant(variable->name()); | 1136 Node* name = jsgraph()->Constant(variable->name()); |
| 1137 Node* value = jsgraph()->ZeroConstant(); // Indicates no initial value. | 1137 Node* value = jsgraph()->ZeroConstant(); // Indicates no initial value. |
| 1138 Node* attr = | |
| 1139 jsgraph()->Constant(variable->DeclarationPropertyAttributes()); | |
| 1140 const Operator* op = | 1138 const Operator* op = |
| 1141 javascript()->CallRuntime(Runtime::kDeclareLookupSlot); | 1139 javascript()->CallRuntime(Runtime::kDeclareLookupSlot); |
| 1142 Node* store = NewNode(op, name, value, attr); | 1140 Node* store = NewNode(op, name, value); |
| 1143 PrepareFrameState(store, decl->proxy()->id()); | 1141 PrepareFrameState(store, decl->proxy()->id()); |
| 1144 break; | 1142 break; |
| 1145 } | 1143 } |
| 1146 } | 1144 } |
| 1147 } | 1145 } |
| 1148 | 1146 |
| 1149 | 1147 |
| 1150 void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) { | 1148 void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) { |
| 1151 Variable* variable = decl->proxy()->var(); | 1149 Variable* variable = decl->proxy()->var(); |
| 1152 switch (variable->location()) { | 1150 switch (variable->location()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1171 VisitForValue(decl->fun()); | 1169 VisitForValue(decl->fun()); |
| 1172 Node* value = environment()->Pop(); | 1170 Node* value = environment()->Pop(); |
| 1173 const Operator* op = javascript()->StoreContext(0, variable->index()); | 1171 const Operator* op = javascript()->StoreContext(0, variable->index()); |
| 1174 NewNode(op, current_context(), value); | 1172 NewNode(op, current_context(), value); |
| 1175 break; | 1173 break; |
| 1176 } | 1174 } |
| 1177 case VariableLocation::LOOKUP: { | 1175 case VariableLocation::LOOKUP: { |
| 1178 VisitForValue(decl->fun()); | 1176 VisitForValue(decl->fun()); |
| 1179 Node* value = environment()->Pop(); | 1177 Node* value = environment()->Pop(); |
| 1180 Node* name = jsgraph()->Constant(variable->name()); | 1178 Node* name = jsgraph()->Constant(variable->name()); |
| 1181 Node* attr = | |
| 1182 jsgraph()->Constant(variable->DeclarationPropertyAttributes()); | |
| 1183 const Operator* op = | 1179 const Operator* op = |
| 1184 javascript()->CallRuntime(Runtime::kDeclareLookupSlot); | 1180 javascript()->CallRuntime(Runtime::kDeclareLookupSlot); |
| 1185 Node* store = NewNode(op, name, value, attr); | 1181 Node* store = NewNode(op, name, value); |
| 1186 PrepareFrameState(store, decl->proxy()->id()); | 1182 PrepareFrameState(store, decl->proxy()->id()); |
| 1187 break; | 1183 break; |
| 1188 } | 1184 } |
| 1189 } | 1185 } |
| 1190 } | 1186 } |
| 1191 | 1187 |
| 1192 | 1188 |
| 1193 void AstGraphBuilder::VisitImportDeclaration(ImportDeclaration* decl) { | 1189 void AstGraphBuilder::VisitImportDeclaration(ImportDeclaration* decl) { |
| 1194 UNREACHABLE(); | 1190 UNREACHABLE(); |
| 1195 } | 1191 } |
| (...skipping 3169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4365 // Phi does not exist yet, introduce one. | 4361 // Phi does not exist yet, introduce one. |
| 4366 value = NewPhi(inputs, value, control); | 4362 value = NewPhi(inputs, value, control); |
| 4367 value->ReplaceInput(inputs - 1, other); | 4363 value->ReplaceInput(inputs - 1, other); |
| 4368 } | 4364 } |
| 4369 return value; | 4365 return value; |
| 4370 } | 4366 } |
| 4371 | 4367 |
| 4372 } // namespace compiler | 4368 } // namespace compiler |
| 4373 } // namespace internal | 4369 } // namespace internal |
| 4374 } // namespace v8 | 4370 } // namespace v8 |
| OLD | NEW |