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

Side by Side Diff: src/parser.h

Issue 207633003: Move new expression parsing funcs to ParserBase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | « no previous file | src/parser.cc » ('j') | src/preparser.h » ('J')
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 // 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 468
469 static bool IsArrayIndex(Handle<String> string, uint32_t* index) { 469 static bool IsArrayIndex(Handle<String> string, uint32_t* index) {
470 return !string.is_null() && string->AsArrayIndex(index); 470 return !string.is_null() && string->AsArrayIndex(index);
471 } 471 }
472 472
473 // Functions for encapsulating the differences between parsing and preparsing; 473 // Functions for encapsulating the differences between parsing and preparsing;
474 // operations interleaved with the recursive descent. 474 // operations interleaved with the recursive descent.
475 static void PushLiteralName(FuncNameInferrer* fni, Handle<String> id) { 475 static void PushLiteralName(FuncNameInferrer* fni, Handle<String> id) {
476 fni->PushLiteralName(id); 476 fni->PushLiteralName(id);
477 } 477 }
478 void MaybePushPropertyName(FuncNameInferrer* fni, Expression* expression);
Michael Starzinger 2014/03/21 10:09:59 nit: Can we call this PushPropertyOrLiteralName, b
marja 2014/03/21 10:28:24 -> PushPropertyName as discussed offline
478 479
479 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( 480 static void CheckFunctionLiteralInsideTopLevelObjectLiteral(
480 Scope* scope, Expression* value, bool* has_function) { 481 Scope* scope, Expression* value, bool* has_function) {
481 if (scope->DeclarationScope()->is_global_scope() && 482 if (scope->DeclarationScope()->is_global_scope() &&
482 value->AsFunctionLiteral() != NULL) { 483 value->AsFunctionLiteral() != NULL) {
483 *has_function = true; 484 *has_function = true;
484 value->AsFunctionLiteral()->set_pretenure(); 485 value->AsFunctionLiteral()->set_pretenure();
485 } 486 }
486 } 487 }
487 488
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // "null" return type creators. 541 // "null" return type creators.
541 static Handle<String> EmptyIdentifier() { 542 static Handle<String> EmptyIdentifier() {
542 return Handle<String>(); 543 return Handle<String>();
543 } 544 }
544 static Expression* EmptyExpression() { 545 static Expression* EmptyExpression() {
545 return NULL; 546 return NULL;
546 } 547 }
547 static Literal* EmptyLiteral() { 548 static Literal* EmptyLiteral() {
548 return NULL; 549 return NULL;
549 } 550 }
551 // Used in error return values.
550 static ZoneList<Expression*>* NullExpressionList() { 552 static ZoneList<Expression*>* NullExpressionList() {
551 return NULL; 553 return NULL;
552 } 554 }
553 555
554 // Odd-ball literal creators. 556 // Odd-ball literal creators.
555 Literal* GetLiteralTheHole(int position, 557 Literal* GetLiteralTheHole(int position,
556 AstNodeFactory<AstConstructionVisitor>* factory); 558 AstNodeFactory<AstConstructionVisitor>* factory);
557 559
558 // Producing data during the recursive descent. 560 // Producing data during the recursive descent.
559 Handle<String> GetSymbol(Scanner* scanner = NULL); 561 Handle<String> GetSymbol(Scanner* scanner = NULL);
(...skipping 20 matching lines...) Expand all
580 // Temporary glue; these functions will move to ParserBase. 582 // Temporary glue; these functions will move to ParserBase.
581 Expression* ParseV8Intrinsic(bool* ok); 583 Expression* ParseV8Intrinsic(bool* ok);
582 FunctionLiteral* ParseFunctionLiteral( 584 FunctionLiteral* ParseFunctionLiteral(
583 Handle<String> name, 585 Handle<String> name,
584 Scanner::Location function_name_location, 586 Scanner::Location function_name_location,
585 bool name_is_strict_reserved, 587 bool name_is_strict_reserved,
586 bool is_generator, 588 bool is_generator,
587 int function_token_position, 589 int function_token_position,
588 FunctionLiteral::FunctionType type, 590 FunctionLiteral::FunctionType type,
589 bool* ok); 591 bool* ok);
590 Expression* ParseMemberWithNewPrefixesExpression(bool* ok);
591 592
592 private: 593 private:
593 Parser* parser_; 594 Parser* parser_;
594 }; 595 };
595 596
596 597
597 class Parser : public ParserBase<ParserTraits> { 598 class Parser : public ParserBase<ParserTraits> {
598 public: 599 public:
599 explicit Parser(CompilationInfo* info); 600 explicit Parser(CompilationInfo* info);
600 ~Parser() { 601 ~Parser() {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); 717 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok);
717 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); 718 Statement* ParseForStatement(ZoneStringList* labels, bool* ok);
718 Statement* ParseThrowStatement(bool* ok); 719 Statement* ParseThrowStatement(bool* ok);
719 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); 720 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value);
720 TryStatement* ParseTryStatement(bool* ok); 721 TryStatement* ParseTryStatement(bool* ok);
721 DebuggerStatement* ParseDebuggerStatement(bool* ok); 722 DebuggerStatement* ParseDebuggerStatement(bool* ok);
722 723
723 // Support for hamony block scoped bindings. 724 // Support for hamony block scoped bindings.
724 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); 725 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok);
725 726
726 Expression* ParseMemberWithNewPrefixesExpression(bool* ok);
727 Expression* ParseMemberExpression(bool* ok);
728 Expression* ParseMemberExpressionContinuation(Expression* expression,
729 bool* ok);
730 // Initialize the components of a for-in / for-of statement. 727 // Initialize the components of a for-in / for-of statement.
731 void InitializeForEachStatement(ForEachStatement* stmt, 728 void InitializeForEachStatement(ForEachStatement* stmt,
732 Expression* each, 729 Expression* each,
733 Expression* subject, 730 Expression* subject,
734 Statement* body); 731 Statement* body);
735 732
736 FunctionLiteral* ParseFunctionLiteral( 733 FunctionLiteral* ParseFunctionLiteral(
737 Handle<String> name, 734 Handle<String> name,
738 Scanner::Location function_name_location, 735 Scanner::Location function_name_location,
739 bool name_is_strict_reserved, 736 bool name_is_strict_reserved,
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 private: 837 private:
841 static const int kLiteralTypeSlot = 0; 838 static const int kLiteralTypeSlot = 0;
842 static const int kElementsSlot = 1; 839 static const int kElementsSlot = 1;
843 840
844 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 841 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
845 }; 842 };
846 843
847 } } // namespace v8::internal 844 } } // namespace v8::internal
848 845
849 #endif // V8_PARSER_H_ 846 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/preparser.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698