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

Side by Side Diff: src/ast.h

Issue 1354523003: Fix temp_zone scoping when parsing inner function literals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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/parser.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_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast-value-factory.h" 9 #include "src/ast-value-factory.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3669 3669
3670 EmptyParentheses* NewEmptyParentheses(int pos) { 3670 EmptyParentheses* NewEmptyParentheses(int pos) {
3671 return new (local_zone_) EmptyParentheses(local_zone_, pos); 3671 return new (local_zone_) EmptyParentheses(local_zone_, pos);
3672 } 3672 }
3673 3673
3674 Zone* zone() const { return local_zone_; } 3674 Zone* zone() const { return local_zone_; }
3675 3675
3676 // Handles use of temporary zones when parsing inner function bodies. 3676 // Handles use of temporary zones when parsing inner function bodies.
3677 class BodyScope { 3677 class BodyScope {
3678 public: 3678 public:
3679 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool can_use_temp_zone) 3679 BodyScope(AstNodeFactory* factory, Zone* temp_zone, bool use_temp_zone)
3680 : factory_(factory), prev_zone_(factory->local_zone_) { 3680 : factory_(factory), prev_zone_(factory->local_zone_) {
3681 if (can_use_temp_zone) { 3681 if (use_temp_zone) {
3682 factory->local_zone_ = temp_zone; 3682 factory->local_zone_ = temp_zone;
3683 } 3683 }
3684 } 3684 }
3685 3685
3686 ~BodyScope() { factory_->local_zone_ = prev_zone_; } 3686 ~BodyScope() { factory_->local_zone_ = prev_zone_; }
3687 3687
3688 private: 3688 private:
3689 AstNodeFactory* factory_; 3689 AstNodeFactory* factory_;
3690 Zone* prev_zone_; 3690 Zone* prev_zone_;
3691 }; 3691 };
3692 3692
3693 private: 3693 private:
3694 // This zone may be deallocated upon returning from parsing a function body 3694 // This zone may be deallocated upon returning from parsing a function body
3695 // which we can guarantee is not going to be compiled or have its AST 3695 // which we can guarantee is not going to be compiled or have its AST
3696 // inspected. 3696 // inspected.
3697 // See ParseFunctionLiteral in parser.cc for preconditions. 3697 // See ParseFunctionLiteral in parser.cc for preconditions.
3698 Zone* local_zone_; 3698 Zone* local_zone_;
3699 // ZoneObjects which need to persist until scope analysis must be allocated in 3699 // ZoneObjects which need to persist until scope analysis must be allocated in
3700 // the parser-level zone. 3700 // the parser-level zone.
3701 Zone* parser_zone_; 3701 Zone* parser_zone_;
3702 AstValueFactory* ast_value_factory_; 3702 AstValueFactory* ast_value_factory_;
3703 }; 3703 };
3704 3704
3705 3705
3706 } } // namespace v8::internal 3706 } } // namespace v8::internal
3707 3707
3708 #endif // V8_AST_H_ 3708 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698