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

Unified Diff: src/heap/heap.h

Issue 2371733002: Introduce EmbedderReachableReferenceReporter (Closed)
Patch Set: Fix UsingEmbedderHeapTracer Created 4 years, 3 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 | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 55914d66c0169f8d49c123b4aacfae65dd123742..b67f7c7a21d271d4775b04b4513a9f57ae263062 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -337,6 +337,7 @@ class Scavenger;
class ScavengeJob;
class Space;
class StoreBuffer;
+class TracePossibleWrapperReporter;
class WeakObjectRetainer;
typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to);
@@ -1204,12 +1205,26 @@ class Heap {
void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
- bool UsingEmbedderHeapTracer();
+ bool UsingEmbedderHeapTracer() { return embedder_heap_tracer() != nullptr; }
void TracePossibleWrapper(JSObject* js_object);
void RegisterExternallyReferencedObject(Object** object);
+ void RegisterWrappersWithEmbedderHeapTracer();
+
+ // In order to avoid running out of memory we force tracing wrappers if there
+ // are too many of them.
+ bool RequiresImmediateWrapperProcessing();
+
+ EmbedderHeapTracer* embedder_heap_tracer() { return embedder_heap_tracer_; }
+
+ EmbedderReachableReferenceReporter* embedder_reachable_reference_reporter() {
+ return embedder_reference_reporter_;
+ }
+
+ size_t wrappers_to_trace() { return wrappers_to_trace_.size(); }
+
// ===========================================================================
// External string table API. ================================================
// ===========================================================================
@@ -2321,6 +2336,10 @@ class Heap {
// The depth of HeapIterator nestings.
int heap_iterator_depth_;
+ EmbedderHeapTracer* embedder_heap_tracer_;
+ EmbedderReachableReferenceReporter* embedder_reference_reporter_;
+ std::vector<std::pair<void*, void*>> wrappers_to_trace_;
+
// Used for testing purposes.
bool force_oom_;
@@ -2644,6 +2663,18 @@ class AllocationObserver {
DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
};
+class TracePossibleWrapperReporter : public EmbedderReachableReferenceReporter {
+ public:
+ explicit TracePossibleWrapperReporter(Heap* heap) : heap_(heap) {}
+ void ReportExternalReference(Value* object) override {
+ heap_->RegisterExternallyReferencedObject(
+ reinterpret_cast<Object**>(object));
+ }
+
+ private:
+ Heap* heap_;
+};
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698