OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 | 1224 |
1225 private: | 1225 private: |
1226 Variable* var_; | 1226 Variable* var_; |
1227 Type type_; | 1227 Type type_; |
1228 int index_; | 1228 int index_; |
1229 }; | 1229 }; |
1230 | 1230 |
1231 | 1231 |
1232 class Property: public Expression { | 1232 class Property: public Expression { |
1233 public: | 1233 public: |
1234 // Synthetic properties are property lookups introduced by the system, | |
1235 // to objects that aren't visible to the user. Function calls to synthetic | |
1236 // properties should use the global object as receiver, not the base object | |
1237 // of the resolved Reference. | |
1238 enum Type { NORMAL, SYNTHETIC }; | |
1239 Property(Isolate* isolate, | 1234 Property(Isolate* isolate, |
1240 Expression* obj, | 1235 Expression* obj, |
1241 Expression* key, | 1236 Expression* key, |
1242 int pos, | 1237 int pos) |
1243 Type type = NORMAL) | |
1244 : Expression(isolate), | 1238 : Expression(isolate), |
1245 obj_(obj), | 1239 obj_(obj), |
1246 key_(key), | 1240 key_(key), |
1247 pos_(pos), | 1241 pos_(pos), |
1248 type_(type), | |
1249 is_monomorphic_(false), | 1242 is_monomorphic_(false), |
1250 is_array_length_(false), | 1243 is_array_length_(false), |
1251 is_string_length_(false), | 1244 is_string_length_(false), |
1252 is_string_access_(false), | 1245 is_string_access_(false), |
1253 is_function_prototype_(false) { } | 1246 is_function_prototype_(false) { } |
1254 | 1247 |
1255 DECLARE_NODE_TYPE(Property) | 1248 DECLARE_NODE_TYPE(Property) |
1256 | 1249 |
1257 virtual bool IsValidLeftHandSide() { return true; } | 1250 virtual bool IsValidLeftHandSide() { return true; } |
1258 virtual bool IsInlineable() const; | 1251 virtual bool IsInlineable() const; |
1259 | 1252 |
1260 Expression* obj() const { return obj_; } | 1253 Expression* obj() const { return obj_; } |
1261 Expression* key() const { return key_; } | 1254 Expression* key() const { return key_; } |
1262 virtual int position() const { return pos_; } | 1255 virtual int position() const { return pos_; } |
1263 bool is_synthetic() const { return type_ == SYNTHETIC; } | |
1264 | 1256 |
1265 bool IsStringLength() const { return is_string_length_; } | 1257 bool IsStringLength() const { return is_string_length_; } |
1266 bool IsStringAccess() const { return is_string_access_; } | 1258 bool IsStringAccess() const { return is_string_access_; } |
1267 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1259 bool IsFunctionPrototype() const { return is_function_prototype_; } |
1268 | 1260 |
1269 // Type feedback information. | 1261 // Type feedback information. |
1270 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1262 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1271 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1263 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1272 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1264 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1273 virtual bool IsArrayLength() { return is_array_length_; } | 1265 virtual bool IsArrayLength() { return is_array_length_; } |
1274 | 1266 |
1275 private: | 1267 private: |
1276 Expression* obj_; | 1268 Expression* obj_; |
1277 Expression* key_; | 1269 Expression* key_; |
1278 int pos_; | 1270 int pos_; |
1279 Type type_; | |
1280 | 1271 |
1281 SmallMapList receiver_types_; | 1272 SmallMapList receiver_types_; |
1282 bool is_monomorphic_ : 1; | 1273 bool is_monomorphic_ : 1; |
1283 bool is_array_length_ : 1; | 1274 bool is_array_length_ : 1; |
1284 bool is_string_length_ : 1; | 1275 bool is_string_length_ : 1; |
1285 bool is_string_access_ : 1; | 1276 bool is_string_access_ : 1; |
1286 bool is_function_prototype_ : 1; | 1277 bool is_function_prototype_ : 1; |
1287 }; | 1278 }; |
1288 | 1279 |
1289 | 1280 |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 | 2253 |
2263 private: | 2254 private: |
2264 Isolate* isolate_; | 2255 Isolate* isolate_; |
2265 bool stack_overflow_; | 2256 bool stack_overflow_; |
2266 }; | 2257 }; |
2267 | 2258 |
2268 | 2259 |
2269 } } // namespace v8::internal | 2260 } } // namespace v8::internal |
2270 | 2261 |
2271 #endif // V8_AST_H_ | 2262 #endif // V8_AST_H_ |
OLD | NEW |