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_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/parsing/parser-base.h" | 9 #include "src/parsing/parser-base.h" |
10 | 10 |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 typedef PreParserExpression Expression; | 832 typedef PreParserExpression Expression; |
833 typedef PreParserStatement Statement; | 833 typedef PreParserStatement Statement; |
834 | 834 |
835 enum PreParseResult { | 835 enum PreParseResult { |
836 kPreParseStackOverflow, | 836 kPreParseStackOverflow, |
837 kPreParseAbort, | 837 kPreParseAbort, |
838 kPreParseSuccess | 838 kPreParseSuccess |
839 }; | 839 }; |
840 | 840 |
841 PreParser(Zone* zone, Scanner* scanner, AstValueFactory* ast_value_factory, | 841 PreParser(Zone* zone, Scanner* scanner, AstValueFactory* ast_value_factory, |
842 uintptr_t stack_limit) | 842 RuntimeCallStats* runtime_call_stats, uintptr_t stack_limit) |
843 : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, | 843 : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, |
844 ast_value_factory), | 844 ast_value_factory, runtime_call_stats), |
845 use_counts_(nullptr), | 845 use_counts_(nullptr), |
846 track_unresolved_variables_(false) {} | 846 track_unresolved_variables_(false) {} |
847 | 847 |
| 848 static bool const IsPreParser() { return true; } |
| 849 |
848 PreParserLogger* logger() { return &log_; } | 850 PreParserLogger* logger() { return &log_; } |
849 | 851 |
850 // Pre-parse the program from the character stream; returns true on | 852 // Pre-parse the program from the character stream; returns true on |
851 // success (even if parsing failed, the pre-parse data successfully | 853 // success (even if parsing failed, the pre-parse data successfully |
852 // captured the syntax error), and false if a stack-overflow happened | 854 // captured the syntax error), and false if a stack-overflow happened |
853 // during parsing. | 855 // during parsing. |
854 PreParseResult PreParseProgram(int* materialized_literals = 0, | 856 PreParseResult PreParseProgram(int* materialized_literals = 0, |
855 bool is_module = false) { | 857 bool is_module = false) { |
856 DCHECK_NULL(scope_state_); | 858 DCHECK_NULL(scope_state_); |
857 DeclarationScope* scope = NewScriptScope(); | 859 DeclarationScope* scope = NewScriptScope(); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 function_state_->NextMaterializedLiteralIndex(); | 1553 function_state_->NextMaterializedLiteralIndex(); |
1552 function_state_->NextMaterializedLiteralIndex(); | 1554 function_state_->NextMaterializedLiteralIndex(); |
1553 } | 1555 } |
1554 return EmptyExpression(); | 1556 return EmptyExpression(); |
1555 } | 1557 } |
1556 | 1558 |
1557 } // namespace internal | 1559 } // namespace internal |
1558 } // namespace v8 | 1560 } // namespace v8 |
1559 | 1561 |
1560 #endif // V8_PARSING_PREPARSER_H | 1562 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |