OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ast/ast-numbering.h" | 5 #include "src/ast/ast-numbering.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { | 206 void AstNumberingVisitor::VisitReturnStatement(ReturnStatement* node) { |
207 IncrementNodeCount(); | 207 IncrementNodeCount(); |
208 Visit(node->expression()); | 208 Visit(node->expression()); |
209 } | 209 } |
210 | 210 |
211 | 211 |
212 void AstNumberingVisitor::VisitYield(Yield* node) { | 212 void AstNumberingVisitor::VisitYield(Yield* node) { |
213 node->set_yield_id(yield_count_); | 213 node->set_yield_id(yield_count_); |
214 yield_count_++; | 214 yield_count_++; |
215 IncrementNodeCount(); | 215 IncrementNodeCount(); |
216 ReserveFeedbackSlots(node); | |
217 node->set_base_id(ReserveIdRange(Yield::num_ids())); | 216 node->set_base_id(ReserveIdRange(Yield::num_ids())); |
218 Visit(node->generator_object()); | 217 Visit(node->generator_object()); |
219 Visit(node->expression()); | 218 Visit(node->expression()); |
220 } | 219 } |
221 | 220 |
222 | 221 |
223 void AstNumberingVisitor::VisitThrow(Throw* node) { | 222 void AstNumberingVisitor::VisitThrow(Throw* node) { |
224 IncrementNodeCount(); | 223 IncrementNodeCount(); |
225 node->set_base_id(ReserveIdRange(Throw::num_ids())); | 224 node->set_base_id(ReserveIdRange(Throw::num_ids())); |
226 Visit(node->exception()); | 225 Visit(node->exception()); |
(...skipping 25 matching lines...) Expand all Loading... |
252 | 251 |
253 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { | 252 void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) { |
254 IncrementNodeCount(); | 253 IncrementNodeCount(); |
255 VisitVariableProxy(node->proxy()); | 254 VisitVariableProxy(node->proxy()); |
256 VisitFunctionLiteral(node->fun()); | 255 VisitFunctionLiteral(node->fun()); |
257 } | 256 } |
258 | 257 |
259 | 258 |
260 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { | 259 void AstNumberingVisitor::VisitCallRuntime(CallRuntime* node) { |
261 IncrementNodeCount(); | 260 IncrementNodeCount(); |
262 ReserveFeedbackSlots(node); | |
263 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); | 261 node->set_base_id(ReserveIdRange(CallRuntime::num_ids())); |
264 VisitArguments(node->arguments()); | 262 VisitArguments(node->arguments()); |
265 } | 263 } |
266 | 264 |
267 | 265 |
268 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { | 266 void AstNumberingVisitor::VisitWithStatement(WithStatement* node) { |
269 IncrementNodeCount(); | 267 IncrementNodeCount(); |
270 DisableCrankshaft(kWithStatement); | 268 DisableCrankshaft(kWithStatement); |
271 node->set_base_id(ReserveIdRange(WithStatement::num_ids())); | 269 node->set_base_id(ReserveIdRange(WithStatement::num_ids())); |
272 Visit(node->expression()); | 270 Visit(node->expression()); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 IncrementNodeCount(); | 386 IncrementNodeCount(); |
389 DisableCrankshaft(kForOfStatement); | 387 DisableCrankshaft(kForOfStatement); |
390 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); | 388 node->set_base_id(ReserveIdRange(ForOfStatement::num_ids())); |
391 Visit(node->assign_iterator()); // Not part of loop. | 389 Visit(node->assign_iterator()); // Not part of loop. |
392 node->set_first_yield_id(yield_count_); | 390 node->set_first_yield_id(yield_count_); |
393 Visit(node->next_result()); | 391 Visit(node->next_result()); |
394 Visit(node->result_done()); | 392 Visit(node->result_done()); |
395 Visit(node->assign_each()); | 393 Visit(node->assign_each()); |
396 Visit(node->body()); | 394 Visit(node->body()); |
397 node->set_yield_count(yield_count_ - node->first_yield_id()); | 395 node->set_yield_count(yield_count_ - node->first_yield_id()); |
398 ReserveFeedbackSlots(node); | |
399 } | 396 } |
400 | 397 |
401 | 398 |
402 void AstNumberingVisitor::VisitConditional(Conditional* node) { | 399 void AstNumberingVisitor::VisitConditional(Conditional* node) { |
403 IncrementNodeCount(); | 400 IncrementNodeCount(); |
404 node->set_base_id(ReserveIdRange(Conditional::num_ids())); | 401 node->set_base_id(ReserveIdRange(Conditional::num_ids())); |
405 Visit(node->condition()); | 402 Visit(node->condition()); |
406 Visit(node->then_expression()); | 403 Visit(node->then_expression()); |
407 Visit(node->else_expression()); | 404 Visit(node->else_expression()); |
408 } | 405 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 } | 585 } |
589 | 586 |
590 | 587 |
591 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 588 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
592 FunctionLiteral* function) { | 589 FunctionLiteral* function) { |
593 AstNumberingVisitor visitor(isolate, zone); | 590 AstNumberingVisitor visitor(isolate, zone); |
594 return visitor.Renumber(function); | 591 return visitor.Renumber(function); |
595 } | 592 } |
596 } // namespace internal | 593 } // namespace internal |
597 } // namespace v8 | 594 } // namespace v8 |
OLD | NEW |