| 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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 }; | 2632 }; |
| 2633 | 2633 |
| 2634 | 2634 |
| 2635 | 2635 |
| 2636 // ---------------------------------------------------------------------------- | 2636 // ---------------------------------------------------------------------------- |
| 2637 // AstNode factory | 2637 // AstNode factory |
| 2638 | 2638 |
| 2639 template<class Visitor> | 2639 template<class Visitor> |
| 2640 class AstNodeFactory BASE_EMBEDDED { | 2640 class AstNodeFactory BASE_EMBEDDED { |
| 2641 public: | 2641 public: |
| 2642 explicit AstNodeFactory(Isolate* isolate) | 2642 AstNodeFactory(Isolate* isolate, Zone* zone) |
| 2643 : isolate_(isolate), | 2643 : isolate_(isolate), |
| 2644 zone_(isolate_->zone()) { } | 2644 zone_(zone) { } |
| 2645 | 2645 |
| 2646 Visitor* visitor() { return &visitor_; } | 2646 Visitor* visitor() { return &visitor_; } |
| 2647 | 2647 |
| 2648 #define VISIT_AND_RETURN(NodeType, node) \ | 2648 #define VISIT_AND_RETURN(NodeType, node) \ |
| 2649 visitor_.Visit##NodeType((node)); \ | 2649 visitor_.Visit##NodeType((node)); \ |
| 2650 return node; | 2650 return node; |
| 2651 | 2651 |
| 2652 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 2652 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 2653 VariableMode mode, | 2653 VariableMode mode, |
| 2654 Scope* scope) { | 2654 Scope* scope) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2704 VISIT_AND_RETURN(ModulePath, module) | 2704 VISIT_AND_RETURN(ModulePath, module) |
| 2705 } | 2705 } |
| 2706 | 2706 |
| 2707 ModuleUrl* NewModuleUrl(Handle<String> url) { | 2707 ModuleUrl* NewModuleUrl(Handle<String> url) { |
| 2708 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_); | 2708 ModuleUrl* module = new(zone_) ModuleUrl(url, zone_); |
| 2709 VISIT_AND_RETURN(ModuleUrl, module) | 2709 VISIT_AND_RETURN(ModuleUrl, module) |
| 2710 } | 2710 } |
| 2711 | 2711 |
| 2712 Block* NewBlock(ZoneStringList* labels, | 2712 Block* NewBlock(ZoneStringList* labels, |
| 2713 int capacity, | 2713 int capacity, |
| 2714 bool is_initializer_block, | 2714 bool is_initializer_block) { |
| 2715 Zone* zone) { | |
| 2716 Block* block = new(zone_) Block( | 2715 Block* block = new(zone_) Block( |
| 2717 isolate_, labels, capacity, is_initializer_block, zone); | 2716 isolate_, labels, capacity, is_initializer_block, zone_); |
| 2718 VISIT_AND_RETURN(Block, block) | 2717 VISIT_AND_RETURN(Block, block) |
| 2719 } | 2718 } |
| 2720 | 2719 |
| 2721 #define STATEMENT_WITH_LABELS(NodeType) \ | 2720 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 2722 NodeType* New##NodeType(ZoneStringList* labels) { \ | 2721 NodeType* New##NodeType(ZoneStringList* labels) { \ |
| 2723 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ | 2722 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ |
| 2724 VISIT_AND_RETURN(NodeType, stmt); \ | 2723 VISIT_AND_RETURN(NodeType, stmt); \ |
| 2725 } | 2724 } |
| 2726 STATEMENT_WITH_LABELS(DoWhileStatement) | 2725 STATEMENT_WITH_LABELS(DoWhileStatement) |
| 2727 STATEMENT_WITH_LABELS(WhileStatement) | 2726 STATEMENT_WITH_LABELS(WhileStatement) |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2985 private: | 2984 private: |
| 2986 Isolate* isolate_; | 2985 Isolate* isolate_; |
| 2987 Zone* zone_; | 2986 Zone* zone_; |
| 2988 Visitor visitor_; | 2987 Visitor visitor_; |
| 2989 }; | 2988 }; |
| 2990 | 2989 |
| 2991 | 2990 |
| 2992 } } // namespace v8::internal | 2991 } } // namespace v8::internal |
| 2993 | 2992 |
| 2994 #endif // V8_AST_H_ | 2993 #endif // V8_AST_H_ |
| OLD | NEW |