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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapTest.cpp

Issue 2531973002: Simple BlinkGC heap compaction. (Closed)
Patch Set: Clear unused pages before decommitting Created 4 years 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
Index: third_party/WebKit/Source/platform/heap/HeapTest.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapTest.cpp b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
index 12ed78e42b27758fd3bd73a1d4fcbb08121550cd..88777a9d6ae5c541bb6fccbf362f2a274a8aedda 100644
--- a/third_party/WebKit/Source/platform/heap/HeapTest.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapTest.cpp
@@ -349,6 +349,12 @@ class CountingVisitor : public Visitor {
return true;
}
+ void registerMovingObjectReference(MovableReference*) override {}
+
+ void registerMovingObjectCallback(MovableReference,
+ MovingObjectCallback,
+ void*) override {}
+
size_t count() { return m_count; }
void reset() { m_count = 0; }
@@ -3765,6 +3771,7 @@ TEST(HeapTest, RefCountedGarbageCollectedWithStackPointers) {
pointer1 = object1.get();
pointer2 = object2.get();
void* objects[2] = {object1.get(), object2.get()};
+ ThreadState::GCForbiddenScope gcScope(ThreadState::current());
RefCountedGarbageCollectedVisitor visitor(ThreadState::current(), 2,
objects);
ThreadState::current()->visitPersistents(&visitor);
@@ -3782,6 +3789,7 @@ TEST(HeapTest, RefCountedGarbageCollectedWithStackPointers) {
// At this point, the reference counts of object1 and object2 are 0.
// Only pointer1 and pointer2 keep references to object1 and object2.
void* objects[] = {0};
+ ThreadState::GCForbiddenScope gcScope(ThreadState::current());
RefCountedGarbageCollectedVisitor visitor(ThreadState::current(), 0,
objects);
ThreadState::current()->visitPersistents(&visitor);
@@ -3792,6 +3800,7 @@ TEST(HeapTest, RefCountedGarbageCollectedWithStackPointers) {
Persistent<RefCountedAndGarbageCollected> object1(pointer1);
Persistent<RefCountedAndGarbageCollected2> object2(pointer2);
void* objects[2] = {object1.get(), object2.get()};
+ ThreadState::GCForbiddenScope gcScope(ThreadState::current());
RefCountedGarbageCollectedVisitor visitor(ThreadState::current(), 2,
objects);
ThreadState::current()->visitPersistents(&visitor);
@@ -3955,6 +3964,7 @@ TEST(HeapTest, CheckAndMarkPointer) {
// checkAndMarkPointer tests.
{
TestGCScope scope(BlinkGC::HeapPointersOnStack);
+ ThreadState::GCForbiddenScope gcScope(ThreadState::current());
CountingVisitor visitor(ThreadState::current());
EXPECT_TRUE(scope.allThreadsParked()); // Fail the test if we could not
// park all threads.
@@ -3976,6 +3986,7 @@ TEST(HeapTest, CheckAndMarkPointer) {
clearOutOldGarbage();
{
TestGCScope scope(BlinkGC::HeapPointersOnStack);
+ ThreadState::GCForbiddenScope gcScope(ThreadState::current());
CountingVisitor visitor(ThreadState::current());
EXPECT_TRUE(scope.allThreadsParked());
heap.flushHeapDoesNotContainCache();
@@ -5874,6 +5885,7 @@ class PartObject {
};
TEST(HeapTest, TraceIfNeeded) {
+ ThreadState::GCForbiddenScope scope(ThreadState::current());
CountingVisitor visitor(ThreadState::current());
{

Powered by Google App Engine
This is Rietveld 408576698