Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index f1b8c474a81c486a816d500dd88870a336b0c2da..0e954ea059bfe266c1ba56cd7d573c6483cdda68 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -747,6 +747,20 @@ void Heap::PreprocessStackTraces() { |
} |
+class GCCallbacksScope { |
+ public: |
+ explicit GCCallbacksScope(Heap* heap) : heap_(heap) { |
+ heap_->gc_callbacks_depth_++; |
+ } |
+ ~GCCallbacksScope() { heap_->gc_callbacks_depth_--; } |
+ |
+ bool CheckReenter() { return heap_->gc_callbacks_depth_ == 1; } |
+ |
+ private: |
+ Heap* heap_; |
+}; |
+ |
+ |
void Heap::HandleGCRequest() { |
if (incremental_marking()->request_type() == |
IncrementalMarking::COMPLETE_MARKING) { |