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 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 PropertyDescriptor* desc, | 1852 PropertyDescriptor* desc, |
1853 ShouldThrow should_throw); | 1853 ShouldThrow should_throw); |
1854 | 1854 |
1855 static bool GetOwnPropertyDescriptor(Isolate* isolate, | 1855 static bool GetOwnPropertyDescriptor(Isolate* isolate, |
1856 Handle<JSObject> object, | 1856 Handle<JSObject> object, |
1857 Handle<Object> key, | 1857 Handle<Object> key, |
1858 PropertyDescriptor* desc); | 1858 PropertyDescriptor* desc); |
1859 static bool GetOwnPropertyDescriptor(LookupIterator* it, | 1859 static bool GetOwnPropertyDescriptor(LookupIterator* it, |
1860 PropertyDescriptor* desc); | 1860 PropertyDescriptor* desc); |
1861 | 1861 |
| 1862 // Disallow further properties to be added to the object. This is |
| 1863 // ES6's [[PreventExtensions]] when passed DONT_THROW. |
| 1864 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
| 1865 Handle<JSReceiver> object, ShouldThrow should_throw); |
| 1866 |
1862 // Tests for the fast common case for property enumeration. | 1867 // Tests for the fast common case for property enumeration. |
1863 bool IsSimpleEnum(); | 1868 bool IsSimpleEnum(); |
1864 | 1869 |
1865 // Returns the class name ([[Class]] property in the specification). | 1870 // Returns the class name ([[Class]] property in the specification). |
1866 String* class_name(); | 1871 String* class_name(); |
1867 | 1872 |
1868 // Returns the constructor name (the name (possibly, inferred name) of the | 1873 // Returns the constructor name (the name (possibly, inferred name) of the |
1869 // function that was used to instantiate the object). | 1874 // function that was used to instantiate the object). |
1870 String* constructor_name(); | 1875 String* constructor_name(); |
1871 | 1876 |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 // pre_allocated_value and the rest with filler_value. | 2312 // pre_allocated_value and the rest with filler_value. |
2308 // Note: this call does not update write barrier, the caller is responsible | 2313 // Note: this call does not update write barrier, the caller is responsible |
2309 // to ensure that |filler_value| can be collected without WB here. | 2314 // to ensure that |filler_value| can be collected without WB here. |
2310 inline void InitializeBody(Map* map, | 2315 inline void InitializeBody(Map* map, |
2311 Object* pre_allocated_value, | 2316 Object* pre_allocated_value, |
2312 Object* filler_value); | 2317 Object* filler_value); |
2313 | 2318 |
2314 // Check whether this object references another object | 2319 // Check whether this object references another object |
2315 bool ReferencesObject(Object* obj); | 2320 bool ReferencesObject(Object* obj); |
2316 | 2321 |
2317 // Disallow further properties to be added to the oject. | 2322 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
2318 MUST_USE_RESULT static Maybe<bool> PreventExtensionsInternal( | 2323 Handle<JSObject> object, ShouldThrow should_throw); |
2319 Handle<JSObject> object); // ES [[PreventExtensions]] | |
2320 MUST_USE_RESULT static MaybeHandle<Object> PreventExtensions( | |
2321 Handle<JSObject> object); // ES Object.preventExtensions | |
2322 | 2324 |
2323 static bool IsExtensible(Handle<JSObject> object); | 2325 static bool IsExtensible(Handle<JSObject> object); |
2324 | 2326 |
2325 // ES5 Object.seal | 2327 // ES5 Object.seal |
2326 MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object); | 2328 MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object); |
2327 | 2329 |
2328 // ES5 Object.freeze | 2330 // ES5 Object.freeze |
2329 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); | 2331 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); |
2330 | 2332 |
2331 // Called the first time an object is observed with ES7 Object.observe. | 2333 // Called the first time an object is observed with ES7 Object.observe. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 | 2502 |
2501 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object); | 2503 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object); |
2502 | 2504 |
2503 static Handle<SeededNumberDictionary> GetNormalizedElementDictionary( | 2505 static Handle<SeededNumberDictionary> GetNormalizedElementDictionary( |
2504 Handle<JSObject> object, Handle<FixedArrayBase> elements); | 2506 Handle<JSObject> object, Handle<FixedArrayBase> elements); |
2505 | 2507 |
2506 // Helper for fast versions of preventExtensions, seal, and freeze. | 2508 // Helper for fast versions of preventExtensions, seal, and freeze. |
2507 // attrs is one of NONE, SEALED, or FROZEN (depending on the operation). | 2509 // attrs is one of NONE, SEALED, or FROZEN (depending on the operation). |
2508 template <PropertyAttributes attrs> | 2510 template <PropertyAttributes attrs> |
2509 MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition( | 2511 MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition( |
2510 Handle<JSObject> object); | 2512 Handle<JSObject> object, ShouldThrow should_throw); |
2511 | 2513 |
2512 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2514 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
2513 }; | 2515 }; |
2514 | 2516 |
2515 | 2517 |
2516 // Common superclass for FixedArrays that allow implementations to share | 2518 // Common superclass for FixedArrays that allow implementations to share |
2517 // common accessors and some code paths. | 2519 // common accessors and some code paths. |
2518 class FixedArrayBase: public HeapObject { | 2520 class FixedArrayBase: public HeapObject { |
2519 public: | 2521 public: |
2520 // [length]: length of the array. | 2522 // [length]: length of the array. |
(...skipping 8208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10729 Handle<FixedArray> keys_; | 10731 Handle<FixedArray> keys_; |
10730 Handle<OrderedHashSet> set_; | 10732 Handle<OrderedHashSet> set_; |
10731 int length_; | 10733 int length_; |
10732 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10734 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
10733 }; | 10735 }; |
10734 | 10736 |
10735 } // NOLINT, false-positive due to second-order macros. | 10737 } // NOLINT, false-positive due to second-order macros. |
10736 } // NOLINT, false-positive due to second-order macros. | 10738 } // NOLINT, false-positive due to second-order macros. |
10737 | 10739 |
10738 #endif // V8_OBJECTS_H_ | 10740 #endif // V8_OBJECTS_H_ |
OLD | NEW |