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 262 matching lines...) Loading... |
273 enum DebugExtraICState { | 273 enum DebugExtraICState { |
274 DEBUG_BREAK, | 274 DEBUG_BREAK, |
275 DEBUG_PREPARE_STEP_IN | 275 DEBUG_PREPARE_STEP_IN |
276 }; | 276 }; |
277 | 277 |
278 | 278 |
279 // Indicates whether the transition is simple: the target map of the transition | 279 // Indicates whether the transition is simple: the target map of the transition |
280 // either extends the current map with a new property, or it modifies the | 280 // either extends the current map with a new property, or it modifies the |
281 // property that was added last to the current map. | 281 // property that was added last to the current map. |
282 enum SimpleTransitionFlag { | 282 enum SimpleTransitionFlag { |
283 SIMPLE_TRANSITION, | 283 SIMPLE_PROPERTY_TRANSITION, |
284 FULL_TRANSITION | 284 PROPERTY_TRANSITION, |
| 285 SPECIAL_TRANSITION |
285 }; | 286 }; |
286 | 287 |
287 | 288 |
288 // Indicates whether we are only interested in the descriptors of a particular | 289 // Indicates whether we are only interested in the descriptors of a particular |
289 // map, or in all descriptors in the descriptor array. | 290 // map, or in all descriptors in the descriptor array. |
290 enum DescriptorFlag { | 291 enum DescriptorFlag { |
291 ALL_DESCRIPTORS, | 292 ALL_DESCRIPTORS, |
292 OWN_DESCRIPTORS | 293 OWN_DESCRIPTORS |
293 }; | 294 }; |
294 | 295 |
(...skipping 5518 matching lines...) Loading... |
5813 | 5814 |
5814 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a | 5815 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
5815 // map with DICTIONARY_ELEMENTS was found in the prototype chain. | 5816 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
5816 bool DictionaryElementsInPrototypeChainOnly(); | 5817 bool DictionaryElementsInPrototypeChainOnly(); |
5817 | 5818 |
5818 inline bool HasTransitionArray() const; | 5819 inline bool HasTransitionArray() const; |
5819 inline bool HasElementsTransition(); | 5820 inline bool HasElementsTransition(); |
5820 inline Map* elements_transition_map(); | 5821 inline Map* elements_transition_map(); |
5821 | 5822 |
5822 inline Map* GetTransition(int transition_index); | 5823 inline Map* GetTransition(int transition_index); |
5823 inline int SearchTransition(Name* name); | 5824 inline int SearchSpecialTransition(Symbol* name); |
| 5825 inline int SearchTransition(PropertyType type, Name* name, |
| 5826 PropertyAttributes attributes); |
5824 inline FixedArrayBase* GetInitialElements(); | 5827 inline FixedArrayBase* GetInitialElements(); |
5825 | 5828 |
5826 DECL_ACCESSORS(transitions, TransitionArray) | 5829 DECL_ACCESSORS(transitions, TransitionArray) |
5827 | 5830 |
5828 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); | 5831 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); |
5829 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); | 5832 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); |
5830 | 5833 |
5831 // Try to follow an existing transition to a field with attributes NONE. The | 5834 // Try to follow an existing transition to a field with attributes NONE. The |
5832 // return value indicates whether the transition was successful. | 5835 // return value indicates whether the transition was successful. |
5833 static inline Handle<Map> FindTransitionToField(Handle<Map> map, | 5836 static inline Handle<Map> FindTransitionToField(Handle<Map> map, |
(...skipping 117 matching lines...) Loading... |
5951 cache->set(kProtoTransitionNumberOfEntriesOffset, Smi::FromInt(value)); | 5954 cache->set(kProtoTransitionNumberOfEntriesOffset, Smi::FromInt(value)); |
5952 } | 5955 } |
5953 | 5956 |
5954 // Lookup in the map's instance descriptors and fill out the result | 5957 // Lookup in the map's instance descriptors and fill out the result |
5955 // with the given holder if the name is found. The holder may be | 5958 // with the given holder if the name is found. The holder may be |
5956 // NULL when this function is used from the compiler. | 5959 // NULL when this function is used from the compiler. |
5957 inline void LookupDescriptor(JSObject* holder, | 5960 inline void LookupDescriptor(JSObject* holder, |
5958 Name* name, | 5961 Name* name, |
5959 LookupResult* result); | 5962 LookupResult* result); |
5960 | 5963 |
5961 inline void LookupTransition(JSObject* holder, | 5964 inline void LookupTransition(JSObject* holder, Name* name, |
5962 Name* name, | 5965 PropertyAttributes attributes, |
5963 LookupResult* result); | 5966 LookupResult* result); |
5964 | 5967 |
5965 inline PropertyDetails GetLastDescriptorDetails(); | 5968 inline PropertyDetails GetLastDescriptorDetails(); |
5966 | 5969 |
5967 // The size of transition arrays are limited so they do not end up in large | 5970 // The size of transition arrays are limited so they do not end up in large |
5968 // object space. Otherwise ClearNonLiveTransitions would leak memory while | 5971 // object space. Otherwise ClearNonLiveTransitions would leak memory while |
5969 // applying in-place right trimming. | 5972 // applying in-place right trimming. |
5970 inline bool CanHaveMoreTransitions(); | 5973 inline bool CanHaveMoreTransitions(); |
5971 | 5974 |
5972 int LastAdded() { | 5975 int LastAdded() { |
(...skipping 349 matching lines...) Loading... |
6322 static Handle<Map> ShareDescriptor(Handle<Map> map, | 6325 static Handle<Map> ShareDescriptor(Handle<Map> map, |
6323 Handle<DescriptorArray> descriptors, | 6326 Handle<DescriptorArray> descriptors, |
6324 Descriptor* descriptor); | 6327 Descriptor* descriptor); |
6325 static Handle<Map> CopyInstallDescriptors( | 6328 static Handle<Map> CopyInstallDescriptors( |
6326 Handle<Map> map, | 6329 Handle<Map> map, |
6327 int new_descriptor, | 6330 int new_descriptor, |
6328 Handle<DescriptorArray> descriptors); | 6331 Handle<DescriptorArray> descriptors); |
6329 static Handle<Map> CopyAddDescriptor(Handle<Map> map, | 6332 static Handle<Map> CopyAddDescriptor(Handle<Map> map, |
6330 Descriptor* descriptor, | 6333 Descriptor* descriptor, |
6331 TransitionFlag flag); | 6334 TransitionFlag flag); |
6332 static Handle<Map> CopyReplaceDescriptors( | 6335 static Handle<Map> CopyReplaceDescriptors(Handle<Map> map, |
6333 Handle<Map> map, | 6336 Handle<DescriptorArray> descriptors, |
6334 Handle<DescriptorArray> descriptors, | 6337 TransitionFlag flag, |
6335 TransitionFlag flag, | 6338 MaybeHandle<Name> maybe_name, |
6336 MaybeHandle<Name> maybe_name, | 6339 SimpleTransitionFlag simple_flag); |
6337 SimpleTransitionFlag simple_flag = FULL_TRANSITION); | |
6338 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, | 6340 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, |
6339 Handle<DescriptorArray> descriptors, | 6341 Handle<DescriptorArray> descriptors, |
6340 Descriptor* descriptor, | 6342 Descriptor* descriptor, |
6341 int index, | 6343 int index, |
6342 TransitionFlag flag); | 6344 TransitionFlag flag); |
6343 | 6345 |
6344 static Handle<Map> CopyNormalized(Handle<Map> map, | 6346 static Handle<Map> CopyNormalized(Handle<Map> map, |
6345 PropertyNormalizationMode mode); | 6347 PropertyNormalizationMode mode); |
6346 | 6348 |
6347 // Fires when the layout of an object with a leaf map changes. | 6349 // Fires when the layout of an object with a leaf map changes. |
6348 // This includes adding transitions to the leaf map or changing | 6350 // This includes adding transitions to the leaf map or changing |
6349 // the descriptor array. | 6351 // the descriptor array. |
6350 inline void NotifyLeafMapLayoutChange(); | 6352 inline void NotifyLeafMapLayoutChange(); |
6351 | 6353 |
6352 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, | 6354 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, |
6353 ElementsKind to_kind); | 6355 ElementsKind to_kind); |
6354 | 6356 |
6355 // Zaps the contents of backing data structures. Note that the | 6357 // Zaps the contents of backing data structures. Note that the |
6356 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects | 6358 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects |
6357 // holding weak references when incremental marking is used, because it also | 6359 // holding weak references when incremental marking is used, because it also |
6358 // iterates over objects that are otherwise unreachable. | 6360 // iterates over objects that are otherwise unreachable. |
6359 // In general we only want to call these functions in release mode when | 6361 // In general we only want to call these functions in release mode when |
6360 // heap verification is turned on. | 6362 // heap verification is turned on. |
6361 void ZapPrototypeTransitions(); | 6363 void ZapPrototypeTransitions(); |
6362 void ZapTransitions(); | 6364 void ZapTransitions(); |
6363 | 6365 |
6364 void DeprecateTransitionTree(); | 6366 void DeprecateTransitionTree(); |
6365 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors); | 6367 void DeprecateTarget(PropertyType type, Name* key, |
| 6368 PropertyAttributes attributes, |
| 6369 DescriptorArray* new_descriptors); |
6366 | 6370 |
6367 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6371 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
6368 | 6372 |
6369 void UpdateFieldType(int descriptor_number, Handle<Name> name, | 6373 void UpdateFieldType(int descriptor_number, Handle<Name> name, |
6370 Handle<HeapType> new_type); | 6374 Handle<HeapType> new_type); |
6371 | 6375 |
6372 void PrintGeneralization(FILE* file, | 6376 void PrintGeneralization(FILE* file, |
6373 const char* reason, | 6377 const char* reason, |
6374 int modify_index, | 6378 int modify_index, |
6375 int split, | 6379 int split, |
(...skipping 4553 matching lines...) Loading... |
10929 } else { | 10933 } else { |
10930 value &= ~(1 << bit_position); | 10934 value &= ~(1 << bit_position); |
10931 } | 10935 } |
10932 return value; | 10936 return value; |
10933 } | 10937 } |
10934 }; | 10938 }; |
10935 | 10939 |
10936 } } // namespace v8::internal | 10940 } } // namespace v8::internal |
10937 | 10941 |
10938 #endif // V8_OBJECTS_H_ | 10942 #endif // V8_OBJECTS_H_ |
OLD | NEW |