OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 inline bool HasLocalProperty(Name* name); | 1696 inline bool HasLocalProperty(Name* name); |
1697 inline bool HasElement(uint32_t index); | 1697 inline bool HasElement(uint32_t index); |
1698 inline bool HasLocalElement(uint32_t index); | 1698 inline bool HasLocalElement(uint32_t index); |
1699 | 1699 |
1700 // Return the object's prototype (might be Heap::null_value()). | 1700 // Return the object's prototype (might be Heap::null_value()). |
1701 inline Object* GetPrototype(); | 1701 inline Object* GetPrototype(); |
1702 | 1702 |
1703 // Return the constructor function (may be Heap::null_value()). | 1703 // Return the constructor function (may be Heap::null_value()). |
1704 inline Object* GetConstructor(); | 1704 inline Object* GetConstructor(); |
1705 | 1705 |
1706 // Set the object's prototype (only JSReceiver and null are allowed). | |
1707 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, | |
1708 bool skip_hidden_prototypes); | |
1709 | |
1710 // Retrieves a permanent object identity hash code. The undefined value might | 1706 // Retrieves a permanent object identity hash code. The undefined value might |
1711 // be returned in case no hash was created yet and OMIT_CREATION was used. | 1707 // be returned in case no hash was created yet and OMIT_CREATION was used. |
1712 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1708 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
1713 | 1709 |
1714 // Lookup a property. If found, the result is valid and has | 1710 // Lookup a property. If found, the result is valid and has |
1715 // detailed information. | 1711 // detailed information. |
1716 void LocalLookup(Name* name, LookupResult* result, | 1712 void LocalLookup(Name* name, LookupResult* result, |
1717 bool search_hidden_prototypes = false); | 1713 bool search_hidden_prototypes = false); |
1718 void Lookup(Name* name, LookupResult* result); | 1714 void Lookup(Name* name, LookupResult* result); |
1719 | 1715 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 PropertyDetails details); | 1897 PropertyDetails details); |
1902 | 1898 |
1903 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, | 1899 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(Name* name, |
1904 Object* value, | 1900 Object* value, |
1905 PropertyDetails details); | 1901 PropertyDetails details); |
1906 | 1902 |
1907 // Deletes the named property in a normalized object. | 1903 // Deletes the named property in a normalized object. |
1908 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(Name* name, | 1904 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(Name* name, |
1909 DeleteMode mode); | 1905 DeleteMode mode); |
1910 | 1906 |
| 1907 static void OptimizeAsPrototype(Handle<JSObject> object); |
1911 MUST_USE_RESULT MaybeObject* OptimizeAsPrototype(); | 1908 MUST_USE_RESULT MaybeObject* OptimizeAsPrototype(); |
1912 | 1909 |
1913 // Retrieve interceptors. | 1910 // Retrieve interceptors. |
1914 InterceptorInfo* GetNamedInterceptor(); | 1911 InterceptorInfo* GetNamedInterceptor(); |
1915 InterceptorInfo* GetIndexedInterceptor(); | 1912 InterceptorInfo* GetIndexedInterceptor(); |
1916 | 1913 |
1917 // Used from JSReceiver. | 1914 // Used from JSReceiver. |
1918 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 1915 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
1919 Name* name, | 1916 Name* name, |
1920 bool continue_search); | 1917 bool continue_search); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2304 inline void FastPropertyAtPut(int index, Object* value); | 2301 inline void FastPropertyAtPut(int index, Object* value); |
2305 | 2302 |
2306 // Access to in object properties. | 2303 // Access to in object properties. |
2307 inline int GetInObjectPropertyOffset(int index); | 2304 inline int GetInObjectPropertyOffset(int index); |
2308 inline Object* InObjectPropertyAt(int index); | 2305 inline Object* InObjectPropertyAt(int index); |
2309 inline Object* InObjectPropertyAtPut(int index, | 2306 inline Object* InObjectPropertyAtPut(int index, |
2310 Object* value, | 2307 Object* value, |
2311 WriteBarrierMode mode | 2308 WriteBarrierMode mode |
2312 = UPDATE_WRITE_BARRIER); | 2309 = UPDATE_WRITE_BARRIER); |
2313 | 2310 |
| 2311 // Set the object's prototype (only JSReceiver and null are allowed values). |
| 2312 static Handle<Object> SetPrototype(Handle<JSObject> object, |
| 2313 Handle<Object> value, |
| 2314 bool skip_hidden_prototypes = false); |
| 2315 |
2314 // Initializes the body after properties slot, properties slot is | 2316 // Initializes the body after properties slot, properties slot is |
2315 // initialized by set_properties. Fill the pre-allocated fields with | 2317 // initialized by set_properties. Fill the pre-allocated fields with |
2316 // pre_allocated_value and the rest with filler_value. | 2318 // pre_allocated_value and the rest with filler_value. |
2317 // Note: this call does not update write barrier, the caller is responsible | 2319 // Note: this call does not update write barrier, the caller is responsible |
2318 // to ensure that |filler_value| can be collected without WB here. | 2320 // to ensure that |filler_value| can be collected without WB here. |
2319 inline void InitializeBody(Map* map, | 2321 inline void InitializeBody(Map* map, |
2320 Object* pre_allocated_value, | 2322 Object* pre_allocated_value, |
2321 Object* filler_value); | 2323 Object* filler_value); |
2322 | 2324 |
2323 // Check whether this object references another object | 2325 // Check whether this object references another object |
(...skipping 3151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5475 TransitionFlag flag); | 5477 TransitionFlag flag); |
5476 | 5478 |
5477 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 5479 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
5478 NormalizedMapSharingMode sharing); | 5480 NormalizedMapSharingMode sharing); |
5479 | 5481 |
5480 inline void AppendDescriptor(Descriptor* desc, | 5482 inline void AppendDescriptor(Descriptor* desc, |
5481 const DescriptorArray::WhitenessWitness&); | 5483 const DescriptorArray::WhitenessWitness&); |
5482 | 5484 |
5483 // Returns a copy of the map, with all transitions dropped from the | 5485 // Returns a copy of the map, with all transitions dropped from the |
5484 // instance descriptors. | 5486 // instance descriptors. |
| 5487 static Handle<Map> Copy(Handle<Map> map); |
5485 MUST_USE_RESULT MaybeObject* Copy(); | 5488 MUST_USE_RESULT MaybeObject* Copy(); |
5486 | 5489 |
5487 // Returns the next free property index (only valid for FAST MODE). | 5490 // Returns the next free property index (only valid for FAST MODE). |
5488 int NextFreePropertyIndex(); | 5491 int NextFreePropertyIndex(); |
5489 | 5492 |
5490 // Returns the number of properties described in instance_descriptors | 5493 // Returns the number of properties described in instance_descriptors |
5491 // filtering out properties with the specified attributes. | 5494 // filtering out properties with the specified attributes. |
5492 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, | 5495 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, |
5493 PropertyAttributes filter = NONE); | 5496 PropertyAttributes filter = NONE); |
5494 | 5497 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5601 void TraverseTransitionTree(TraverseCallback callback, void* data); | 5604 void TraverseTransitionTree(TraverseCallback callback, void* data); |
5602 | 5605 |
5603 // When you set the prototype of an object using the __proto__ accessor you | 5606 // When you set the prototype of an object using the __proto__ accessor you |
5604 // need a new map for the object (the prototype is stored in the map). In | 5607 // need a new map for the object (the prototype is stored in the map). In |
5605 // order not to multiply maps unnecessarily we store these as transitions in | 5608 // order not to multiply maps unnecessarily we store these as transitions in |
5606 // the original map. That way we can transition to the same map if the same | 5609 // the original map. That way we can transition to the same map if the same |
5607 // prototype is set, rather than creating a new map every time. The | 5610 // prototype is set, rather than creating a new map every time. The |
5608 // transitions are in the form of a map where the keys are prototype objects | 5611 // transitions are in the form of a map where the keys are prototype objects |
5609 // and the values are the maps the are transitioned to. | 5612 // and the values are the maps the are transitioned to. |
5610 static const int kMaxCachedPrototypeTransitions = 256; | 5613 static const int kMaxCachedPrototypeTransitions = 256; |
5611 | 5614 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
5612 Map* GetPrototypeTransition(Object* prototype); | 5615 Handle<Object> prototype); |
5613 | 5616 static Handle<Map> PutPrototypeTransition(Handle<Map> map, |
5614 MUST_USE_RESULT MaybeObject* PutPrototypeTransition(Object* prototype, | 5617 Handle<Object> prototype, |
5615 Map* map); | 5618 Handle<Map> target_map); |
5616 | 5619 |
5617 static const int kMaxPreAllocatedPropertyFields = 255; | 5620 static const int kMaxPreAllocatedPropertyFields = 255; |
5618 | 5621 |
5619 // Constant for denoting that the enum cache is not yet initialized. | 5622 // Constant for denoting that the enum cache is not yet initialized. |
5620 static const int kInvalidEnumCache = EnumLengthBits::kMax; | 5623 static const int kInvalidEnumCache = EnumLengthBits::kMax; |
5621 | 5624 |
5622 // Layout description. | 5625 // Layout description. |
5623 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; | 5626 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; |
5624 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; | 5627 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; |
5625 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; | 5628 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; |
(...skipping 4119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9745 } else { | 9748 } else { |
9746 value &= ~(1 << bit_position); | 9749 value &= ~(1 << bit_position); |
9747 } | 9750 } |
9748 return value; | 9751 return value; |
9749 } | 9752 } |
9750 }; | 9753 }; |
9751 | 9754 |
9752 } } // namespace v8::internal | 9755 } } // namespace v8::internal |
9753 | 9756 |
9754 #endif // V8_OBJECTS_H_ | 9757 #endif // V8_OBJECTS_H_ |
OLD | NEW |