summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/ConservativeRoots.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/heap/ConservativeRoots.cpp')
-rw-r--r--Source/JavaScriptCore/heap/ConservativeRoots.cpp46
1 files changed, 37 insertions, 9 deletions
diff --git a/Source/JavaScriptCore/heap/ConservativeRoots.cpp b/Source/JavaScriptCore/heap/ConservativeRoots.cpp
index d63faebf3..6b9cbef45 100644
--- a/Source/JavaScriptCore/heap/ConservativeRoots.cpp
+++ b/Source/JavaScriptCore/heap/ConservativeRoots.cpp
@@ -62,11 +62,6 @@ void ConservativeRoots::grow()
m_roots = newRoots;
}
-class DummyMarkHook {
-public:
- void mark(void*) { }
-};
-
template<typename MarkHook>
inline void ConservativeRoots::genericAddPointer(void* p, TinyBloomFilter filter, MarkHook& markHook)
{
@@ -110,15 +105,48 @@ void ConservativeRoots::genericAddSpan(void* begin, void* end, MarkHook& markHoo
genericAddPointer(*it, filter, markHook);
}
+class DummyMarkHook {
+public:
+ void mark(void*) { }
+};
+
void ConservativeRoots::add(void* begin, void* end)
{
- DummyMarkHook hook;
- genericAddSpan(begin, end, hook);
+ DummyMarkHook dummy;
+ genericAddSpan(begin, end, dummy);
}
-void ConservativeRoots::add(void* begin, void* end, DFGCodeBlocks& dfgCodeBlocks)
+void ConservativeRoots::add(void* begin, void* end, JITStubRoutineSet& jitStubRoutines)
+{
+ genericAddSpan(begin, end, jitStubRoutines);
+}
+
+template<typename T, typename U>
+class CompositeMarkHook {
+public:
+ CompositeMarkHook(T& first, U& second)
+ : m_first(first)
+ , m_second(second)
+ {
+ }
+
+ void mark(void* address)
+ {
+ m_first.mark(address);
+ m_second.mark(address);
+ }
+
+private:
+ T& m_first;
+ U& m_second;
+};
+
+void ConservativeRoots::add(
+ void* begin, void* end, JITStubRoutineSet& jitStubRoutines, DFGCodeBlocks& dfgCodeBlocks)
{
- genericAddSpan(begin, end, dfgCodeBlocks);
+ CompositeMarkHook<JITStubRoutineSet, DFGCodeBlocks> markHook(
+ jitStubRoutines, dfgCodeBlocks);
+ genericAddSpan(begin, end, markHook);
}
} // namespace JSC