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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // functions are ints, and they should not overflow. In addition, accessing | 229 // functions are ints, and they should not overflow. In addition, accessing |
230 // local variables creates user-controlled constants in the generated code, | 230 // local variables creates user-controlled constants in the generated code, |
231 // and we don't want too much user-controlled memory inside the code (this was | 231 // and we don't want too much user-controlled memory inside the code (this was |
232 // the reason why this limit was introduced in the first place; see | 232 // the reason why this limit was introduced in the first place; see |
233 // https://codereview.chromium.org/7003030/ ). | 233 // https://codereview.chromium.org/7003030/ ). |
234 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 | 234 static const int kMaxNumFunctionLocals = 4194303; // 2^22-1 |
235 | 235 |
236 // Returns NULL if parsing failed. | 236 // Returns NULL if parsing failed. |
237 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); | 237 FunctionLiteral* ParseProgram(Isolate* isolate, ParseInfo* info); |
238 | 238 |
239 FunctionLiteral* ParseLazy(Isolate* isolate, ParseInfo* info); | 239 FunctionLiteral* ParseFunction(Isolate* isolate, ParseInfo* info); |
240 FunctionLiteral* DoParseLazy(ParseInfo* info, const AstRawString* raw_name, | 240 FunctionLiteral* DoParseFunction(ParseInfo* info, |
241 Utf16CharacterStream* source); | 241 const AstRawString* raw_name, |
| 242 Utf16CharacterStream* source); |
242 | 243 |
243 // Called by ParseProgram after setting up the scanner. | 244 // Called by ParseProgram after setting up the scanner. |
244 FunctionLiteral* DoParseProgram(ParseInfo* info); | 245 FunctionLiteral* DoParseProgram(ParseInfo* info); |
245 | 246 |
246 void SetCachedData(ParseInfo* info); | 247 void SetCachedData(ParseInfo* info); |
247 | 248 |
248 ScriptCompiler::CompileOptions compile_options() const { | 249 ScriptCompiler::CompileOptions compile_options() const { |
249 return compile_options_; | 250 return compile_options_; |
250 } | 251 } |
251 bool consume_cached_parse_data() const { | 252 bool consume_cached_parse_data() const { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 488 |
488 // Skip over a lazy function, either using cached data if we have it, or | 489 // Skip over a lazy function, either using cached data if we have it, or |
489 // by parsing the function with PreParser. Consumes the ending }. | 490 // by parsing the function with PreParser. Consumes the ending }. |
490 // If may_abort == true, the (pre-)parser may decide to abort skipping | 491 // If may_abort == true, the (pre-)parser may decide to abort skipping |
491 // in order to force the function to be eagerly parsed, after all. | 492 // in order to force the function to be eagerly parsed, after all. |
492 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, | 493 LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count, |
493 int* expected_property_count, | 494 int* expected_property_count, |
494 bool is_inner_function, bool may_abort, | 495 bool is_inner_function, bool may_abort, |
495 bool* ok); | 496 bool* ok); |
496 | 497 |
497 PreParser::PreParseResult ParseLazyFunctionBodyWithPreParser( | 498 PreParser::PreParseResult ParseFunctionBodyWithPreParser( |
498 SingletonLogger* logger, bool is_inner_function, bool may_abort); | 499 SingletonLogger* logger, bool is_inner_function, bool may_abort); |
499 | 500 |
500 Block* BuildParameterInitializationBlock( | 501 Block* BuildParameterInitializationBlock( |
501 const ParserFormalParameters& parameters, bool* ok); | 502 const ParserFormalParameters& parameters, bool* ok); |
502 Block* BuildRejectPromiseOnException(Block* block, bool* ok); | 503 Block* BuildRejectPromiseOnException(Block* block, bool* ok); |
503 | 504 |
504 // Consumes the ending }. | 505 // Consumes the ending }. |
505 ZoneList<Statement*>* ParseEagerFunctionBody( | 506 ZoneList<Statement*>* ParseEagerFunctionBody( |
506 const AstRawString* function_name, int pos, | 507 const AstRawString* function_name, int pos, |
507 const ParserFormalParameters& parameters, FunctionKind kind, | 508 const ParserFormalParameters& parameters, FunctionKind kind, |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1142 |
1142 private: | 1143 private: |
1143 ParserTarget** variable_; | 1144 ParserTarget** variable_; |
1144 ParserTarget* previous_; | 1145 ParserTarget* previous_; |
1145 }; | 1146 }; |
1146 | 1147 |
1147 } // namespace internal | 1148 } // namespace internal |
1148 } // namespace v8 | 1149 } // namespace v8 |
1149 | 1150 |
1150 #endif // V8_PARSING_PARSER_H_ | 1151 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |