Index: third_party/WebKit/Source/platform/heap/Heap.cpp |
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp |
index 22e5ef818fadfd6d85f53922ff8256e08e2fa5b5..7dd5529466edbef3408790ab41b17e360efa0f3e 100644 |
--- a/third_party/WebKit/Source/platform/heap/Heap.cpp |
+++ b/third_party/WebKit/Source/platform/heap/Heap.cpp |
@@ -36,7 +36,6 @@ |
#include "platform/heap/BlinkGCMemoryDumpProvider.h" |
#include "platform/heap/CallbackStack.h" |
#include "platform/heap/HeapCompact.h" |
-#include "platform/heap/MarkingVisitor.h" |
#include "platform/heap/PageMemory.h" |
#include "platform/heap/PagePool.h" |
#include "platform/heap/SafePoint.h" |
@@ -316,6 +315,30 @@ Address ThreadHeap::checkAndMarkPointer(Visitor* visitor, Address address) { |
return nullptr; |
} |
+#if DCHECK_IS_ON() |
+// To support unit testing of the marking of off-heap root references |
+// into the heap, provide a checkAndMarkPointer() version with an |
+// extra notification argument. |
+Address ThreadHeap::checkAndMarkPointer( |
+ Visitor* visitor, |
+ Address address, |
+ MarkedPointerCallbackForTesting callback) { |
+ DCHECK(ThreadState::current()->isInGC()); |
+ |
+ if (BasePage* page = lookupPageForAddress(address)) { |
+ DCHECK(page->contains(address)); |
+ DCHECK(!page->orphaned()); |
+ DCHECK(!m_heapDoesNotContainCache->lookup(address)); |
+ DCHECK(&visitor->heap() == &page->arena()->getThreadState()->heap()); |
+ page->checkAndMarkPointer(visitor, address, callback); |
+ return address; |
+ } |
+ if (!m_heapDoesNotContainCache->lookup(address)) |
+ m_heapDoesNotContainCache->addEntry(address); |
+ return nullptr; |
+} |
+#endif |
+ |
void ThreadHeap::pushTraceCallback(void* object, TraceCallback callback) { |
ASSERT(ThreadState::current()->isInGC()); |