Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 90564f3e731b6a86d7e5358eacac2c2eafc2060c..ad012f49505b25189fde17bfa9f1f931608ddd06 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -780,6 +780,7 @@ class MaybeObject BASE_EMBEDDED { |
V(JSModule) \ |
V(Map) \ |
V(DescriptorArray) \ |
+ V(TransitionArray) \ |
V(DeoptimizationInputData) \ |
V(DeoptimizationOutputData) \ |
V(TypeFeedbackCells) \ |
@@ -1194,6 +1195,14 @@ class HeapObject: public Object { |
// barrier mode. |
inline WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation&); |
+ inline Address FieldAddress(int offset); |
Jakob Kummerow
2012/06/29 16:31:36
I guess you forgot to remove these declarations?
Toon Verwaest
2012/07/05 12:56:11
Done.
|
+ inline Object* ReadField(int offset); |
+ inline void WriteField(int offset, Object* value); |
+ inline void ConditionalWriteBarrier(Heap* heap, |
+ uint32_t offset, |
+ Object* value, |
+ WriteBarrierMode mode); |
+ |
// Dispatched behavior. |
void HeapObjectShortPrint(StringStream* accumulator); |
#ifdef OBJECT_PRINT |
@@ -1898,7 +1907,8 @@ class JSObject: public JSReceiver { |
// new_map. |
MUST_USE_RESULT MaybeObject* AddFastPropertyUsingMap(Map* new_map, |
String* name, |
- Object* value); |
+ Object* value, |
+ int field_index); |
// Add a constant function property to a fast-case object. |
// This leaves a CONSTANT_TRANSITION in the old map, and |
@@ -2056,6 +2066,10 @@ class JSObject: public JSReceiver { |
PrintElements(stdout); |
} |
void PrintElements(FILE* out); |
+ inline void PrintTransitions() { |
+ PrintElements(stdout); |
Jakob Kummerow
2012/06/29 16:31:36
Don't you mean PrintTransitions(stdout) here?
Toon Verwaest
2012/07/05 12:56:11
Done.
|
+ } |
+ void PrintTransitions(FILE* out); |
#endif |
void PrintElementsTransition( |
@@ -2209,7 +2223,6 @@ class JSObject: public JSReceiver { |
Object* getter, |
Object* setter, |
PropertyAttributes attributes); |
- void LookupInDescriptor(String* name, LookupResult* result); |
// Returns the hidden properties backing store object, currently |
// a StringDictionary, stored on this object. |
@@ -2436,17 +2449,20 @@ class DescriptorArray: public FixedArray { |
// yet used. |
inline bool IsEmpty(); |
inline bool MayContainTransitions(); |
+ inline bool HasTransitionArray(); |
- DECL_ACCESSORS(elements_transition_map, Map) |
- inline void ClearElementsTransition(); |
+ DECL_ACCESSORS(transitions, TransitionArray) |
+ inline void ClearTransitions(); |
// Returns the number of descriptors in the array. |
int number_of_descriptors() { |
- ASSERT(length() >= kFirstIndex || IsEmpty()); |
+ ASSERT(MayContainTransitions() || IsEmpty()); |
int len = length(); |
return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize; |
} |
+ inline int number_of_entries() { return number_of_descriptors(); } |
+ |
int NextEnumerationIndex() { |
if (IsEmpty()) return PropertyDetails::kInitialIndex; |
Object* obj = get(kEnumerationIndexIndex); |
@@ -2481,7 +2497,6 @@ class DescriptorArray: public FixedArray { |
} |
Object** GetTransitionsSlot() { |
- ASSERT(elements_transition_map() != NULL); |
return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), |
kTransitionsOffset); |
} |
@@ -2501,22 +2516,14 @@ class DescriptorArray: public FixedArray { |
// Accessors for fetching instance descriptor at descriptor number. |
inline String* GetKey(int descriptor_number); |
inline Object** GetKeySlot(int descriptor_number); |
- inline void SetKeyUnchecked(Heap* heap, int descriptor_number, String* value); |
inline Object* GetValue(int descriptor_number); |
inline Object** GetValueSlot(int descriptor_number); |
- inline void SetNullValueUnchecked(Heap* heap, int descriptor_number); |
- inline void SetValueUnchecked(Heap* heap, |
- int descriptor_number, |
- Object* value); |
inline PropertyDetails GetDetails(int descriptor_number); |
- inline void SetDetailsUnchecked(int descriptor_number, Smi* value); |
inline PropertyType GetType(int descriptor_number); |
inline int GetFieldIndex(int descriptor_number); |
inline JSFunction* GetConstantFunction(int descriptor_number); |
inline Object* GetCallbacksObject(int descriptor_number); |
inline AccessorDescriptor* GetCallbacks(int descriptor_number); |
- inline bool IsProperty(int descriptor_number); |
- inline bool IsTransitionOnly(int descriptor_number); |
// WhitenessWitness is used to prove that a specific descriptor array is white |
// (unmarked), so incremental write barriers can be skipped because the |
@@ -2562,8 +2569,7 @@ class DescriptorArray: public FixedArray { |
// or null), its enumeration index is kept as is. |
// If adding a real property, map transitions must be removed. If adding |
// a transition, they must not be removed. All null descriptors are removed. |
- MUST_USE_RESULT MaybeObject* CopyInsert(Descriptor* descriptor, |
- TransitionFlag transition_flag); |
+ MUST_USE_RESULT MaybeObject* CopyInsert(Descriptor* descriptor); |
// Indicates whether the search function should expect a sorted or an unsorted |
// descriptor array as input. |
@@ -2574,7 +2580,7 @@ class DescriptorArray: public FixedArray { |
// Return a copy of the array with all transitions and null descriptors |
// removed. Return a Failure object in case of an allocation failure. |
- MUST_USE_RESULT MaybeObject* RemoveTransitions(SharedMode shared_mode); |
+ MUST_USE_RESULT MaybeObject* Copy(SharedMode shared_mode); |
// Sort the instance descriptors by the hash codes of their keys. |
// Does not check for duplicates. |
@@ -2594,17 +2600,6 @@ class DescriptorArray: public FixedArray { |
// Tells whether the name is present int the array. |
bool Contains(String* name) { return kNotFound != Search(name); } |
- // Perform a binary search in the instance descriptors represented |
- // by this fixed array. low and high are descriptor indices. If there |
- // are three instance descriptors in this array it should be called |
- // with low=0 and high=2. |
- int BinarySearch(String* name, int low, int high); |
- |
- // Perform a linear search in the instance descriptors represented |
- // by this fixed array. len is the number of descriptor indices that are |
- // valid. |
- int LinearSearch(SearchMode mode, String* name, int len); |
- |
// Allocates a DescriptorArray, but returns the singleton |
// empty descriptor array object if number_of_descriptors is 0. |
MUST_USE_RESULT static MaybeObject* Allocate(int number_of_descriptors, |
@@ -2629,8 +2624,8 @@ class DescriptorArray: public FixedArray { |
// Layout description. |
static const int kBitField3StorageOffset = FixedArray::kHeaderSize; |
- static const int kEnumerationIndexOffset = |
- kBitField3StorageOffset + kPointerSize; |
+ static const int kEnumerationIndexOffset = kBitField3StorageOffset + |
+ kPointerSize; |
static const int kTransitionsOffset = kEnumerationIndexOffset + kPointerSize; |
static const int kFirstOffset = kTransitionsOffset + kPointerSize; |
@@ -2706,7 +2701,7 @@ class DescriptorArray: public FixedArray { |
static inline void NoIncrementalWriteBarrierSwap( |
FixedArray* array, int first, int second); |
- // Swap descriptor first and second. |
+ // Swap first and second descriptor. |
inline void NoIncrementalWriteBarrierSwapDescriptors( |
int first, int second); |
@@ -2714,6 +2709,14 @@ class DescriptorArray: public FixedArray { |
}; |
+template<typename T> |
+inline int LinearSearch(T* array, SearchMode mode, String* name, int len); |
+ |
+ |
+template<typename T> |
+inline int Search(T* array, String* name); |
+ |
+ |
// HashTable is a subclass of FixedArray that implements a hash table |
// that uses open addressing and quadratic probing. |
// |
@@ -3178,8 +3181,6 @@ class StringDictionary: public Dictionary<StringDictionaryShape, String*> { |
// Find entry for key, otherwise return kNotFound. Optimized version of |
// HashTable::FindEntry. |
int FindEntry(String* key); |
- |
- bool ContainsTransition(int entry); |
}; |
@@ -4628,6 +4629,7 @@ class Map: public HeapObject { |
// DescriptorArray when the map has one). |
inline int bit_field3(); |
inline void set_bit_field3(int value); |
+ inline void SetOwnBitField3(int value); |
// Tells whether the object in the prototype property will be used |
// for instances created from this function. If the prototype |
@@ -4748,8 +4750,15 @@ class Map: public HeapObject { |
static bool IsValidElementsTransition(ElementsKind from_kind, |
ElementsKind to_kind); |
+ inline bool HasTransitionArray(); |
+ inline bool HasElementsTransition(); |
inline Map* elements_transition_map(); |
- inline void set_elements_transition_map(Map* transitioned_map); |
+ MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( |
+ Map* transitioned_map); |
+ inline TransitionArray* transitions(); |
+ MUST_USE_RESULT inline MaybeObject* set_transitions( |
+ TransitionArray* transitions); |
+ inline void ClearTransitions(); |
// Tells whether the map is attached to SharedFunctionInfo |
// (for inobject slack tracking). |
@@ -4839,9 +4848,13 @@ class Map: public HeapObject { |
// Lookup in the map's instance descriptors and fill out the result |
// with the given holder if the name is found. The holder may be |
// NULL when this function is used from the compiler. |
- void LookupInDescriptors(JSObject* holder, |
- String* name, |
- LookupResult* result); |
+ void LookupDescriptor(JSObject* holder, |
+ String* name, |
+ LookupResult* result); |
+ |
+ void LookupTransitionOrDescriptor(JSObject* holder, |
+ String* name, |
+ LookupResult* result); |
MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
@@ -4925,8 +4938,8 @@ class Map: public HeapObject { |
// holding weak references when incremental marking is used, because it also |
// iterates over objects that are otherwise unreachable. |
#ifdef DEBUG |
- void ZapInstanceDescriptors(); |
void ZapPrototypeTransitions(); |
+ void ZapTransitions(); |
#endif |
// Dispatched behavior. |