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/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/control-builders.h" | 8 #include "src/compiler/control-builders.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 locals_count_(scope->num_stack_slots()), | 170 locals_count_(scope->num_stack_slots()), |
171 parameters_node_(NULL), | 171 parameters_node_(NULL), |
172 locals_node_(NULL), | 172 locals_node_(NULL), |
173 stack_node_(NULL), | 173 stack_node_(NULL), |
174 parameters_dirty_(false), | 174 parameters_dirty_(false), |
175 locals_dirty_(false), | 175 locals_dirty_(false), |
176 stack_dirty_(false) { | 176 stack_dirty_(false) { |
177 ASSERT_EQ(scope->num_parameters() + 1, parameters_count()); | 177 ASSERT_EQ(scope->num_parameters() + 1, parameters_count()); |
178 | 178 |
179 // Bind the receiver variable. | 179 // Bind the receiver variable. |
180 values()->insert(values()->end(), parameters_count(), | |
181 static_cast<Node*>(NULL)); | |
182 Node* receiver = builder->graph()->NewNode(common()->Parameter(0)); | 180 Node* receiver = builder->graph()->NewNode(common()->Parameter(0)); |
183 Bind(scope->receiver(), receiver); | 181 values()->push_back(receiver); |
184 | 182 |
185 // Bind all parameter variables. The parameter indices are shifted by 1 | 183 // Bind all parameter variables. The parameter indices are shifted by 1 |
186 // (receiver is parameter index -1 but environment index 0). | 184 // (receiver is parameter index -1 but environment index 0). |
187 for (int i = 0; i < scope->num_parameters(); ++i) { | 185 for (int i = 0; i < scope->num_parameters(); ++i) { |
188 // Unused parameters are allocated to Variable::UNALLOCATED. | |
189 if (!scope->parameter(i)->IsParameter()) continue; | |
190 Node* parameter = builder->graph()->NewNode(common()->Parameter(i + 1)); | 186 Node* parameter = builder->graph()->NewNode(common()->Parameter(i + 1)); |
191 Bind(scope->parameter(i), parameter); | 187 values()->push_back(parameter); |
192 } | 188 } |
193 | 189 |
194 // Bind all local variables to undefined. | 190 // Bind all local variables to undefined. |
195 Node* undefined_constant = builder->jsgraph()->UndefinedConstant(); | 191 Node* undefined_constant = builder->jsgraph()->UndefinedConstant(); |
196 values()->insert(values()->end(), locals_count(), undefined_constant); | 192 values()->insert(values()->end(), locals_count(), undefined_constant); |
197 } | 193 } |
198 | 194 |
199 | 195 |
200 AstGraphBuilder::Environment::Environment(const Environment& copy) | 196 AstGraphBuilder::Environment::Environment(const Environment& copy) |
201 : StructuredGraphBuilder::Environment( | 197 : StructuredGraphBuilder::Environment( |
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 | 1977 |
1982 // Continue with the original environment. | 1978 // Continue with the original environment. |
1983 set_environment(continuation_env); | 1979 set_environment(continuation_env); |
1984 | 1980 |
1985 NewNode(common()->Continuation()); | 1981 NewNode(common()->Continuation()); |
1986 } | 1982 } |
1987 } | 1983 } |
1988 } | 1984 } |
1989 } | 1985 } |
1990 } // namespace v8::internal::compiler | 1986 } // namespace v8::internal::compiler |
OLD | NEW |