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 [[PreventExtensions]] (when passed DONT_THROW) |
1869 MUST_USE_RESULT static Maybe<bool> PreventExtensions( | 1875 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
1870 Handle<JSReceiver> object, ShouldThrow should_throw); | 1876 Handle<JSReceiver> object, ShouldThrow should_throw); |
1871 | 1877 |
1872 MUST_USE_RESULT static Maybe<bool> IsExtensible(Handle<JSReceiver> object); | 1878 MUST_USE_RESULT static Maybe<bool> IsExtensible(Handle<JSReceiver> object); |
1873 | 1879 |
1874 // Tests for the fast common case for property enumeration. | 1880 // Tests for the fast common case for property enumeration. |
1875 bool IsSimpleEnum(); | 1881 bool IsSimpleEnum(); |
1876 | 1882 |
1877 // Returns the class name ([[Class]] property in the specification). | 1883 // Returns the class name ([[Class]] property in the specification). |
1878 String* class_name(); | 1884 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. | 1918 // be returned in case no hash was created yet. |
1913 inline Object* GetIdentityHash(); | 1919 inline Object* GetIdentityHash(); |
1914 | 1920 |
1915 // Retrieves a permanent object identity hash code. May create and store a | 1921 // Retrieves a permanent object identity hash code. May create and store a |
1916 // hash code if needed and none exists. | 1922 // hash code if needed and none exists. |
1917 inline static Handle<Smi> GetOrCreateIdentityHash( | 1923 inline static Handle<Smi> GetOrCreateIdentityHash( |
1918 Handle<JSReceiver> object); | 1924 Handle<JSReceiver> object); |
1919 | 1925 |
1920 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; | 1926 enum KeyCollectionType { OWN_ONLY, INCLUDE_PROTOS }; |
1921 | 1927 |
| 1928 // ES6 [[OwnPropertyKeys]] (modulo return type) |
| 1929 MUST_USE_RESULT static MaybeHandle<FixedArray> OwnPropertyKeys( |
| 1930 Handle<JSReceiver> object) { |
| 1931 return GetKeys(object, JSReceiver::OWN_ONLY, ALL_PROPERTIES, |
| 1932 CONVERT_TO_STRING); |
| 1933 } |
| 1934 |
1922 // Computes the enumerable keys for a JSObject. Used for implementing | 1935 // Computes the enumerable keys for a JSObject. Used for implementing |
1923 // "for (n in object) { }". | 1936 // "for (n in object) { }". |
1924 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 1937 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( |
1925 Handle<JSReceiver> object, KeyCollectionType type, PropertyFilter filter, | 1938 Handle<JSReceiver> object, KeyCollectionType type, PropertyFilter filter, |
1926 GetKeysConversion keys_conversion = KEEP_NUMBERS); | 1939 GetKeysConversion keys_conversion = KEEP_NUMBERS); |
1927 | 1940 |
1928 private: | 1941 private: |
1929 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 1942 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
1930 }; | 1943 }; |
1931 | 1944 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 Object* pre_allocated_value, Object* filler_value); | 2363 Object* pre_allocated_value, Object* filler_value); |
2351 | 2364 |
2352 // Check whether this object references another object | 2365 // Check whether this object references another object |
2353 bool ReferencesObject(Object* obj); | 2366 bool ReferencesObject(Object* obj); |
2354 | 2367 |
2355 MUST_USE_RESULT static Maybe<bool> PreventExtensions( | 2368 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
2356 Handle<JSObject> object, ShouldThrow should_throw); | 2369 Handle<JSObject> object, ShouldThrow should_throw); |
2357 | 2370 |
2358 static bool IsExtensible(Handle<JSObject> object); | 2371 static bool IsExtensible(Handle<JSObject> object); |
2359 | 2372 |
2360 // ES5 Object.seal | |
2361 MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object); | |
2362 | |
2363 // ES5 Object.freeze | |
2364 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); | |
2365 | |
2366 // Called the first time an object is observed with ES7 Object.observe. | 2373 // Called the first time an object is observed with ES7 Object.observe. |
2367 static void SetObserved(Handle<JSObject> object); | 2374 static void SetObserved(Handle<JSObject> object); |
2368 | 2375 |
2369 // Copy object. | 2376 // Copy object. |
2370 enum DeepCopyHints { kNoHints = 0, kObjectIsShallow = 1 }; | 2377 enum DeepCopyHints { kNoHints = 0, kObjectIsShallow = 1 }; |
2371 | 2378 |
2372 MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy( | 2379 MUST_USE_RESULT static MaybeHandle<JSObject> DeepCopy( |
2373 Handle<JSObject> object, | 2380 Handle<JSObject> object, |
2374 AllocationSiteUsageContext* site_context, | 2381 AllocationSiteUsageContext* site_context, |
2375 DeepCopyHints hints = kNoHints); | 2382 DeepCopyHints hints = kNoHints); |
(...skipping 8309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10685 } | 10692 } |
10686 return value; | 10693 return value; |
10687 } | 10694 } |
10688 }; | 10695 }; |
10689 | 10696 |
10690 | 10697 |
10691 } // NOLINT, false-positive due to second-order macros. | 10698 } // NOLINT, false-positive due to second-order macros. |
10692 } // NOLINT, false-positive due to second-order macros. | 10699 } // NOLINT, false-positive due to second-order macros. |
10693 | 10700 |
10694 #endif // V8_OBJECTS_H_ | 10701 #endif // V8_OBJECTS_H_ |
OLD | NEW |