[heap] Prevent leakage of GCCallbacksScope outside of heap.
authormstarzinger <mstarzinger@chromium.org>
Tue, 8 Sep 2015 17:14:12 +0000 (10:14 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 8 Sep 2015 17:14:27 +0000 (17:14 +0000)
R=mlippautz@chromium.org

Review URL: https://codereview.chromium.org/1314543014

Cr-Commit-Position: refs/heads/master@{#30642}

src/heap/heap-inl.h
src/heap/heap.cc
src/heap/heap.h

index dbb3e95..8781685 100644 (file)
@@ -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 cfe4630..cfb93cd 100644 (file)
@@ -749,6 +749,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 9ae12f7..58f7a7b 100644 (file)
@@ -2404,18 +2404,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.