| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // For constructing objects returned by the traversing functions. | 434 // For constructing objects returned by the traversing functions. |
| 435 typedef AstNodeFactory<AstConstructionVisitor> Factory; | 435 typedef AstNodeFactory<AstConstructionVisitor> Factory; |
| 436 }; | 436 }; |
| 437 | 437 |
| 438 explicit ParserTraits(Parser* parser) : parser_(parser) {} | 438 explicit ParserTraits(Parser* parser) : parser_(parser) {} |
| 439 | 439 |
| 440 // Custom operations executed when FunctionStates are created and destructed. | 440 // Custom operations executed when FunctionStates are created and destructed. |
| 441 template<typename FunctionState> | 441 template<typename FunctionState> |
| 442 static void SetUpFunctionState(FunctionState* function_state, Zone* zone) { | 442 static void SetUpFunctionState(FunctionState* function_state, Zone* zone) { |
| 443 Isolate* isolate = zone->isolate(); | 443 Isolate* isolate = zone->isolate(); |
| 444 function_state->isolate_ = isolate; | |
| 445 function_state->saved_ast_node_id_ = isolate->ast_node_id(); | 444 function_state->saved_ast_node_id_ = isolate->ast_node_id(); |
| 446 isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt()); | 445 isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt()); |
| 447 } | 446 } |
| 448 | 447 |
| 449 template<typename FunctionState> | 448 template<typename FunctionState> |
| 450 static void TearDownFunctionState(FunctionState* function_state) { | 449 static void TearDownFunctionState(FunctionState* function_state, Zone* zone) { |
| 451 if (function_state->outer_function_state_ != NULL) { | 450 if (function_state->outer_function_state_ != NULL) { |
| 452 function_state->isolate_->set_ast_node_id( | 451 zone->isolate()->set_ast_node_id(function_state->saved_ast_node_id_); |
| 453 function_state->saved_ast_node_id_); | |
| 454 } | 452 } |
| 455 } | 453 } |
| 456 | 454 |
| 457 // Helper functions for recursive descent. | 455 // Helper functions for recursive descent. |
| 458 bool IsEvalOrArguments(Handle<String> identifier) const; | 456 bool IsEvalOrArguments(Handle<String> identifier) const; |
| 459 | 457 |
| 460 // Returns true if the expression is of type "this.foo". | 458 // Returns true if the expression is of type "this.foo". |
| 461 static bool IsThisProperty(Expression* expression); | 459 static bool IsThisProperty(Expression* expression); |
| 462 | 460 |
| 463 static bool IsIdentifier(Expression* expression); | 461 static bool IsIdentifier(Expression* expression); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 private: | 837 private: |
| 840 static const int kLiteralTypeSlot = 0; | 838 static const int kLiteralTypeSlot = 0; |
| 841 static const int kElementsSlot = 1; | 839 static const int kElementsSlot = 1; |
| 842 | 840 |
| 843 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 841 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 844 }; | 842 }; |
| 845 | 843 |
| 846 } } // namespace v8::internal | 844 } } // namespace v8::internal |
| 847 | 845 |
| 848 #endif // V8_PARSER_H_ | 846 #endif // V8_PARSER_H_ |
| OLD | NEW |