From 53be2063cc0abb0615e8f544cf202b86d4eacca9 Mon Sep 17 00:00:00 2001 From: hpayer Date: Tue, 4 Aug 2015 12:18:47 -0700 Subject: [PATCH] Retire ShortCircuitConsString. BUG= Review URL: https://codereview.chromium.org/1267313002 Cr-Commit-Position: refs/heads/master@{#30015} --- src/heap/mark-compact.cc | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 581db4a..84e18d0 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -1201,41 +1201,6 @@ MarkCompactCollector::~MarkCompactCollector() { } -static inline HeapObject* ShortCircuitConsString(Object** p) { - // Optimization: If the heap object pointed to by p is a non-internalized - // cons string whose right substring is HEAP->empty_string, update - // it in place to its left substring. Return the updated value. - // - // Here we assume that if we change *p, we replace it with a heap object - // (i.e., the left substring of a cons string is always a heap object). - // - // The check performed is: - // object->IsConsString() && !object->IsInternalizedString() && - // (ConsString::cast(object)->second() == HEAP->empty_string()) - // except the maps for the object and its possible substrings might be - // marked. - HeapObject* object = HeapObject::cast(*p); - Map* map = object->map(); - InstanceType type = map->instance_type(); - if (!IsShortcutCandidate(type)) return object; - - Object* second = reinterpret_cast(object)->second(); - Heap* heap = map->GetHeap(); - if (second != heap->empty_string()) { - return object; - } - - // Since we don't have the object's start, it is impossible to update the - // page dirty marks. Therefore, we only replace the string with its left - // substring when page dirty marks do not change. - Object* first = reinterpret_cast(object)->first(); - if (!heap->InNewSpace(object) && heap->InNewSpace(first)) return object; - - *p = first; - return HeapObject::cast(first); -} - - class MarkCompactMarkingVisitor : public StaticMarkingVisitor { public: @@ -1293,7 +1258,7 @@ class MarkCompactMarkingVisitor INLINE(static void MarkObjectByPointer(MarkCompactCollector* collector, HeapObject* object, Object** p)) { if (!(*p)->IsHeapObject()) return; - HeapObject* target_object = ShortCircuitConsString(p); + HeapObject* target_object = HeapObject::cast(*p); collector->RecordSlot(object, p, target_object); MarkBit mark = Marking::MarkBitFrom(target_object); collector->MarkObject(target_object, mark); @@ -1671,7 +1636,7 @@ class RootMarkingVisitor : public ObjectVisitor { if (!(*p)->IsHeapObject()) return; // Replace flat cons strings in place. - HeapObject* object = ShortCircuitConsString(p); + HeapObject* object = HeapObject::cast(*p); MarkBit mark_bit = Marking::MarkBitFrom(object); if (Marking::IsBlackOrGrey(mark_bit)) return; -- 2.7.4