Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 436553003: Ensure environment does not contain nil values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler/graph-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/compiler/graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698