Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index f3d2a661ae171b64fd658ad2fc35205a6bba37c6..5920679f6ab9b70360f151512257092ca81ffefc 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -221,12 +221,9 @@ bool Object::IsSpecFunction() { |
bool Object::IsInternalizedString() { |
if (!this->IsHeapObject()) return false; |
uint32_t type = HeapObject::cast(this)->map()->instance_type(); |
- // Because the internalized tag is non-zero and no non-string types have the |
- // internalized bit set we can test for internalized strings with a very |
- // simple test operation. |
STATIC_ASSERT(kInternalizedTag != 0); |
- ASSERT(kNotStringTag + kIsInternalizedMask > LAST_TYPE); |
- return (type & kIsInternalizedMask) != 0; |
+ return (type & (kIsNotStringMask | kIsInternalizedMask)) == |
+ (kInternalizedTag | kStringTag); |
} |
@@ -323,7 +320,8 @@ StringShape::StringShape(InstanceType t) |
bool StringShape::IsInternalized() { |
ASSERT(valid()); |
STATIC_ASSERT(kInternalizedTag != 0); |
- return (type_ & kIsInternalizedMask) != 0; |
+ return (type_ & (kIsNotStringMask | kIsInternalizedMask)) == |
+ (kInternalizedTag | kStringTag); |
} |
@@ -3388,15 +3386,13 @@ int Map::pre_allocated_property_fields() { |
int HeapObject::SizeFromMap(Map* map) { |
int instance_size = map->instance_size(); |
if (instance_size != kVariableSizeSentinel) return instance_size; |
- // We can ignore the "internalized" bit because it is only set for strings |
- // and thus implies a string type. |
- int instance_type = |
- static_cast<int>(map->instance_type()) & ~kIsInternalizedMask; |
// Only inline the most frequent cases. |
+ int instance_type = static_cast<int>(map->instance_type()); |
if (instance_type == FIXED_ARRAY_TYPE) { |
return FixedArray::BodyDescriptor::SizeOf(map, this); |
} |
- if (instance_type == ASCII_STRING_TYPE) { |
+ if (instance_type == ASCII_STRING_TYPE || |
+ instance_type == ASCII_INTERNALIZED_STRING_TYPE) { |
return SeqOneByteString::SizeFor( |
reinterpret_cast<SeqOneByteString*>(this)->length()); |
} |
@@ -3406,7 +3402,8 @@ int HeapObject::SizeFromMap(Map* map) { |
if (instance_type == FREE_SPACE_TYPE) { |
return reinterpret_cast<FreeSpace*>(this)->size(); |
} |
- if (instance_type == STRING_TYPE) { |
+ if (instance_type == STRING_TYPE || |
+ instance_type == INTERNALIZED_STRING_TYPE) { |
return SeqTwoByteString::SizeFor( |
reinterpret_cast<SeqTwoByteString*>(this)->length()); |
} |