Index: src/heap-inl.h |
diff --git a/src/heap-inl.h b/src/heap-inl.h |
index d42e1cfc1164f396fe0b782d93754ef8f3510e42..09d754ff82164aa961f6dceba941a0db3460a996 100644 |
--- a/src/heap-inl.h |
+++ b/src/heap-inl.h |
@@ -418,7 +418,7 @@ AllocationSpace Heap::TargetSpaceId(InstanceType type) { |
} |
-bool Heap::AllowedToBeMigrated(HeapObject* object, AllocationSpace dst) { |
+bool Heap::AllowedToBeMigrated(HeapObject* obj, AllocationSpace dst) { |
// Object migration is governed by the following rules: |
// |
// 1) Objects in new-space can be migrated to one of the old spaces |
@@ -428,18 +428,22 @@ bool Heap::AllowedToBeMigrated(HeapObject* object, AllocationSpace dst) { |
// fixed arrays in new-space, old-data-space and old-pointer-space. |
// 4) Fillers (one word) can never migrate, they are skipped by |
// incremental marking explicitly to prevent invalid pattern. |
+ // 5) Short external strings can end up in old pointer space when a cons |
+ // string in old pointer space is made external (String::MakeExternal). |
// |
// Since this function is used for debugging only, we do not place |
// asserts here, but check everything explicitly. |
- if (object->map() == one_pointer_filler_map()) return false; |
- InstanceType type = object->map()->instance_type(); |
- MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); |
+ if (obj->map() == one_pointer_filler_map()) return false; |
+ InstanceType type = obj->map()->instance_type(); |
+ MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); |
AllocationSpace src = chunk->owner()->identity(); |
switch (src) { |
case NEW_SPACE: |
return dst == src || dst == TargetSpaceId(type); |
case OLD_POINTER_SPACE: |
- return dst == src && (dst == TargetSpaceId(type) || object->IsFiller()); |
+ return dst == src && |
+ (dst == TargetSpaceId(type) || obj->IsFiller() || |
+ (obj->IsExternalString() && ExternalString::cast(obj)->is_short())); |
case OLD_DATA_SPACE: |
return dst == src && dst == TargetSpaceId(type); |
case CODE_SPACE: |