Index: test/cctest/test-heap.cc |
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc |
index 2c85596090bd6e4f858336be88b464ed766ef64b..66e4f2a114236589cc393d8d68f436f962fc54c6 100644 |
--- a/test/cctest/test-heap.cc |
+++ b/test/cctest/test-heap.cc |
@@ -6663,5 +6663,40 @@ TEST(SharedFunctionInfoIterator) { |
CHECK_EQ(0, sfi_count); |
} |
+ |
+template <typename T> |
+static UniqueId MakeUniqueId(const Persistent<T>& p) { |
+ return UniqueId(reinterpret_cast<uintptr_t>(*v8::Utils::OpenPersistent(p))); |
+} |
+ |
+ |
+TEST(Regress519319) { |
+ CcTest::InitializeVM(); |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ Heap* heap = CcTest::heap(); |
+ LocalContext context; |
+ |
+ v8::Persistent<Value> parent; |
+ v8::Persistent<Value> child; |
+ |
+ parent.Reset(isolate, v8::Object::New(isolate)); |
+ child.Reset(isolate, v8::Object::New(isolate)); |
+ |
+ SimulateFullSpace(heap->old_space()); |
+ heap->CollectGarbage(OLD_SPACE); |
+ { |
+ UniqueId id = MakeUniqueId(parent); |
+ isolate->SetObjectGroupId(parent, id); |
+ isolate->SetReferenceFromGroup(id, child); |
+ } |
+ // The CollectGarbage call above starts sweeper threads. |
+ // The crash will happen if the following two functions |
+ // are called before sweeping finishes. |
+ heap->StartIncrementalMarking(); |
+ heap->FinalizeIncrementalMarkingIfComplete("test"); |
+} |
+ |
+ |
} // namespace internal |
} // namespace v8 |