| 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 is_inner_function, bool may_abort, | 487 bool may_abort, bool* ok); |
| 488 bool* ok); | |
| 489 | 488 |
| 490 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 489 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
| 491 SingletonLogger* logger, bool is_inner_function, bool may_abort); | 490 SingletonLogger* logger, bool may_abort); |
| 492 | 491 |
| 493 Block* BuildParameterInitializationBlock( | 492 Block* BuildParameterInitializationBlock( |
| 494 const ParserFormalParameters& parameters, bool* ok); | 493 const ParserFormalParameters& parameters, bool* ok); |
| 495 Block* BuildRejectPromiseOnException(Block* block, bool* ok); | 494 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
| 496 | 495 |
| 497 // Consumes the ending }. | 496 // Consumes the ending }. |
| 498 ZoneList<Statement*>* ParseEagerFunctionBody( | 497 ZoneList<Statement*>* ParseEagerFunctionBody( |
| 499 const AstRawString* function_name, int pos, | 498 const AstRawString* function_name, int pos, |
| 500 const ParserFormalParameters& parameters, FunctionKind kind, | 499 const ParserFormalParameters& parameters, FunctionKind kind, |
| 501 FunctionLiteral::FunctionType function_type, bool* ok); | 500 FunctionLiteral::FunctionType function_type, bool* ok); |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 | 1056 |
| 1058 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { | 1057 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { |
| 1059 return function_state_->non_patterns_to_rewrite(); | 1058 return function_state_->non_patterns_to_rewrite(); |
| 1060 } | 1059 } |
| 1061 | 1060 |
| 1062 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { | 1061 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { |
| 1063 ++use_counts_[feature]; | 1062 ++use_counts_[feature]; |
| 1064 } | 1063 } |
| 1065 | 1064 |
| 1066 // Parser's private field members. | 1065 // Parser's private field members. |
| 1067 friend class DiscardableZoneScope; // Uses reusable_preparser_. | |
| 1068 // FIXME(marja): Make reusable_preparser_ always use its own temp Zone (call | |
| 1069 // DeleteAll after each function), so this won't be needed. | |
| 1070 | 1066 |
| 1071 Scanner scanner_; | 1067 Scanner scanner_; |
| 1072 PreParser* reusable_preparser_; | 1068 PreParser* reusable_preparser_; |
| 1073 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1069 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
| 1074 | 1070 |
| 1075 friend class ParserTarget; | 1071 friend class ParserTarget; |
| 1076 friend class ParserTargetScope; | 1072 friend class ParserTargetScope; |
| 1077 ParserTarget* target_stack_; // for break, continue statements | 1073 ParserTarget* target_stack_; // for break, continue statements |
| 1078 | 1074 |
| 1079 ScriptCompiler::CompileOptions compile_options_; | 1075 ScriptCompiler::CompileOptions compile_options_; |
| 1080 ParseData* cached_parse_data_; | 1076 ParseData* cached_parse_data_; |
| 1081 | 1077 |
| 1082 PendingCompilationErrorHandler pending_error_handler_; | 1078 PendingCompilationErrorHandler pending_error_handler_; |
| 1083 | 1079 |
| 1084 // Other information which will be stored in Parser and moved to Isolate after | 1080 // Other information which will be stored in Parser and moved to Isolate after |
| 1085 // parsing. | 1081 // parsing. |
| 1086 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 1082 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
| 1087 int total_preparse_skipped_; | 1083 int total_preparse_skipped_; |
| 1088 HistogramTimer* pre_parse_timer_; | 1084 HistogramTimer* pre_parse_timer_; |
| 1089 | 1085 |
| 1090 bool parsing_on_main_thread_; | 1086 bool parsing_on_main_thread_; |
| 1091 }; | 1087 }; |
| 1092 | 1088 |
| 1093 } // namespace internal | 1089 } // namespace internal |
| 1094 } // namespace v8 | 1090 } // namespace v8 |
| 1095 | 1091 |
| 1096 #endif // V8_PARSING_PARSER_H_ | 1092 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |