- Revision
- 277346
- Author
- [email protected]
- Date
- 2021-05-11 17:52:09 -0700 (Tue, 11 May 2021)
Log Message
ConservativeRoots triggers page demand on Speedometer
https://bugs.webkit.org/show_bug.cgi?id=225676
Reviewed by Saam Barati.
Use a Vector instead of OSAllocator to avoid mmap() and page fault --
and, like, come on.
Bump default inlineCapacity up to 1024 because we seem to overflow
frequently.
* heap/ConservativeRoots.cpp:
(JSC::ConservativeRoots::ConservativeRoots):
(JSC::ConservativeRoots::~ConservativeRoots):
(JSC::ConservativeRoots::genericAddPointer):
(JSC::ConservativeRoots::grow): Deleted.
* heap/ConservativeRoots.h:
(JSC::ConservativeRoots::roots const):
(JSC::ConservativeRoots::size const): Deleted.
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::append):
* heap/VerifierSlotVisitor.cpp:
(JSC::VerifierSlotVisitor::append):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (277345 => 277346)
--- trunk/Source/_javascript_Core/ChangeLog 2021-05-12 00:46:17 UTC (rev 277345)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-05-12 00:52:09 UTC (rev 277346)
@@ -1,3 +1,29 @@
+2021-05-11 Geoffrey Garen <[email protected]>
+
+ ConservativeRoots triggers page demand on Speedometer
+ https://bugs.webkit.org/show_bug.cgi?id=225676
+
+ Reviewed by Saam Barati.
+
+ Use a Vector instead of OSAllocator to avoid mmap() and page fault --
+ and, like, come on.
+
+ Bump default inlineCapacity up to 1024 because we seem to overflow
+ frequently.
+
+ * heap/ConservativeRoots.cpp:
+ (JSC::ConservativeRoots::ConservativeRoots):
+ (JSC::ConservativeRoots::~ConservativeRoots):
+ (JSC::ConservativeRoots::genericAddPointer):
+ (JSC::ConservativeRoots::grow): Deleted.
+ * heap/ConservativeRoots.h:
+ (JSC::ConservativeRoots::roots const):
+ (JSC::ConservativeRoots::size const): Deleted.
+ * heap/SlotVisitor.cpp:
+ (JSC::SlotVisitor::append):
+ * heap/VerifierSlotVisitor.cpp:
+ (JSC::VerifierSlotVisitor::append):
+
2021-05-10 Filip Pizlo <[email protected]>
Tune number of threads for AS
Modified: trunk/Source/_javascript_Core/heap/ConservativeRoots.cpp (277345 => 277346)
--- trunk/Source/_javascript_Core/heap/ConservativeRoots.cpp 2021-05-12 00:46:17 UTC (rev 277345)
+++ trunk/Source/_javascript_Core/heap/ConservativeRoots.cpp 2021-05-12 00:52:09 UTC (rev 277346)
@@ -38,30 +38,14 @@
namespace JSC {
ConservativeRoots::ConservativeRoots(Heap& heap)
- : m_roots(m_inlineRoots)
- , m_size(0)
- , m_capacity(inlineCapacity)
- , m_heap(heap)
+ : m_heap(heap)
{
}
ConservativeRoots::~ConservativeRoots()
{
- if (m_roots != m_inlineRoots)
- OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(HeapCell*));
}
-void ConservativeRoots::grow()
-{
- size_t newCapacity = m_capacity == inlineCapacity ? nonInlineCapacity : m_capacity * 2;
- HeapCell** newRoots = static_cast<HeapCell**>(OSAllocator::reserveAndCommit(newCapacity * sizeof(HeapCell*)));
- memcpy(newRoots, m_roots, m_size * sizeof(HeapCell*));
- if (m_roots != m_inlineRoots)
- OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(HeapCell*));
- m_capacity = newCapacity;
- m_roots = newRoots;
-}
-
template<typename MarkHook>
inline void ConservativeRoots::genericAddPointer(void* p, HeapVersion markingVersion, HeapVersion newlyAllocatedVersion, TinyBloomFilter filter, MarkHook& markHook)
{
@@ -74,10 +58,7 @@
if (isJSCellKind(cellKind))
markHook.markKnownJSCell(static_cast<JSCell*>(p));
- if (m_size == m_capacity)
- grow();
-
- m_roots[m_size++] = bitwise_cast<HeapCell*>(p);
+ m_roots.append(bitwise_cast<HeapCell*>(p));
});
}
Modified: trunk/Source/_javascript_Core/heap/ConservativeRoots.h (277345 => 277346)
--- trunk/Source/_javascript_Core/heap/ConservativeRoots.h 2021-05-12 00:46:17 UTC (rev 277345)
+++ trunk/Source/_javascript_Core/heap/ConservativeRoots.h 2021-05-12 00:52:09 UTC (rev 277346)
@@ -34,6 +34,8 @@
class JITStubRoutineSet;
class ConservativeRoots {
+ static constexpr size_t inlineCapacity = 1024;
+
public:
ConservativeRoots(Heap&);
~ConservativeRoots();
@@ -41,13 +43,9 @@
void add(void* begin, void* end);
void add(void* begin, void* end, JITStubRoutineSet&, CodeBlockSet&);
- size_t size() const;
- HeapCell** roots() const;
+ const Vector<HeapCell*, inlineCapacity>& roots() const { return m_roots; };
private:
- static constexpr size_t inlineCapacity = 128;
- static constexpr size_t nonInlineCapacity = 8192 / sizeof(HeapCell*);
-
template<typename MarkHook>
void genericAddPointer(void*, HeapVersion markingVersion, HeapVersion newlyAllocatedVersion, TinyBloomFilter, MarkHook&);
@@ -54,23 +52,8 @@
template<typename MarkHook>
void genericAddSpan(void*, void* end, MarkHook&);
- void grow();
-
- HeapCell** m_roots;
- size_t m_size;
- size_t m_capacity;
Heap& m_heap;
- HeapCell* m_inlineRoots[inlineCapacity];
+ Vector<HeapCell*, inlineCapacity> m_roots;
};
-inline size_t ConservativeRoots::size() const
-{
- return m_size;
-}
-
-inline HeapCell** ConservativeRoots::roots() const
-{
- return m_roots;
-}
-
} // namespace JSC
Modified: trunk/Source/_javascript_Core/heap/SlotVisitor.cpp (277345 => 277346)
--- trunk/Source/_javascript_Core/heap/SlotVisitor.cpp 2021-05-12 00:46:17 UTC (rev 277345)
+++ trunk/Source/_javascript_Core/heap/SlotVisitor.cpp 2021-05-12 00:52:09 UTC (rev 277346)
@@ -129,10 +129,8 @@
void SlotVisitor::append(const ConservativeRoots& conservativeRoots)
{
- HeapCell** roots = conservativeRoots.roots();
- size_t size = conservativeRoots.size();
- for (size_t i = 0; i < size; ++i)
- appendJSCellOrAuxiliary(roots[i]);
+ for (auto root : conservativeRoots.roots())
+ appendJSCellOrAuxiliary(root);
}
void SlotVisitor::appendJSCellOrAuxiliary(HeapCell* heapCell)
Modified: trunk/Source/_javascript_Core/heap/VerifierSlotVisitor.cpp (277345 => 277346)
--- trunk/Source/_javascript_Core/heap/VerifierSlotVisitor.cpp 2021-05-12 00:46:17 UTC (rev 277345)
+++ trunk/Source/_javascript_Core/heap/VerifierSlotVisitor.cpp 2021-05-12 00:52:09 UTC (rev 277346)
@@ -148,10 +148,8 @@
}
};
- HeapCell** roots = conservativeRoots.roots();
- size_t size = conservativeRoots.size();
- for (size_t i = 0; i < size; ++i)
- appendJSCellOrAuxiliary(roots[i]);
+ for (auto root : conservativeRoots.roots())
+ appendJSCellOrAuxiliary(root);
}
void VerifierSlotVisitor::appendToMarkStack(JSCell* cell)