| Index: Source/platform/heap/Visitor.h
|
| diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
|
| index da05ed36430dc711342b43f719fb60f3489f2509..b1de94998b1a039f4e9ce7b05625df5804539fbf 100644
|
| --- a/Source/platform/heap/Visitor.h
|
| +++ b/Source/platform/heap/Visitor.h
|
| @@ -32,7 +32,6 @@
|
| #define Visitor_h
|
|
|
| #include "platform/PlatformExport.h"
|
| -#include "platform/heap/StackFrameDepth.h"
|
| #include "platform/heap/ThreadState.h"
|
| #include "wtf/Assertions.h"
|
| #include "wtf/Deque.h"
|
| @@ -613,25 +612,18 @@
|
| }
|
| #endif
|
|
|
| - inline bool canTraceEagerly() const
|
| - {
|
| - ASSERT(m_stackFrameDepth);
|
| - return m_stackFrameDepth->isSafeToRecurse();
|
| - }
|
| -
|
| - inline void configureEagerTraceLimit()
|
| - {
|
| - if (!m_stackFrameDepth)
|
| - m_stackFrameDepth = new StackFrameDepth;
|
| - m_stackFrameDepth->configureLimit();
|
| - }
|
| + inline bool canTraceEagerly() const { return m_traceDepth < kMaxEagerTraceDepth; }
|
| + inline void incrementTraceDepth() { m_traceDepth++; }
|
| + inline void decrementTraceDepth() { ASSERT(m_traceDepth > 0); m_traceDepth--; }
|
|
|
| inline bool isGlobalMarkingVisitor() const { return m_isGlobalMarkingVisitor; }
|
|
|
| protected:
|
| explicit Visitor(VisitorType type)
|
| : m_isGlobalMarkingVisitor(type == GlobalMarkingVisitorType)
|
| - { }
|
| + {
|
| + m_traceDepth = 0;
|
| + }
|
|
|
| virtual void registerWeakCellWithCallback(void**, WeakPointerCallback) = 0;
|
| #if ENABLE(GC_PROFILE_MARKING)
|
| @@ -646,8 +638,12 @@
|
|
|
| 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;
|
| };
|
|
|
| @@ -714,7 +710,9 @@
|
| ASSERT(visitor->canTraceEagerly());
|
| if (LIKELY(visitor->canTraceEagerly())) {
|
| if (visitor->ensureMarked(t)) {
|
| + visitor->incrementTraceDepth();
|
| TraceTrait<T>::trace(visitor, const_cast<T*>(t));
|
| + visitor->decrementTraceDepth();
|
| }
|
| return;
|
| }
|
|
|