Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: src/ast/ast.h

Issue 2374963002: Preparse top-level functions in discardable zones (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698