Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Unified Diff: src/objects.h

Issue 7033024: Add bit_field3 to Map objects (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: implement all three platforms Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 68d81e141676353775491e20e20f96ba877f6fb4..08bb848b391c82c71ceae1091f20b047b934808e 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2039,16 +2039,19 @@ class FixedArray: public HeapObject {
// DescriptorArrays are fixed arrays used to hold instance descriptors.
// The format of the these objects is:
-// [0]: point to a fixed array with (value, detail) pairs.
-// [1]: next enumeration index (Smi), or pointer to small fixed array:
+// [0]: storage for bit_field3 for Map owning this object (Smi)
Mads Ager (chromium) 2011/05/23 10:14:51 Add a TODO(bugnumber) comment about moving this to
danno 2011/06/01 13:15:11 Done.
+// [1]: point to a fixed array with (value, detail) pairs.
+// [2]: next enumeration index (Smi), or pointer to small fixed array:
// [0]: next enumeration index (Smi)
// [1]: pointer to fixed array with enum cache
-// [2]: first key
+// [3]: first key
// [length() - 1]: last key
//
class DescriptorArray: public FixedArray {
public:
- // Is this the singleton empty_descriptor_array?
+ // Returns true for both shared empty_descriptor_array and for smis, which the
+ // map uses to encode additional bit fields when the descriptor array is not
+ // yet used.
inline bool IsEmpty();
// Returns the number of descriptors in the array.
@@ -2085,6 +2088,9 @@ class DescriptorArray: public FixedArray {
return bridge->get(kEnumCacheBridgeCacheIndex);
}
+ inline int bit_field3_storage();
Mads Ager (chromium) 2011/05/23 10:14:51 I would probably repeat the TODO(bugnumber) commen
danno 2011/06/01 13:15:11 Done.
+ inline void set_bit_field3_storage(int value);
+
// Initialize or change the enum cache,
// using the supplied storage for the small "bridge".
void SetEnumCache(FixedArray* bridge_storage, FixedArray* new_cache);
@@ -2163,9 +2169,10 @@ class DescriptorArray: public FixedArray {
// Constant for denoting key was not found.
static const int kNotFound = -1;
- static const int kContentArrayIndex = 0;
- static const int kEnumerationIndexIndex = 1;
- static const int kFirstIndex = 2;
+ static const int kBitField3StorageIndex = 0;
+ static const int kContentArrayIndex = 1;
+ static const int kEnumerationIndexIndex = 2;
+ static const int kFirstIndex = 3;
// The length of the "bridge" to the enum cache.
static const int kEnumCacheBridgeLength = 2;
@@ -2173,7 +2180,8 @@ class DescriptorArray: public FixedArray {
static const int kEnumCacheBridgeCacheIndex = 1;
// Layout description.
- static const int kContentArrayOffset = FixedArray::kHeaderSize;
+ static const int kBitField3StorageOffset = FixedArray::kHeaderSize;
+ static const int kContentArrayOffset = kBitField3StorageOffset + kPointerSize;
static const int kEnumerationIndexOffset = kContentArrayOffset + kPointerSize;
static const int kFirstOffset = kEnumerationIndexOffset + kPointerSize;
@@ -3645,6 +3653,10 @@ class Map: public HeapObject {
inline byte bit_field2();
inline void set_bit_field2(byte value);
+ // Bit field 3.
Mads Ager (chromium) 2011/05/23 10:14:51 TODO(bugnumber) comment explaining that this is re
danno 2011/06/01 13:15:11 Done.
+ inline int bit_field3();
+ inline void set_bit_field3(int value);
+
// Tells whether the object in the prototype property will be used
// for instances created from this function. If the prototype
// property is set to a value that is not a JSObject, the prototype
@@ -3766,9 +3778,17 @@ class Map: public HeapObject {
inline JSFunction* unchecked_constructor();
+ // Should only be called by the code that initializes map to set initial valid
+ // value the instance descriptor member.
Mads Ager (chromium) 2011/05/23 10:14:51 value the -> value of the?
danno 2011/06/01 13:15:11 Done.
+ inline void init_instance_descriptors();
+
// [instance descriptors]: describes the object.
DECL_ACCESSORS(instance_descriptors, DescriptorArray)
+ // Sets the instance descriptor array for the map to be an empty descriptor
+ // list.
Mads Ager (chromium) 2011/05/23 10:14:51 list -> array
danno 2011/06/01 13:15:11 Done.
+ inline void clear_instance_descriptors();
+
// [stub cache]: contains stubs compiled for this map.
DECL_ACCESSORS(code_cache, Object)
@@ -3894,9 +3914,19 @@ class Map: public HeapObject {
static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
- static const int kInstanceDescriptorsOffset =
+ // Storage for instance descriptors is overloaded to also contain additional
+ // map flags when unused (bit_field3). When the map has instance descriptors,
+ // the flags are transferred to the instance descriptor array and accessed
+ // through an extra indirection.
+ // TODO(1399): It should be possible to make room for bit_field3 in the map
+ // without overloading the instance descriptors field, but the map is
+ // currently perfectly aligned to 32 bytes and extending it at all would
+ // double its size. After the increment GC work lands, this size restriction
+ // could be loosened and bit_field3 moved directly back in the map.
+ static const int kInstanceDescriptorsOrBitField3Offset =
kConstructorOffset + kPointerSize;
- static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize;
+ static const int kCodeCacheOffset =
+ kInstanceDescriptorsOrBitField3Offset + kPointerSize;
static const int kPrototypeTransitionsOffset =
kCodeCacheOffset + kPointerSize;
static const int kPadStart = kPrototypeTransitionsOffset + kPointerSize;

Powered by Google App Engine
This is Rietveld 408576698