Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 31ebbb18c8a42bf0399208099e20ac7f910c2d8c..9c616247afc462924d2c2103e9d15280ef15dd8f 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -3673,10 +3673,9 @@ void* FixedTypedArrayBase::DataPtr() { |
} |
-int FixedTypedArrayBase::DataSize() { |
- InstanceType instance_type = map()->instance_type(); |
+int FixedTypedArrayBase::DataSize(InstanceType type) { |
int element_size; |
- switch (instance_type) { |
+ switch (type) { |
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
case FIXED_##TYPE##_ARRAY_TYPE: \ |
element_size = size; \ |
@@ -3692,11 +3691,21 @@ int FixedTypedArrayBase::DataSize() { |
} |
+int FixedTypedArrayBase::DataSize() { |
+ return DataSize(map()->instance_type()); |
+} |
+ |
+ |
int FixedTypedArrayBase::size() { |
return OBJECT_POINTER_ALIGN(kDataOffset + DataSize()); |
} |
+int FixedTypedArrayBase::TypedArraySize(InstanceType type) { |
+ return OBJECT_POINTER_ALIGN(kDataOffset + DataSize(type)); |
+} |
+ |
+ |
uint8_t Uint8ArrayTraits::defaultValue() { return 0; } |
@@ -3918,7 +3927,7 @@ int HeapObject::SizeFromMap(Map* map) { |
int instance_size = map->instance_size(); |
if (instance_size != kVariableSizeSentinel) return instance_size; |
// Only inline the most frequent cases. |
- int instance_type = static_cast<int>(map->instance_type()); |
+ InstanceType instance_type = map->instance_type(); |
if (instance_type == FIXED_ARRAY_TYPE) { |
return FixedArray::BodyDescriptor::SizeOf(map, this); |
} |
@@ -3951,7 +3960,8 @@ int HeapObject::SizeFromMap(Map* map) { |
} |
if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE && |
instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE) { |
- return reinterpret_cast<FixedTypedArrayBase*>(this)->size(); |
+ return reinterpret_cast<FixedTypedArrayBase*>( |
+ this)->TypedArraySize(instance_type); |
} |
ASSERT(instance_type == CODE_TYPE); |
return reinterpret_cast<Code*>(this)->CodeSize(); |