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

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

Issue 2738153003: [parser] Make reusable_preparser really reusable (Closed)
Patch Set: Created 3 years, 9 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/parsing/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_PARSING_PARSER_H_ 5 #ifndef V8_PARSING_PARSER_H_
6 #define V8_PARSING_PARSER_H_ 6 #define V8_PARSING_PARSER_H_
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/base/compiler-specific.h" 10 #include "src/base/compiler-specific.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 ScriptCompiler::CompileOptions compile_options() const { 292 ScriptCompiler::CompileOptions compile_options() const {
293 return compile_options_; 293 return compile_options_;
294 } 294 }
295 bool consume_cached_parse_data() const { 295 bool consume_cached_parse_data() const {
296 return compile_options_ == ScriptCompiler::kConsumeParserCache; 296 return compile_options_ == ScriptCompiler::kConsumeParserCache;
297 } 297 }
298 bool produce_cached_parse_data() const { 298 bool produce_cached_parse_data() const {
299 return compile_options_ == ScriptCompiler::kProduceParserCache; 299 return compile_options_ == ScriptCompiler::kProduceParserCache;
300 } 300 }
301 301
302 PreParser* reusable_preparser() {
303 if (reusable_preparser_ == NULL) {
304 reusable_preparser_ =
305 new PreParser(zone(), &scanner_, stack_limit_, ast_value_factory(),
306 &pending_error_handler_, runtime_call_stats_,
307 parsing_on_main_thread_);
308 #define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
309 SET_ALLOW(natives);
310 SET_ALLOW(harmony_do_expressions);
311 SET_ALLOW(harmony_function_sent);
312 SET_ALLOW(harmony_trailing_commas);
313 SET_ALLOW(harmony_class_fields);
314 SET_ALLOW(harmony_object_rest_spread);
315 SET_ALLOW(harmony_dynamic_import);
316 SET_ALLOW(harmony_async_iteration);
317 #undef SET_ALLOW
318 }
319 return reusable_preparser_;
320 }
321
302 void ParseModuleItemList(ZoneList<Statement*>* body, bool* ok); 322 void ParseModuleItemList(ZoneList<Statement*>* body, bool* ok);
303 Statement* ParseModuleItem(bool* ok); 323 Statement* ParseModuleItem(bool* ok);
304 const AstRawString* ParseModuleSpecifier(bool* ok); 324 const AstRawString* ParseModuleSpecifier(bool* ok);
305 void ParseImportDeclaration(bool* ok); 325 void ParseImportDeclaration(bool* ok);
306 Statement* ParseExportDeclaration(bool* ok); 326 Statement* ParseExportDeclaration(bool* ok);
307 Statement* ParseExportDefault(bool* ok); 327 Statement* ParseExportDefault(bool* ok);
308 void ParseExportClause(ZoneList<const AstRawString*>* export_names, 328 void ParseExportClause(ZoneList<const AstRawString*>* export_names,
309 ZoneList<Scanner::Location>* export_locations, 329 ZoneList<Scanner::Location>* export_locations,
310 ZoneList<const AstRawString*>* local_names, 330 ZoneList<const AstRawString*>* local_names,
311 Scanner::Location* reserved_loc, bool* ok); 331 Scanner::Location* reserved_loc, bool* ok);
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 1231
1212 private: 1232 private:
1213 ParserTarget** variable_; 1233 ParserTarget** variable_;
1214 ParserTarget* previous_; 1234 ParserTarget* previous_;
1215 }; 1235 };
1216 1236
1217 } // namespace internal 1237 } // namespace internal
1218 } // namespace v8 1238 } // namespace v8
1219 1239
1220 #endif // V8_PARSING_PARSER_H_ 1240 #endif // V8_PARSING_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698