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