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...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 enum DebugExtraICState { | 274 enum DebugExtraICState { |
275 DEBUG_BREAK, | 275 DEBUG_BREAK, |
276 DEBUG_PREPARE_STEP_IN | 276 DEBUG_PREPARE_STEP_IN |
277 }; | 277 }; |
278 | 278 |
279 | 279 |
280 // Indicates whether the transition is simple: the target map of the transition | 280 // Indicates whether the transition is simple: the target map of the transition |
281 // either extends the current map with a new property, or it modifies the | 281 // either extends the current map with a new property, or it modifies the |
282 // property that was added last to the current map. | 282 // property that was added last to the current map. |
283 enum SimpleTransitionFlag { | 283 enum SimpleTransitionFlag { SIMPLE_TRANSITION, FULL_TRANSITION }; |
284 SIMPLE_PROPERTY_TRANSITION, | |
285 PROPERTY_TRANSITION, | |
286 SPECIAL_TRANSITION | |
287 }; | |
288 | 284 |
289 | 285 |
290 // Indicates whether we are only interested in the descriptors of a particular | 286 // Indicates whether we are only interested in the descriptors of a particular |
291 // map, or in all descriptors in the descriptor array. | 287 // map, or in all descriptors in the descriptor array. |
292 enum DescriptorFlag { | 288 enum DescriptorFlag { |
293 ALL_DESCRIPTORS, | 289 ALL_DESCRIPTORS, |
294 OWN_DESCRIPTORS | 290 OWN_DESCRIPTORS |
295 }; | 291 }; |
296 | 292 |
297 // The GC maintains a bit of information, the MarkingParity, which toggles | 293 // The GC maintains a bit of information, the MarkingParity, which toggles |
(...skipping 5488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5786 | 5782 |
5787 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a | 5783 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
5788 // map with DICTIONARY_ELEMENTS was found in the prototype chain. | 5784 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
5789 bool DictionaryElementsInPrototypeChainOnly(); | 5785 bool DictionaryElementsInPrototypeChainOnly(); |
5790 | 5786 |
5791 inline bool HasTransitionArray() const; | 5787 inline bool HasTransitionArray() const; |
5792 inline bool HasElementsTransition(); | 5788 inline bool HasElementsTransition(); |
5793 inline Map* elements_transition_map(); | 5789 inline Map* elements_transition_map(); |
5794 | 5790 |
5795 inline Map* GetTransition(int transition_index); | 5791 inline Map* GetTransition(int transition_index); |
5796 inline int SearchSpecialTransition(Symbol* name); | 5792 inline int SearchTransition(Name* name); |
5797 inline int SearchTransition(PropertyType type, Name* name, | |
5798 PropertyAttributes attributes); | |
5799 inline FixedArrayBase* GetInitialElements(); | 5793 inline FixedArrayBase* GetInitialElements(); |
5800 | 5794 |
5801 DECL_ACCESSORS(transitions, TransitionArray) | 5795 DECL_ACCESSORS(transitions, TransitionArray) |
5802 | 5796 |
5803 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); | 5797 static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); |
5804 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); | 5798 static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); |
5805 | 5799 |
5806 // Try to follow an existing transition to a field with attributes NONE. The | 5800 // Try to follow an existing transition to a field with attributes NONE. The |
5807 // return value indicates whether the transition was successful. | 5801 // return value indicates whether the transition was successful. |
5808 static inline Handle<Map> FindTransitionToField(Handle<Map> map, | 5802 static inline Handle<Map> FindTransitionToField(Handle<Map> map, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5942 } | 5936 } |
5943 | 5937 |
5944 // Lookup in the map's instance descriptors and fill out the result | 5938 // Lookup in the map's instance descriptors and fill out the result |
5945 // with the given holder if the name is found. The holder may be | 5939 // with the given holder if the name is found. The holder may be |
5946 // NULL when this function is used from the compiler. | 5940 // NULL when this function is used from the compiler. |
5947 inline void LookupDescriptor(JSObject* holder, | 5941 inline void LookupDescriptor(JSObject* holder, |
5948 Name* name, | 5942 Name* name, |
5949 LookupResult* result); | 5943 LookupResult* result); |
5950 | 5944 |
5951 inline void LookupTransition(JSObject* holder, Name* name, | 5945 inline void LookupTransition(JSObject* holder, Name* name, |
5952 PropertyAttributes attributes, | |
5953 LookupResult* result); | 5946 LookupResult* result); |
5954 | 5947 |
5955 inline PropertyDetails GetLastDescriptorDetails(); | 5948 inline PropertyDetails GetLastDescriptorDetails(); |
5956 | 5949 |
5957 // The size of transition arrays are limited so they do not end up in large | 5950 // The size of transition arrays are limited so they do not end up in large |
5958 // object space. Otherwise ClearNonLiveTransitions would leak memory while | 5951 // object space. Otherwise ClearNonLiveTransitions would leak memory while |
5959 // applying in-place right trimming. | 5952 // applying in-place right trimming. |
5960 inline bool CanHaveMoreTransitions(); | 5953 inline bool CanHaveMoreTransitions(); |
5961 | 5954 |
5962 int LastAdded() { | 5955 int LastAdded() { |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6333 static Handle<Map> CopyInstallDescriptors( | 6326 static Handle<Map> CopyInstallDescriptors( |
6334 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors, | 6327 Handle<Map> map, int new_descriptor, Handle<DescriptorArray> descriptors, |
6335 Handle<LayoutDescriptor> layout_descriptor); | 6328 Handle<LayoutDescriptor> layout_descriptor); |
6336 static Handle<Map> CopyAddDescriptor(Handle<Map> map, | 6329 static Handle<Map> CopyAddDescriptor(Handle<Map> map, |
6337 Descriptor* descriptor, | 6330 Descriptor* descriptor, |
6338 TransitionFlag flag); | 6331 TransitionFlag flag); |
6339 static Handle<Map> CopyReplaceDescriptors( | 6332 static Handle<Map> CopyReplaceDescriptors( |
6340 Handle<Map> map, Handle<DescriptorArray> descriptors, | 6333 Handle<Map> map, Handle<DescriptorArray> descriptors, |
6341 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, | 6334 Handle<LayoutDescriptor> layout_descriptor, TransitionFlag flag, |
6342 MaybeHandle<Name> maybe_name, const char* reason, | 6335 MaybeHandle<Name> maybe_name, const char* reason, |
6343 SimpleTransitionFlag simple_flag); | 6336 SimpleTransitionFlag simple_flag = FULL_TRANSITION); |
6344 | |
6345 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, | 6337 static Handle<Map> CopyReplaceDescriptor(Handle<Map> map, |
6346 Handle<DescriptorArray> descriptors, | 6338 Handle<DescriptorArray> descriptors, |
6347 Descriptor* descriptor, | 6339 Descriptor* descriptor, |
6348 int index, | 6340 int index, |
6349 TransitionFlag flag); | 6341 TransitionFlag flag); |
6350 | 6342 |
6351 static Handle<Map> CopyNormalized(Handle<Map> map, | 6343 static Handle<Map> CopyNormalized(Handle<Map> map, |
6352 PropertyNormalizationMode mode); | 6344 PropertyNormalizationMode mode); |
6353 | 6345 |
6354 // Fires when the layout of an object with a leaf map changes. | 6346 // Fires when the layout of an object with a leaf map changes. |
6355 // This includes adding transitions to the leaf map or changing | 6347 // This includes adding transitions to the leaf map or changing |
6356 // the descriptor array. | 6348 // the descriptor array. |
6357 inline void NotifyLeafMapLayoutChange(); | 6349 inline void NotifyLeafMapLayoutChange(); |
6358 | 6350 |
6359 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, | 6351 static Handle<Map> TransitionElementsToSlow(Handle<Map> object, |
6360 ElementsKind to_kind); | 6352 ElementsKind to_kind); |
6361 | 6353 |
6362 // Zaps the contents of backing data structures. Note that the | 6354 // Zaps the contents of backing data structures. Note that the |
6363 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects | 6355 // heap verifier (i.e. VerifyMarkingVisitor) relies on zapping of objects |
6364 // holding weak references when incremental marking is used, because it also | 6356 // holding weak references when incremental marking is used, because it also |
6365 // iterates over objects that are otherwise unreachable. | 6357 // iterates over objects that are otherwise unreachable. |
6366 // In general we only want to call these functions in release mode when | 6358 // In general we only want to call these functions in release mode when |
6367 // heap verification is turned on. | 6359 // heap verification is turned on. |
6368 void ZapPrototypeTransitions(); | 6360 void ZapPrototypeTransitions(); |
6369 void ZapTransitions(); | 6361 void ZapTransitions(); |
6370 | 6362 |
6371 void DeprecateTransitionTree(); | 6363 void DeprecateTransitionTree(); |
6372 void DeprecateTarget(PropertyType type, Name* key, | 6364 void DeprecateTarget(Name* key, DescriptorArray* new_descriptors, |
6373 PropertyAttributes attributes, | |
6374 DescriptorArray* new_descriptors, | |
6375 LayoutDescriptor* new_layout_descriptor); | 6365 LayoutDescriptor* new_layout_descriptor); |
6376 | 6366 |
6377 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); | 6367 Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
6378 | 6368 |
6379 void UpdateFieldType(int descriptor_number, Handle<Name> name, | 6369 void UpdateFieldType(int descriptor_number, Handle<Name> name, |
6380 Representation new_representation, | 6370 Representation new_representation, |
6381 Handle<HeapType> new_type); | 6371 Handle<HeapType> new_type); |
6382 | 6372 |
6383 void PrintGeneralization(FILE* file, | 6373 void PrintGeneralization(FILE* file, |
6384 const char* reason, | 6374 const char* reason, |
(...skipping 4583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10968 } else { | 10958 } else { |
10969 value &= ~(1 << bit_position); | 10959 value &= ~(1 << bit_position); |
10970 } | 10960 } |
10971 return value; | 10961 return value; |
10972 } | 10962 } |
10973 }; | 10963 }; |
10974 | 10964 |
10975 } } // namespace v8::internal | 10965 } } // namespace v8::internal |
10976 | 10966 |
10977 #endif // V8_OBJECTS_H_ | 10967 #endif // V8_OBJECTS_H_ |
OLD | NEW |