| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2631 }; | 2631 }; |
| 2632 | 2632 |
| 2633 | 2633 |
| 2634 | 2634 |
| 2635 // ---------------------------------------------------------------------------- | 2635 // ---------------------------------------------------------------------------- |
| 2636 // AstNode factory | 2636 // AstNode factory |
| 2637 | 2637 |
| 2638 template<class Visitor> | 2638 template<class Visitor> |
| 2639 class AstNodeFactory BASE_EMBEDDED { | 2639 class AstNodeFactory BASE_EMBEDDED { |
| 2640 public: | 2640 public: |
| 2641 explicit AstNodeFactory(Isolate* isolate) | 2641 AstNodeFactory(Isolate* isolate, Zone* zone) |
| 2642 : isolate_(isolate), | 2642 : isolate_(isolate), |
| 2643 zone_(isolate_->zone()) { } | 2643 zone_(zone) { } |
| 2644 | 2644 |
| 2645 Visitor* visitor() { return &visitor_; } | 2645 Visitor* visitor() { return &visitor_; } |
| 2646 | 2646 |
| 2647 #define VISIT_AND_RETURN(NodeType, node) \ | 2647 #define VISIT_AND_RETURN(NodeType, node) \ |
| 2648 visitor_.Visit##NodeType((node)); \ | 2648 visitor_.Visit##NodeType((node)); \ |
| 2649 return node; | 2649 return node; |
| 2650 | 2650 |
| 2651 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 2651 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 2652 VariableMode mode, | 2652 VariableMode mode, |
| 2653 Scope* scope) { | 2653 Scope* scope) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 VISIT_AND_RETURN(ModulePath, module) | 2703 VISIT_AND_RETURN(ModulePath, module) |
| 2704 } | 2704 } |
| 2705 | 2705 |
| 2706 ModuleUrl* NewModuleUrl(Handle<String> url) { | 2706 ModuleUrl* NewModuleUrl(Handle<String> url) { |
| 2707 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_); | 2707 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_); |
| 2708 VISIT_AND_RETURN(ModuleUrl, module) | 2708 VISIT_AND_RETURN(ModuleUrl, module) |
| 2709 } | 2709 } |
| 2710 | 2710 |
| 2711 Block* NewBlock(ZoneStringList* labels, | 2711 Block* NewBlock(ZoneStringList* labels, |
| 2712 int capacity, | 2712 int capacity, |
| 2713 bool is_initializer_block, | 2713 bool is_initializer_block) { |
| 2714 Zone* zone) { | |
| 2715 Block* block = new(zone_) Block( | 2714 Block* block = new(zone_) Block( |
| 2716 isolate_, labels, capacity, is_initializer_block, zone); | 2715 isolate_, labels, capacity, is_initializer_block, zone_); |
| 2717 VISIT_AND_RETURN(Block, block) | 2716 VISIT_AND_RETURN(Block, block) |
| 2718 } | 2717 } |
| 2719 | 2718 |
| 2720 #define STATEMENT_WITH_LABELS(NodeType) \ | 2719 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 2721 NodeType* New##NodeType(ZoneStringList* labels) { \ | 2720 NodeType* New##NodeType(ZoneStringList* labels) { \ |
| 2722 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ | 2721 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ |
| 2723 VISIT_AND_RETURN(NodeType, stmt); \ | 2722 VISIT_AND_RETURN(NodeType, stmt); \ |
| 2724 } | 2723 } |
| 2725 STATEMENT_WITH_LABELS(DoWhileStatement) | 2724 STATEMENT_WITH_LABELS(DoWhileStatement) |
| 2726 STATEMENT_WITH_LABELS(WhileStatement) | 2725 STATEMENT_WITH_LABELS(WhileStatement) |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2984 private: | 2983 private: |
| 2985 Isolate* isolate_; | 2984 Isolate* isolate_; |
| 2986 Zone* zone_; | 2985 Zone* zone_; |
| 2987 Visitor visitor_; | 2986 Visitor visitor_; |
| 2988 }; | 2987 }; |
| 2989 | 2988 |
| 2990 | 2989 |
| 2991 } } // namespace v8::internal | 2990 } } // namespace v8::internal |
| 2992 | 2991 |
| 2993 #endif // V8_AST_H_ | 2992 #endif // V8_AST_H_ |
| OLD | NEW |