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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 void AstNumberingVisitor::VisitProperty(Property* node) { | 342 void AstNumberingVisitor::VisitProperty(Property* node) { |
343 VisitPropertyReference(node); | 343 VisitPropertyReference(node); |
344 ReserveFeedbackSlots(node); | 344 ReserveFeedbackSlots(node); |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 void AstNumberingVisitor::VisitAssignment(Assignment* node) { | 348 void AstNumberingVisitor::VisitAssignment(Assignment* node) { |
349 IncrementNodeCount(); | 349 IncrementNodeCount(); |
350 node->set_base_id(ReserveIdRange(Assignment::num_ids())); | 350 node->set_base_id(ReserveIdRange(Assignment::num_ids())); |
| 351 |
351 if (node->is_compound()) VisitBinaryOperation(node->binary_operation()); | 352 if (node->is_compound()) VisitBinaryOperation(node->binary_operation()); |
352 VisitReference(node->target()); | 353 VisitReference(node->target()); |
353 Visit(node->value()); | 354 Visit(node->value()); |
354 ReserveFeedbackSlots(node); | 355 ReserveFeedbackSlots(node); |
355 } | 356 } |
356 | 357 |
357 | 358 |
358 void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) { | 359 void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) { |
359 IncrementNodeCount(); | 360 IncrementNodeCount(); |
360 node->set_base_id(ReserveIdRange(BinaryOperation::num_ids())); | 361 node->set_base_id(ReserveIdRange(BinaryOperation::num_ids())); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 550 |
550 | 551 |
551 void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) { | 552 void AstNumberingVisitor::VisitFunctionLiteral(FunctionLiteral* node) { |
552 IncrementNodeCount(); | 553 IncrementNodeCount(); |
553 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); | 554 node->set_base_id(ReserveIdRange(FunctionLiteral::num_ids())); |
554 // We don't recurse into the declarations or body of the function literal: | 555 // We don't recurse into the declarations or body of the function literal: |
555 // you have to separately Renumber() each FunctionLiteral that you compile. | 556 // you have to separately Renumber() each FunctionLiteral that you compile. |
556 } | 557 } |
557 | 558 |
558 | 559 |
| 560 void AstNumberingVisitor::VisitRewritableExpression( |
| 561 RewritableExpression* node) { |
| 562 Visit(node->expression()); |
| 563 } |
| 564 |
| 565 |
559 bool AstNumberingVisitor::Finish(FunctionLiteral* node) { | 566 bool AstNumberingVisitor::Finish(FunctionLiteral* node) { |
560 node->set_ast_properties(&properties_); | 567 node->set_ast_properties(&properties_); |
561 node->set_dont_optimize_reason(dont_optimize_reason()); | 568 node->set_dont_optimize_reason(dont_optimize_reason()); |
562 return !HasStackOverflow(); | 569 return !HasStackOverflow(); |
563 } | 570 } |
564 | 571 |
565 | 572 |
566 bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { | 573 bool AstNumberingVisitor::Renumber(FunctionLiteral* node) { |
567 Scope* scope = node->scope(); | 574 Scope* scope = node->scope(); |
568 | 575 |
(...skipping 14 matching lines...) Expand all Loading... |
583 } | 590 } |
584 | 591 |
585 | 592 |
586 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 593 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
587 FunctionLiteral* function) { | 594 FunctionLiteral* function) { |
588 AstNumberingVisitor visitor(isolate, zone); | 595 AstNumberingVisitor visitor(isolate, zone); |
589 return visitor.Renumber(function); | 596 return visitor.Renumber(function); |
590 } | 597 } |
591 } // namespace internal | 598 } // namespace internal |
592 } // namespace v8 | 599 } // namespace v8 |
OLD | NEW |