OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 // Synthetic properties are property lookups introduced by the system, | 1198 // Synthetic properties are property lookups introduced by the system, |
1199 // to objects that aren't visible to the user. Function calls to synthetic | 1199 // to objects that aren't visible to the user. Function calls to synthetic |
1200 // properties should use the global object as receiver, not the base object | 1200 // properties should use the global object as receiver, not the base object |
1201 // of the resolved Reference. | 1201 // of the resolved Reference. |
1202 enum Type { NORMAL, SYNTHETIC }; | 1202 enum Type { NORMAL, SYNTHETIC }; |
1203 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) | 1203 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) |
1204 : obj_(obj), | 1204 : obj_(obj), |
1205 key_(key), | 1205 key_(key), |
1206 pos_(pos), | 1206 pos_(pos), |
1207 type_(type), | 1207 type_(type), |
| 1208 receiver_types_(NULL), |
1208 is_monomorphic_(false), | 1209 is_monomorphic_(false), |
1209 receiver_types_(NULL), | |
1210 is_array_length_(false), | 1210 is_array_length_(false), |
| 1211 is_string_length_(false), |
1211 is_function_prototype_(false), | 1212 is_function_prototype_(false), |
1212 is_arguments_access_(false) { } | 1213 is_arguments_access_(false) { } |
1213 | 1214 |
1214 DECLARE_NODE_TYPE(Property) | 1215 DECLARE_NODE_TYPE(Property) |
1215 | 1216 |
1216 virtual bool IsValidLeftHandSide() { return true; } | 1217 virtual bool IsValidLeftHandSide() { return true; } |
1217 virtual bool IsInlineable() const; | 1218 virtual bool IsInlineable() const; |
1218 | 1219 |
1219 Expression* obj() const { return obj_; } | 1220 Expression* obj() const { return obj_; } |
1220 Expression* key() const { return key_; } | 1221 Expression* key() const { return key_; } |
1221 int position() const { return pos_; } | 1222 int position() const { return pos_; } |
1222 bool is_synthetic() const { return type_ == SYNTHETIC; } | 1223 bool is_synthetic() const { return type_ == SYNTHETIC; } |
1223 | 1224 |
| 1225 bool IsStringLength() const { return is_string_length_; } |
1224 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1226 bool IsFunctionPrototype() const { return is_function_prototype_; } |
1225 | 1227 |
1226 // Marks that this is actually an argument rewritten to a keyed property | 1228 // Marks that this is actually an argument rewritten to a keyed property |
1227 // accessing the argument through the arguments shadow object. | 1229 // accessing the argument through the arguments shadow object. |
1228 void set_is_arguments_access(bool is_arguments_access) { | 1230 void set_is_arguments_access(bool is_arguments_access) { |
1229 is_arguments_access_ = is_arguments_access; | 1231 is_arguments_access_ = is_arguments_access; |
1230 } | 1232 } |
1231 bool is_arguments_access() const { return is_arguments_access_; } | 1233 bool is_arguments_access() const { return is_arguments_access_; } |
1232 | 1234 |
1233 // Type feedback information. | 1235 // Type feedback information. |
1234 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1236 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1235 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1237 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1236 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1238 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
1237 virtual bool IsArrayLength() { return is_array_length_; } | 1239 virtual bool IsArrayLength() { return is_array_length_; } |
1238 virtual Handle<Map> GetMonomorphicReceiverType() { | 1240 virtual Handle<Map> GetMonomorphicReceiverType() { |
1239 return monomorphic_receiver_type_; | 1241 return monomorphic_receiver_type_; |
1240 } | 1242 } |
1241 | 1243 |
1242 // Returns a property singleton property access on 'this'. Used | 1244 // Returns a property singleton property access on 'this'. Used |
1243 // during preparsing. | 1245 // during preparsing. |
1244 static Property* this_property() { return &this_property_; } | 1246 static Property* this_property() { return &this_property_; } |
1245 | 1247 |
1246 private: | 1248 private: |
1247 Expression* obj_; | 1249 Expression* obj_; |
1248 Expression* key_; | 1250 Expression* key_; |
1249 int pos_; | 1251 int pos_; |
1250 Type type_; | 1252 Type type_; |
1251 | 1253 |
1252 bool is_monomorphic_; | |
1253 ZoneMapList* receiver_types_; | 1254 ZoneMapList* receiver_types_; |
1254 bool is_array_length_; | 1255 bool is_monomorphic_ : 1; |
1255 bool is_function_prototype_; | 1256 bool is_array_length_ : 1; |
1256 bool is_arguments_access_; | 1257 bool is_string_length_ : 1; |
| 1258 bool is_function_prototype_ : 1; |
| 1259 bool is_arguments_access_ : 1; |
1257 Handle<Map> monomorphic_receiver_type_; | 1260 Handle<Map> monomorphic_receiver_type_; |
1258 | 1261 |
1259 // Dummy property used during preparsing. | 1262 // Dummy property used during preparsing. |
1260 static Property this_property_; | 1263 static Property this_property_; |
1261 }; | 1264 }; |
1262 | 1265 |
1263 | 1266 |
1264 class Call: public Expression { | 1267 class Call: public Expression { |
1265 public: | 1268 public: |
1266 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) | 1269 Call(Expression* expression, ZoneList<Expression*>* arguments, int pos) |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 AST_NODE_LIST(DEF_VISIT) | 2173 AST_NODE_LIST(DEF_VISIT) |
2171 #undef DEF_VISIT | 2174 #undef DEF_VISIT |
2172 | 2175 |
2173 private: | 2176 private: |
2174 bool stack_overflow_; | 2177 bool stack_overflow_; |
2175 }; | 2178 }; |
2176 | 2179 |
2177 } } // namespace v8::internal | 2180 } } // namespace v8::internal |
2178 | 2181 |
2179 #endif // V8_AST_H_ | 2182 #endif // V8_AST_H_ |
OLD | NEW |