| 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/bailout-reason.h" | 8 #include "src/bailout-reason.h" | 
| 9 #include "src/expression-classifier.h" | 9 #include "src/expression-classifier.h" | 
| 10 #include "src/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" | 
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 941 | 941 | 
| 942   static PreParserExpression BinaryOperation(PreParserExpression left, | 942   static PreParserExpression BinaryOperation(PreParserExpression left, | 
| 943                                              Token::Value op, | 943                                              Token::Value op, | 
| 944                                              PreParserExpression right) { | 944                                              PreParserExpression right) { | 
| 945     return PreParserExpression( | 945     return PreParserExpression( | 
| 946         TypeField::encode(kBinaryOperationExpression) | | 946         TypeField::encode(kBinaryOperationExpression) | | 
| 947         HasRestField::encode(op == Token::COMMA && | 947         HasRestField::encode(op == Token::COMMA && | 
| 948                              right->IsSpreadExpression())); | 948                              right->IsSpreadExpression())); | 
| 949   } | 949   } | 
| 950 | 950 | 
|  | 951   static PreParserExpression ObjectLiteral() { | 
|  | 952     return PreParserExpression(TypeField::encode(kObjectLiteralExpression)); | 
|  | 953   } | 
|  | 954 | 
| 951   static PreParserExpression StringLiteral() { | 955   static PreParserExpression StringLiteral() { | 
| 952     return PreParserExpression(TypeField::encode(kStringLiteralExpression)); | 956     return PreParserExpression(TypeField::encode(kStringLiteralExpression)); | 
| 953   } | 957   } | 
| 954 | 958 | 
| 955   static PreParserExpression UseStrictStringLiteral() { | 959   static PreParserExpression UseStrictStringLiteral() { | 
| 956     return PreParserExpression(TypeField::encode(kStringLiteralExpression) | | 960     return PreParserExpression(TypeField::encode(kStringLiteralExpression) | | 
| 957                                IsUseStrictField::encode(true)); | 961                                IsUseStrictField::encode(true)); | 
| 958   } | 962   } | 
| 959 | 963 | 
| 960   static PreParserExpression UseStrongStringLiteral() { | 964   static PreParserExpression UseStrongStringLiteral() { | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 998 | 1002 | 
| 999   bool IsIdentifier() const { | 1003   bool IsIdentifier() const { | 
| 1000     return TypeField::decode(code_) == kIdentifierExpression; | 1004     return TypeField::decode(code_) == kIdentifierExpression; | 
| 1001   } | 1005   } | 
| 1002 | 1006 | 
| 1003   PreParserIdentifier AsIdentifier() const { | 1007   PreParserIdentifier AsIdentifier() const { | 
| 1004     DCHECK(IsIdentifier()); | 1008     DCHECK(IsIdentifier()); | 
| 1005     return PreParserIdentifier(IdentifierTypeField::decode(code_)); | 1009     return PreParserIdentifier(IdentifierTypeField::decode(code_)); | 
| 1006   } | 1010   } | 
| 1007 | 1011 | 
|  | 1012   bool IsObjectLiteral() const { | 
|  | 1013     return TypeField::decode(code_) == kObjectLiteralExpression; | 
|  | 1014   } | 
|  | 1015 | 
|  | 1016   bool IsArrayLiteral() const { | 
|  | 1017     return TypeField::decode(code_) == kObjectLiteralExpression; | 
|  | 1018   } | 
|  | 1019 | 
| 1008   bool IsStringLiteral() const { | 1020   bool IsStringLiteral() const { | 
| 1009     return TypeField::decode(code_) == kStringLiteralExpression; | 1021     return TypeField::decode(code_) == kStringLiteralExpression; | 
| 1010   } | 1022   } | 
| 1011 | 1023 | 
| 1012   bool IsUseStrictLiteral() const { | 1024   bool IsUseStrictLiteral() const { | 
| 1013     return TypeField::decode(code_) == kStringLiteralExpression && | 1025     return TypeField::decode(code_) == kStringLiteralExpression && | 
| 1014            IsUseStrictField::decode(code_); | 1026            IsUseStrictField::decode(code_); | 
| 1015   } | 1027   } | 
| 1016 | 1028 | 
| 1017   bool IsUseStrongLiteral() const { | 1029   bool IsUseStrongLiteral() const { | 
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1086 | 1098 | 
| 1087   int position() const { return RelocInfo::kNoPosition; } | 1099   int position() const { return RelocInfo::kNoPosition; } | 
| 1088   void set_function_token_position(int position) {} | 1100   void set_function_token_position(int position) {} | 
| 1089 | 1101 | 
| 1090  private: | 1102  private: | 
| 1091   enum Type { | 1103   enum Type { | 
| 1092     kExpression, | 1104     kExpression, | 
| 1093     kIdentifierExpression, | 1105     kIdentifierExpression, | 
| 1094     kStringLiteralExpression, | 1106     kStringLiteralExpression, | 
| 1095     kBinaryOperationExpression, | 1107     kBinaryOperationExpression, | 
| 1096     kSpreadExpression | 1108     kSpreadExpression, | 
|  | 1109     kObjectLiteralExpression | 
| 1097   }; | 1110   }; | 
| 1098 | 1111 | 
| 1099   enum ExpressionType { | 1112   enum ExpressionType { | 
| 1100     kThisExpression, | 1113     kThisExpression, | 
| 1101     kThisPropertyExpression, | 1114     kThisPropertyExpression, | 
| 1102     kPropertyExpression, | 1115     kPropertyExpression, | 
| 1103     kCallExpression, | 1116     kCallExpression, | 
| 1104     kSuperCallReference, | 1117     kSuperCallReference, | 
| 1105     kNoTemplateTagExpression | 1118     kNoTemplateTagExpression | 
| 1106   }; | 1119   }; | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1224                                        PreParserIdentifier js_flags, | 1237                                        PreParserIdentifier js_flags, | 
| 1225                                        int literal_index, | 1238                                        int literal_index, | 
| 1226                                        bool is_strong, | 1239                                        bool is_strong, | 
| 1227                                        int pos) { | 1240                                        int pos) { | 
| 1228     return PreParserExpression::Default(); | 1241     return PreParserExpression::Default(); | 
| 1229   } | 1242   } | 
| 1230   PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1243   PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 
| 1231                                       int literal_index, | 1244                                       int literal_index, | 
| 1232                                       bool is_strong, | 1245                                       bool is_strong, | 
| 1233                                       int pos) { | 1246                                       int pos) { | 
| 1234     return PreParserExpression::Default(); | 1247     return PreParserExpression::ObjectLiteral(); | 
| 1235   } | 1248   } | 
| 1236   PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 1249   PreParserExpression NewArrayLiteral(PreParserExpressionList values, | 
| 1237                                       int first_spread_index, int literal_index, | 1250                                       int first_spread_index, int literal_index, | 
| 1238                                       bool is_strong, int pos) { | 1251                                       bool is_strong, int pos) { | 
| 1239     return PreParserExpression::Default(); | 1252     return PreParserExpression::ObjectLiteral(); | 
| 1240   } | 1253   } | 
| 1241   PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1254   PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 
| 1242                                                PreParserExpression value, | 1255                                                PreParserExpression value, | 
| 1243                                                ObjectLiteralProperty::Kind kind, | 1256                                                ObjectLiteralProperty::Kind kind, | 
| 1244                                                bool is_static, | 1257                                                bool is_static, | 
| 1245                                                bool is_computed_name) { | 1258                                                bool is_computed_name) { | 
| 1246     return PreParserExpression::Default(); | 1259     return PreParserExpression::Default(); | 
| 1247   } | 1260   } | 
| 1248   PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 1261   PreParserExpression NewObjectLiteralProperty(PreParserExpression key, | 
| 1249                                                PreParserExpression value, | 1262                                                PreParserExpression value, | 
| 1250                                                bool is_static, | 1263                                                bool is_static, | 
| 1251                                                bool is_computed_name) { | 1264                                                bool is_computed_name) { | 
| 1252     return PreParserExpression::Default(); | 1265     return PreParserExpression::Default(); | 
| 1253   } | 1266   } | 
| 1254   PreParserExpression NewObjectLiteral(PreParserExpressionList properties, | 1267   PreParserExpression NewObjectLiteral(PreParserExpressionList properties, | 
| 1255                                        int literal_index, | 1268                                        int literal_index, | 
| 1256                                        int boilerplate_properties, | 1269                                        int boilerplate_properties, | 
| 1257                                        bool has_function, | 1270                                        bool has_function, | 
| 1258                                        bool is_strong, | 1271                                        bool is_strong, | 
| 1259                                        int pos) { | 1272                                        int pos) { | 
| 1260     return PreParserExpression::Default(); | 1273     return PreParserExpression::ObjectLiteral(); | 
| 1261   } | 1274   } | 
| 1262   PreParserExpression NewVariableProxy(void* variable) { | 1275   PreParserExpression NewVariableProxy(void* variable) { | 
| 1263     return PreParserExpression::Default(); | 1276     return PreParserExpression::Default(); | 
| 1264   } | 1277   } | 
| 1265   PreParserExpression NewProperty(PreParserExpression obj, | 1278   PreParserExpression NewProperty(PreParserExpression obj, | 
| 1266                                   PreParserExpression key, | 1279                                   PreParserExpression key, | 
| 1267                                   int pos) { | 1280                                   int pos) { | 
| 1268     if (obj.IsThis()) { | 1281     if (obj.IsThis()) { | 
| 1269       return PreParserExpression::ThisProperty(); | 1282       return PreParserExpression::ThisProperty(); | 
| 1270     } | 1283     } | 
| (...skipping 2933 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4204       return; | 4217       return; | 
| 4205     } | 4218     } | 
| 4206     has_seen_constructor_ = true; | 4219     has_seen_constructor_ = true; | 
| 4207     return; | 4220     return; | 
| 4208   } | 4221   } | 
| 4209 } | 4222 } | 
| 4210 }  // namespace internal | 4223 }  // namespace internal | 
| 4211 }  // namespace v8 | 4224 }  // namespace v8 | 
| 4212 | 4225 | 
| 4213 #endif  // V8_PREPARSER_H | 4226 #endif  // V8_PREPARSER_H | 
| OLD | NEW | 
|---|