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 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 PropertyDescriptor* desc, PropertyDescriptor* current, | 1857 PropertyDescriptor* desc, PropertyDescriptor* current, |
1858 ShouldThrow should_throw, Handle<Name> property_name = Handle<Name>()); | 1858 ShouldThrow should_throw, Handle<Name> property_name = Handle<Name>()); |
1859 | 1859 |
1860 static bool GetOwnPropertyDescriptor(Isolate* isolate, | 1860 static bool GetOwnPropertyDescriptor(Isolate* isolate, |
1861 Handle<JSReceiver> object, | 1861 Handle<JSReceiver> object, |
1862 Handle<Object> key, | 1862 Handle<Object> key, |
1863 PropertyDescriptor* desc); | 1863 PropertyDescriptor* desc); |
1864 static bool GetOwnPropertyDescriptor(LookupIterator* it, | 1864 static bool GetOwnPropertyDescriptor(LookupIterator* it, |
1865 PropertyDescriptor* desc); | 1865 PropertyDescriptor* desc); |
1866 | 1866 |
1867 // Disallow further properties to be added to the object. This is | 1867 typedef PropertyAttributes IntegrityLevel; |
1868 // ES6's [[PreventExtensions]] when passed DONT_THROW. | 1868 |
| 1869 // ES6 7.3.14 (when passed DONT_THROW) |
| 1870 // 'level' must be SEALED or FROZEN. |
| 1871 MUST_USE_RESULT static Maybe<bool> SetIntegrityLevel( |
| 1872 Handle<JSReceiver> object, IntegrityLevel lvl, ShouldThrow should_throw); |
| 1873 |
| 1874 // ES6 7.3.15 |
| 1875 // 'level' must be SEALED or FROZEN. |
| 1876 MUST_USE_RESULT static Maybe<bool> TestIntegrityLevel( |
| 1877 Handle<JSReceiver> object, IntegrityLevel lvl); |
| 1878 |
| 1879 // ES6 [[PreventExtensions]] (when passed DONT_THROW) |
1869 MUST_USE_RESULT static Maybe<bool> PreventExtensions( | 1880 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
1870 Handle<JSReceiver> object, ShouldThrow should_throw); | 1881 Handle<JSReceiver> object, ShouldThrow should_throw); |
1871 | 1882 |
1872 MUST_USE_RESULT static Maybe<bool> IsExtensible(Handle<JSReceiver> object); | 1883 MUST_USE_RESULT static Maybe<bool> IsExtensible(Handle<JSReceiver> object); |
1873 | 1884 |
1874 // Tests for the fast common case for property enumeration. | 1885 // Tests for the fast common case for property enumeration. |
1875 bool IsSimpleEnum(); | 1886 bool IsSimpleEnum(); |
1876 | 1887 |
1877 // Returns the class name ([[Class]] property in the specification). | 1888 // Returns the class name ([[Class]] property in the specification). |
1878 String* class_name(); | 1889 String* class_name(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 // be returned in case no hash was created yet. | 1923 // be returned in case no hash was created yet. |
1913 inline Object* GetIdentityHash(); | 1924 inline Object* GetIdentityHash(); |
1914 | 1925 |
1915 // Retrieves a permanent object identity hash code. May create and store a | 1926 // Retrieves a permanent object identity hash code. May create and store a |
1916 // hash code if needed and none exists. | 1927 // hash code if needed and none exists. |
1917 inline static Handle<Smi> GetOrCreateIdentityHash( | 1928 inline static Handle<Smi> GetOrCreateIdentityHash( |
1918 Handle<JSReceiver> object); | 1929 Handle<JSReceiver> object); |
1919 | 1930 |
1920 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; | 1931 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; |
1921 | 1932 |
| 1933 // ES6 [[OwnPropertyKeys]] (modulo return type) |
| 1934 MUST_USE_RESULT static MaybeHandle<FixedArray> OwnPropertyKeys( |
| 1935 Handle<JSReceiver> object) { |
| 1936 return GetKeys(object, JSReceiver::OWN_ONLY, ALL_PROPERTIES, |
| 1937 CONVERT_TO_STRING); |
| 1938 } |
| 1939 |
1922 // Computes the enumerable keys for a JSObject. Used for implementing | 1940 // Computes the enumerable keys for a JSObject. Used for implementing |
1923 // "for (n in object) { }". | 1941 // "for (n in object) { }". |
1924 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 1942 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( |
1925 Handle<JSReceiver> object, KeyCollectionType type, PropertyFilter filter, | 1943 Handle<JSReceiver> object, KeyCollectionType type, PropertyFilter filter, |
1926 GetKeysConversion keys_conversion = KEEP_NUMBERS); | 1944 GetKeysConversion keys_conversion = KEEP_NUMBERS); |
1927 | 1945 |
1928 private: | 1946 private: |
1929 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 1947 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
1930 }; | 1948 }; |
1931 | 1949 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 Object* pre_allocated_value, Object* filler_value); | 2353 Object* pre_allocated_value, Object* filler_value); |
2336 | 2354 |
2337 // Check whether this object references another object | 2355 // Check whether this object references another object |
2338 bool ReferencesObject(Object* obj); | 2356 bool ReferencesObject(Object* obj); |
2339 | 2357 |
2340 MUST_USE_RESULT static Maybe<bool> PreventExtensions( | 2358 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
2341 Handle<JSObject> object, ShouldThrow should_throw); | 2359 Handle<JSObject> object, ShouldThrow should_throw); |
2342 | 2360 |
2343 static bool IsExtensible(Handle<JSObject> object); | 2361 static bool IsExtensible(Handle<JSObject> object); |
2344 | 2362 |
2345 // ES5 Object.seal | |
2346 MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object); | |
2347 | |
2348 // ES5 Object.freeze | |
2349 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); | |
2350 | |
2351 // Called the first time an object is observed with ES7 Object.observe. | 2363 // Called the first time an object is observed with ES7 Object.observe. |
2352 static void SetObserved(Handle<JSObject> object); | 2364 static void SetObserved(Handle<JSObject> object); |
2353 | 2365 |
2354 // Copy object. | 2366 // Copy object. |
2355 enum DeepCopyHints { kNoHints = 0, kObjectIsShallow = 1 }; | 2367 enum DeepCopyHints { kNoHints = 0, kObjectIsShallow = 1 }; |
2356 | 2368 |
2357 MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy( | 2369 MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy( |
2358 Handle<JSObject> object, | 2370 Handle<JSObject> object, |
2359 AllocationSiteUsageContext* site_context, | 2371 AllocationSiteUsageContext* site_context, |
2360 DeepCopyHints hints = kNoHints); | 2372 DeepCopyHints hints = kNoHints); |
(...skipping 8309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10670 } | 10682 } |
10671 return value; | 10683 return value; |
10672 } | 10684 } |
10673 }; | 10685 }; |
10674 | 10686 |
10675 | 10687 |
10676 } // NOLINT, false-positive due to second-order macros. | 10688 } // NOLINT, false-positive due to second-order macros. |
10677 } // NOLINT, false-positive due to second-order macros. | 10689 } // NOLINT, false-positive due to second-order macros. |
10678 | 10690 |
10679 #endif // V8_OBJECTS_H_ | 10691 #endif // V8_OBJECTS_H_ |
OLD | NEW |