Chromium Code Reviews| Index: src/objects.h |
| diff --git a/src/objects.h b/src/objects.h |
| index 0e64e37eb1988b92e87404d5c738b6a55ac7fff7..0ff40f6d3d28264e6e332d7a33650b17f1ef4d49 100644 |
| --- a/src/objects.h |
| +++ b/src/objects.h |
| @@ -1060,6 +1060,22 @@ class Object : public MaybeObject { |
| inline double Number(); |
| inline bool IsNaN(); |
| + inline Representation RequiredRepresentation() { |
| + if (IsSmi()) return Representation::Smi(); |
| + if (IsHeapNumber()) return Representation::Double(); |
| + return Representation::Tagged(); |
| + } |
| + |
| + inline bool FitsRepresentation(Representation representation) { |
|
danno
2013/04/24 15:23:00
Check for FLAG_track_double_fields
Toon Verwaest
2013/04/25 10:59:38
Done.
|
| + if (!FLAG_track_fields) return true; |
| + if (representation.IsSmi()) { |
| + return IsSmi(); |
| + } else if (representation.IsDouble()) { |
| + return IsNumber(); |
| + } |
| + return true; |
| + } |
| + |
| // Returns true if the object is of the correct type to be used as a |
| // implementation of a JSObject's elements. |
| inline bool HasValidElements(); |
| @@ -1806,11 +1822,12 @@ class JSObject: public JSReceiver { |
| // Extend the receiver with a single fast property appeared first in the |
| // passed map. This also extends the property backing store if necessary. |
| - static void AddFastPropertyUsingMap(Handle<JSObject> object, Handle<Map> map); |
| - inline MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap(Map* map); |
| static void TransitionToMap(Handle<JSObject> object, Handle<Map> map); |
| inline MUST_USE_RESULT MaybeObject* TransitionToMap(Map* map); |
| + static void MigrateInstance(Handle<JSObject> instance); |
| + inline MUST_USE_RESULT MaybeObject* MigrateInstance(); |
| + |
| // Can cause GC. |
| MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
| Name* key, |
| @@ -2164,6 +2181,11 @@ class JSObject: public JSReceiver { |
| Object* new_value, |
| PropertyAttributes attributes); |
| + MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); |
| + MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( |
| + int modify_index, |
| + Representation new_representation); |
| + |
| // Add a property to a fast-case object. |
| MUST_USE_RESULT MaybeObject* AddFastProperty( |
| Name* name, |
| @@ -2753,6 +2775,9 @@ class DescriptorArray: public FixedArray { |
| inline Name* GetSortedKey(int descriptor_number); |
| inline int GetSortedKeyIndex(int descriptor_number); |
| inline void SetSortedKey(int pointer, int descriptor_number); |
| + inline void InitializeRepresentations(Representation representation); |
| + inline void SetRepresentation(int descriptor_number, |
| + Representation representation); |
| // Accessor for complete descriptor. |
| inline void Get(int descriptor_number, Descriptor* desc); |
| @@ -2773,6 +2798,10 @@ class DescriptorArray: public FixedArray { |
| DescriptorArray* src, |
| int src_index, |
| const WhitenessWitness&); |
| + MUST_USE_RESULT MaybeObject* Merge(int verbatim, |
| + int valid, |
| + int new_size, |
| + DescriptorArray* other); |
| MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index); |
| @@ -4889,6 +4918,9 @@ class DependentCode: public FixedArray { |
| // Group of code that weakly embed this map and depend on being |
| // deoptimized when the map is garbage collected. |
| kWeaklyEmbeddedGroup, |
| + // Group of code that embed a transition to this map, and depend on being |
| + // deoptimized when the transition is replaced by a new version. |
| + kTransitionGroup, |
| // Group of code that omit run-time prototype checks for prototypes |
| // described by this map. The group is deoptimized whenever an object |
| // described by this map changes shape (and transitions to a new map), |
| @@ -4982,6 +5014,7 @@ class Map: public HeapObject { |
| class DictionaryMap: public BitField<bool, 24, 1> {}; |
| class OwnsDescriptors: public BitField<bool, 25, 1> {}; |
| class IsObserved: public BitField<bool, 26, 1> {}; |
| + class InvalidTransition: public BitField<bool, 27, 1> {}; |
| // Tells whether the object in the prototype property will be used |
| // for instances created from this function. If the prototype |
| @@ -5124,6 +5157,29 @@ class Map: public HeapObject { |
| inline void ClearTransitions(Heap* heap, |
| WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| + void InvalidateTransitionTree(); |
| + void InvalidateTarget(Name* key, DescriptorArray* new_descriptors); |
| + |
| + Map* FindRootMap(); |
| + Map* FindUpdatedMap(int verbatim, int length, DescriptorArray* descriptors); |
| + Map* FindLastMatchMap(int verbatim, int length, DescriptorArray* descriptors); |
| + |
| + int NumberOfFields(); |
| + |
| + bool InstancesNeedRewriting(int target_number_of_fields, |
| + int target_inobject, |
| + int target_unused); |
| + static Handle<Map> GeneralizeRepresentation( |
| + Handle<Map> map, |
| + int modify_index, |
| + Representation new_representation); |
| + MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( |
| + int modify_index, |
| + Representation representation); |
| + MUST_USE_RESULT MaybeObject* CopyGeneralizeRepresentation( |
| + int modify_index, |
| + Representation representation); |
| + |
| // Tells whether the map is attached to SharedFunctionInfo |
| // (for inobject slack tracking). |
| inline void set_attached_to_shared_function_info(bool value); |
| @@ -5262,6 +5318,9 @@ class Map: public HeapObject { |
| inline void set_owns_descriptors(bool is_shared); |
| inline bool is_observed(); |
| inline void set_is_observed(bool is_observed); |
| + inline void invalidate_transition(); |
| + inline bool is_invalid_transition(); |
| + inline bool CanTransitionBeInvalidated(); |
| MUST_USE_RESULT MaybeObject* RawCopy(int instance_size); |
| MUST_USE_RESULT MaybeObject* CopyWithPreallocatedFieldDescriptors(); |
| @@ -5271,6 +5330,9 @@ class Map: public HeapObject { |
| Name* name, |
| TransitionFlag flag, |
| int descriptor_index); |
| + MUST_USE_RESULT MaybeObject* CopyInstallDescriptors( |
| + int new_descriptor, |
| + DescriptorArray* descriptors); |
| MUST_USE_RESULT MaybeObject* ShareDescriptor(DescriptorArray* descriptors, |
| Descriptor* descriptor); |
| MUST_USE_RESULT MaybeObject* CopyAddDescriptor(Descriptor* descriptor, |
| @@ -5296,9 +5358,6 @@ class Map: public HeapObject { |
| // instance descriptors. |
| MUST_USE_RESULT MaybeObject* Copy(); |
| - // Returns the property index for name (only valid for FAST MODE). |
| - int PropertyIndexFor(Name* name); |
| - |
| // Returns the next free property index (only valid for FAST MODE). |
| int NextFreePropertyIndex(); |
| @@ -5349,6 +5408,8 @@ class Map: public HeapObject { |
| // Computes a hash value for this map, to be used in HashTables and such. |
| int Hash(); |
| + bool EquivalentToForTransition(Map* other); |
| + |
| // Compares this map to another to see if they describe equivalent objects. |
| // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if |
| // it had exactly zero inobject properties. |