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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 } | 1085 } |
1086 } | 1086 } |
1087 | 1087 |
1088 | 1088 |
1089 void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) { | 1089 void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) { |
1090 Variable* variable = decl->proxy()->var(); | 1090 Variable* variable = decl->proxy()->var(); |
1091 VariableMode mode = decl->mode(); | 1091 VariableMode mode = decl->mode(); |
1092 bool hole_init = mode == CONST || mode == LET; | 1092 bool hole_init = mode == CONST || mode == LET; |
1093 switch (variable->location()) { | 1093 switch (variable->location()) { |
1094 case VariableLocation::GLOBAL: | 1094 case VariableLocation::GLOBAL: |
1095 case VariableLocation::UNALLOCATED: { | 1095 case VariableLocation::UNALLOCATED: |
1096 Handle<Oddball> value = variable->binding_needs_init() | 1096 DCHECK(!variable->binding_needs_init()); |
1097 ? isolate()->factory()->the_hole_value() | |
1098 : isolate()->factory()->undefined_value(); | |
1099 globals()->push_back(variable->name()); | 1097 globals()->push_back(variable->name()); |
1100 globals()->push_back(value); | 1098 globals()->push_back(isolate()->factory()->undefined_value()); |
1101 break; | 1099 break; |
1102 } | |
1103 case VariableLocation::PARAMETER: | 1100 case VariableLocation::PARAMETER: |
1104 case VariableLocation::LOCAL: | 1101 case VariableLocation::LOCAL: |
1105 if (hole_init) { | 1102 if (hole_init) { |
1106 Node* value = jsgraph()->TheHoleConstant(); | 1103 Node* value = jsgraph()->TheHoleConstant(); |
1107 environment()->Bind(variable, value); | 1104 environment()->Bind(variable, value); |
1108 } | 1105 } |
1109 break; | 1106 break; |
1110 case VariableLocation::CONTEXT: | 1107 case VariableLocation::CONTEXT: |
1111 if (hole_init) { | 1108 if (hole_init) { |
1112 Node* value = jsgraph()->TheHoleConstant(); | 1109 Node* value = jsgraph()->TheHoleConstant(); |
(...skipping 3230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4343 // Phi does not exist yet, introduce one. | 4340 // Phi does not exist yet, introduce one. |
4344 value = NewPhi(inputs, value, control); | 4341 value = NewPhi(inputs, value, control); |
4345 value->ReplaceInput(inputs - 1, other); | 4342 value->ReplaceInput(inputs - 1, other); |
4346 } | 4343 } |
4347 return value; | 4344 return value; |
4348 } | 4345 } |
4349 | 4346 |
4350 } // namespace compiler | 4347 } // namespace compiler |
4351 } // namespace internal | 4348 } // namespace internal |
4352 } // namespace v8 | 4349 } // namespace v8 |
OLD | NEW |