Remove pad word from arrays
This change removes the 4 byte pad from all arrays except longs and
doubles. It saves 76kb from the boot image, and will also reduce the
size of arrays in the heap (and thereby reduce garbage collection).
Change-Id: I3ff277d5bf14c57c0f7552215818e588ec6cc275
diff --git a/src/mark_sweep.cc b/src/mark_sweep.cc
index 48473d5..952bf85 100644
--- a/src/mark_sweep.cc
+++ b/src/mark_sweep.cc
@@ -371,8 +371,9 @@
const ObjectArray<Object>* array = obj->AsObjectArray<Object>();
for (int32_t i = 0; i < array->GetLength(); ++i) {
const Object* element = array->GetWithoutChecks(i);
- CheckReference(obj, element, MemberOffset(i * sizeof(Object*) +
- Array::DataOffset().Int32Value()), false);
+ size_t width = sizeof(Object*);
+ CheckReference(obj, element, MemberOffset(i * width +
+ Array::DataOffset(width).Int32Value()), false);
}
}
}