Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: test/cctest/test-global-handles.cc

Issue 14294009: Revert the commits adding new GC-related APIs. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: remove test Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-global-handles.cc
diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc
index 324ea8db116c33bfc675bf22ff527fa8d0dc7f35..1959a40503a91ed797502fa6293b2350fabae6d5 100644
--- a/test/cctest/test-global-handles.cc
+++ b/test/cctest/test-global-handles.cc
@@ -30,7 +30,6 @@
#include "cctest.h"
using namespace v8::internal;
-using v8::UniqueId;
static int NumberOfWeakCalls = 0;
static void WeakPointerCallback(v8::Isolate* isolate,
@@ -197,115 +196,3 @@ TEST(IterateObjectGroupsOldApi) {
ASSERT(info2.has_been_disposed());
}
}
-
-TEST(IterateObjectGroups) {
- CcTest::InitializeVM();
- GlobalHandles* global_handles = Isolate::Current()->global_handles();
-
- v8::HandleScope handle_scope(CcTest::isolate());
-
- Handle<Object> g1s1 =
- global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked());
- Handle<Object> g1s2 =
- 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);
-
- Handle<Object> g2s1 =
- global_handles->Create(HEAP->AllocateFixedArray(1)->ToObjectChecked());
- Handle<Object> g2s2 =
- 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);
-
- TestRetainedObjectInfo info1;
- TestRetainedObjectInfo info2;
- {
- global_handles->SetObjectGroupId(g2s1.location(), UniqueId(2));
- global_handles->SetObjectGroupId(g2s2.location(), UniqueId(2));
- global_handles->SetRetainedObjectInfo(UniqueId(2), &info2);
- global_handles->SetObjectGroupId(g1s1.location(), UniqueId(1));
- global_handles->SetObjectGroupId(g1s2.location(), UniqueId(1));
- global_handles->SetRetainedObjectInfo(UniqueId(1), &info1);
- }
-
- // Iterate the object groups. First skip all.
- {
- ResetCanSkipData();
- skippable_objects.Add(*g1s1.location());
- skippable_objects.Add(*g1s2.location());
- skippable_objects.Add(*g2s1.location());
- skippable_objects.Add(*g2s2.location());
- TestObjectVisitor visitor;
- global_handles->IterateObjectGroups(&visitor, &CanSkipCallback);
-
- // CanSkipCallback was called for all objects.
- ASSERT(can_skip_called_objects.length() == 4);
- ASSERT(can_skip_called_objects.Contains(*g1s1.location()));
- ASSERT(can_skip_called_objects.Contains(*g1s2.location()));
- ASSERT(can_skip_called_objects.Contains(*g2s1.location()));
- ASSERT(can_skip_called_objects.Contains(*g2s2.location()));
-
- // Nothing was visited.
- ASSERT(visitor.visited.length() == 0);
- ASSERT(!info1.has_been_disposed());
- ASSERT(!info2.has_been_disposed());
- }
-
- // Iterate again, now only skip the second object group.
- {
- ResetCanSkipData();
- // The first grough should still be visited, since only one object is
- // skipped.
- skippable_objects.Add(*g1s1.location());
- skippable_objects.Add(*g2s1.location());
- skippable_objects.Add(*g2s2.location());
- TestObjectVisitor visitor;
- global_handles->IterateObjectGroups(&visitor, &CanSkipCallback);
-
- // CanSkipCallback was called for all objects.
- ASSERT(can_skip_called_objects.length() == 3 ||
- can_skip_called_objects.length() == 4);
- ASSERT(can_skip_called_objects.Contains(*g1s2.location()));
- ASSERT(can_skip_called_objects.Contains(*g2s1.location()));
- ASSERT(can_skip_called_objects.Contains(*g2s2.location()));
-
- // The first group was visited.
- ASSERT(visitor.visited.length() == 2);
- ASSERT(visitor.visited.Contains(*g1s1.location()));
- ASSERT(visitor.visited.Contains(*g1s2.location()));
- ASSERT(info1.has_been_disposed());
- ASSERT(!info2.has_been_disposed());
- }
-
- // Iterate again, don't skip anything.
- {
- ResetCanSkipData();
- TestObjectVisitor visitor;
- global_handles->IterateObjectGroups(&visitor, &CanSkipCallback);
-
- // CanSkipCallback was called for all objects.
- fprintf(stderr, "can skip len %d\n", can_skip_called_objects.length());
- ASSERT(can_skip_called_objects.length() == 1);
- ASSERT(can_skip_called_objects.Contains(*g2s1.location()) ||
- can_skip_called_objects.Contains(*g2s2.location()));
-
- // The second group was visited.
- ASSERT(visitor.visited.length() == 2);
- ASSERT(visitor.visited.Contains(*g2s1.location()));
- ASSERT(visitor.visited.Contains(*g2s2.location()));
- ASSERT(info2.has_been_disposed());
- }
-}
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698