| 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2046 inline int GetInternalFieldCount(); | 2046 inline int GetInternalFieldCount(); |
| 2047 inline int GetInternalFieldOffset(int index); | 2047 inline int GetInternalFieldOffset(int index); |
| 2048 inline Object* GetInternalField(int index); | 2048 inline Object* GetInternalField(int index); |
| 2049 inline void SetInternalField(int index, Object* value); | 2049 inline void SetInternalField(int index, Object* value); |
| 2050 inline void SetInternalField(int index, Smi* value); | 2050 inline void SetInternalField(int index, Smi* value); |
| 2051 | 2051 |
| 2052 // Returns the number of properties on this object filtering out properties | 2052 // Returns the number of properties on this object filtering out properties |
| 2053 // with the specified attributes (ignoring interceptors). | 2053 // with the specified attributes (ignoring interceptors). |
| 2054 int NumberOfOwnProperties(PropertyAttributes filter = NONE); | 2054 int NumberOfOwnProperties(PropertyAttributes filter = NONE); |
| 2055 // Fill in details for properties into storage starting at the specified | 2055 // Fill in details for properties into storage starting at the specified |
| 2056 // index. | 2056 // index. Returns the number of properties added. |
| 2057 void GetOwnPropertyNames( | 2057 int GetOwnPropertyNames(FixedArray* storage, int index, |
| 2058 FixedArray* storage, int index, PropertyAttributes filter = NONE); | 2058 PropertyAttributes filter = NONE); |
| 2059 | 2059 |
| 2060 // Returns the number of properties on this object filtering out properties | 2060 // Returns the number of properties on this object filtering out properties |
| 2061 // with the specified attributes (ignoring interceptors). | 2061 // with the specified attributes (ignoring interceptors). |
| 2062 int NumberOfOwnElements(PropertyAttributes filter); | 2062 int NumberOfOwnElements(PropertyAttributes filter); |
| 2063 // Returns the number of enumerable elements (ignoring interceptors). | 2063 // Returns the number of enumerable elements (ignoring interceptors). |
| 2064 int NumberOfEnumElements(); | 2064 int NumberOfEnumElements(); |
| 2065 // Returns the number of elements on this object filtering out elements | 2065 // Returns the number of elements on this object filtering out elements |
| 2066 // with the specified attributes (ignoring interceptors). | 2066 // with the specified attributes (ignoring interceptors). |
| 2067 int GetOwnElementKeys(FixedArray* storage, PropertyAttributes filter); | 2067 int GetOwnElementKeys(FixedArray* storage, PropertyAttributes filter); |
| 2068 // Count and fill in the enumerable elements into storage. | 2068 // Count and fill in the enumerable elements into storage. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 Handle<JSObject> object, const char* type, Handle<Name> name, | 2276 Handle<JSObject> object, const char* type, Handle<Name> name, |
| 2277 Handle<Object> old_value); | 2277 Handle<Object> old_value); |
| 2278 | 2278 |
| 2279 // Gets the number of currently used elements. | 2279 // Gets the number of currently used elements. |
| 2280 int GetFastElementsUsage(); | 2280 int GetFastElementsUsage(); |
| 2281 | 2281 |
| 2282 // Deletes an existing named property in a normalized object. | 2282 // Deletes an existing named property in a normalized object. |
| 2283 static void DeleteNormalizedProperty(Handle<JSObject> object, | 2283 static void DeleteNormalizedProperty(Handle<JSObject> object, |
| 2284 Handle<Name> name, int entry); | 2284 Handle<Name> name, int entry); |
| 2285 | 2285 |
| 2286 static bool AllCanRead(LookupIterator* it); |
| 2287 static bool AllCanWrite(LookupIterator* it); |
| 2288 |
| 2286 private: | 2289 private: |
| 2287 friend class JSReceiver; | 2290 friend class JSReceiver; |
| 2288 friend class Object; | 2291 friend class Object; |
| 2289 | 2292 |
| 2290 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); | 2293 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); |
| 2291 static void MigrateFastToSlow(Handle<JSObject> object, | 2294 static void MigrateFastToSlow(Handle<JSObject> object, |
| 2292 Handle<Map> new_map, | 2295 Handle<Map> new_map, |
| 2293 int expected_additional_properties); | 2296 int expected_additional_properties); |
| 2294 | 2297 |
| 2295 // Used from Object::GetProperty(). | 2298 // Used from Object::GetProperty(). |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 return NumberOfElementsFilterAttributes( | 3245 return NumberOfElementsFilterAttributes( |
| 3243 static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC)); | 3246 static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC)); |
| 3244 } | 3247 } |
| 3245 | 3248 |
| 3246 // Returns true if the dictionary contains any elements that are non-writable, | 3249 // Returns true if the dictionary contains any elements that are non-writable, |
| 3247 // non-configurable, non-enumerable, or have getters/setters. | 3250 // non-configurable, non-enumerable, or have getters/setters. |
| 3248 bool HasComplexElements(); | 3251 bool HasComplexElements(); |
| 3249 | 3252 |
| 3250 enum SortMode { UNSORTED, SORTED }; | 3253 enum SortMode { UNSORTED, SORTED }; |
| 3251 | 3254 |
| 3252 // Copies keys to preallocated fixed array. | |
| 3253 void CopyKeysTo(FixedArray* storage, PropertyAttributes filter, | |
| 3254 SortMode sort_mode); | |
| 3255 | |
| 3256 // Fill in details for properties into storage. | 3255 // Fill in details for properties into storage. |
| 3257 void CopyKeysTo(FixedArray* storage, int index, PropertyAttributes filter, | 3256 // Returns the number of properties added. |
| 3258 SortMode sort_mode); | 3257 int CopyKeysTo(FixedArray* storage, int index, PropertyAttributes filter, |
| 3258 SortMode sort_mode); |
| 3259 | 3259 |
| 3260 // Copies enumerable keys to preallocated fixed array. | 3260 // Copies enumerable keys to preallocated fixed array. |
| 3261 void CopyEnumKeysTo(FixedArray* storage); | 3261 void CopyEnumKeysTo(FixedArray* storage); |
| 3262 | 3262 |
| 3263 // Accessors for next enumeration index. | 3263 // Accessors for next enumeration index. |
| 3264 void SetNextEnumerationIndex(int index) { | 3264 void SetNextEnumerationIndex(int index) { |
| 3265 DCHECK(index != 0); | 3265 DCHECK(index != 0); |
| 3266 this->set(kNextEnumerationIndexIndex, Smi::FromInt(index)); | 3266 this->set(kNextEnumerationIndexIndex, Smi::FromInt(index)); |
| 3267 } | 3267 } |
| 3268 | 3268 |
| (...skipping 7516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10785 } else { | 10785 } else { |
| 10786 value &= ~(1 << bit_position); | 10786 value &= ~(1 << bit_position); |
| 10787 } | 10787 } |
| 10788 return value; | 10788 return value; |
| 10789 } | 10789 } |
| 10790 }; | 10790 }; |
| 10791 | 10791 |
| 10792 } } // namespace v8::internal | 10792 } } // namespace v8::internal |
| 10793 | 10793 |
| 10794 #endif // V8_OBJECTS_H_ | 10794 #endif // V8_OBJECTS_H_ |
| OLD | NEW |