| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 | 1217 |
| 1218 // Sets the property value in a normalized object given (key, value, details). | 1218 // Sets the property value in a normalized object given (key, value, details). |
| 1219 // Handles the special representation of JS global objects. | 1219 // Handles the special representation of JS global objects. |
| 1220 Object* SetNormalizedProperty(String* name, | 1220 Object* SetNormalizedProperty(String* name, |
| 1221 Object* value, | 1221 Object* value, |
| 1222 PropertyDetails details); | 1222 PropertyDetails details); |
| 1223 | 1223 |
| 1224 // Deletes the named property in a normalized object. | 1224 // Deletes the named property in a normalized object. |
| 1225 Object* DeleteNormalizedProperty(String* name, DeleteMode mode); | 1225 Object* DeleteNormalizedProperty(String* name, DeleteMode mode); |
| 1226 | 1226 |
| 1227 // Sets a property that currently has lazy loading. | |
| 1228 Object* SetLazyProperty(LookupResult* result, | |
| 1229 String* name, | |
| 1230 Object* value, | |
| 1231 PropertyAttributes attributes); | |
| 1232 | |
| 1233 // Returns the class name ([[Class]] property in the specification). | 1227 // Returns the class name ([[Class]] property in the specification). |
| 1234 String* class_name(); | 1228 String* class_name(); |
| 1235 | 1229 |
| 1236 // Returns the constructor name (the name (possibly, inferred name) of the | 1230 // Returns the constructor name (the name (possibly, inferred name) of the |
| 1237 // function that was used to instantiate the object). | 1231 // function that was used to instantiate the object). |
| 1238 String* constructor_name(); | 1232 String* constructor_name(); |
| 1239 | 1233 |
| 1240 // Retrieve interceptors. | 1234 // Retrieve interceptors. |
| 1241 InterceptorInfo* GetNamedInterceptor(); | 1235 InterceptorInfo* GetNamedInterceptor(); |
| 1242 InterceptorInfo* GetIndexedInterceptor(); | 1236 InterceptorInfo* GetIndexedInterceptor(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1257 PropertyAttributes* attributes); | 1251 PropertyAttributes* attributes); |
| 1258 Object* GetPropertyWithInterceptor(JSObject* receiver, | 1252 Object* GetPropertyWithInterceptor(JSObject* receiver, |
| 1259 String* name, | 1253 String* name, |
| 1260 PropertyAttributes* attributes); | 1254 PropertyAttributes* attributes); |
| 1261 Object* GetPropertyPostInterceptor(JSObject* receiver, | 1255 Object* GetPropertyPostInterceptor(JSObject* receiver, |
| 1262 String* name, | 1256 String* name, |
| 1263 PropertyAttributes* attributes); | 1257 PropertyAttributes* attributes); |
| 1264 Object* GetLocalPropertyPostInterceptor(JSObject* receiver, | 1258 Object* GetLocalPropertyPostInterceptor(JSObject* receiver, |
| 1265 String* name, | 1259 String* name, |
| 1266 PropertyAttributes* attributes); | 1260 PropertyAttributes* attributes); |
| 1267 Object* GetLazyProperty(Object* receiver, | |
| 1268 LookupResult* result, | |
| 1269 String* name, | |
| 1270 PropertyAttributes* attributes); | |
| 1271 | |
| 1272 // Tells whether this object needs to be loaded. | |
| 1273 inline bool IsLoaded(); | |
| 1274 | 1261 |
| 1275 // Returns true if this is an instance of an api function and has | 1262 // Returns true if this is an instance of an api function and has |
| 1276 // been modified since it was created. May give false positives. | 1263 // been modified since it was created. May give false positives. |
| 1277 bool IsDirty(); | 1264 bool IsDirty(); |
| 1278 | 1265 |
| 1279 bool HasProperty(String* name) { | 1266 bool HasProperty(String* name) { |
| 1280 return GetPropertyAttribute(name) != ABSENT; | 1267 return GetPropertyAttribute(name) != ABSENT; |
| 1281 } | 1268 } |
| 1282 | 1269 |
| 1283 // Can cause a GC if it hits an interceptor. | 1270 // Can cause a GC if it hits an interceptor. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1301 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real | 1288 // a JSGlobalProxy. Use BypassGlobalProxy method above to get to the real |
| 1302 // holder. | 1289 // holder. |
| 1303 // | 1290 // |
| 1304 // These accessors do not touch interceptors or accessors. | 1291 // These accessors do not touch interceptors or accessors. |
| 1305 inline bool HasHiddenPropertiesObject(); | 1292 inline bool HasHiddenPropertiesObject(); |
| 1306 inline Object* GetHiddenPropertiesObject(); | 1293 inline Object* GetHiddenPropertiesObject(); |
| 1307 inline Object* SetHiddenPropertiesObject(Object* hidden_obj); | 1294 inline Object* SetHiddenPropertiesObject(Object* hidden_obj); |
| 1308 | 1295 |
| 1309 Object* DeleteProperty(String* name, DeleteMode mode); | 1296 Object* DeleteProperty(String* name, DeleteMode mode); |
| 1310 Object* DeleteElement(uint32_t index, DeleteMode mode); | 1297 Object* DeleteElement(uint32_t index, DeleteMode mode); |
| 1311 Object* DeleteLazyProperty(LookupResult* result, | |
| 1312 String* name, | |
| 1313 DeleteMode mode); | |
| 1314 | 1298 |
| 1315 // Tests for the fast common case for property enumeration. | 1299 // Tests for the fast common case for property enumeration. |
| 1316 bool IsSimpleEnum(); | 1300 bool IsSimpleEnum(); |
| 1317 | 1301 |
| 1318 // Do we want to keep the elements in fast case when increasing the | 1302 // Do we want to keep the elements in fast case when increasing the |
| 1319 // capacity? | 1303 // capacity? |
| 1320 bool ShouldConvertToSlowElements(int new_capacity); | 1304 bool ShouldConvertToSlowElements(int new_capacity); |
| 1321 // Returns true if the backing storage for the slow-case elements of | 1305 // Returns true if the backing storage for the slow-case elements of |
| 1322 // this object takes up nearly as much space as a fast-case backing | 1306 // this object takes up nearly as much space as a fast-case backing |
| 1323 // storage would. In that case the JSObject should have fast | 1307 // storage would. In that case the JSObject should have fast |
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2885 // document.all in Firefox & Safari. | 2869 // document.all in Firefox & Safari. |
| 2886 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. | 2870 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. |
| 2887 inline void set_is_undetectable() { | 2871 inline void set_is_undetectable() { |
| 2888 set_bit_field(bit_field() | (1 << kIsUndetectable)); | 2872 set_bit_field(bit_field() | (1 << kIsUndetectable)); |
| 2889 } | 2873 } |
| 2890 | 2874 |
| 2891 inline bool is_undetectable() { | 2875 inline bool is_undetectable() { |
| 2892 return ((1 << kIsUndetectable) & bit_field()) != 0; | 2876 return ((1 << kIsUndetectable) & bit_field()) != 0; |
| 2893 } | 2877 } |
| 2894 | 2878 |
| 2895 inline void set_needs_loading(bool value) { | |
| 2896 if (value) { | |
| 2897 set_bit_field2(bit_field2() | (1 << kNeedsLoading)); | |
| 2898 } else { | |
| 2899 set_bit_field2(bit_field2() & ~(1 << kNeedsLoading)); | |
| 2900 } | |
| 2901 } | |
| 2902 | |
| 2903 // Does this object or function require a lazily loaded script to be | |
| 2904 // run before being used? | |
| 2905 inline bool needs_loading() { | |
| 2906 return ((1 << kNeedsLoading) & bit_field2()) != 0; | |
| 2907 } | |
| 2908 | |
| 2909 // Tells whether the instance has a call-as-function handler. | 2879 // Tells whether the instance has a call-as-function handler. |
| 2910 inline void set_has_instance_call_handler() { | 2880 inline void set_has_instance_call_handler() { |
| 2911 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); | 2881 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); |
| 2912 } | 2882 } |
| 2913 | 2883 |
| 2914 inline bool has_instance_call_handler() { | 2884 inline bool has_instance_call_handler() { |
| 2915 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; | 2885 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; |
| 2916 } | 2886 } |
| 2917 | 2887 |
| 2918 inline void set_is_extensible() { | 2888 inline void set_is_extensible() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3032 static const int kUnused = 0; // To be used for marking recently used maps. | 3002 static const int kUnused = 0; // To be used for marking recently used maps. |
| 3033 static const int kHasNonInstancePrototype = 1; | 3003 static const int kHasNonInstancePrototype = 1; |
| 3034 static const int kIsHiddenPrototype = 2; | 3004 static const int kIsHiddenPrototype = 2; |
| 3035 static const int kHasNamedInterceptor = 3; | 3005 static const int kHasNamedInterceptor = 3; |
| 3036 static const int kHasIndexedInterceptor = 4; | 3006 static const int kHasIndexedInterceptor = 4; |
| 3037 static const int kIsUndetectable = 5; | 3007 static const int kIsUndetectable = 5; |
| 3038 static const int kHasInstanceCallHandler = 6; | 3008 static const int kHasInstanceCallHandler = 6; |
| 3039 static const int kIsAccessCheckNeeded = 7; | 3009 static const int kIsAccessCheckNeeded = 7; |
| 3040 | 3010 |
| 3041 // Bit positions for bit field 2 | 3011 // Bit positions for bit field 2 |
| 3042 static const int kNeedsLoading = 0; | 3012 static const int kIsExtensible = 0; |
| 3043 static const int kIsExtensible = 1; | |
| 3044 | 3013 |
| 3045 // Layout of the default cache. It holds alternating name and code objects. | 3014 // Layout of the default cache. It holds alternating name and code objects. |
| 3046 static const int kCodeCacheEntrySize = 2; | 3015 static const int kCodeCacheEntrySize = 2; |
| 3047 static const int kCodeCacheEntryNameOffset = 0; | 3016 static const int kCodeCacheEntryNameOffset = 0; |
| 3048 static const int kCodeCacheEntryCodeOffset = 1; | 3017 static const int kCodeCacheEntryCodeOffset = 1; |
| 3049 | 3018 |
| 3050 private: | 3019 private: |
| 3051 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); | 3020 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); |
| 3052 }; | 3021 }; |
| 3053 | 3022 |
| (...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5098 } else { | 5067 } else { |
| 5099 value &= ~(1 << bit_position); | 5068 value &= ~(1 << bit_position); |
| 5100 } | 5069 } |
| 5101 return value; | 5070 return value; |
| 5102 } | 5071 } |
| 5103 }; | 5072 }; |
| 5104 | 5073 |
| 5105 } } // namespace v8::internal | 5074 } } // namespace v8::internal |
| 5106 | 5075 |
| 5107 #endif // V8_OBJECTS_H_ | 5076 #endif // V8_OBJECTS_H_ |
| OLD | NEW |