Commit ece887da authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Turn visitor_id into a byte field and free back one word in Map.

Review URL: http://codereview.chromium.org/3364007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5414 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 47e6e4fa
...@@ -2109,7 +2109,16 @@ void ExternalFloatArray::set(int index, float value) { ...@@ -2109,7 +2109,16 @@ void ExternalFloatArray::set(int index, float value) {
} }
INT_ACCESSORS(Map, visitor_id, kScavengerCallbackOffset) int Map::visitor_id() {
return READ_BYTE_FIELD(this, kVisitorIdOffset);
}
void Map::set_visitor_id(int id) {
ASSERT(0 <= id && id < 256);
WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id));
}
int Map::instance_size() { int Map::instance_size() {
return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2; return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2;
......
...@@ -106,6 +106,9 @@ class StaticVisitorBase : public AllStatic { ...@@ -106,6 +106,9 @@ class StaticVisitorBase : public AllStatic {
kMinObjectSizeInWords = 2 kMinObjectSizeInWords = 2
}; };
// Visitor ID should fit in one byte.
STATIC_ASSERT(kVisitorIdCount <= 256);
// Determine which specialized visitor should be used for given instance type // Determine which specialized visitor should be used for given instance type
// and instance type. // and instance type.
static VisitorId GetVisitorId(int instance_type, int instance_size); static VisitorId GetVisitorId(int instance_type, int instance_size);
......
...@@ -2126,9 +2126,6 @@ Object* NormalizedMapCache::Get(JSObject* obj, PropertyNormalizationMode mode) { ...@@ -2126,9 +2126,6 @@ Object* NormalizedMapCache::Get(JSObject* obj, PropertyNormalizationMode mode) {
// The cached map should match newly created normalized map bit-by-bit. // The cached map should match newly created normalized map bit-by-bit.
Object* fresh = fast->CopyNormalized(mode); Object* fresh = fast->CopyNormalized(mode);
if (!fresh->IsFailure()) { if (!fresh->IsFailure()) {
// Copy the unused byte so that the assertion below works.
Map::cast(fresh)->address()[Map::kUnusedOffset] =
Map::cast(result)->address()[Map::kUnusedOffset];
ASSERT(memcmp(Map::cast(fresh)->address(), ASSERT(memcmp(Map::cast(fresh)->address(),
Map::cast(result)->address(), Map::cast(result)->address(),
Map::kSize) == 0); Map::kSize) == 0);
......
...@@ -3245,8 +3245,7 @@ class Map: public HeapObject { ...@@ -3245,8 +3245,7 @@ class Map: public HeapObject {
static const int kInstanceDescriptorsOffset = static const int kInstanceDescriptorsOffset =
kConstructorOffset + kPointerSize; kConstructorOffset + kPointerSize;
static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize; static const int kCodeCacheOffset = kInstanceDescriptorsOffset + kPointerSize;
static const int kScavengerCallbackOffset = kCodeCacheOffset + kPointerSize; static const int kPadStart = kCodeCacheOffset + kPointerSize;
static const int kPadStart = kScavengerCallbackOffset + kPointerSize;
static const int kSize = MAP_POINTER_ALIGN(kPadStart); static const int kSize = MAP_POINTER_ALIGN(kPadStart);
// Layout of pointer fields. Heap iteration code relies on them // Layout of pointer fields. Heap iteration code relies on them
...@@ -3263,9 +3262,8 @@ class Map: public HeapObject { ...@@ -3263,9 +3262,8 @@ class Map: public HeapObject {
static const int kPreAllocatedPropertyFieldsByte = 2; static const int kPreAllocatedPropertyFieldsByte = 2;
static const int kPreAllocatedPropertyFieldsOffset = static const int kPreAllocatedPropertyFieldsOffset =
kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte; kInstanceSizesOffset + kPreAllocatedPropertyFieldsByte;
// The byte at position 3 is not in use at the moment. static const int kVisitorIdByte = 3;
static const int kUnusedByte = 3; static const int kVisitorIdOffset = kInstanceSizesOffset + kVisitorIdByte;
static const int kUnusedOffset = kInstanceSizesOffset + kUnusedByte;
// Byte offsets within kInstanceAttributesOffset attributes. // Byte offsets within kInstanceAttributesOffset attributes.
static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0; static const int kInstanceTypeOffset = kInstanceAttributesOffset + 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment