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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 bool multiline_; | 332 bool multiline_; |
333 bool simple_; | 333 bool simple_; |
334 bool contains_anchor_; | 334 bool contains_anchor_; |
335 bool is_scanned_for_captures_; | 335 bool is_scanned_for_captures_; |
336 bool failed_; | 336 bool failed_; |
337 }; | 337 }; |
338 | 338 |
339 // ---------------------------------------------------------------------------- | 339 // ---------------------------------------------------------------------------- |
340 // JAVASCRIPT PARSING | 340 // JAVASCRIPT PARSING |
341 | 341 |
| 342 |
| 343 class ParserCheckpoint BASE_EMBEDDED { |
| 344 public: |
| 345 template <typename Parser> |
| 346 explicit ParserCheckpoint(Parser* parser) { |
| 347 isolate_ = parser->zone()->isolate(); |
| 348 saved_ast_node_id_ = isolate_->ast_node_id(); |
| 349 } |
| 350 |
| 351 void Restore() { isolate_->set_ast_node_id(saved_ast_node_id_); } |
| 352 |
| 353 private: |
| 354 Isolate* isolate_; |
| 355 int saved_ast_node_id_; |
| 356 }; |
| 357 |
| 358 |
342 class Parser; | 359 class Parser; |
343 class SingletonLogger; | 360 class SingletonLogger; |
344 | 361 |
345 class ParserTraits { | 362 class ParserTraits { |
346 public: | 363 public: |
347 struct Type { | 364 struct Type { |
348 // TODO(marja): To be removed. The Traits object should contain all the data | 365 // TODO(marja): To be removed. The Traits object should contain all the data |
349 // it needs. | 366 // it needs. |
350 typedef v8::internal::Parser* Parser; | 367 typedef v8::internal::Parser* Parser; |
351 | 368 |
352 // Used by FunctionState and BlockState. | 369 // Used by FunctionState and BlockState. |
353 typedef v8::internal::Scope Scope; | 370 typedef v8::internal::Scope Scope; |
354 typedef v8::internal::Scope* ScopePtr; | 371 typedef v8::internal::Scope* ScopePtr; |
355 typedef Variable GeneratorVariable; | 372 typedef Variable GeneratorVariable; |
356 typedef v8::internal::Zone Zone; | 373 typedef v8::internal::Zone Zone; |
| 374 typedef ParserCheckpoint Checkpoint; |
357 | 375 |
358 typedef v8::internal::AstProperties AstProperties; | 376 typedef v8::internal::AstProperties AstProperties; |
359 typedef Vector<VariableProxy*> ParameterIdentifierVector; | 377 typedef Vector<VariableProxy*> ParameterIdentifierVector; |
360 | 378 |
361 // Return types for traversing functions. | 379 // Return types for traversing functions. |
362 typedef const AstRawString* Identifier; | 380 typedef const AstRawString* Identifier; |
363 typedef v8::internal::Expression* Expression; | 381 typedef v8::internal::Expression* Expression; |
364 typedef Yield* YieldExpression; | 382 typedef Yield* YieldExpression; |
365 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 383 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
366 typedef v8::internal::Literal* Literal; | 384 typedef v8::internal::Literal* Literal; |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 private: | 901 private: |
884 static const int kLiteralTypeSlot = 0; | 902 static const int kLiteralTypeSlot = 0; |
885 static const int kElementsSlot = 1; | 903 static const int kElementsSlot = 1; |
886 | 904 |
887 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 905 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
888 }; | 906 }; |
889 | 907 |
890 } } // namespace v8::internal | 908 } } // namespace v8::internal |
891 | 909 |
892 #endif // V8_PARSER_H_ | 910 #endif // V8_PARSER_H_ |
OLD | NEW |