Index: src/heap/scavenger.cc |
diff --git a/src/heap/scavenger.cc b/src/heap/scavenger.cc |
index f2722e81de5e27a1d415991b955ce3f91cc1e38f..d4e191ade48f36f4c136b82c4147fc63c0d5ce04 100644 |
--- a/src/heap/scavenger.cc |
+++ b/src/heap/scavenger.cc |
@@ -30,6 +30,7 @@ class ScavengingVisitor : public StaticVisitorBase { |
table_.Register(kVisitSeqOneByteString, &EvacuateSeqOneByteString); |
table_.Register(kVisitSeqTwoByteString, &EvacuateSeqTwoByteString); |
table_.Register(kVisitShortcutCandidate, &EvacuateShortcutCandidate); |
+ table_.Register(kVisitThinString, &EvacuateThinString); |
table_.Register(kVisitByteArray, &EvacuateByteArray); |
table_.Register(kVisitFixedArray, &EvacuateFixedArray); |
table_.Register(kVisitFixedDoubleArray, &EvacuateFixedDoubleArray); |
@@ -89,6 +90,12 @@ class ScavengingVisitor : public StaticVisitorBase { |
return &table_; |
} |
+ static void EvacuateThinStringNoShortcut(Map* map, HeapObject** slot, |
+ HeapObject* object) { |
+ EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object, |
+ ThinString::kSize); |
+ } |
+ |
private: |
enum ObjectContents { DATA_OBJECT, POINTER_OBJECT }; |
@@ -339,6 +346,22 @@ class ScavengingVisitor : public StaticVisitorBase { |
object_size); |
} |
+ static inline void EvacuateThinString(Map* map, HeapObject** slot, |
+ HeapObject* object) { |
+ if (marks_handling == IGNORE_MARKS) { |
+ HeapObject* actual = ThinString::cast(object)->actual(); |
+ *slot = actual; |
+ // ThinStrings always refer to internalized strings, which are |
+ // always in old space. |
+ DCHECK(!map->GetHeap()->InNewSpace(actual)); |
+ object->set_map_word(MapWord::FromForwardingAddress(actual)); |
+ return; |
+ } |
+ |
+ EvacuateObject<POINTER_OBJECT, kWordAligned>(map, slot, object, |
+ ThinString::kSize); |
+ } |
+ |
template <ObjectContents object_contents> |
class ObjectEvacuationStrategy { |
public: |
@@ -423,6 +446,10 @@ void Scavenger::SelectScavengingVisitorsTable() { |
StaticVisitorBase::kVisitShortcutCandidate, |
scavenging_visitors_table_.GetVisitorById( |
StaticVisitorBase::kVisitConsString)); |
+ scavenging_visitors_table_.Register( |
+ StaticVisitorBase::kVisitThinString, |
+ &ScavengingVisitor<TRANSFER_MARKS, LOGGING_AND_PROFILING_DISABLED>:: |
+ EvacuateThinStringNoShortcut); |
} |
} |
} |