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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { | 196 class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { |
197 public: | 197 public: |
198 explicit Parser(ParseInfo* info); | 198 explicit Parser(ParseInfo* info); |
199 ~Parser() { | 199 ~Parser() { |
200 delete reusable_preparser_; | 200 delete reusable_preparser_; |
201 reusable_preparser_ = NULL; | 201 reusable_preparser_ = NULL; |
202 delete cached_parse_data_; | 202 delete cached_parse_data_; |
203 cached_parse_data_ = NULL; | 203 cached_parse_data_ = NULL; |
204 } | 204 } |
205 | 205 |
| 206 static bool const IsPreParser() { return false; } |
| 207 |
206 // Parses the source code represented by the compilation info and sets its | 208 // Parses the source code represented by the compilation info and sets its |
207 // function literal. Returns false (and deallocates any allocated AST | 209 // function literal. Returns false (and deallocates any allocated AST |
208 // nodes) if parsing failed. | 210 // nodes) if parsing failed. |
209 static bool ParseStatic(ParseInfo* info); | 211 static bool ParseStatic(ParseInfo* info); |
210 bool Parse(ParseInfo* info); | 212 bool Parse(ParseInfo* info); |
211 void ParseOnBackground(ParseInfo* info); | 213 void ParseOnBackground(ParseInfo* info); |
212 | 214 |
213 // Deserialize the scope chain prior to parsing in which the script is going | 215 // Deserialize the scope chain prior to parsing in which the script is going |
214 // to be executed. If the script is a top-level script, or the scope chain | 216 // to be executed. If the script is a top-level script, or the scope chain |
215 // consists of only a native context, maybe_outer_scope_info should be an | 217 // consists of only a native context, maybe_outer_scope_info should be an |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 | 1145 |
1144 ScriptCompiler::CompileOptions compile_options_; | 1146 ScriptCompiler::CompileOptions compile_options_; |
1145 ParseData* cached_parse_data_; | 1147 ParseData* cached_parse_data_; |
1146 | 1148 |
1147 PendingCompilationErrorHandler pending_error_handler_; | 1149 PendingCompilationErrorHandler pending_error_handler_; |
1148 | 1150 |
1149 // Other information which will be stored in Parser and moved to Isolate after | 1151 // Other information which will be stored in Parser and moved to Isolate after |
1150 // parsing. | 1152 // parsing. |
1151 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; | 1153 int use_counts_[v8::Isolate::kUseCounterFeatureCount]; |
1152 int total_preparse_skipped_; | 1154 int total_preparse_skipped_; |
1153 | |
1154 bool parsing_on_main_thread_; | 1155 bool parsing_on_main_thread_; |
1155 ParserLogger* log_; | 1156 ParserLogger* log_; |
1156 }; | 1157 }; |
1157 | 1158 |
1158 // ---------------------------------------------------------------------------- | 1159 // ---------------------------------------------------------------------------- |
1159 // Target is a support class to facilitate manipulation of the | 1160 // Target is a support class to facilitate manipulation of the |
1160 // Parser's target_stack_ (the stack of potential 'break' and | 1161 // Parser's target_stack_ (the stack of potential 'break' and |
1161 // 'continue' statement targets). Upon construction, a new target is | 1162 // 'continue' statement targets). Upon construction, a new target is |
1162 // added; it is removed upon destruction. | 1163 // added; it is removed upon destruction. |
1163 | 1164 |
(...skipping 29 matching lines...) Expand all Loading... |
1193 | 1194 |
1194 private: | 1195 private: |
1195 ParserTarget** variable_; | 1196 ParserTarget** variable_; |
1196 ParserTarget* previous_; | 1197 ParserTarget* previous_; |
1197 }; | 1198 }; |
1198 | 1199 |
1199 } // namespace internal | 1200 } // namespace internal |
1200 } // namespace v8 | 1201 } // namespace v8 |
1201 | 1202 |
1202 #endif // V8_PARSING_PARSER_H_ | 1203 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |