| 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 | |
| 359 class Parser; | 342 class Parser; |
| 360 class SingletonLogger; | 343 class SingletonLogger; |
| 361 | 344 |
| 362 class ParserTraits { | 345 class ParserTraits { |
| 363 public: | 346 public: |
| 364 struct Type { | 347 struct Type { |
| 365 // TODO(marja): To be removed. The Traits object should contain all the data | 348 // TODO(marja): To be removed. The Traits object should contain all the data |
| 366 // it needs. | 349 // it needs. |
| 367 typedef v8::internal::Parser* Parser; | 350 typedef v8::internal::Parser* Parser; |
| 368 | 351 |
| 369 // Used by FunctionState and BlockState. | 352 // Used by FunctionState and BlockState. |
| 370 typedef v8::internal::Scope Scope; | 353 typedef v8::internal::Scope Scope; |
| 371 typedef v8::internal::Scope* ScopePtr; | 354 typedef v8::internal::Scope* ScopePtr; |
| 372 typedef Variable GeneratorVariable; | 355 typedef Variable GeneratorVariable; |
| 373 typedef v8::internal::Zone Zone; | 356 typedef v8::internal::Zone Zone; |
| 374 typedef ParserCheckpoint Checkpoint; | |
| 375 | 357 |
| 376 typedef v8::internal::AstProperties AstProperties; | 358 typedef v8::internal::AstProperties AstProperties; |
| 377 typedef Vector<VariableProxy*> ParameterIdentifierVector; | 359 typedef Vector<VariableProxy*> ParameterIdentifierVector; |
| 378 | 360 |
| 379 // Return types for traversing functions. | 361 // Return types for traversing functions. |
| 380 typedef const AstRawString* Identifier; | 362 typedef const AstRawString* Identifier; |
| 381 typedef v8::internal::Expression* Expression; | 363 typedef v8::internal::Expression* Expression; |
| 382 typedef Yield* YieldExpression; | 364 typedef Yield* YieldExpression; |
| 383 typedef v8::internal::FunctionLiteral* FunctionLiteral; | 365 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| 384 typedef v8::internal::Literal* Literal; | 366 typedef v8::internal::Literal* Literal; |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 private: | 883 private: |
| 902 static const int kLiteralTypeSlot = 0; | 884 static const int kLiteralTypeSlot = 0; |
| 903 static const int kElementsSlot = 1; | 885 static const int kElementsSlot = 1; |
| 904 | 886 |
| 905 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 887 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 906 }; | 888 }; |
| 907 | 889 |
| 908 } } // namespace v8::internal | 890 } } // namespace v8::internal |
| 909 | 891 |
| 910 #endif // V8_PARSER_H_ | 892 #endif // V8_PARSER_H_ |
| OLD | NEW |