Index: test/cctest/test-mark-compact.cc |
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc |
index ee1481f4e0a063a0854f9758c9985f822a6cecc8..db8c3e403452e5875406e1572b519314164cb817 100644 |
--- a/test/cctest/test-mark-compact.cc |
+++ b/test/cctest/test-mark-compact.cc |
@@ -43,8 +43,6 @@ |
using namespace v8::internal; |
-using v8::UniqueId; |
- |
TEST(MarkingDeque) { |
CcTest::InitializeVM(); |
@@ -308,7 +306,7 @@ static void WeakPointerCallback(v8::Isolate* isolate, |
handle.Dispose(isolate); |
} |
-TEST(ObjectGroupsOldApi) { |
+TEST(ObjectGroups) { |
FLAG_incremental_marking = false; |
CcTest::InitializeVM(); |
GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
@@ -370,7 +368,7 @@ TEST(ObjectGroupsOldApi) { |
Handle<HeapObject>::cast(g1s1).location(), g1_children, 1); |
global_handles->AddObjectGroup(g2_objects, 2, NULL); |
global_handles->AddImplicitReferences( |
- Handle<HeapObject>::cast(g2s1).location(), g2_children, 1); |
+ Handle<HeapObject>::cast(g2s2).location(), g2_children, 1); |
} |
// Do a full GC |
HEAP->CollectGarbage(OLD_POINTER_SPACE); |
@@ -399,7 +397,7 @@ TEST(ObjectGroupsOldApi) { |
Handle<HeapObject>::cast(g1s1).location(), g1_children, 1); |
global_handles->AddObjectGroup(g2_objects, 2, NULL); |
global_handles->AddImplicitReferences( |
- Handle<HeapObject>::cast(g2s1).location(), g2_children, 1); |
+ Handle<HeapObject>::cast(g2s2).location(), g2_children, 1); |
} |
HEAP->CollectGarbage(OLD_POINTER_SPACE); |
@@ -421,122 +419,6 @@ TEST(ObjectGroupsOldApi) { |
CHECK_EQ(7, NumberOfWeakCalls); |
} |
-TEST(ObjectGroups) { |
- FLAG_incremental_marking = false; |
- CcTest::InitializeVM(); |
- GlobalHandles* global_handles = reinterpret_cast<v8::internal::Isolate*>( |
- CcTest::isolate())->global_handles(); |
- |
- NumberOfWeakCalls = 0; |
- v8::HandleScope handle_scope(CcTest::isolate()); |
- |
- Heap* heap = reinterpret_cast<v8::internal::Isolate*>( |
- CcTest::isolate())->heap(); |
- Handle<Object> g1s1 = |
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
- Handle<Object> g1s2 = |
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
- Handle<Object> g1c1 = |
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
- global_handles->MakeWeak(g1s1.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- global_handles->MakeWeak(g1s2.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- global_handles->MakeWeak(g1c1.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- |
- Handle<Object> g2s1 = |
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
- Handle<Object> g2s2 = |
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
- Handle<Object> g2c1 = |
- global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked()); |
- global_handles->MakeWeak(g2s1.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- global_handles->MakeWeak(g2s2.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- global_handles->MakeWeak(g2c1.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- |
- Handle<Object> root = global_handles->Create(*g1s1); // make a root. |
- |
- // Connect group 1 and 2, make a cycle. |
- Handle<FixedArray>::cast(g1s2)->set(0, *g2s2); |
- Handle<FixedArray>::cast(g2s1)->set(0, *g1s1); |
- |
- { |
- global_handles->SetObjectGroupId(g1s1.location(), v8::UniqueId(1)); |
- global_handles->SetObjectGroupId(g1s2.location(), v8::UniqueId(1)); |
- global_handles->SetObjectGroupRepresentative( |
- v8::UniqueId(1), reinterpret_cast<HeapObject**>(g1s1.location())); |
- global_handles->AddImplicitReference(v8::UniqueId(1), g1c1.location()); |
- global_handles->SetObjectGroupId(g2s1.location(), v8::UniqueId(2)); |
- global_handles->SetObjectGroupId(g2s2.location(), v8::UniqueId(2)); |
- global_handles->SetObjectGroupRepresentative( |
- v8::UniqueId(2), reinterpret_cast<HeapObject**>(g2s1.location())); |
- global_handles->AddImplicitReference(v8::UniqueId(2), g2c1.location()); |
- } |
- // Do a full GC |
- heap->CollectGarbage(OLD_POINTER_SPACE); |
- |
- // All object should be alive. |
- CHECK_EQ(0, NumberOfWeakCalls); |
- |
- // Weaken the root. |
- global_handles->MakeWeak(root.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- // But make children strong roots---all the objects (except for children) |
- // should be collectable now. |
- global_handles->ClearWeakness(g1c1.location()); |
- global_handles->ClearWeakness(g2c1.location()); |
- |
- // Groups are deleted, rebuild groups. |
- { |
- global_handles->SetObjectGroupId(g1s1.location(), v8::UniqueId(1)); |
- global_handles->SetObjectGroupId(g1s2.location(), v8::UniqueId(1)); |
- global_handles->SetObjectGroupRepresentative( |
- v8::UniqueId(1), reinterpret_cast<HeapObject**>(g1s1.location())); |
- global_handles->AddImplicitReference(v8::UniqueId(1), g1c1.location()); |
- global_handles->SetObjectGroupId(g2s1.location(), v8::UniqueId(2)); |
- global_handles->SetObjectGroupId(g2s2.location(), v8::UniqueId(2)); |
- global_handles->SetObjectGroupRepresentative( |
- v8::UniqueId(2), reinterpret_cast<HeapObject**>(g2s1.location())); |
- global_handles->AddImplicitReference(v8::UniqueId(2), g2c1.location()); |
- } |
- |
- heap->CollectGarbage(OLD_POINTER_SPACE); |
- |
- // All objects should be gone. 5 global handles in total. |
- CHECK_EQ(5, NumberOfWeakCalls); |
- |
- // And now make children weak again and collect them. |
- global_handles->MakeWeak(g1c1.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- global_handles->MakeWeak(g2c1.location(), |
- reinterpret_cast<void*>(1234), |
- NULL, |
- &WeakPointerCallback); |
- |
- heap->CollectGarbage(OLD_POINTER_SPACE); |
- CHECK_EQ(7, NumberOfWeakCalls); |
-} |
- |
class TestRetainedObjectInfo : public v8::RetainedObjectInfo { |
public: |
@@ -562,7 +444,7 @@ class TestRetainedObjectInfo : public v8::RetainedObjectInfo { |
}; |
-TEST(EmptyObjectGroupsOldApi) { |
+TEST(EmptyObjectGroups) { |
CcTest::InitializeVM(); |
GlobalHandles* global_handles = Isolate::Current()->global_handles(); |