Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/parser.h

Issue 633373003: Simplify AST ID generation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.h ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 typedef ZoneList<v8::internal::Expression*>* ExpressionList; 369 typedef ZoneList<v8::internal::Expression*>* ExpressionList;
370 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; 370 typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
371 typedef ZoneList<v8::internal::Statement*>* StatementList; 371 typedef ZoneList<v8::internal::Statement*>* StatementList;
372 372
373 // For constructing objects returned by the traversing functions. 373 // For constructing objects returned by the traversing functions.
374 typedef AstNodeFactory<AstConstructionVisitor> Factory; 374 typedef AstNodeFactory<AstConstructionVisitor> Factory;
375 }; 375 };
376 376
377 explicit ParserTraits(Parser* parser) : parser_(parser) {} 377 explicit ParserTraits(Parser* parser) : parser_(parser) {}
378 378
379 // Custom operations executed when FunctionStates are created and destructed.
380 template <typename FunctionState>
381 static void SetUpFunctionState(FunctionState* function_state) {
382 function_state->saved_id_gen_ = *function_state->ast_node_id_gen_;
383 *function_state->ast_node_id_gen_ =
384 AstNode::IdGen(BailoutId::FirstUsable().ToInt());
385 }
386
387 template <typename FunctionState>
388 static void TearDownFunctionState(FunctionState* function_state) {
389 if (function_state->outer_function_state_ != NULL) {
390 *function_state->ast_node_id_gen_ = function_state->saved_id_gen_;
391 }
392 }
393
394 // Helper functions for recursive descent. 379 // Helper functions for recursive descent.
395 bool IsEvalOrArguments(const AstRawString* identifier) const; 380 bool IsEvalOrArguments(const AstRawString* identifier) const;
396 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const; 381 V8_INLINE bool IsFutureStrictReserved(const AstRawString* identifier) const;
397 382
398 // Returns true if the expression is of type "this.foo". 383 // Returns true if the expression is of type "this.foo".
399 static bool IsThisProperty(Expression* expression); 384 static bool IsThisProperty(Expression* expression);
400 385
401 static bool IsIdentifier(Expression* expression); 386 static bool IsIdentifier(Expression* expression);
402 387
403 bool IsPrototype(const AstRawString* identifier) const; 388 bool IsPrototype(const AstRawString* identifier) const;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 private: 917 private:
933 static const int kLiteralTypeSlot = 0; 918 static const int kLiteralTypeSlot = 0;
934 static const int kElementsSlot = 1; 919 static const int kElementsSlot = 1;
935 920
936 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 921 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
937 }; 922 };
938 923
939 } } // namespace v8::internal 924 } } // namespace v8::internal
940 925
941 #endif // V8_PARSER_H_ 926 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698