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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 PendingCompilationErrorHandler* pending_error_handler, | 842 PendingCompilationErrorHandler* pending_error_handler, |
843 uintptr_t stack_limit) | 843 RuntimeCallStats* runtime_call_stats, uintptr_t stack_limit) |
844 : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, | 844 : ParserBase<PreParser>(zone, scanner, stack_limit, nullptr, |
845 ast_value_factory), | 845 ast_value_factory, runtime_call_stats), |
846 use_counts_(nullptr), | 846 use_counts_(nullptr), |
847 track_unresolved_variables_(false), | 847 track_unresolved_variables_(false), |
848 pending_error_handler_(pending_error_handler) {} | 848 pending_error_handler_(pending_error_handler) {} |
849 | 849 |
| 850 static bool const IsPreParser() { return true; } |
| 851 |
850 PreParserLogger* logger() { return &log_; } | 852 PreParserLogger* logger() { return &log_; } |
851 | 853 |
852 // Pre-parse the program from the character stream; returns true on | 854 // Pre-parse the program from the character stream; returns true on |
853 // success (even if parsing failed, the pre-parse data successfully | 855 // success (even if parsing failed, the pre-parse data successfully |
854 // captured the syntax error), and false if a stack-overflow happened | 856 // captured the syntax error), and false if a stack-overflow happened |
855 // during parsing. | 857 // during parsing. |
856 PreParseResult PreParseProgram(int* materialized_literals = 0, | 858 PreParseResult PreParseProgram(int* materialized_literals = 0, |
857 bool is_module = false) { | 859 bool is_module = false) { |
858 DCHECK_NULL(scope_state_); | 860 DCHECK_NULL(scope_state_); |
859 DeclarationScope* scope = NewScriptScope(); | 861 DeclarationScope* scope = NewScriptScope(); |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 function_state_->NextMaterializedLiteralIndex(); | 1557 function_state_->NextMaterializedLiteralIndex(); |
1556 function_state_->NextMaterializedLiteralIndex(); | 1558 function_state_->NextMaterializedLiteralIndex(); |
1557 } | 1559 } |
1558 return EmptyExpression(); | 1560 return EmptyExpression(); |
1559 } | 1561 } |
1560 | 1562 |
1561 } // namespace internal | 1563 } // namespace internal |
1562 } // namespace v8 | 1564 } // namespace v8 |
1563 | 1565 |
1564 #endif // V8_PARSING_PREPARSER_H | 1566 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |