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

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

Issue 2531973002: Simple BlinkGC heap compaction. (Closed)
Patch Set: rebased upto r438110 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 aae128a2c35b3414f98d61a8d9b21a739a027f81..1310bac479cbd23cccbd3a017c0696de49d5704d 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; }
@@ -3759,6 +3765,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);
@@ -3776,6 +3783,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);
@@ -3786,6 +3794,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);
@@ -3935,6 +3944,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.
@@ -3956,6 +3966,7 @@ TEST(HeapTest, CheckAndMarkPointer) {
clearOutOldGarbage();
{
TestGCScope scope(BlinkGC::HeapPointersOnStack);
+ ThreadState::GCForbiddenScope gcScope(ThreadState::current());
CountingVisitor visitor(ThreadState::current());
EXPECT_TRUE(scope.allThreadsParked());
heap.flushHeapDoesNotContainCache();
@@ -5854,6 +5865,7 @@ class PartObject {
};
TEST(HeapTest, TraceIfNeeded) {
+ ThreadState::GCForbiddenScope scope(ThreadState::current());
CountingVisitor visitor(ThreadState::current());
{

Powered by Google App Engine
This is Rietveld 408576698