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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, | 459 FunctionLiteral* DefaultConstructor(const AstRawString* name, bool call_super, |
460 int pos, int end_pos, | 460 int pos, int end_pos, |
461 LanguageMode language_mode); | 461 LanguageMode language_mode); |
462 | 462 |
463 // Skip over a lazy function, either using cached data if we have it, or | 463 // Skip over a lazy function, either using cached data if we have it, or |
464 // by parsing the function with PreParser. Consumes the ending }. | 464 // by parsing the function with PreParser. Consumes the ending }. |
465 // If may_abort == true, the (pre-)parser may decide to abort skipping | 465 // If may_abort == true, the (pre-)parser may decide to abort skipping |
466 // in order to force the function to be eagerly parsed, after all. | 466 // in order to force the function to be eagerly parsed, after all. |
467 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, | 467 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, |
468 int* expected_property_count, | 468 int* expected_property_count, |
469 bool may_abort, bool* ok); | 469 bool is_inner_function, bool may_abort, |
470 bool* ok); | |
470 | 471 |
471 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 472 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( |
472 SingletonLogger* logger, bool may_abort); | 473 SingletonLogger* logger, bool is_inner_function, bool may_abort); |
473 | 474 |
474 Block* BuildParameterInitializationBlock( | 475 Block* BuildParameterInitializationBlock( |
475 const ParserFormalParameters& parameters, bool* ok); | 476 const ParserFormalParameters& parameters, bool* ok); |
476 Block* BuildRejectPromiseOnException(Block* block, bool* ok); | 477 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
477 | 478 |
478 // Consumes the ending }. | 479 // Consumes the ending }. |
479 ZoneList<Statement*>* ParseEagerFunctionBody( | 480 ZoneList<Statement*>* ParseEagerFunctionBody( |
480 const AstRawString* function_name, int pos, | 481 const AstRawString* function_name, int pos, |
481 const ParserFormalParameters& parameters, FunctionKind kind, | 482 const ParserFormalParameters& parameters, FunctionKind kind, |
482 FunctionLiteral::FunctionType function_type, bool* ok); | 483 FunctionLiteral::FunctionType function_type, bool* ok); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1042 | 1043 |
1043 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { | 1044 V8_INLINE ZoneList<Expression*>* GetNonPatternList() const { |
1044 return function_state_->non_patterns_to_rewrite(); | 1045 return function_state_->non_patterns_to_rewrite(); |
1045 } | 1046 } |
1046 | 1047 |
1047 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { | 1048 V8_INLINE void CountUsage(v8::Isolate::UseCounterFeature feature) { |
1048 ++use_counts_[feature]; | 1049 ++use_counts_[feature]; |
1049 } | 1050 } |
1050 | 1051 |
1051 // Parser's private field members. | 1052 // Parser's private field members. |
1053 friend class DiscardableZoneScope; | |
vogelheim
2016/09/16 08:13:04
Why?
marja
2016/09/16 08:38:16
Because of reusable_preparser_
| |
1052 | 1054 |
1053 Scanner scanner_; | 1055 Scanner scanner_; |
1054 PreParser* reusable_preparser_; | 1056 PreParser* reusable_preparser_; |
1055 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 1057 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
1056 | 1058 |
1057 friend class ParserTarget; | 1059 friend class ParserTarget; |
1058 friend class ParserTargetScope; | 1060 friend class ParserTargetScope; |
1059 ParserTarget* target_stack_; // for break, continue statements | 1061 ParserTarget* target_stack_; // for break, continue statements |
1060 | 1062 |
1061 ScriptCompiler::CompileOptions compile_options_; | 1063 ScriptCompiler::CompileOptions compile_options_; |
(...skipping 11 matching lines...) Expand all Loading... | |
1073 | 1075 |
1074 #ifdef DEBUG | 1076 #ifdef DEBUG |
1075 void Print(AstNode* node); | 1077 void Print(AstNode* node); |
1076 #endif // DEBUG | 1078 #endif // DEBUG |
1077 }; | 1079 }; |
1078 | 1080 |
1079 } // namespace internal | 1081 } // namespace internal |
1080 } // namespace v8 | 1082 } // namespace v8 |
1081 | 1083 |
1082 #endif // V8_PARSING_PARSER_H_ | 1084 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |