| 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 "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 855 |
| 856 class AccessorPair; | 856 class AccessorPair; |
| 857 class AllocationSite; | 857 class AllocationSite; |
| 858 class AllocationSiteCreationContext; | 858 class AllocationSiteCreationContext; |
| 859 class AllocationSiteUsageContext; | 859 class AllocationSiteUsageContext; |
| 860 class DictionaryElementsAccessor; | 860 class DictionaryElementsAccessor; |
| 861 class ElementsAccessor; | 861 class ElementsAccessor; |
| 862 class FixedArrayBase; | 862 class FixedArrayBase; |
| 863 class GlobalObject; | 863 class GlobalObject; |
| 864 class ObjectVisitor; | 864 class ObjectVisitor; |
| 865 class LookupIterator; |
| 865 class StringStream; | 866 class StringStream; |
| 866 // We cannot just say "class HeapType;" if it is created from a template... =8-? | 867 // We cannot just say "class HeapType;" if it is created from a template... =8-? |
| 867 template<class> class TypeImpl; | 868 template<class> class TypeImpl; |
| 868 struct HeapTypeConfig; | 869 struct HeapTypeConfig; |
| 869 typedef TypeImpl<HeapTypeConfig> HeapType; | 870 typedef TypeImpl<HeapTypeConfig> HeapType; |
| 870 | 871 |
| 871 | 872 |
| 872 // A template-ized version of the IsXXX functions. | 873 // A template-ized version of the IsXXX functions. |
| 873 template <class C> inline bool Is(Object* obj); | 874 template <class C> inline bool Is(Object* obj); |
| 874 | 875 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1449 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, | 1450 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, |
| 1450 Handle<Object> object, | 1451 Handle<Object> object, |
| 1451 Handle<Context> context); | 1452 Handle<Context> context); |
| 1452 | 1453 |
| 1453 // Converts this to a Smi if possible. | 1454 // Converts this to a Smi if possible. |
| 1454 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, | 1455 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, |
| 1455 Handle<Object> object); | 1456 Handle<Object> object); |
| 1456 | 1457 |
| 1457 void Lookup(Handle<Name> name, LookupResult* result); | 1458 void Lookup(Handle<Name> name, LookupResult* result); |
| 1458 | 1459 |
| 1459 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver( | 1460 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); |
| 1460 Handle<Object> object, | |
| 1461 Handle<Object> receiver, | |
| 1462 Handle<Name> name, | |
| 1463 PropertyAttributes* attributes); | |
| 1464 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1461 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
| 1465 Handle<Object> object, | 1462 Handle<Object> object, |
| 1466 Handle<Name> key); | 1463 Handle<Name> key); |
| 1467 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1464 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1468 Isolate* isolate, | 1465 Isolate* isolate, |
| 1469 Handle<Object> object, | 1466 Handle<Object> object, |
| 1470 const char* key); | 1467 const char* key); |
| 1471 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1468 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
| 1472 Handle<Object> object, | 1469 Handle<Object> object, |
| 1473 Handle<Name> key); | 1470 Handle<Name> key); |
| 1474 MUST_USE_RESULT static MaybeHandle<Object> GetProperty( | |
| 1475 Handle<Object> object, | |
| 1476 Handle<Object> receiver, | |
| 1477 LookupResult* result, | |
| 1478 Handle<Name> key, | |
| 1479 PropertyAttributes* attributes); | |
| 1480 | 1471 |
| 1481 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithCallback( | 1472 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( |
| 1482 Handle<Object> receiver, | 1473 Handle<Object> receiver, |
| 1483 Handle<Name> name, | 1474 Handle<Name> name, |
| 1484 Handle<JSObject> holder, | 1475 Handle<JSObject> holder, |
| 1485 Handle<Object> structure); | 1476 Handle<Object> structure); |
| 1486 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback( | 1477 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback( |
| 1487 Handle<Object> receiver, | 1478 Handle<Object> receiver, |
| 1488 Handle<Name> name, | 1479 Handle<Name> name, |
| 1489 Handle<Object> value, | 1480 Handle<Object> value, |
| 1490 Handle<JSObject> holder, | 1481 Handle<JSObject> holder, |
| 1491 Handle<Object> structure, | 1482 Handle<Object> structure, |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 v8::AccessControl access_control = v8::DEFAULT); | 2248 v8::AccessControl access_control = v8::DEFAULT); |
| 2258 | 2249 |
| 2259 // Defines an AccessorInfo property on the given object. | 2250 // Defines an AccessorInfo property on the given object. |
| 2260 MUST_USE_RESULT static MaybeHandle<Object> SetAccessor( | 2251 MUST_USE_RESULT static MaybeHandle<Object> SetAccessor( |
| 2261 Handle<JSObject> object, | 2252 Handle<JSObject> object, |
| 2262 Handle<AccessorInfo> info); | 2253 Handle<AccessorInfo> info); |
| 2263 | 2254 |
| 2264 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor( | 2255 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithInterceptor( |
| 2265 Handle<JSObject> object, | 2256 Handle<JSObject> object, |
| 2266 Handle<Object> receiver, | 2257 Handle<Object> receiver, |
| 2267 Handle<Name> name, | 2258 Handle<Name> name); |
| 2268 PropertyAttributes* attributes); | |
| 2269 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyPostInterceptor( | |
| 2270 Handle<JSObject> object, | |
| 2271 Handle<Object> receiver, | |
| 2272 Handle<Name> name, | |
| 2273 PropertyAttributes* attributes); | |
| 2274 | 2259 |
| 2275 // Returns true if this is an instance of an api function and has | 2260 // Returns true if this is an instance of an api function and has |
| 2276 // been modified since it was created. May give false positives. | 2261 // been modified since it was created. May give false positives. |
| 2277 bool IsDirty(); | 2262 bool IsDirty(); |
| 2278 | 2263 |
| 2279 // Accessors for hidden properties object. | 2264 // Accessors for hidden properties object. |
| 2280 // | 2265 // |
| 2281 // Hidden properties are not own properties of the object itself. | 2266 // Hidden properties are not own properties of the object itself. |
| 2282 // Instead they are stored in an auxiliary structure kept as an own | 2267 // Instead they are stored in an auxiliary structure kept as an own |
| 2283 // property with a special name Heap::hidden_string(). But if the | 2268 // property with a special name Heap::hidden_string(). But if the |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2674 private: | 2659 private: |
| 2675 friend class DictionaryElementsAccessor; | 2660 friend class DictionaryElementsAccessor; |
| 2676 friend class JSReceiver; | 2661 friend class JSReceiver; |
| 2677 friend class Object; | 2662 friend class Object; |
| 2678 | 2663 |
| 2679 static void UpdateAllocationSite(Handle<JSObject> object, | 2664 static void UpdateAllocationSite(Handle<JSObject> object, |
| 2680 ElementsKind to_kind); | 2665 ElementsKind to_kind); |
| 2681 | 2666 |
| 2682 // Used from Object::GetProperty(). | 2667 // Used from Object::GetProperty(). |
| 2683 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( | 2668 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( |
| 2684 Handle<JSObject> object, | 2669 LookupIterator* it); |
| 2685 Handle<Object> receiver, | |
| 2686 LookupResult* result, | |
| 2687 Handle<Name> name, | |
| 2688 PropertyAttributes* attributes); | |
| 2689 | 2670 |
| 2690 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithCallback( | 2671 MUST_USE_RESULT static MaybeHandle<Object> GetElementWithCallback( |
| 2691 Handle<JSObject> object, | 2672 Handle<JSObject> object, |
| 2692 Handle<Object> receiver, | 2673 Handle<Object> receiver, |
| 2693 Handle<Object> structure, | 2674 Handle<Object> structure, |
| 2694 uint32_t index, | 2675 uint32_t index, |
| 2695 Handle<Object> holder); | 2676 Handle<Object> holder); |
| 2696 | 2677 |
| 2697 static PropertyAttributes GetElementAttributeWithInterceptor( | 2678 static PropertyAttributes GetElementAttributeWithInterceptor( |
| 2698 Handle<JSObject> object, | 2679 Handle<JSObject> object, |
| (...skipping 3938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6637 | 6618 |
| 6638 bool CanTransition() { | 6619 bool CanTransition() { |
| 6639 // Only JSObject and subtypes have map transitions and back pointers. | 6620 // Only JSObject and subtypes have map transitions and back pointers. |
| 6640 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE); | 6621 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE); |
| 6641 return instance_type() >= FIRST_JS_OBJECT_TYPE; | 6622 return instance_type() >= FIRST_JS_OBJECT_TYPE; |
| 6642 } | 6623 } |
| 6643 | 6624 |
| 6644 bool IsJSObjectMap() { | 6625 bool IsJSObjectMap() { |
| 6645 return instance_type() >= FIRST_JS_OBJECT_TYPE; | 6626 return instance_type() >= FIRST_JS_OBJECT_TYPE; |
| 6646 } | 6627 } |
| 6628 bool IsJSProxyMap() { |
| 6629 InstanceType type = instance_type(); |
| 6630 return FIRST_JS_PROXY_TYPE <= type && type <= LAST_JS_PROXY_TYPE; |
| 6631 } |
| 6647 bool IsJSGlobalProxyMap() { | 6632 bool IsJSGlobalProxyMap() { |
| 6648 return instance_type() == JS_GLOBAL_PROXY_TYPE; | 6633 return instance_type() == JS_GLOBAL_PROXY_TYPE; |
| 6649 } | 6634 } |
| 6650 bool IsJSGlobalObjectMap() { | 6635 bool IsJSGlobalObjectMap() { |
| 6651 return instance_type() == JS_GLOBAL_OBJECT_TYPE; | 6636 return instance_type() == JS_GLOBAL_OBJECT_TYPE; |
| 6652 } | 6637 } |
| 6653 bool IsGlobalObjectMap() { | 6638 bool IsGlobalObjectMap() { |
| 6654 const InstanceType type = instance_type(); | 6639 const InstanceType type = instance_type(); |
| 6655 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; | 6640 return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE; |
| 6656 } | 6641 } |
| (...skipping 4587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11244 } else { | 11229 } else { |
| 11245 value &= ~(1 << bit_position); | 11230 value &= ~(1 << bit_position); |
| 11246 } | 11231 } |
| 11247 return value; | 11232 return value; |
| 11248 } | 11233 } |
| 11249 }; | 11234 }; |
| 11250 | 11235 |
| 11251 } } // namespace v8::internal | 11236 } } // namespace v8::internal |
| 11252 | 11237 |
| 11253 #endif // V8_OBJECTS_H_ | 11238 #endif // V8_OBJECTS_H_ |
| OLD | NEW |