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

Side by Side Diff: src/parsing/parser.cc

Issue 2400613003: PreParsing inner functions: Fix declaration-only variables, part 2. (Closed)
Patch Set: rebased 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
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 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/ast/ast-expression-rewriter.h" 10 #include "src/ast/ast-expression-rewriter.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 : ast_node_factory_scope_(parser->factory(), temp_zone, use_temp_zone), 117 : ast_node_factory_scope_(parser->factory(), temp_zone, use_temp_zone),
118 fni_(parser->ast_value_factory_, temp_zone), 118 fni_(parser->ast_value_factory_, temp_zone),
119 parser_(parser), 119 parser_(parser),
120 prev_fni_(parser->fni_), 120 prev_fni_(parser->fni_),
121 prev_zone_(parser->zone_) { 121 prev_zone_(parser->zone_) {
122 if (use_temp_zone) { 122 if (use_temp_zone) {
123 parser_->fni_ = &fni_; 123 parser_->fni_ = &fni_;
124 parser_->zone_ = temp_zone; 124 parser_->zone_ = temp_zone;
125 if (parser_->reusable_preparser_ != nullptr) { 125 if (parser_->reusable_preparser_ != nullptr) {
126 parser_->reusable_preparser_->zone_ = temp_zone; 126 parser_->reusable_preparser_->zone_ = temp_zone;
127 parser_->reusable_preparser_->factory()->set_zone(temp_zone);
adamk 2016/10/07 18:35:55 Seems a little weird to set this zone, but not the
marja 2016/10/07 19:00:27 Offline discussion: - AstValueFactories always use
127 } 128 }
128 } 129 }
129 } 130 }
130 void Reset() { 131 void Reset() {
131 parser_->fni_ = prev_fni_; 132 parser_->fni_ = prev_fni_;
132 parser_->zone_ = prev_zone_; 133 parser_->zone_ = prev_zone_;
133 if (parser_->reusable_preparser_ != nullptr) { 134 if (parser_->reusable_preparser_ != nullptr) {
134 parser_->reusable_preparser_->zone_ = prev_zone_; 135 parser_->reusable_preparser_->zone_ = prev_zone_;
136 parser_->reusable_preparser_->factory()->set_zone(prev_zone_);
135 } 137 }
136 ast_node_factory_scope_.Reset(); 138 ast_node_factory_scope_.Reset();
137 } 139 }
138 ~DiscardableZoneScope() { Reset(); } 140 ~DiscardableZoneScope() { Reset(); }
139 141
140 private: 142 private:
141 AstNodeFactory::BodyScope ast_node_factory_scope_; 143 AstNodeFactory::BodyScope ast_node_factory_scope_;
142 FuncNameInferrer fni_; 144 FuncNameInferrer fni_;
143 Parser* parser_; 145 Parser* parser_;
144 FuncNameInferrer* prev_fni_; 146 FuncNameInferrer* prev_fni_;
(...skipping 5297 matching lines...) Expand 10 before | Expand all | Expand 10 after
5442 5444
5443 return final_loop; 5445 return final_loop;
5444 } 5446 }
5445 5447
5446 #undef CHECK_OK 5448 #undef CHECK_OK
5447 #undef CHECK_OK_VOID 5449 #undef CHECK_OK_VOID
5448 #undef CHECK_FAILED 5450 #undef CHECK_FAILED
5449 5451
5450 } // namespace internal 5452 } // namespace internal
5451 } // namespace v8 5453 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698