| 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 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 | 1184 |
| 1185 private: | 1185 private: |
| 1186 Variable* var_; | 1186 Variable* var_; |
| 1187 Type type_; | 1187 Type type_; |
| 1188 int index_; | 1188 int index_; |
| 1189 }; | 1189 }; |
| 1190 | 1190 |
| 1191 | 1191 |
| 1192 class Property: public Expression { | 1192 class Property: public Expression { |
| 1193 public: | 1193 public: |
| 1194 // Synthetic properties are property lookups introduced by the system, | 1194 Property(Expression* obj, Expression* key, int pos) |
| 1195 // to objects that aren't visible to the user. Function calls to synthetic | |
| 1196 // properties should use the global object as receiver, not the base object | |
| 1197 // of the resolved Reference. | |
| 1198 enum Type { NORMAL, SYNTHETIC }; | |
| 1199 Property(Expression* obj, Expression* key, int pos, Type type = NORMAL) | |
| 1200 : obj_(obj), | 1195 : obj_(obj), |
| 1201 key_(key), | 1196 key_(key), |
| 1202 pos_(pos), | 1197 pos_(pos), |
| 1203 type_(type), | |
| 1204 receiver_types_(NULL), | 1198 receiver_types_(NULL), |
| 1205 is_monomorphic_(false), | 1199 is_monomorphic_(false), |
| 1206 is_array_length_(false), | 1200 is_array_length_(false), |
| 1207 is_string_length_(false), | 1201 is_string_length_(false), |
| 1208 is_string_access_(false), | 1202 is_string_access_(false), |
| 1209 is_function_prototype_(false), | 1203 is_function_prototype_(false) { } |
| 1210 is_arguments_access_(false) { } | |
| 1211 | 1204 |
| 1212 DECLARE_NODE_TYPE(Property) | 1205 DECLARE_NODE_TYPE(Property) |
| 1213 | 1206 |
| 1214 virtual bool IsValidLeftHandSide() { return true; } | 1207 virtual bool IsValidLeftHandSide() { return true; } |
| 1215 virtual bool IsInlineable() const; | 1208 virtual bool IsInlineable() const; |
| 1216 | 1209 |
| 1217 Expression* obj() const { return obj_; } | 1210 Expression* obj() const { return obj_; } |
| 1218 Expression* key() const { return key_; } | 1211 Expression* key() const { return key_; } |
| 1219 int position() const { return pos_; } | 1212 int position() const { return pos_; } |
| 1220 bool is_synthetic() const { return type_ == SYNTHETIC; } | |
| 1221 | 1213 |
| 1222 bool IsStringLength() const { return is_string_length_; } | 1214 bool IsStringLength() const { return is_string_length_; } |
| 1223 bool IsStringAccess() const { return is_string_access_; } | 1215 bool IsStringAccess() const { return is_string_access_; } |
| 1224 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1216 bool IsFunctionPrototype() const { return is_function_prototype_; } |
| 1225 | 1217 |
| 1226 // Marks that this is actually an argument rewritten to a keyed property | |
| 1227 // accessing the argument through the arguments shadow object. | |
| 1228 void set_is_arguments_access(bool is_arguments_access) { | |
| 1229 is_arguments_access_ = is_arguments_access; | |
| 1230 } | |
| 1231 bool is_arguments_access() const { return is_arguments_access_; } | |
| 1232 | |
| 1233 ExternalArrayType GetExternalArrayType() const { return array_type_; } | 1218 ExternalArrayType GetExternalArrayType() const { return array_type_; } |
| 1234 void SetExternalArrayType(ExternalArrayType array_type) { | 1219 void SetExternalArrayType(ExternalArrayType array_type) { |
| 1235 array_type_ = array_type; | 1220 array_type_ = array_type; |
| 1236 } | 1221 } |
| 1237 | 1222 |
| 1238 // Type feedback information. | 1223 // Type feedback information. |
| 1239 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1224 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1240 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1225 virtual bool IsMonomorphic() { return is_monomorphic_; } |
| 1241 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } | 1226 virtual ZoneMapList* GetReceiverTypes() { return receiver_types_; } |
| 1242 virtual bool IsArrayLength() { return is_array_length_; } | 1227 virtual bool IsArrayLength() { return is_array_length_; } |
| 1243 virtual Handle<Map> GetMonomorphicReceiverType() { | 1228 virtual Handle<Map> GetMonomorphicReceiverType() { |
| 1244 return monomorphic_receiver_type_; | 1229 return monomorphic_receiver_type_; |
| 1245 } | 1230 } |
| 1246 | 1231 |
| 1247 // Returns a property singleton property access on 'this'. Used | 1232 // Returns a property singleton property access on 'this'. Used |
| 1248 // during preparsing. | 1233 // during preparsing. |
| 1249 static Property* this_property() { return &this_property_; } | 1234 static Property* this_property() { return &this_property_; } |
| 1250 | 1235 |
| 1251 private: | 1236 private: |
| 1252 Expression* obj_; | 1237 Expression* obj_; |
| 1253 Expression* key_; | 1238 Expression* key_; |
| 1254 int pos_; | 1239 int pos_; |
| 1255 Type type_; | |
| 1256 | 1240 |
| 1257 ZoneMapList* receiver_types_; | 1241 ZoneMapList* receiver_types_; |
| 1258 bool is_monomorphic_ : 1; | 1242 bool is_monomorphic_ : 1; |
| 1259 bool is_array_length_ : 1; | 1243 bool is_array_length_ : 1; |
| 1260 bool is_string_length_ : 1; | 1244 bool is_string_length_ : 1; |
| 1261 bool is_string_access_ : 1; | 1245 bool is_string_access_ : 1; |
| 1262 bool is_function_prototype_ : 1; | 1246 bool is_function_prototype_ : 1; |
| 1263 bool is_arguments_access_ : 1; | |
| 1264 Handle<Map> monomorphic_receiver_type_; | 1247 Handle<Map> monomorphic_receiver_type_; |
| 1265 ExternalArrayType array_type_; | 1248 ExternalArrayType array_type_; |
| 1266 | 1249 |
| 1267 // Dummy property used during preparsing. | 1250 // Dummy property used during preparsing. |
| 1268 static Property this_property_; | 1251 static Property this_property_; |
| 1269 }; | 1252 }; |
| 1270 | 1253 |
| 1271 | 1254 |
| 1272 class Call: public Expression { | 1255 class Call: public Expression { |
| 1273 public: | 1256 public: |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 AST_NODE_LIST(DEF_VISIT) | 2159 AST_NODE_LIST(DEF_VISIT) |
| 2177 #undef DEF_VISIT | 2160 #undef DEF_VISIT |
| 2178 | 2161 |
| 2179 private: | 2162 private: |
| 2180 bool stack_overflow_; | 2163 bool stack_overflow_; |
| 2181 }; | 2164 }; |
| 2182 | 2165 |
| 2183 } } // namespace v8::internal | 2166 } } // namespace v8::internal |
| 2184 | 2167 |
| 2185 #endif // V8_AST_H_ | 2168 #endif // V8_AST_H_ |
| OLD | NEW |