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

Unified Diff: Source/platform/heap/Visitor.h

Issue 818253005: Oilpan: Query stack frame register instead of manual bookkeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move preGC Created 5 years, 11 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 | « Source/platform/heap/StackFrameDepth.cpp ('k') | Source/platform/heap/Visitor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Visitor.h
diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
index e4c51f7a0ba6cd65304fec4b5a09b65c52f2299f..93f408b602712a5f0497967e74833d8749cb455e 100644
--- a/Source/platform/heap/Visitor.h
+++ b/Source/platform/heap/Visitor.h
@@ -32,6 +32,7 @@
#define Visitor_h
#include "platform/PlatformExport.h"
+#include "platform/heap/StackFrameDepth.h"
#include "platform/heap/ThreadState.h"
#include "wtf/Assertions.h"
#include "wtf/Atomics.h"
@@ -627,9 +628,18 @@ public:
}
#endif
- inline bool canTraceEagerly() const { return m_traceDepth < kMaxEagerTraceDepth; }
- inline void incrementTraceDepth() { m_traceDepth++; }
- inline void decrementTraceDepth() { ASSERT(m_traceDepth > 0); m_traceDepth--; }
+ inline static bool canTraceEagerly()
+ {
+ ASSERT(m_stackFrameDepth);
+ return m_stackFrameDepth->isSafeToRecurse();
+ }
+
+ inline static void configureEagerTraceLimit()
+ {
+ if (!m_stackFrameDepth)
+ m_stackFrameDepth = new StackFrameDepth;
+ m_stackFrameDepth->configureLimit();
+ }
inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor; }
@@ -640,9 +650,7 @@ public:
protected:
explicit Visitor(VisitorType type)
: m_isGlobalMarkingVisitor(type == GlobalMarkingVisitorType)
- {
- m_traceDepth = 0;
- }
+ { }
virtual void registerWeakCellWithCallback(void**, WeakPointerCallback) = 0;
#if ENABLE(GC_PROFILE_MARKING)
@@ -661,12 +669,8 @@ protected:
private:
static Visitor* fromHelper(VisitorHelper<Visitor>* helper) { return static_cast<Visitor*>(helper); }
+ static StackFrameDepth* m_stackFrameDepth;
- // The maximum depth of eager, unrolled trace() calls that is
- // considered safe and allowed.
- const int kMaxEagerTraceDepth = 100;
-
- static int m_traceDepth;
bool m_isGlobalMarkingVisitor;
};
@@ -730,12 +734,13 @@ public:
// Assert against deep stacks so as to flush them out,
// but test and appropriately handle them should they occur
// in release builds.
- ASSERT(visitor->canTraceEagerly());
+ // FIXME: visitor->isMarked(t) exception is to allow empty trace()
+ // calls from HashTable weak processing. Remove the condition once
+ // it is refactored.
+ ASSERT(visitor->canTraceEagerly() || visitor->isMarked(t));
if (LIKELY(visitor->canTraceEagerly())) {
if (visitor->ensureMarked(t)) {
- visitor->incrementTraceDepth();
TraceTrait<T>::trace(visitor, const_cast<T*>(t));
- visitor->decrementTraceDepth();
}
return;
}
« no previous file with comments | « Source/platform/heap/StackFrameDepth.cpp ('k') | Source/platform/heap/Visitor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698