Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 4fd29ad56227d368d2ebb0773c566f6cba3909b0..b2f44a183d08818b2da3622f14df8ea92df7b4e3 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -2429,7 +2429,7 @@ class DescriptorArray: public FixedArray { |
int number_of_descriptors() { |
ASSERT(length() > kFirstIndex || IsEmpty()); |
int len = length(); |
- return len <= kFirstIndex ? 0 : len - kFirstIndex; |
+ return len <= kFirstIndex ? 0 : (len - kFirstIndex) / kDescriptorSize; |
} |
int NextEnumerationIndex() { |
@@ -2459,6 +2459,12 @@ class DescriptorArray: public FixedArray { |
return bridge->get(kEnumCacheBridgeCacheIndex); |
} |
+ Object** GetEnumCacheSlot() { |
+ ASSERT(HasEnumCache()); |
+ return HeapObject::RawField(reinterpret_cast<HeapObject*>(this), |
+ kEnumerationIndexOffset); |
+ } |
+ |
// TODO(1399): It should be possible to make room for bit_field3 in the map |
// without overloading the instance descriptors field in the map |
// (and storing it in the DescriptorArray when the map has one). |
@@ -2473,8 +2479,16 @@ 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 Object* GetValue(int descriptor_number); |
+ inline Object** GetValueSlot(int descriptor_number); |
+ inline void SetNullValueUnchecked(int descriptor_number, Heap* heap); |
inline PropertyDetails GetDetails(int descriptor_number); |
+ inline void SetDetailsUnchecked(int descriptor_number, Smi* value); |
+ |
+ inline Object* RawGetValue(int descriptor_number); |
+ inline PropertyDetails RawGetDetails(int descriptor_number); |
+ |
inline PropertyType GetType(int descriptor_number); |
inline int GetFieldIndex(int descriptor_number); |
inline JSFunction* GetConstantFunction(int descriptor_number); |
@@ -2484,6 +2498,13 @@ class DescriptorArray: public FixedArray { |
inline bool IsTransitionOnly(int descriptor_number); |
inline bool IsNullDescriptor(int descriptor_number); |
+ // WhitenessWitness is used to prove that a specific descriptor array is white |
+ // (unmarked), so potentially unique heap objects can be freely assigned |
+ // without potentially causing memory leaks. A witness is always |
+ // stack-allocated right after creating a descriptor array. By allocating a witness, |
Florian Schneider
2012/05/22 16:53:09
Long line.
|
+ // incremental marking is globally disabled. The witness is then passed along |
+ // wherever needed to statically prove that the descriptor array is known to |
+ // be white. |
class WhitenessWitness { |
public: |
inline explicit WhitenessWitness(DescriptorArray* array); |
@@ -2567,9 +2588,8 @@ class DescriptorArray: public FixedArray { |
static const int kNotFound = -1; |
static const int kBitField3StorageIndex = 0; |
- static const int kContentArrayIndex = 1; |
- static const int kEnumerationIndexIndex = 2; |
- static const int kFirstIndex = 3; |
+ static const int kEnumerationIndexIndex = 1; |
+ static const int kFirstIndex = 2; |
// The length of the "bridge" to the enum cache. |
static const int kEnumCacheBridgeLength = 3; |
@@ -2579,8 +2599,8 @@ class DescriptorArray: public FixedArray { |
// Layout description. |
static const int kBitField3StorageOffset = FixedArray::kHeaderSize; |
- static const int kContentArrayOffset = kBitField3StorageOffset + kPointerSize; |
- static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize; |
+ static const int kEnumerationIndexOffset = kBitField3StorageOffset + |
+ kPointerSize; |
static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize; |
// Layout description for the bridge array. |
@@ -2588,6 +2608,12 @@ class DescriptorArray: public FixedArray { |
static const int kEnumCacheBridgeCacheOffset = |
kEnumCacheBridgeEnumOffset + kPointerSize; |
+ // Layout of descriptor. |
+ static const int kDescriptorSize = 3; |
Florian Schneider
2012/05/22 16:53:09
Maybe sort the constants for the layout by increas
|
+ static const int kDescriptorKey = 0; |
+ static const int kDescriptorDetails = 1; |
+ static const int kDescriptorValue = 2; |
+ |
#ifdef OBJECT_PRINT |
// Print all the descriptors. |
inline void PrintDescriptors() { |
@@ -2628,15 +2654,21 @@ class DescriptorArray: public FixedArray { |
// Conversion from descriptor number to array indices. |
static int ToKeyIndex(int descriptor_number) { |
- return descriptor_number+kFirstIndex; |
+ return kFirstIndex + |
+ (descriptor_number * kDescriptorSize) + |
+ kDescriptorKey; |
} |
static int ToDetailsIndex(int descriptor_number) { |
- return (descriptor_number << 1) + 1; |
+ return kFirstIndex + |
+ (descriptor_number * kDescriptorSize) + |
+ kDescriptorDetails; |
} |
static int ToValueIndex(int descriptor_number) { |
- return descriptor_number << 1; |
+ return kFirstIndex + |
+ (descriptor_number * kDescriptorSize) + |
+ kDescriptorValue; |
} |
// Swap operation on FixedArray without using write barriers. |
@@ -2647,9 +2679,6 @@ class DescriptorArray: public FixedArray { |
inline void NoIncrementalWriteBarrierSwapDescriptors( |
int first, int second); |
- FixedArray* GetContentArray() { |
- return FixedArray::cast(get(kContentArrayIndex)); |
- } |
DISALLOW_IMPLICIT_CONSTRUCTORS(DescriptorArray); |
}; |