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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 *has_function = true; | 483 *has_function = true; |
484 value->AsFunctionLiteral()->set_pretenure(); | 484 value->AsFunctionLiteral()->set_pretenure(); |
485 } | 485 } |
486 } | 486 } |
487 | 487 |
488 // If we assign a function literal to a property we pretenure the | 488 // If we assign a function literal to a property we pretenure the |
489 // literal so it can be added as a constant function property. | 489 // literal so it can be added as a constant function property. |
490 static void CheckAssigningFunctionLiteralToProperty(Expression* left, | 490 static void CheckAssigningFunctionLiteralToProperty(Expression* left, |
491 Expression* right); | 491 Expression* right); |
492 | 492 |
493 // Determine whether the expression is a valid assignment left-hand side. | |
494 static bool IsValidLeftHandSide(Expression* expression) { | |
495 return expression->IsValidLeftHandSide(); | |
496 } | |
497 | |
498 // Determine if the expression is a variable proxy and mark it as being used | 493 // Determine if the expression is a variable proxy and mark it as being used |
499 // in an assignment or with a increment/decrement operator. This is currently | 494 // in an assignment or with a increment/decrement operator. This is currently |
500 // used on for the statically checking assignments to harmony const bindings. | 495 // used on for the statically checking assignments to harmony const bindings. |
501 static Expression* MarkExpressionAsLValue(Expression* expression); | 496 static Expression* MarkExpressionAsLValue(Expression* expression); |
502 | 497 |
503 // Checks LHS expression for assignment and prefix/postfix increment/decrement | 498 // Checks LHS expression for assignment and prefix/postfix increment/decrement |
504 // in strict mode. | 499 // in strict mode. |
505 void CheckStrictModeLValue(Expression*expression, bool* ok); | 500 void CheckStrictModeLValue(Expression*expression, bool* ok); |
506 | 501 |
507 // Returns true if we have a binary expression between two numeric | 502 // Returns true if we have a binary expression between two numeric |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // Temporary glue; these functions will move to ParserBase. | 577 // Temporary glue; these functions will move to ParserBase. |
583 Expression* ParseV8Intrinsic(bool* ok); | 578 Expression* ParseV8Intrinsic(bool* ok); |
584 FunctionLiteral* ParseFunctionLiteral( | 579 FunctionLiteral* ParseFunctionLiteral( |
585 Handle<String> name, | 580 Handle<String> name, |
586 Scanner::Location function_name_location, | 581 Scanner::Location function_name_location, |
587 bool name_is_strict_reserved, | 582 bool name_is_strict_reserved, |
588 bool is_generator, | 583 bool is_generator, |
589 int function_token_position, | 584 int function_token_position, |
590 FunctionLiteral::FunctionType type, | 585 FunctionLiteral::FunctionType type, |
591 bool* ok); | 586 bool* ok); |
592 Expression* ParsePostfixExpression(bool* ok); | 587 Expression* ParseLeftHandSideExpression(bool* ok); |
593 | 588 |
594 private: | 589 private: |
595 Parser* parser_; | 590 Parser* parser_; |
596 }; | 591 }; |
597 | 592 |
598 | 593 |
599 class Parser : public ParserBase<ParserTraits> { | 594 class Parser : public ParserBase<ParserTraits> { |
600 public: | 595 public: |
601 explicit Parser(CompilationInfo* info); | 596 explicit Parser(CompilationInfo* info); |
602 ~Parser() { | 597 ~Parser() { |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); | 736 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); |
742 Statement* ParseThrowStatement(bool* ok); | 737 Statement* ParseThrowStatement(bool* ok); |
743 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); | 738 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); |
744 TryStatement* ParseTryStatement(bool* ok); | 739 TryStatement* ParseTryStatement(bool* ok); |
745 DebuggerStatement* ParseDebuggerStatement(bool* ok); | 740 DebuggerStatement* ParseDebuggerStatement(bool* ok); |
746 | 741 |
747 // Support for hamony block scoped bindings. | 742 // Support for hamony block scoped bindings. |
748 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); | 743 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); |
749 | 744 |
750 Expression* ParseUnaryExpression(bool* ok); | 745 Expression* ParseUnaryExpression(bool* ok); |
751 Expression* ParsePostfixExpression(bool* ok); | |
752 Expression* ParseLeftHandSideExpression(bool* ok); | 746 Expression* ParseLeftHandSideExpression(bool* ok); |
753 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); | 747 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); |
754 Expression* ParseMemberExpression(bool* ok); | 748 Expression* ParseMemberExpression(bool* ok); |
755 Expression* ParseMemberExpressionContinuation(Expression* expression, | 749 Expression* ParseMemberExpressionContinuation(Expression* expression, |
756 bool* ok); | 750 bool* ok); |
757 Expression* ParseObjectLiteral(bool* ok); | 751 Expression* ParseObjectLiteral(bool* ok); |
758 | 752 |
759 // Initialize the components of a for-in / for-of statement. | 753 // Initialize the components of a for-in / for-of statement. |
760 void InitializeForEachStatement(ForEachStatement* stmt, | 754 void InitializeForEachStatement(ForEachStatement* stmt, |
761 Expression* each, | 755 Expression* each, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 private: | 865 private: |
872 static const int kLiteralTypeSlot = 0; | 866 static const int kLiteralTypeSlot = 0; |
873 static const int kElementsSlot = 1; | 867 static const int kElementsSlot = 1; |
874 | 868 |
875 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 869 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
876 }; | 870 }; |
877 | 871 |
878 } } // namespace v8::internal | 872 } } // namespace v8::internal |
879 | 873 |
880 #endif // V8_PARSER_H_ | 874 #endif // V8_PARSER_H_ |
OLD | NEW |