| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 371 |
| 372 // For constructing objects returned by the traversing functions. | 372 // For constructing objects returned by the traversing functions. |
| 373 typedef AstNodeFactory<AstConstructionVisitor> Factory; | 373 typedef AstNodeFactory<AstConstructionVisitor> Factory; |
| 374 }; | 374 }; |
| 375 | 375 |
| 376 class Checkpoint; | 376 class Checkpoint; |
| 377 | 377 |
| 378 explicit ParserTraits(Parser* parser) : parser_(parser) {} | 378 explicit ParserTraits(Parser* parser) : parser_(parser) {} |
| 379 | 379 |
| 380 // Custom operations executed when FunctionStates are created and destructed. | 380 // Custom operations executed when FunctionStates are created and destructed. |
| 381 template<typename FunctionState> | 381 template <typename FunctionState> |
| 382 static void SetUpFunctionState(FunctionState* function_state, Zone* zone) { | 382 static void SetUpFunctionState(FunctionState* function_state) { |
| 383 Isolate* isolate = zone->isolate(); | 383 function_state->saved_id_gen_ = *function_state->ast_node_id_gen_; |
| 384 function_state->saved_ast_node_id_ = isolate->ast_node_id(); | 384 *function_state->ast_node_id_gen_ = |
| 385 isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt()); | 385 AstNode::IdGen(BailoutId::FirstUsable().ToInt()); |
| 386 } | 386 } |
| 387 | 387 |
| 388 template<typename FunctionState> | 388 template <typename FunctionState> |
| 389 static void TearDownFunctionState(FunctionState* function_state, Zone* zone) { | 389 static void TearDownFunctionState(FunctionState* function_state) { |
| 390 if (function_state->outer_function_state_ != NULL) { | 390 if (function_state->outer_function_state_ != NULL) { |
| 391 zone->isolate()->set_ast_node_id(function_state->saved_ast_node_id_); | 391 *function_state->ast_node_id_gen_ = function_state->saved_id_gen_; |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 | 394 |
| 395 // Helper functions for recursive descent. | 395 // Helper functions for recursive descent. |
| 396 bool IsEvalOrArguments(const AstRawString* identifier) const; | 396 bool IsEvalOrArguments(const AstRawString* identifier) const; |
| 397 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; | 397 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; |
| 398 | 398 |
| 399 // Returns true if the expression is of type "this.foo". | 399 // Returns true if the expression is of type "this.foo". |
| 400 static bool IsThisProperty(Expression* expression); | 400 static bool IsThisProperty(Expression* expression); |
| 401 | 401 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 private: | 890 private: |
| 891 static const int kLiteralTypeSlot = 0; | 891 static const int kLiteralTypeSlot = 0; |
| 892 static const int kElementsSlot = 1; | 892 static const int kElementsSlot = 1; |
| 893 | 893 |
| 894 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 894 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 895 }; | 895 }; |
| 896 | 896 |
| 897 } } // namespace v8::internal | 897 } } // namespace v8::internal |
| 898 | 898 |
| 899 #endif // V8_PARSER_H_ | 899 #endif // V8_PARSER_H_ |
| OLD | NEW |