| 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 18 matching lines...) Expand all Loading... |
| 29 private: | 29 private: |
| 30 // AST node visitor interface. | 30 // AST node visitor interface. |
| 31 #define DEFINE_VISIT(type) void Visit##type(type* node); | 31 #define DEFINE_VISIT(type) void Visit##type(type* node); |
| 32 AST_NODE_LIST(DEFINE_VISIT) | 32 AST_NODE_LIST(DEFINE_VISIT) |
| 33 #undef DEFINE_VISIT | 33 #undef DEFINE_VISIT |
| 34 | 34 |
| 35 void VisitVariableProxyReference(VariableProxy* node); | 35 void VisitVariableProxyReference(VariableProxy* node); |
| 36 void VisitPropertyReference(Property* node); | 36 void VisitPropertyReference(Property* node); |
| 37 void VisitReference(Expression* expr); | 37 void VisitReference(Expression* expr); |
| 38 | 38 |
| 39 void VisitStatements(ZoneList<Statement*>* statements); | 39 void VisitStatements(ZoneChunkList<Statement*>* statements); |
| 40 void VisitDeclarations(ZoneList<Declaration*>* declarations); | 40 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| 41 void VisitArguments(ZoneList<Expression*>* arguments); | 41 void VisitArguments(ZoneList<Expression*>* arguments); |
| 42 void VisitLiteralProperty(LiteralProperty* property); | 42 void VisitLiteralProperty(LiteralProperty* property); |
| 43 | 43 |
| 44 int ReserveIdRange(int n) { | 44 int ReserveIdRange(int n) { |
| 45 int tmp = next_id_; | 45 int tmp = next_id_; |
| 46 next_id_ += n; | 46 next_id_ += n; |
| 47 return tmp; | 47 return tmp; |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 532 |
| 533 | 533 |
| 534 void AstNumberingVisitor::VisitCallNew(CallNew* node) { | 534 void AstNumberingVisitor::VisitCallNew(CallNew* node) { |
| 535 IncrementNodeCount(); | 535 IncrementNodeCount(); |
| 536 ReserveFeedbackSlots(node); | 536 ReserveFeedbackSlots(node); |
| 537 node->set_base_id(ReserveIdRange(CallNew::num_ids())); | 537 node->set_base_id(ReserveIdRange(CallNew::num_ids())); |
| 538 Visit(node->expression()); | 538 Visit(node->expression()); |
| 539 VisitArguments(node->arguments()); | 539 VisitArguments(node->arguments()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 | 542 void AstNumberingVisitor::VisitStatements( |
| 543 void AstNumberingVisitor::VisitStatements(ZoneList<Statement*>* statements) { | 543 ZoneChunkList<Statement*>* statements) { |
| 544 if (statements == NULL) return; | 544 if (statements == NULL) return; |
| 545 for (int i = 0; i < statements->length(); i++) { | 545 for (auto statement : *statements) { |
| 546 Visit(statements->at(i)); | 546 Visit(statement); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 | 549 |
| 550 | 550 |
| 551 void AstNumberingVisitor::VisitDeclarations( | 551 void AstNumberingVisitor::VisitDeclarations( |
| 552 ZoneList<Declaration*>* declarations) { | 552 ZoneList<Declaration*>* declarations) { |
| 553 for (int i = 0; i < declarations->length(); i++) { | 553 for (int i = 0; i < declarations->length(); i++) { |
| 554 Visit(declarations->at(i)); | 554 Visit(declarations->at(i)); |
| 555 } | 555 } |
| 556 } | 556 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 } | 614 } |
| 615 | 615 |
| 616 | 616 |
| 617 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, | 617 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
| 618 FunctionLiteral* function) { | 618 FunctionLiteral* function) { |
| 619 AstNumberingVisitor visitor(isolate, zone); | 619 AstNumberingVisitor visitor(isolate, zone); |
| 620 return visitor.Renumber(function); | 620 return visitor.Renumber(function); |
| 621 } | 621 } |
| 622 } // namespace internal | 622 } // namespace internal |
| 623 } // namespace v8 | 623 } // namespace v8 |
| OLD | NEW |