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 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 PropertyDescriptor* desc, | 1858 PropertyDescriptor* desc, |
1859 ShouldThrow should_throw); | 1859 ShouldThrow should_throw); |
1860 | 1860 |
1861 static bool GetOwnPropertyDescriptor(Isolate* isolate, | 1861 static bool GetOwnPropertyDescriptor(Isolate* isolate, |
1862 Handle<JSObject> object, | 1862 Handle<JSObject> object, |
1863 Handle<Object> key, | 1863 Handle<Object> key, |
1864 PropertyDescriptor* desc); | 1864 PropertyDescriptor* desc); |
1865 static bool GetOwnPropertyDescriptor(LookupIterator* it, | 1865 static bool GetOwnPropertyDescriptor(LookupIterator* it, |
1866 PropertyDescriptor* desc); | 1866 PropertyDescriptor* desc); |
1867 | 1867 |
| 1868 // Disallow further properties to be added to the object. This is |
| 1869 // ES6's [[PreventExtensions]] when passed DONT_THROW. |
| 1870 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
| 1871 Handle<JSReceiver> object, ShouldThrow should_throw); |
| 1872 |
1868 // Tests for the fast common case for property enumeration. | 1873 // Tests for the fast common case for property enumeration. |
1869 bool IsSimpleEnum(); | 1874 bool IsSimpleEnum(); |
1870 | 1875 |
1871 // Returns the class name ([[Class]] property in the specification). | 1876 // Returns the class name ([[Class]] property in the specification). |
1872 String* class_name(); | 1877 String* class_name(); |
1873 | 1878 |
1874 // Returns the constructor name (the name (possibly, inferred name) of the | 1879 // Returns the constructor name (the name (possibly, inferred name) of the |
1875 // function that was used to instantiate the object). | 1880 // function that was used to instantiate the object). |
1876 String* constructor_name(); | 1881 String* constructor_name(); |
1877 | 1882 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2317 // pre_allocated_value and the rest with filler_value. | 2322 // pre_allocated_value and the rest with filler_value. |
2318 // Note: this call does not update write barrier, the caller is responsible | 2323 // Note: this call does not update write barrier, the caller is responsible |
2319 // to ensure that |filler_value| can be collected without WB here. | 2324 // to ensure that |filler_value| can be collected without WB here. |
2320 inline void InitializeBody(Map* map, | 2325 inline void InitializeBody(Map* map, |
2321 Object* pre_allocated_value, | 2326 Object* pre_allocated_value, |
2322 Object* filler_value); | 2327 Object* filler_value); |
2323 | 2328 |
2324 // Check whether this object references another object | 2329 // Check whether this object references another object |
2325 bool ReferencesObject(Object* obj); | 2330 bool ReferencesObject(Object* obj); |
2326 | 2331 |
2327 // Disallow further properties to be added to the oject. | 2332 MUST_USE_RESULT static Maybe<bool> PreventExtensions( |
2328 MUST_USE_RESULT static Maybe<bool> PreventExtensionsInternal( | 2333 Handle<JSObject> object, ShouldThrow should_throw); |
2329 Handle<JSObject> object); // ES [[PreventExtensions]] | |
2330 MUST_USE_RESULT static MaybeHandle<Object> PreventExtensions( | |
2331 Handle<JSObject> object); // ES Object.preventExtensions | |
2332 | 2334 |
2333 static bool IsExtensible(Handle<JSObject> object); | 2335 static bool IsExtensible(Handle<JSObject> object); |
2334 | 2336 |
2335 // ES5 Object.seal | 2337 // ES5 Object.seal |
2336 MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object); | 2338 MUST_USE_RESULT static MaybeHandle<Object> Seal(Handle<JSObject> object); |
2337 | 2339 |
2338 // ES5 Object.freeze | 2340 // ES5 Object.freeze |
2339 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); | 2341 MUST_USE_RESULT static MaybeHandle<Object> Freeze(Handle<JSObject> object); |
2340 | 2342 |
2341 // Called the first time an object is observed with ES7 Object.observe. | 2343 // 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... |
2510 | 2512 |
2511 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object); | 2513 static Handle<Smi> GetOrCreateIdentityHash(Handle<JSObject> object); |
2512 | 2514 |
2513 static Handle<SeededNumberDictionary> GetNormalizedElementDictionary( | 2515 static Handle<SeededNumberDictionary> GetNormalizedElementDictionary( |
2514 Handle<JSObject> object, Handle<FixedArrayBase> elements); | 2516 Handle<JSObject> object, Handle<FixedArrayBase> elements); |
2515 | 2517 |
2516 // Helper for fast versions of preventExtensions, seal, and freeze. | 2518 // Helper for fast versions of preventExtensions, seal, and freeze. |
2517 // attrs is one of NONE, SEALED, or FROZEN (depending on the operation). | 2519 // attrs is one of NONE, SEALED, or FROZEN (depending on the operation). |
2518 template <PropertyAttributes attrs> | 2520 template <PropertyAttributes attrs> |
2519 MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition( | 2521 MUST_USE_RESULT static Maybe<bool> PreventExtensionsWithTransition( |
2520 Handle<JSObject> object); | 2522 Handle<JSObject> object, ShouldThrow should_throw); |
2521 | 2523 |
2522 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2524 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
2523 }; | 2525 }; |
2524 | 2526 |
2525 | 2527 |
2526 // Common superclass for FixedArrays that allow implementations to share | 2528 // Common superclass for FixedArrays that allow implementations to share |
2527 // common accessors and some code paths. | 2529 // common accessors and some code paths. |
2528 class FixedArrayBase: public HeapObject { | 2530 class FixedArrayBase: public HeapObject { |
2529 public: | 2531 public: |
2530 // [length]: length of the array. | 2532 // [length]: length of the array. |
(...skipping 8249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10780 // (elements + properties) in the current level. | 10782 // (elements + properties) in the current level. |
10781 int levelLength_; | 10783 int levelLength_; |
10782 | 10784 |
10783 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); | 10785 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); |
10784 }; | 10786 }; |
10785 | 10787 |
10786 } // NOLINT, false-positive due to second-order macros. | 10788 } // NOLINT, false-positive due to second-order macros. |
10787 } // NOLINT, false-positive due to second-order macros. | 10789 } // NOLINT, false-positive due to second-order macros. |
10788 | 10790 |
10789 #endif // V8_OBJECTS_H_ | 10791 #endif // V8_OBJECTS_H_ |
OLD | NEW |