Reviewers: Michael Lippautz,

Description:
[heap] Prevent leakage of GCCallbacksScope outside of heap.

[email protected]

Please review this at https://codereview.chromium.org/1314543014/

Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-remove-alloc-failure-scope

Affected files (+14, -25 lines):
  M src/heap/heap.h
  M src/heap/heap.cc
  M src/heap/heap-inl.h


Index: src/heap/heap-inl.h
diff --git a/src/heap/heap-inl.h b/src/heap/heap-inl.h
index dbb3e95866f9426fed6e213ad9df7c8a855bcb5f..8781685ad4838ce76dc4389fb325b3bc6055da67 100644
--- a/src/heap/heap-inl.h
+++ b/src/heap/heap-inl.h
@@ -758,19 +758,6 @@ AlwaysAllocateScope::~AlwaysAllocateScope() {
 }


-GCCallbacksScope::GCCallbacksScope(Heap* heap) : heap_(heap) {
-  heap_->gc_callbacks_depth_++;
-}
-
-
-GCCallbacksScope::~GCCallbacksScope() { heap_->gc_callbacks_depth_--; }
-
-
-bool GCCallbacksScope::CheckReenter() {
-  return heap_->gc_callbacks_depth_ == 1;
-}
-
-
 void VerifyPointersVisitor::VisitPointers(Object** start, Object** end) {
   for (Object** current = start; current < end; current++) {
     if ((*current)->IsHeapObject()) {
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) {
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index aa08d449970b4f7f89cadcf037feff8dd72a848d..09593c24adc78a7de2d35ab2a7c9cf03c4201da3 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -2430,18 +2430,6 @@ class AlwaysAllocateScope {
 };


-class GCCallbacksScope {
- public:
-  explicit inline GCCallbacksScope(Heap* heap);
-  inline ~GCCallbacksScope();
-
-  inline bool CheckReenter();
-
- private:
-  Heap* heap_;
-};
-
-
 // Visitor class to verify interior pointers in spaces that do not contain
// or care about intergenerational references. All heap object pointers have to // point into the heap to a location that has a map pointer at its first word.


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to