From ca2f8d811ca08783e38ce5dd42d38a6b6a7b876f Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 5 Jun 2015 05:09:37 -0700 Subject: [PATCH] Add CHECKs to verify that we never finalize stale copies of external strings BUG=none R=ulan@chromium.org LOG=n Review URL: https://codereview.chromium.org/1160253010 Cr-Commit-Position: refs/heads/master@{#28811} --- src/heap/mark-compact.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 31af805..cd26803 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -1679,13 +1679,20 @@ class StringTableCleaner : public ObjectVisitor { if (o->IsHeapObject() && Marking::IsWhite(Marking::MarkBitFrom(HeapObject::cast(o)))) { if (finalize_external_strings) { - DCHECK(o->IsExternalString()); + // We must never finalize a string that was copied (has a forwarding + // map). + CHECK(o->IsExternalString()); heap_->FinalizeExternalString(String::cast(*p)); } else { pointers_removed_++; } // Set the entry to the_hole_value (as deleted). *p = heap_->the_hole_value(); + } else { + // Anything in the external string table has to be either a string or + // the hole. + CHECK(!finalize_external_strings || o->IsExternalString() || + o->IsTheHole()); } } } -- 2.7.4