Commit 0faceaec authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[heap] Prevent leakage of GCCallbacksScope outside of heap.

R=mlippautz@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#30642}
parent 057514d3
......@@ -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()) {
......
......@@ -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) {
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment