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_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/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, | 477 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, |
478 bool requires_class_field_init, int pos, | 478 bool requires_class_field_init, int pos, |
479 int end_pos, LanguageMode language_mode); | 479 int end_pos, LanguageMode language_mode); |
480 | 480 |
481 // Skip over a lazy function, either using cached data if we have it, or | 481 // Skip over a lazy function, either using cached data if we have it, or |
482 // by parsing the function with PreParser. Consumes the ending }. | 482 // by parsing the function with PreParser. Consumes the ending }. |
483 // If may_abort == true, the (pre-)parser may decide to abort skipping | 483 // If may_abort == true, the (pre-)parser may decide to abort skipping |
484 // in order to force the function to be eagerly parsed, after all. | 484 // in order to force the function to be eagerly parsed, after all. |
485 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, | 485 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, |
486 int* expected_property_count, | 486 int* expected_property_count, |
487 bool may_abort, bool* ok); | 487 bool is_inner_function, bool may_abort, |
| 488 bool* ok); |
488 | 489 |
489 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 490 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
490 SingletonLogger* logger, bool may_abort); | 491 SingletonLogger* logger, bool is_inner_function, bool may_abort); |
491 | 492 |
492 Block* BuildParameterInitializationBlock( | 493 Block* BuildParameterInitializationBlock( |
493 const ParserFormalParameters& parameters, bool* ok); | 494 const ParserFormalParameters& parameters, bool* ok); |
494 Block* BuildRejectPromiseOnException(Block* block, bool* ok); | 495 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
495 | 496 |
496 // Consumes the ending }. | 497 // Consumes the ending }. |
497 ZoneList<Statement*>* ParseEagerFunctionBody( | 498 ZoneList<Statement*>* ParseEagerFunctionBody( |
498 const AstRawString* function_name, int pos, | 499 const AstRawString* function_name, int pos, |
499 const ParserFormalParameters& parameters, FunctionKind kind, | 500 const ParserFormalParameters& parameters, FunctionKind kind, |
500 FunctionLiteral::FunctionType function_type, bool* ok); | 501 FunctionLiteral::FunctionType function_type, bool* ok); |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 | 1057 |
1057 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { | 1058 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { |
1058 return function_state_->non_patterns_to_rewrite(); | 1059 return function_state_->non_patterns_to_rewrite(); |
1059 } | 1060 } |
1060 | 1061 |
1061 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { | 1062 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { |
1062 ++use_counts_[feature]; | 1063 ++use_counts_[feature]; |
1063 } | 1064 } |
1064 | 1065 |
1065 // Parser's private field members. | 1066 // Parser's private field members. |
| 1067 friend class DiscardableZoneScope; // Uses reusable_preparser_. |
1066 | 1068 |
1067 Scanner scanner_; | 1069 Scanner scanner_; |
1068 PreParser* reusable_preparser_; | 1070 PreParser* reusable_preparser_; |
1069 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1071 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1070 | 1072 |
1071 friend class ParserTarget; | 1073 friend class ParserTarget; |
1072 friend class ParserTargetScope; | 1074 friend class ParserTargetScope; |
1073 ParserTarget* target_stack_; // for break, continue statements | 1075 ParserTarget* target_stack_; // for break, continue statements |
1074 | 1076 |
1075 ScriptCompiler::CompileOptions compile_options_; | 1077 ScriptCompiler::CompileOptions compile_options_; |
1076 ParseData* cached_parse_data_; | 1078 ParseData* cached_parse_data_; |
1077 | 1079 |
1078 PendingCompilationErrorHandler pending_error_handler_; | 1080 PendingCompilationErrorHandler pending_error_handler_; |
1079 | 1081 |
1080 // Other information which will be stored in Parser and moved to Isolate after | 1082 // Other information which will be stored in Parser and moved to Isolate after |
1081 // parsing. | 1083 // parsing. |
1082 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 1084 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
1083 int total_preparse_skipped_; | 1085 int total_preparse_skipped_; |
1084 HistogramTimer* pre_parse_timer_; | 1086 HistogramTimer* pre_parse_timer_; |
1085 | 1087 |
1086 bool parsing_on_main_thread_; | 1088 bool parsing_on_main_thread_; |
1087 }; | 1089 }; |
1088 | 1090 |
1089 } // namespace internal | 1091 } // namespace internal |
1090 } // namespace v8 | 1092 } // namespace v8 |
1091 | 1093 |
1092 #endif // V8_PARSING_PARSER_H_ | 1094 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |