| Index: Source/platform/heap/Visitor.h
|
| diff --git a/Source/platform/heap/Visitor.h b/Source/platform/heap/Visitor.h
|
| index 94ca56442140c3618c1db43b080493208ec21f04..8da1800bbc9efd09a245f42671e3e5f97b1c29a2 100644
|
| --- a/Source/platform/heap/Visitor.h
|
| +++ b/Source/platform/heap/Visitor.h
|
| @@ -191,7 +191,7 @@ template<typename T> class TraceTrait<const T> : public TraceTrait<T> { };
|
| // be eagerly traced by default. A class type can opt out by declaring
|
| // a TraceEagerlyTrait<> specialization, mapping the value to 'false'
|
| // (see the WILL_NOT_BE_EAGERLY_TRACED() macro below.)
|
| -#define ENABLE_EAGER_TRACING_BY_DEFAULT 0
|
| +#define ENABLE_EAGER_TRACING_BY_DEFAULT 1
|
|
|
| // DISABLE_ALL_EAGER_TRACING provides the "kill switch" for eager
|
| // tracing; setting it to 1 will disable the use of eager tracing
|
| @@ -264,6 +264,11 @@ struct ObjectAliveTrait {
|
| static bool isHeapObjectAlive(Visitor*, T*);
|
| };
|
|
|
| +enum MarkingMode {
|
| + GlobalMarking,
|
| + ThreadLocalMarking,
|
| +};
|
| +
|
| // Visitor is used to traverse the Blink object graph. Used for the
|
| // marking phase of the mark-sweep garbage collector.
|
| //
|
| @@ -275,6 +280,7 @@ struct ObjectAliveTrait {
|
| // contained pointers and push them on the marking stack.
|
| class PLATFORM_EXPORT Visitor {
|
| public:
|
| + Visitor(MarkingMode mode) : m_mode(mode) {}
|
| virtual ~Visitor() { }
|
|
|
| template<typename T>
|
| @@ -465,7 +471,8 @@ public:
|
| #endif
|
|
|
| virtual bool isMarked(const void*) = 0;
|
| - virtual bool ensureMarked(const void*) = 0;
|
| +
|
| + bool ensureMarked(const void*);
|
|
|
| template<typename T> inline bool isAlive(T* obj)
|
| {
|
| @@ -497,8 +504,8 @@ public:
|
| #define DECLARE_VISITOR_METHODS(Type) \
|
| DEBUG_ONLY(void checkGCInfo(const Type*, const GCInfo*);) \
|
| virtual void mark(const Type*, TraceCallback) = 0; \
|
| - virtual bool isMarked(const Type*) = 0; \
|
| - virtual bool ensureMarked(const Type*) = 0;
|
| + virtual bool isMarked(const Type*) = 0; \
|
| + bool ensureMarked(const Type*);
|
|
|
| FOR_EACH_TYPED_HEAP(DECLARE_VISITOR_METHODS)
|
| #undef DECLARE_VISITOR_METHODS
|
| @@ -511,16 +518,7 @@ public:
|
| }
|
| #endif
|
|
|
| - inline bool canTraceEagerly() const { return m_traceDepth < kMaxEagerTraceDepth; }
|
| - inline void incrementTraceDepth() { m_traceDepth++; }
|
| - inline void decrementTraceDepth() { ASSERT(m_traceDepth > 0); m_traceDepth--; }
|
| -
|
| protected:
|
| - Visitor()
|
| - : m_traceDepth(0)
|
| - {
|
| - }
|
| -
|
| virtual void registerWeakCell(void**, WeakPointerCallback) = 0;
|
| #if ENABLE(GC_PROFILE_MARKING)
|
| void* m_hostObject;
|
| @@ -536,11 +534,7 @@ private:
|
| *cell = 0;
|
| }
|
|
|
| - // The maximum depth of eager, unrolled trace() calls that is
|
| - // considered safe and allowed.
|
| - const int kMaxEagerTraceDepth = 100;
|
| -
|
| - int m_traceDepth;
|
| + MarkingMode m_mode;
|
| };
|
|
|
| // We trace vectors by using the trace trait on each element, which means you
|
| @@ -594,21 +588,9 @@ public:
|
| // If the trait allows it, invoke the trace callback right here on the
|
| // not-yet-marked object.
|
| if (!DISABLE_ALL_EAGER_TRACING && TraceEagerlyTrait<T>::value) {
|
| - // Protect against too deep trace call chains, and the
|
| - // unbounded system stack usage they can bring about.
|
| - //
|
| - // 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());
|
| - if (LIKELY(visitor->canTraceEagerly())) {
|
| - if (visitor->ensureMarked(t)) {
|
| - visitor->incrementTraceDepth();
|
| - TraceTrait<T>::trace(visitor, const_cast<T*>(t));
|
| - visitor->decrementTraceDepth();
|
| - }
|
| - return;
|
| - }
|
| + if (visitor->ensureMarked(t))
|
| + TraceTrait<T>::trace(visitor, const_cast<T*>(t));
|
| + return;
|
| }
|
| visitor->mark(const_cast<T*>(t), &TraceTrait<T>::trace);
|
| }
|
|
|