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 #ifndef V8_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
(...skipping 3528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3539 // Handles use of temporary zones when parsing inner function bodies. | 3539 // Handles use of temporary zones when parsing inner function bodies. |
3540 class BodyScope { | 3540 class BodyScope { |
3541 public: | 3541 public: |
3542 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) | 3542 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone) |
3543 : factory_(factory), prev_zone_(factory->zone_) { | 3543 : factory_(factory), prev_zone_(factory->zone_) { |
3544 if (use_temp_zone) { | 3544 if (use_temp_zone) { |
3545 factory->zone_ = temp_zone; | 3545 factory->zone_ = temp_zone; |
3546 } | 3546 } |
3547 } | 3547 } |
3548 | 3548 |
3549 ~BodyScope() { factory_->zone_ = prev_zone_; } | 3549 void Reset() { factory_->zone_ = prev_zone_; } |
| 3550 ~BodyScope() { Reset(); } |
3550 | 3551 |
3551 private: | 3552 private: |
3552 AstNodeFactory* factory_; | 3553 AstNodeFactory* factory_; |
3553 Zone* prev_zone_; | 3554 Zone* prev_zone_; |
3554 }; | 3555 }; |
3555 | 3556 |
3556 private: | 3557 private: |
3557 // This zone may be deallocated upon returning from parsing a function body | 3558 // This zone may be deallocated upon returning from parsing a function body |
3558 // which we can guarantee is not going to be compiled or have its AST | 3559 // which we can guarantee is not going to be compiled or have its AST |
3559 // inspected. | 3560 // inspected. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3600 : NULL; \ | 3601 : NULL; \ |
3601 } | 3602 } |
3602 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3603 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3603 #undef DECLARE_NODE_FUNCTIONS | 3604 #undef DECLARE_NODE_FUNCTIONS |
3604 | 3605 |
3605 | 3606 |
3606 } // namespace internal | 3607 } // namespace internal |
3607 } // namespace v8 | 3608 } // namespace v8 |
3608 | 3609 |
3609 #endif // V8_AST_AST_H_ | 3610 #endif // V8_AST_AST_H_ |
OLD | NEW |