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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 static PreParserExpression UseStrongStringLiteral() { | 813 static PreParserExpression UseStrongStringLiteral() { |
814 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | | 814 return PreParserExpression(TypeField::encode(kStringLiteralExpression) | |
815 IsUseStrongField::encode(true)); | 815 IsUseStrongField::encode(true)); |
816 } | 816 } |
817 | 817 |
818 static PreParserExpression This() { | 818 static PreParserExpression This() { |
819 return PreParserExpression(TypeField::encode(kExpression) | | 819 return PreParserExpression(TypeField::encode(kExpression) | |
820 ExpressionTypeField::encode(kThisExpression)); | 820 ExpressionTypeField::encode(kThisExpression)); |
821 } | 821 } |
822 | 822 |
823 static PreParserExpression Super() { | |
824 return PreParserExpression(TypeField::encode(kExpression) | | |
825 ExpressionTypeField::encode(kSuperExpression)); | |
826 } | |
827 | |
828 static PreParserExpression ThisProperty() { | 823 static PreParserExpression ThisProperty() { |
829 return PreParserExpression( | 824 return PreParserExpression( |
830 TypeField::encode(kExpression) | | 825 TypeField::encode(kExpression) | |
831 ExpressionTypeField::encode(kThisPropertyExpression)); | 826 ExpressionTypeField::encode(kThisPropertyExpression)); |
832 } | 827 } |
833 | 828 |
834 static PreParserExpression Property() { | 829 static PreParserExpression Property() { |
835 return PreParserExpression( | 830 return PreParserExpression( |
836 TypeField::encode(kExpression) | | 831 TypeField::encode(kExpression) | |
837 ExpressionTypeField::encode(kPropertyExpression)); | 832 ExpressionTypeField::encode(kPropertyExpression)); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 kNotParenthesized, | 945 kNotParenthesized, |
951 kParanthesizedExpression, | 946 kParanthesizedExpression, |
952 kMultiParenthesizedExpression | 947 kMultiParenthesizedExpression |
953 }; | 948 }; |
954 | 949 |
955 enum ExpressionType { | 950 enum ExpressionType { |
956 kThisExpression, | 951 kThisExpression, |
957 kThisPropertyExpression, | 952 kThisPropertyExpression, |
958 kPropertyExpression, | 953 kPropertyExpression, |
959 kCallExpression, | 954 kCallExpression, |
960 kSuperExpression, | |
961 kNoTemplateTagExpression | 955 kNoTemplateTagExpression |
962 }; | 956 }; |
963 | 957 |
964 explicit PreParserExpression(uint32_t expression_code) | 958 explicit PreParserExpression(uint32_t expression_code) |
965 : code_(expression_code) {} | 959 : code_(expression_code) {} |
966 | 960 |
967 V8_INLINE bool IsValidArrowParams() const { | 961 V8_INLINE bool IsValidArrowParams() const { |
968 return IsBinaryOperation() | 962 return IsBinaryOperation() |
969 ? IsValidArrowParamListField::decode(code_) | 963 ? IsValidArrowParamListField::decode(code_) |
970 : (IsIdentifier() && AsIdentifier().IsValidArrowParam()); | 964 : (IsIdentifier() && AsIdentifier().IsValidArrowParam()); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 } | 1386 } |
1393 | 1387 |
1394 static PreParserExpression ThisExpression(Scope* scope, | 1388 static PreParserExpression ThisExpression(Scope* scope, |
1395 PreParserFactory* factory, | 1389 PreParserFactory* factory, |
1396 int pos) { | 1390 int pos) { |
1397 return PreParserExpression::This(); | 1391 return PreParserExpression::This(); |
1398 } | 1392 } |
1399 | 1393 |
1400 static PreParserExpression SuperReference(Scope* scope, | 1394 static PreParserExpression SuperReference(Scope* scope, |
1401 PreParserFactory* factory) { | 1395 PreParserFactory* factory) { |
1402 return PreParserExpression::Super(); | 1396 return PreParserExpression::Default(); |
1403 } | 1397 } |
1404 | 1398 |
1405 static PreParserExpression DefaultConstructor(bool call_super, Scope* scope, | 1399 static PreParserExpression DefaultConstructor(bool call_super, Scope* scope, |
1406 int pos, int end_pos) { | 1400 int pos, int end_pos) { |
1407 return PreParserExpression::Default(); | 1401 return PreParserExpression::Default(); |
1408 } | 1402 } |
1409 | 1403 |
1410 static PreParserExpression ExpressionFromLiteral( | 1404 static PreParserExpression ExpressionFromLiteral( |
1411 Token::Value token, int pos, Scanner* scanner, | 1405 Token::Value token, int pos, Scanner* scanner, |
1412 PreParserFactory* factory) { | 1406 PreParserFactory* factory) { |
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3109 *ok = false; | 3103 *ok = false; |
3110 return; | 3104 return; |
3111 } | 3105 } |
3112 has_seen_constructor_ = true; | 3106 has_seen_constructor_ = true; |
3113 return; | 3107 return; |
3114 } | 3108 } |
3115 } | 3109 } |
3116 } } // v8::internal | 3110 } } // v8::internal |
3117 | 3111 |
3118 #endif // V8_PREPARSER_H | 3112 #endif // V8_PREPARSER_H |
OLD | NEW |