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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 | 15 |
16 class AstNumberingVisitor FINAL : public AstVisitor { | 16 class AstNumberingVisitor FINAL : public AstVisitor { |
17 public: | 17 public: |
18 explicit AstNumberingVisitor(Zone* zone) | 18 explicit AstNumberingVisitor(Isolate* isolate, Zone* zone) |
19 : AstVisitor(), | 19 : AstVisitor(), |
20 next_id_(BailoutId::FirstUsable().ToInt()), | 20 next_id_(BailoutId::FirstUsable().ToInt()), |
21 dont_optimize_reason_(kNoReason) { | 21 dont_optimize_reason_(kNoReason) { |
22 InitializeAstVisitor(zone); | 22 InitializeAstVisitor(isolate, zone); |
23 } | 23 } |
24 | 24 |
25 bool Renumber(FunctionLiteral* node); | 25 bool Renumber(FunctionLiteral* node); |
26 | 26 |
27 private: | 27 private: |
28 // AST node visitor interface. | 28 // AST node visitor interface. |
29 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; | 29 #define DEFINE_VISIT(type) virtual void Visit##type(type* node) OVERRIDE; |
30 AST_NODE_LIST(DEFINE_VISIT) | 30 AST_NODE_LIST(DEFINE_VISIT) |
31 #undef DEFINE_VISIT | 31 #undef DEFINE_VISIT |
32 | 32 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 if (scope->is_function_scope() && scope->function() != NULL) { | 552 if (scope->is_function_scope() && scope->function() != NULL) { |
553 // Visit the name of the named function expression. | 553 // Visit the name of the named function expression. |
554 Visit(scope->function()); | 554 Visit(scope->function()); |
555 } | 555 } |
556 VisitStatements(node->body()); | 556 VisitStatements(node->body()); |
557 | 557 |
558 return Finish(node); | 558 return Finish(node); |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 bool AstNumbering::Renumber(FunctionLiteral* function, Zone* zone) { | 562 bool AstNumbering::Renumber(Isolate* isolate, Zone* zone, |
563 AstNumberingVisitor visitor(zone); | 563 FunctionLiteral* function) { |
| 564 AstNumberingVisitor visitor(isolate, zone); |
564 return visitor.Renumber(function); | 565 return visitor.Renumber(function); |
565 } | 566 } |
566 } | 567 } |
567 } // namespace v8::internal | 568 } // namespace v8::internal |
OLD | NEW |