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/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ScriptData* script_data_; | 127 ScriptData* script_data_; |
128 int function_index_; | 128 int function_index_; |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(ParseData); | 130 DISALLOW_COPY_AND_ASSIGN(ParseData); |
131 }; | 131 }; |
132 | 132 |
133 // ---------------------------------------------------------------------------- | 133 // ---------------------------------------------------------------------------- |
134 // JAVASCRIPT PARSING | 134 // JAVASCRIPT PARSING |
135 | 135 |
136 class Parser; | 136 class Parser; |
137 class SingletonLogger; | |
138 | 137 |
139 | 138 |
140 struct ParserFormalParameters : FormalParametersBase { | 139 struct ParserFormalParameters : FormalParametersBase { |
141 struct Parameter { | 140 struct Parameter { |
142 Parameter(const AstRawString* name, Expression* pattern, | 141 Parameter(const AstRawString* name, Expression* pattern, |
143 Expression* initializer, int initializer_end_position, | 142 Expression* initializer, int initializer_end_position, |
144 bool is_rest) | 143 bool is_rest) |
145 : name(name), | 144 : name(name), |
146 pattern(pattern), | 145 pattern(pattern), |
147 initializer(initializer), | 146 initializer(initializer), |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 // If may_abort == true, the (pre-)parser may decide to abort skipping | 515 // If may_abort == true, the (pre-)parser may decide to abort skipping |
517 // in order to force the function to be eagerly parsed, after all. | 516 // in order to force the function to be eagerly parsed, after all. |
518 LazyParsingResult SkipFunction( | 517 LazyParsingResult SkipFunction( |
519 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, | 518 FunctionKind kind, DeclarationScope* function_scope, int* num_parameters, |
520 int* function_length, bool* has_duplicate_parameters, | 519 int* function_length, bool* has_duplicate_parameters, |
521 int* materialized_literal_count, int* expected_property_count, | 520 int* materialized_literal_count, int* expected_property_count, |
522 bool is_inner_function, bool may_abort, bool* ok); | 521 bool is_inner_function, bool may_abort, bool* ok); |
523 | 522 |
524 PreParser::PreParseResult ParseFunctionWithPreParser(FunctionKind kind, | 523 PreParser::PreParseResult ParseFunctionWithPreParser(FunctionKind kind, |
525 DeclarationScope* scope, | 524 DeclarationScope* scope, |
526 SingletonLogger* logger, | |
527 bool is_inner_function, | 525 bool is_inner_function, |
528 bool may_abort); | 526 bool may_abort); |
529 | 527 |
530 Block* BuildParameterInitializationBlock( | 528 Block* BuildParameterInitializationBlock( |
531 const ParserFormalParameters& parameters, bool* ok); | 529 const ParserFormalParameters& parameters, bool* ok); |
532 Block* BuildRejectPromiseOnException(Block* block, bool* ok); | 530 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
533 | 531 |
534 // Consumes the ending }. | 532 // Consumes the ending }. |
535 ZoneList<Statement*>* ParseEagerFunctionBody( | 533 ZoneList<Statement*>* ParseEagerFunctionBody( |
536 const AstRawString* function_name, int pos, | 534 const AstRawString* function_name, int pos, |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 ParseData* cached_parse_data_; | 1128 ParseData* cached_parse_data_; |
1131 | 1129 |
1132 PendingCompilationErrorHandler pending_error_handler_; | 1130 PendingCompilationErrorHandler pending_error_handler_; |
1133 | 1131 |
1134 // Other information which will be stored in Parser and moved to Isolate after | 1132 // Other information which will be stored in Parser and moved to Isolate after |
1135 // parsing. | 1133 // parsing. |
1136 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 1134 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
1137 int total_preparse_skipped_; | 1135 int total_preparse_skipped_; |
1138 | 1136 |
1139 bool parsing_on_main_thread_; | 1137 bool parsing_on_main_thread_; |
| 1138 ParserLogger* log_; |
1140 }; | 1139 }; |
1141 | 1140 |
1142 // ---------------------------------------------------------------------------- | 1141 // ---------------------------------------------------------------------------- |
1143 // Target is a support class to facilitate manipulation of the | 1142 // Target is a support class to facilitate manipulation of the |
1144 // Parser's target_stack_ (the stack of potential 'break' and | 1143 // Parser's target_stack_ (the stack of potential 'break' and |
1145 // 'continue' statement targets). Upon construction, a new target is | 1144 // 'continue' statement targets). Upon construction, a new target is |
1146 // added; it is removed upon destruction. | 1145 // added; it is removed upon destruction. |
1147 | 1146 |
1148 class ParserTarget BASE_EMBEDDED { | 1147 class ParserTarget BASE_EMBEDDED { |
1149 public: | 1148 public: |
(...skipping 27 matching lines...) Expand all Loading... |
1177 | 1176 |
1178 private: | 1177 private: |
1179 ParserTarget** variable_; | 1178 ParserTarget** variable_; |
1180 ParserTarget* previous_; | 1179 ParserTarget* previous_; |
1181 }; | 1180 }; |
1182 | 1181 |
1183 } // namespace internal | 1182 } // namespace internal |
1184 } // namespace v8 | 1183 } // namespace v8 |
1185 | 1184 |
1186 #endif // V8_PARSING_PARSER_H_ | 1185 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |