<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[265416] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/265416">265416</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2020-08-09 04:49:11 -0700 (Sun, 09 Aug 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, reverting <a href="http://trac.webkit.org/projects/webkit/changeset/263195">r263195</a>, <a href="http://trac.webkit.org/projects/webkit/changeset/263252">r263252</a>, and <a href="http://trac.webkit.org/projects/webkit/changeset/265394">r265394</a>.
https://bugs.webkit.org/show_bug.cgi?id=215312

Revert all related GC Bitmap changes because some of perf is
not fully recovered

Reverted changesets:

"Replace JSC::FreeList linked list with a Bitmap."
https://bugs.webkit.org/show_bug.cgi?id=213071
https://trac.webkit.org/changeset/263195

"Unify Bitmap math loops in
MarkedBlock::Handle::specializedSweep()."
https://bugs.webkit.org/show_bug.cgi?id=213345
https://trac.webkit.org/changeset/263252

"[JSC] Disable ENABLE_BITMAP_FREELIST"
https://bugs.webkit.org/show_bug.cgi?id=215285
https://trac.webkit.org/changeset/265394</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapFreeListcpp">trunk/Source/JavaScriptCore/heap/FreeList.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapFreeListh">trunk/Source/JavaScriptCore/heap/FreeList.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapFreeListInlinesh">trunk/Source/JavaScriptCore/heap/FreeListInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapLocalAllocatorcpp">trunk/Source/JavaScriptCore/heap/LocalAllocator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedBlockh">trunk/Source/JavaScriptCore/heap/MarkedBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreheapMarkedBlockInlinesh">trunk/Source/JavaScriptCore/heap/MarkedBlockInlines.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitAssemblyHelperscpp">trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitAssemblyHelpersh">trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfBitmaph">trunk/Source/WTF/wtf/Bitmap.h</a></li>
<li><a href="#trunkSourceWTFwtfMathExtrash">trunk/Source/WTF/wtf/MathExtras.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/ChangeLog       2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2020-08-09  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, reverting r263195, r263252, and r265394.
+        https://bugs.webkit.org/show_bug.cgi?id=215312
+
+        Revert all related GC Bitmap changes because some of perf is
+        not fully recovered
+
+        Reverted changesets:
+
+        "Replace JSC::FreeList linked list with a Bitmap."
+        https://bugs.webkit.org/show_bug.cgi?id=213071
+        https://trac.webkit.org/changeset/263195
+
+        "Unify Bitmap math loops in
+        MarkedBlock::Handle::specializedSweep()."
+        https://bugs.webkit.org/show_bug.cgi?id=213345
+        https://trac.webkit.org/changeset/263252
+
+        "[JSC] Disable ENABLE_BITMAP_FREELIST"
+        https://bugs.webkit.org/show_bug.cgi?id=215285
+        https://trac.webkit.org/changeset/265394
+
</ins><span class="cx"> 2020-08-08  Yusuke Suzuki  <ysuzuki@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [JSC] Speculate children first in DFG NewArray
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp      2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp 2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -15204,14 +15204,7 @@
</span><span class="cx">             patchpoint->numGPScratchRegisters++;
</span><span class="cx">         else
</span><span class="cx">             patchpoint->appendSomeRegisterWithClobber(allocator);
</span><del>-#if ENABLE(BITMAP_FREELIST)
-        constexpr unsigned scratchRegistersNeeded = 3;
-        constexpr unsigned allocatorScratch = 3;
-#else
-        constexpr unsigned scratchRegistersNeeded = 1;
-        constexpr unsigned allocatorScratch = 1;
-#endif
-        patchpoint->numGPScratchRegisters += scratchRegistersNeeded;
</del><ins>+        patchpoint->numGPScratchRegisters++;
</ins><span class="cx">         patchpoint->resultConstraints = { ValueRep::SomeEarlyRegister };
</span><span class="cx">         
</span><span class="cx">         m_out.appendSuccessor(usually(continuation));
</span><span class="lines">@@ -15224,7 +15217,7 @@
</span><span class="cx">                 
</span><span class="cx">                 GPRReg allocatorGPR;
</span><span class="cx">                 if (actualAllocator.isConstant())
</span><del>-                    allocatorGPR = params.gpScratch(allocatorScratch);
</del><ins>+                    allocatorGPR = params.gpScratch(1);
</ins><span class="cx">                 else
</span><span class="cx">                     allocatorGPR = params[1].gpr();
</span><span class="cx">                 
</span><span class="lines">@@ -15236,11 +15229,7 @@
</span><span class="cx">                 // all of the compiler tiers.
</span><span class="cx">                 jit.emitAllocateWithNonNullAllocator(
</span><span class="cx">                     params[0].gpr(), actualAllocator, allocatorGPR, params.gpScratch(0),
</span><del>-                    jumpToSlowPath
-#if ENABLE(BITMAP_FREELIST)
-                    , params.gpScratch(1), params.gpScratch(2)
-#endif
-                    );
</del><ins>+                    jumpToSlowPath);
</ins><span class="cx">                 
</span><span class="cx">                 CCallHelpers::Jump jumpToSuccess;
</span><span class="cx">                 if (!params.fallsThroughToSuccessor(0))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapFreeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/FreeList.cpp (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/FreeList.cpp    2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/heap/FreeList.cpp       2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -39,48 +39,13 @@
</span><span class="cx"> 
</span><span class="cx"> void FreeList::clear()
</span><span class="cx"> {
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    m_currentRowBitmap = 0;
-    m_currentRowIndex = 0;
-#else
</del><span class="cx">     m_scrambledHead = 0;
</span><span class="cx">     m_secret = 0;
</span><del>-#endif
</del><span class="cx">     m_payloadEnd = nullptr;
</span><span class="cx">     m_remaining = 0;
</span><span class="cx">     m_originalSize = 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(BITMAP_FREELIST)
-
-void FreeList::initializeAtomsBitmap(MarkedBlock::Handle* block, AtomsBitmap& freeAtoms, unsigned bytes)
-{
-#if ASSERT_ENABLED
-    m_markedBlock = block;
-#endif
-    ASSERT_UNUSED(freeAtoms, &freeAtoms == &m_bitmap);
-    // m_bitmap has already been filled in by MarkedBlock::Handle::specializedSweep().
-
-    m_currentRowBitmap = 0;
-    size_t rowIndex = AtomsBitmap::numberOfWords;
-    while (rowIndex--) {
-        auto rowBitmap = m_bitmap.wordAt(rowIndex);
-        if (rowBitmap) {
-            m_currentRowBitmap = rowBitmap;
-            break;
-        }
-    }
-    ASSERT(m_currentRowBitmap || m_bitmap.isEmpty());
-    m_currentRowIndex = m_currentRowBitmap ? rowIndex : 0;
-
-    size_t firstAtomInRow = m_currentRowIndex * atomsPerRow;
-    m_currentMarkedBlockRowAddress = bitwise_cast<Atom*>(block->atomAt(firstAtomInRow));
-    m_originalSize = bytes;
-}
-
-#else
-// Linked List implementation.
-
</del><span class="cx"> void FreeList::initializeList(FreeCell* head, uintptr_t secret, unsigned bytes)
</span><span class="cx"> {
</span><span class="cx">     // It's *slightly* more optimal to use a scrambled head. It saves a register on the fast path.
</span><span class="lines">@@ -91,23 +56,16 @@
</span><span class="cx">     m_originalSize = bytes;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif // ENABLE(BITMAP_FREELIST)
-
</del><span class="cx"> void FreeList::initializeBump(char* payloadEnd, unsigned remaining)
</span><span class="cx"> {
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    m_currentRowBitmap = 0;
-    m_currentRowIndex = 0;
-#else
</del><span class="cx">     m_scrambledHead = 0;
</span><span class="cx">     m_secret = 0;
</span><del>-#endif
</del><span class="cx">     m_payloadEnd = payloadEnd;
</span><span class="cx">     m_remaining = remaining;
</span><span class="cx">     m_originalSize = remaining;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FreeList::contains(HeapCell* target, MarkedBlock::Handle* currentBlock) const
</del><ins>+bool FreeList::contains(HeapCell* target) const
</ins><span class="cx"> {
</span><span class="cx">     if (m_remaining) {
</span><span class="cx">         const void* start = (m_payloadEnd - m_remaining);
</span><span class="lines">@@ -115,31 +73,6 @@
</span><span class="cx">         return (start <= target) && (target < end);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    if (bitmapIsEmpty())
-        return false;
-
-    // currentBlock may be null if the allocator has been reset (and therefore,
-    // the FreeList cleared. Hence, we should only check this assertion after
-    // we check if the FreeList bitmap is empty above.
-    ASSERT(m_markedBlock == currentBlock);
-    if (!currentBlock->contains(target))
-        return false;
-
-    unsigned atomNumber = currentBlock->block().atomNumber(target);
-    unsigned rowIndex = atomNumber / atomsPerRow;
-    if (rowIndex > m_currentRowIndex)
-        return false;
-    if (rowIndex == m_currentRowIndex) {
-        constexpr AtomsBitmap::Word one = 1;
-        unsigned firstAtomInRow = rowIndex * atomsPerRow;
-        unsigned atomIndexInRow = atomNumber - firstAtomInRow;
-        return m_currentRowBitmap & (one << atomIndexInRow);
-    }
-    return m_bitmap.get(atomNumber);
-
-#else
-    UNUSED_PARAM(currentBlock);
</del><span class="cx">     FreeCell* candidate = head();
</span><span class="cx">     while (candidate) {
</span><span class="cx">         if (bitwise_cast<HeapCell*>(candidate) == target)
</span><span class="lines">@@ -146,20 +79,13 @@
</span><span class="cx">             return true;
</span><span class="cx">         candidate = candidate->next(m_secret);
</span><span class="cx">     }
</span><ins>+
</ins><span class="cx">     return false;
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FreeList::dump(PrintStream& out) const
</span><span class="cx"> {
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    if (m_remaining)
-        out.print("{payloadEnd = ", RawPointer(m_payloadEnd), ", remaining = ", m_remaining, ", originalSize = ", m_originalSize, "}");
-    else
-        out.print("{currentRowBitmap = ", m_currentRowBitmap, ", currentRowIndex = ", m_currentRowIndex, ", originalSize = ", m_originalSize, "}");
-#else
</del><span class="cx">     out.print("{head = ", RawPointer(head()), ", secret = ", m_secret, ", payloadEnd = ", RawPointer(m_payloadEnd), ", remaining = ", m_remaining, ", originalSize = ", m_originalSize, "}");
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapFreeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/FreeList.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/FreeList.h      2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/heap/FreeList.h 2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -25,25 +25,13 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include "MarkedBlock.h"
</del><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/PrintStream.h>
</span><del>-#include <wtf/StdIntExtras.h>
</del><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class HeapCell;
</span><span class="cx"> 
</span><del>-// Currently it is disabled because of Speedometer2 regression.
-// FIXME: We should attempt to enable it again or remove the code.
-// https://bugs.webkit.org/show_bug.cgi?id=215284
-#if CPU(X86_64)
-#define ENABLE_BITMAP_FREELIST 0
-#else
-#define ENABLE_BITMAP_FREELIST 0
-#endif
-
-#if !ENABLE(BITMAP_FREELIST)
</del><span class="cx"> struct FreeCell {
</span><span class="cx">     static uintptr_t scramble(FreeCell* cell, uintptr_t secret)
</span><span class="cx">     {
</span><span class="lines">@@ -70,7 +58,6 @@
</span><span class="cx">     uint64_t preservedBitsForCrashAnalysis;
</span><span class="cx">     uintptr_t scrambledNext;
</span><span class="cx"> };
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> class FreeList {
</span><span class="cx"> public:
</span><span class="lines">@@ -79,14 +66,16 @@
</span><span class="cx">     
</span><span class="cx">     void clear();
</span><span class="cx">     
</span><ins>+    JS_EXPORT_PRIVATE void initializeList(FreeCell* head, uintptr_t secret, unsigned bytes);
</ins><span class="cx">     JS_EXPORT_PRIVATE void initializeBump(char* payloadEnd, unsigned remaining);
</span><span class="cx">     
</span><ins>+    bool allocationWillFail() const { return !head() && !m_remaining; }
</ins><span class="cx">     bool allocationWillSucceed() const { return !allocationWillFail(); }
</span><span class="cx">     
</span><span class="cx">     template<typename Func>
</span><span class="cx">     HeapCell* allocate(const Func& slowPath);
</span><span class="cx">     
</span><del>-    bool contains(HeapCell*, MarkedBlock::Handle* currentBlock) const;
</del><ins>+    bool contains(HeapCell*) const;
</ins><span class="cx">     
</span><span class="cx">     template<typename Func>
</span><span class="cx">     void forEach(const Func&) const;
</span><span class="lines">@@ -93,47 +82,11 @@
</span><span class="cx">     
</span><span class="cx">     unsigned originalSize() const { return m_originalSize; }
</span><span class="cx"> 
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    using Atom = MarkedBlock::Atom;
-    using AtomsBitmap = MarkedBlock::AtomsBitmap;
-
-    static constexpr size_t atomsPerRow = AtomsBitmap::bitsInWord;
-    static constexpr size_t atomsRowBytes = atomsPerRow * sizeof(Atom);
-    static constexpr unsigned atomSizeShift = WTF::log2Constexpr(sizeof(Atom));
-    static_assert((static_cast<size_t>(1) << atomSizeShift) == sizeof(Atom));
-
-    JS_EXPORT_PRIVATE void initializeAtomsBitmap(MarkedBlock::Handle*, AtomsBitmap& freeAtoms, unsigned bytes);
-
-    bool bitmapIsEmpty() const
-    {
-        // Remember, we don't actually clear the bits in m_bitmap as we allocate
-        // the atoms. Instead, m_currentRowBitmap and m_currentRowIndex tells us
-        // if there are atoms still available for allocation. See comment blob below
-        // at the declaration of m_currentRowIndex for more details.
-        return !m_currentRowBitmap && !m_currentRowIndex;
-    }
-    bool allocationWillFail() const { return bitmapIsEmpty() && !m_remaining; }
-
-    static ptrdiff_t offsetOfCurrentRowBitmap() { return OBJECT_OFFSETOF(FreeList, m_currentRowBitmap); }
-
-    // We're deliberately returning the address of 1 word before m_bitmap so that
-    // we can schedule instructions better i.e. to do a load before decrementing the
-    // row index.
-    static ptrdiff_t offsetOfBitmapRowsMinusOne() { return OBJECT_OFFSETOF(FreeList, m_bitmap) - sizeof(AtomsBitmap::Word); }
-
-    static ptrdiff_t offsetOfCurrentRowIndex() { return OBJECT_OFFSETOF(FreeList, m_currentRowIndex); }
-    static ptrdiff_t offsetOfCurrentMarkedBlockRowAddress() { return OBJECT_OFFSETOF(FreeList, m_currentMarkedBlockRowAddress); }
-#else
-    JS_EXPORT_PRIVATE void initializeList(FreeCell* head, uintptr_t secret, unsigned bytes);
-
-    bool allocationWillFail() const { return !head() && !m_remaining; }
-
</del><span class="cx">     static ptrdiff_t offsetOfScrambledHead() { return OBJECT_OFFSETOF(FreeList, m_scrambledHead); }
</span><span class="cx">     static ptrdiff_t offsetOfSecret() { return OBJECT_OFFSETOF(FreeList, m_secret); }
</span><del>-#endif
-
</del><span class="cx">     static ptrdiff_t offsetOfPayloadEnd() { return OBJECT_OFFSETOF(FreeList, m_payloadEnd); }
</span><span class="cx">     static ptrdiff_t offsetOfRemaining() { return OBJECT_OFFSETOF(FreeList, m_remaining); }
</span><ins>+    static ptrdiff_t offsetOfOriginalSize() { return OBJECT_OFFSETOF(FreeList, m_originalSize); }
</ins><span class="cx">     static ptrdiff_t offsetOfCellSize() { return OBJECT_OFFSETOF(FreeList, m_cellSize); }
</span><span class="cx">     
</span><span class="cx">     JS_EXPORT_PRIVATE void dump(PrintStream&) const;
</span><span class="lines">@@ -141,74 +94,14 @@
</span><span class="cx">     unsigned cellSize() const { return m_cellSize; }
</span><span class="cx">     
</span><span class="cx"> private:
</span><del>-
-#if ENABLE(BITMAP_FREELIST)
-    AtomsBitmap& atomsBitmap() { return m_bitmap; }
-    AtomsBitmap::Word* bitmapRowsMinusOne() const
-    {
-        // See comment about offsetOfBitmapRowsMinusOne().
-        return bitwise_cast<AtomsBitmap::Word*>(&m_bitmap) - 1;
-    }
-
-    // This allocation algorithm thinks of the MarkedBlock as consisting of rows
-    // of atoms, where the number of atoms in a row equals the number of bits in
-    // a AtomsBitmap::Word. On 64-bit CPUs, this would be 64.
-    //
-    // We will start allocating from the last (highest numbered) row down to the
-    // first (row 0). As we allocate, we will only update m_currentRowIndex and
-    // m_currentRowBitmap. m_bitmap will not be updated. This is so in oder to
-    // reduce the number of instructions executed during an allocation.
-    //
-    // When m_currentRowIndex points to N, the AtomsBitmap::Word for row N in
-    // m_bitmap will have been copied into m_currentRowBitmap. This is the row
-    // that we will be allocating from until the row is exhausted.
-    //
-    // This is how we know whether an atom is available for allocation or not:
-    // 1. Atoms in any rows above m_currentRowIndex are guaranteed to be
-    //    allocated already (because we allocate downwards), and hence, are not
-    //    available.
-    // 2. For row m_currentRowIndex, m_currentRowBitmap is the source of truth
-    //    on which atoms in the row are available for allocation.
-    // 3. For rows below m_currentRowIndex, m_bitmap is the source of truth on
-    //    which atoms are available for allocation.
-    //
-    // When m_currentRowIndex reaches 0, the info in m_bitmap is completely
-    // obsoleted, and m_currentRowBitmap holds the availability info for row 0.
-    // When both m_currentRowIndex and m_currentRowBitmap are 0, then we have
-    // completely exhausted the block and no more atoms are available for
-    // allocation.
-
-    AtomsBitmap::Word m_currentRowBitmap { 0 };
-    unsigned m_currentRowIndex { 0 };
-    unsigned m_originalSize { 0 };
-
-#else
</del><span class="cx">     FreeCell* head() const { return FreeCell::descramble(m_scrambledHead, m_secret); }
</span><del>-
</del><ins>+    
</ins><span class="cx">     uintptr_t m_scrambledHead { 0 };
</span><span class="cx">     uintptr_t m_secret { 0 };
</span><del>-#endif
-
-    union {
-        char* m_payloadEnd { nullptr };
-#if ENABLE(BITMAP_FREELIST)
-        Atom* m_currentMarkedBlockRowAddress;
-#endif
-    };
</del><ins>+    char* m_payloadEnd { nullptr };
</ins><span class="cx">     unsigned m_remaining { 0 };
</span><ins>+    unsigned m_originalSize { 0 };
</ins><span class="cx">     unsigned m_cellSize { 0 };
</span><del>-
-#if ENABLE(BITMAP_FREELIST)
-    AtomsBitmap m_bitmap;
-#else
-    unsigned m_originalSize { 0 };
-#endif
-
-#if ASSERT_ENABLED
-    MarkedBlock::Handle* m_markedBlock { nullptr };
-#endif
-
-    friend class MarkedBlock;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapFreeListInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/FreeListInlines.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/FreeListInlines.h       2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/heap/FreeListInlines.h  2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2017-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2017 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "FreeList.h"
</span><del>-#include <wtf/MathExtras.h>
</del><ins>+#include "MarkedBlock.h"
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -40,39 +40,7 @@
</span><span class="cx">         m_remaining = remaining;
</span><span class="cx">         return bitwise_cast<HeapCell*>(m_payloadEnd - remaining - cellSize);
</span><span class="cx">     }
</span><del>-
-#if ENABLE(BITMAP_FREELIST)
-    AtomsBitmap::Word rowBitmap = m_currentRowBitmap;
-    do {
-        if (rowBitmap) {
-            constexpr AtomsBitmap::Word one = 1;
-            unsigned atomIndexInRow = ctz(rowBitmap);
-            auto* cell = bitwise_cast<HeapCell*>(&m_currentMarkedBlockRowAddress[atomIndexInRow]);
-            rowBitmap &= ~(one << atomIndexInRow);
-            m_currentRowBitmap = rowBitmap;
-            return cell;
-        }
-
-        unsigned rowIndex = m_currentRowIndex;
-        auto* rowAddress = m_currentMarkedBlockRowAddress;
-        while (rowIndex) {
-            // We load before decrementing rowIndex because bitmapRowsMinusOne() points
-            // to 1 word before m_bitmap. See comments about offsetOfBitmapRowsMinusOne()
-            // for why we do this.
-            rowBitmap = bitmapRowsMinusOne()[rowIndex--];
-            rowAddress -= atomsPerRow;
-            if (rowBitmap)
-                break;
-        }
-        m_currentMarkedBlockRowAddress = rowAddress;
-        m_currentRowIndex = rowIndex;
-    } while (rowBitmap);
-
-    m_currentRowBitmap = rowBitmap;
-    ASSERT(bitmapIsEmpty());
-    return slowPath();
-
-#else // !ENABLE(BITMAP_FREELIST)
</del><ins>+    
</ins><span class="cx">     FreeCell* result = head();
</span><span class="cx">     if (UNLIKELY(!result))
</span><span class="cx">         return slowPath();
</span><span class="lines">@@ -79,7 +47,6 @@
</span><span class="cx">     
</span><span class="cx">     m_scrambledHead = result->scrambledNext;
</span><span class="cx">     return bitwise_cast<HeapCell*>(result);
</span><del>-#endif // !ENABLE(BITMAP_FREELIST)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename Func>
</span><span class="lines">@@ -89,33 +56,6 @@
</span><span class="cx">         for (unsigned remaining = m_remaining; remaining; remaining -= m_cellSize)
</span><span class="cx">             func(bitwise_cast<HeapCell*>(m_payloadEnd - remaining));
</span><span class="cx">     } else {
</span><del>-#if ENABLE(BITMAP_FREELIST)
-        if (bitmapIsEmpty())
-            return;
-
-        AtomsBitmap::Word rowBitmap = m_currentRowBitmap;
-        unsigned rowIndex = m_currentRowIndex;
-        Atom* currentMarkedBlockRowAddress = m_currentMarkedBlockRowAddress;
-        do {
-            while (rowBitmap) {
-                constexpr AtomsBitmap::Word one = 1;
-                unsigned atomIndexInRow = ctz(rowBitmap);
-                auto* cell = bitwise_cast<HeapCell*>(&currentMarkedBlockRowAddress[atomIndexInRow]);
-                rowBitmap &= ~(one << atomIndexInRow);
-                func(cell);
-            }
-
-            while (rowIndex) {
-                // We load before decrementing rowIndex because bitmapRowsMinusOne() points
-                // to 1 word before m_bitmap. See comments about offsetOfBitmapRowsMinusOne()
-                // for why we do this.
-                rowBitmap = bitmapRowsMinusOne()[rowIndex--];
-                currentMarkedBlockRowAddress -= atomsPerRow;
-                if (rowBitmap)
-                    break;
-            }
-        } while (rowBitmap);
-#else
</del><span class="cx">         for (FreeCell* cell = head(); cell;) {
</span><span class="cx">             // We can use this to overwrite free objects before destroying the free list. So, we need
</span><span class="cx">             // to get next before proceeding further.
</span><span class="lines">@@ -123,8 +63,8 @@
</span><span class="cx">             func(bitwise_cast<HeapCell*>(cell));
</span><span class="cx">             cell = next;
</span><span class="cx">         }
</span><del>-#endif
</del><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span><ins>+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapLocalAllocatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/LocalAllocator.cpp (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/LocalAllocator.cpp      2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/heap/LocalAllocator.cpp 2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2018-2020 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -272,7 +272,7 @@
</span><span class="cx">     // if we know that the block owning the object is free-listed, then it's impossible for any
</span><span class="cx">     // objects to be in the dead-but-not-destructed state.
</span><span class="cx">     // FIXME: Get rid of this abomination. https://bugs.webkit.org/show_bug.cgi?id=181655
</span><del>-    return m_freeList.contains(bitwise_cast<HeapCell*>(target), m_currentBlock);
</del><ins>+    return m_freeList.contains(bitwise_cast<HeapCell*>(target));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedBlock.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedBlock.h   2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/heap/MarkedBlock.h      2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
</span><span class="cx">  *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
</span><del>- *  Copyright (C) 2003-2020 Apple Inc. All rights reserved.
</del><ins>+ *  Copyright (C) 2003-2019 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  *  This library is free software; you can redistribute it and/or
</span><span class="cx">  *  modify it under the terms of the GNU Lesser General Public
</span><span class="lines">@@ -84,8 +84,6 @@
</span><span class="cx">     static_assert(!(MarkedBlock::atomSize & (MarkedBlock::atomSize - 1)), "MarkedBlock::atomSize must be a power of two.");
</span><span class="cx">     static_assert(!(MarkedBlock::blockSize & (MarkedBlock::blockSize - 1)), "MarkedBlock::blockSize must be a power of two.");
</span><span class="cx">     
</span><del>-    using AtomsBitmap = Bitmap<atomsPerBlock>;
-
</del><span class="cx">     struct VoidFunctor {
</span><span class="cx">         typedef void ReturnType;
</span><span class="cx">         void returnValue() { }
</span><span class="lines">@@ -205,7 +203,6 @@
</span><span class="cx">         
</span><span class="cx">         void* start() const { return &m_block->atoms()[0]; }
</span><span class="cx">         void* end() const { return &m_block->atoms()[m_endAtom]; }
</span><del>-        void* atomAt(size_t i) const { return &m_block->atoms()[i]; }
</del><span class="cx">         bool contains(void* p) const { return start() <= p && p < end(); }
</span><span class="cx"> 
</span><span class="cx">         void dumpState(PrintStream&);
</span><span class="lines">@@ -297,8 +294,8 @@
</span><span class="cx">         HeapVersion m_markingVersion;
</span><span class="cx">         HeapVersion m_newlyAllocatedVersion;
</span><span class="cx"> 
</span><del>-        AtomsBitmap m_marks;
-        AtomsBitmap m_newlyAllocated;
</del><ins>+        Bitmap<atomsPerBlock> m_marks;
+        Bitmap<atomsPerBlock> m_newlyAllocated;
</ins><span class="cx">     };
</span><span class="cx">     
</span><span class="cx"> private:    
</span><span class="lines">@@ -339,7 +336,7 @@
</span><span class="cx">     bool isNewlyAllocated(const void*);
</span><span class="cx">     void setNewlyAllocated(const void*);
</span><span class="cx">     void clearNewlyAllocated(const void*);
</span><del>-    const AtomsBitmap& newlyAllocated() const;
</del><ins>+    const Bitmap<atomsPerBlock>& newlyAllocated() const;
</ins><span class="cx">     
</span><span class="cx">     HeapVersion newlyAllocatedVersion() const { return footer().m_newlyAllocatedVersion; }
</span><span class="cx">     
</span><span class="lines">@@ -377,7 +374,7 @@
</span><span class="cx">     bool isMarkedRaw(const void* p);
</span><span class="cx">     HeapVersion markingVersion() const { return footer().m_markingVersion; }
</span><span class="cx">     
</span><del>-    const AtomsBitmap& marks() const;
</del><ins>+    const Bitmap<atomsPerBlock>& marks() const;
</ins><span class="cx">     
</span><span class="cx">     CountingLock& lock() { return footer().m_lock; }
</span><span class="cx">     
</span><span class="lines">@@ -402,8 +399,6 @@
</span><span class="cx">     
</span><span class="cx">     inline bool marksConveyLivenessDuringMarking(HeapVersion markingVersion);
</span><span class="cx">     inline bool marksConveyLivenessDuringMarking(HeapVersion myMarkingVersion, HeapVersion markingVersion);
</span><del>-
-    friend class FreeList;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline MarkedBlock::Footer& MarkedBlock::footer()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreheapMarkedBlockInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/heap/MarkedBlockInlines.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/heap/MarkedBlockInlines.h    2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/heap/MarkedBlockInlines.h       2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -264,11 +264,6 @@
</span><span class="cx">     
</span><span class="cx">     m_directory->setIsDestructible(NoLockingNecessary, this, false);
</span><span class="cx">     
</span><del>-    char* startOfLastCell = static_cast<char*>(cellAlign(block.atoms() + m_endAtom - 1));
-    char* payloadEnd = startOfLastCell + cellSize;
-    RELEASE_ASSERT(payloadEnd - MarkedBlock::blockSize <= bitwise_cast<char*>(&block));
-    char* payloadBegin = bitwise_cast<char*>(block.atoms());
-
</del><span class="cx">     if (Options::useBumpAllocator()
</span><span class="cx">         && emptyMode == IsEmpty
</span><span class="cx">         && newlyAllocatedMode == DoesNotHaveNewlyAllocated) {
</span><span class="lines">@@ -285,6 +280,11 @@
</span><span class="cx">                 });
</span><span class="cx">         }
</span><span class="cx">         
</span><ins>+        char* startOfLastCell = static_cast<char*>(cellAlign(block.atoms() + m_endAtom - 1));
+        char* payloadEnd = startOfLastCell + cellSize;
+        RELEASE_ASSERT(payloadEnd - MarkedBlock::blockSize <= bitwise_cast<char*>(&block));
+        char* payloadBegin = bitwise_cast<char*>(block.atoms());
+        
</ins><span class="cx">         if (sweepMode == SweepToFreeList)
</span><span class="cx">             setIsFreeListed();
</span><span class="cx">         if (space()->isMarking())
</span><span class="lines">@@ -303,96 +303,6 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    // The code below is an optimized version of the following by merging the
-    // various loops over the bitmaps.
-    //
-    //    AtomsBitmap cellLocations;
-    //    cellLocations.setEachNthBit(m_atomsPerCell, 0, m_endAtom);
-    //
-    //    if (emptyMode == NotEmpty) {
-    //        if (marksMode == MarksNotStale) {
-    //            freeAtoms = footer.m_marks;
-    //            if (newlyAllocatedMode == HasNewlyAllocated)
-    //                freeAtoms |= footer.m_newlyAllocated;
-    //        } else if (newlyAllocatedMode == HasNewlyAllocated)
-    //            freeAtoms = footer.m_newlyAllocated;
-    //        // At this point, a set bit in freeAtoms represents live cells.
-    //        isEmpty = freeAtoms.isEmpty();
-    //
-    //        // Invert the bits at each cell location so that the ones for live cells
-    //        // are cleared, and the ones for dead cells are set.
-    //        freeAtoms ^= cellLocations;
-    //    } else
-    //        freeAtoms = cellLocations; // all cells are free.
-
-    AtomsBitmap localFreeAtoms;
-    AtomsBitmap& freeAtoms = freeList ? freeList->atomsBitmap() : localFreeAtoms;
-
-    AtomsBitmap::Word* free = freeAtoms.words();
-    AtomsBitmap::Word* marks = footer.m_marks.words();
-    AtomsBitmap::Word* newlyAllocated = footer.m_newlyAllocated.words();
-
-    unsigned roundedUpEndAtoms = roundUpToMultipleOf<AtomsBitmap::bitsInWord>(m_endAtom);
-    unsigned endWordIndex = roundedUpEndAtoms / AtomsBitmap::bitsInWord;
-    ASSERT(m_endAtom <= endWordIndex * AtomsBitmap::bitsInWord);
-
-    if (freeList)
-        freeAtoms.clearAll();
-    freeAtoms.setEachNthBit(m_atomsPerCell, 0, m_endAtom);
-
-    if (emptyMode == NotEmpty) {
-        if (marksMode == MarksNotStale && newlyAllocatedMode == HasNewlyAllocated) {
-            for (unsigned i = 0; i < endWordIndex; ++i)
-                free[i] ^= marks[i] | newlyAllocated[i];
-
-        } else if (marksMode == MarksNotStale) {
-            for (unsigned i = 0; i < endWordIndex; ++i)
-                free[i] ^= marks[i];
-
-        } else if (newlyAllocatedMode == HasNewlyAllocated) {
-            for (unsigned i = 0; i < endWordIndex; ++i)
-                free[i] ^= newlyAllocated[i];
-        }
-    }
-
-    // At this point, a set bit in freeAtoms represents a dead cell.
-
-    // We only want to discard the newlyAllocated bits if we're creating a FreeList,
-    // otherwise we would lose information on what's currently alive.
-    if (sweepMode == SweepToFreeList && newlyAllocatedMode == HasNewlyAllocated)
-        footer.m_newlyAllocatedVersion = MarkedSpace::nullVersion;
-
-    if (space()->isMarking())
-        footer.m_lock.unlock();
-
-    // Handle dead cells.
-    unsigned deadCellCount = 0;
-    freeAtoms.forEachSetBit([&] (size_t i) {
-        HeapCell* cell = reinterpret_cast_ptr<HeapCell*>(atomAt(i));
-
-        if (destructionMode != BlockHasNoDestructors)
-            destroy(cell);
-
-        if (sweepMode == SweepToFreeList) {
-            if (scribbleMode == Scribble)
-                scribble(cell, cellSize);
-        }
-        ++deadCellCount;
-    });
-
-    unsigned numberOfCellsInBlock = (payloadEnd - payloadBegin) / cellSize;
-    bool isEmpty = (deadCellCount == numberOfCellsInBlock);
-    if (sweepMode == SweepToFreeList) {
-        freeList->initializeAtomsBitmap(this, freeAtoms, deadCellCount * cellSize);
-        setIsFreeListed();
-    } else if (isEmpty)
-        m_directory->setIsEmpty(NoLockingNecessary, this, true);
-    if (false)
-        dataLog("Slowly swept block ", RawPointer(&block), " with cell size ", cellSize, " and attributes ", m_attributes, ": ", pointerDump(freeList), "\n");
-
-#else // not ENABLE(BITMAP_FREELIST)
-
</del><span class="cx">     // This produces a free list that is ordered in reverse through the block.
</span><span class="cx">     // This is fine, since the allocation code makes no assumptions about the
</span><span class="cx">     // order of the free list.
</span><span class="lines">@@ -451,7 +361,6 @@
</span><span class="cx">         m_directory->setIsEmpty(NoLockingNecessary, this, true);
</span><span class="cx">     if (false)
</span><span class="cx">         dataLog("Slowly swept block ", RawPointer(&block), " with cell size ", cellSize, " and attributes ", m_attributes, ": ", pointerDump(freeList), "\n");
</span><del>-#endif // ENABLE(BITMAP_FREELIST)
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<typename DestroyFunc>
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitAssemblyHelperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp      2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp 2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -521,7 +521,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void AssemblyHelpers::emitAllocateWithNonNullAllocator(GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath, Optional<GPRReg> optionalScratchGPR2, Optional<GPRReg> optionalScratchGPR3)
</del><ins>+void AssemblyHelpers::emitAllocateWithNonNullAllocator(GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath)
</ins><span class="cx"> {
</span><span class="cx">     if (Options::forceGCSlowPaths()) {
</span><span class="cx">         slowPath.append(jump());
</span><span class="lines">@@ -534,7 +534,7 @@
</span><span class="cx">     // - We *can* use RegisterSet::macroScratchRegisters on ARM.
</span><span class="cx"> 
</span><span class="cx">     Jump popPath;
</span><del>-    JumpList done;
</del><ins>+    Jump done;
</ins><span class="cx">     
</span><span class="cx">     if (allocator.isConstant())
</span><span class="cx">         move(TrustedImmPtr(allocator.allocator().localAllocator()), allocatorGPR);
</span><span class="lines">@@ -552,124 +552,10 @@
</span><span class="cx">     Address payloadEndAddr = Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfPayloadEnd());
</span><span class="cx">     addPtr(payloadEndAddr, resultGPR);
</span><span class="cx"> 
</span><del>-    done.append(jump());
</del><ins>+    done = jump();
</ins><span class="cx">         
</span><del>-#if ENABLE(BITMAP_FREELIST)
-    ASSERT(resultGPR != scratchGPR);
-
-    auto rowIndexGPR = resultGPR;
-    auto rowBitmapGPR = scratchGPR;
-
-    GPRReg scratchGPR2 = optionalScratchGPR2 ? optionalScratchGPR2.value() : scratchRegister();
-    ASSERT(scratchGPR2 != resultGPR);
-    ASSERT(scratchGPR2 != scratchGPR);
-
-    auto rowAddressGPR = scratchGPR2;
-    auto clearBit64ScratchGPR = scratchGPR2;
-
-    bool canPreloadRowAddressGPR = false;
-    if (optionalScratchGPR3) {
-        clearBit64ScratchGPR = optionalScratchGPR3.value();
-        canPreloadRowAddressGPR = true;
-    } else if (isX86_64()) {
-        // x86_64's clearBit64() does actually need to use clearBit64ScratchGPR.
-        // So, we can preload the row address into it.
-        clearBit64ScratchGPR = InvalidGPRReg;
-        canPreloadRowAddressGPR = true;
-#if CPU(ARM64)
-    } else if (isARM64()) {
-        // ARM64's fast path does actually need to use the memoryTempRegister.
-        // So, we can use that for the clearBit64ScratchGPR and allow the
-        // row address to be preloaded in scratchGPR2.
-        clearBit64ScratchGPR = getCachedMemoryTempRegisterIDAndInvalidate();
-        canPreloadRowAddressGPR = true;
-#endif
-    }
-    ASSERT(clearBit64ScratchGPR != resultGPR);
-    ASSERT(clearBit64ScratchGPR != scratchGPR);
-    if (canPreloadRowAddressGPR)
-        ASSERT(clearBit64ScratchGPR != scratchGPR2);
-
-    // The code below for rowBitmapGPR relies on this.
-    static_assert(sizeof(FreeList::AtomsBitmap::Word) == sizeof(uint64_t));
-
-    // Check for middle path: have another row to visit?
-    Label checkForMoreRows = label();
-
-    load32(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentRowIndex()), rowIndexGPR);
-
-    if (!canPreloadRowAddressGPR)
-        loadPtr(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentMarkedBlockRowAddress()), rowAddressGPR);
-
-    slowPath.append(branchTestPtr(Zero, rowIndexGPR));
-
-    // Middle path: there is another row left to visit.
-    Jump foundNonEmptyRow;
-    Label checkNextRow = label();
-    {
-        // Load the next row bitmap and point m_currentMarkedBlockRowAddress to the next row.
-
-        // Note: offsetOfBitmapRowsMinusOne() points to 1 word before m_bitmap. We do this
-        // deliberately because it allows us to schedule instructions better and
-        // do this load before the decrement below.
-        load64(BaseIndex(allocatorGPR, rowIndexGPR, TimesEight, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfBitmapRowsMinusOne()), rowBitmapGPR);
-
-        sub64(TrustedImm32(1), rowIndexGPR);
-        subPtr(TrustedImm32(FreeList::atomsRowBytes), rowAddressGPR);
-
-        foundNonEmptyRow = branchTest64(NonZero, rowBitmapGPR);
-        branchTestPtr(NonZero, rowIndexGPR).linkTo(checkNextRow, this);
-    }
-
-    // Slow path: no more rows.
-    // Both rowIndexGPR and rowBitmapGPR should be null here.
-    store32(rowIndexGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentRowIndex()));
-    store64(rowBitmapGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentRowBitmap()));
-    slowPath.append(jump());
-
-    // Transition from middle path back to fast path to allocate.
-    foundNonEmptyRow.link(this);
-    storePtr(rowAddressGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentMarkedBlockRowAddress()));
-    store32(rowIndexGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentRowIndex()));
-
-    Jump allocateFromCurrentRow = jump();
-
</del><span class="cx">     popPath.link(this);
</span><del>-
-    // Check for fast path: have available bit in m_currentRowBitmap?
-    load64(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentRowBitmap()), rowBitmapGPR);
-
-    if (canPreloadRowAddressGPR) {
-        // Preload the row address needed on the fast and middle path.
-        loadPtr(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentMarkedBlockRowAddress()), rowAddressGPR);
-    }
-
-    branchTest64(Zero, rowBitmapGPR).linkTo(checkForMoreRows, this);
-
-    // Fast path: we have a bit to use.
-    allocateFromCurrentRow.link(this);
-    {
-        // Remove this bit from m_currentRowBitmap.
-        auto atomIndexInRowGPR = resultGPR;
-        countTrailingZeros64WithoutNullCheck(rowBitmapGPR, atomIndexInRowGPR);
-        clearBit64(atomIndexInRowGPR, rowBitmapGPR, clearBit64ScratchGPR);
-
-        if (!canPreloadRowAddressGPR)
-            loadPtr(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentMarkedBlockRowAddress()), rowAddressGPR);
-
-        store64(rowBitmapGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfCurrentRowBitmap()));
-
-        // Compute atom address of this bit.
-        ASSERT(resultGPR == atomIndexInRowGPR);
-        shiftAndAdd(rowAddressGPR, resultGPR, FreeList::atomSizeShift, resultGPR);
-    }
-
-#else
-    UNUSED_PARAM(optionalScratchGPR2);
-    UNUSED_PARAM(optionalScratchGPR3);
-
-    popPath.link(this);
-
</del><ins>+        
</ins><span class="cx">     loadPtr(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfScrambledHead()), resultGPR);
</span><span class="cx">     xorPtr(Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfSecret()), resultGPR);
</span><span class="cx">     slowPath.append(branchTestPtr(Zero, resultGPR));
</span><span class="lines">@@ -678,8 +564,7 @@
</span><span class="cx">     // it's still on the GC's free list.
</span><span class="cx">     loadPtr(Address(resultGPR, FreeCell::offsetOfScrambledNext()), scratchGPR);
</span><span class="cx">     storePtr(scratchGPR, Address(allocatorGPR, LocalAllocator::offsetOfFreeList() + FreeList::offsetOfScrambledHead()));
</span><del>-#endif
-
</del><ins>+        
</ins><span class="cx">     done.link(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitAssemblyHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h        2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h   2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -44,7 +44,6 @@
</span><span class="cx"> #include "TagRegistersMode.h"
</span><span class="cx"> #include "TypeofType.h"
</span><span class="cx"> #include "VM.h"
</span><del>-#include <wtf/Optional.h>
</del><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -1953,8 +1952,8 @@
</span><span class="cx">     // that allocator is non-null; allocator can be null as a signal that we don't know what the
</span><span class="cx">     // value of allocatorGPR is. Additionally, if the allocator is not null, then there is no need
</span><span class="cx">     // to populate allocatorGPR - this code will ignore the contents of allocatorGPR.
</span><del>-    void emitAllocateWithNonNullAllocator(GPRReg resultGPR, const JITAllocator&, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath, Optional<GPRReg> scratchGPR2 = { }, Optional<GPRReg> scratchGPR3 = { });
-
</del><ins>+    void emitAllocateWithNonNullAllocator(GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath);
+    
</ins><span class="cx">     void emitAllocate(GPRReg resultGPR, const JITAllocator& allocator, GPRReg allocatorGPR, GPRReg scratchGPR, JumpList& slowPath);
</span><span class="cx">     
</span><span class="cx">     template<typename StructureType>
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/WTF/ChangeLog  2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2020-08-09  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, reverting r263195, r263252, and r265394.
+        https://bugs.webkit.org/show_bug.cgi?id=215312
+
+        Revert all related GC Bitmap changes because some of perf is
+        not fully recovered
+
+        Reverted changesets:
+
+        "Replace JSC::FreeList linked list with a Bitmap."
+        https://bugs.webkit.org/show_bug.cgi?id=213071
+        https://trac.webkit.org/changeset/263195
+
+        "Unify Bitmap math loops in
+        MarkedBlock::Handle::specializedSweep()."
+        https://bugs.webkit.org/show_bug.cgi?id=213345
+        https://trac.webkit.org/changeset/263252
+
+        "[JSC] Disable ENABLE_BITMAP_FREELIST"
+        https://bugs.webkit.org/show_bug.cgi?id=215285
+        https://trac.webkit.org/changeset/265394
+
</ins><span class="cx"> 2020-08-08  Joonghun Park  <jh718.park@samsung.com>
</span><span class="cx"> 
</span><span class="cx">         [WTF] Remove the build warning since r265344.
</span></span></pre></div>
<a id="trunkSourceWTFwtfBitmaph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Bitmap.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Bitmap.h    2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/WTF/wtf/Bitmap.h       2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -130,14 +130,10 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned hash() const;
</span><span class="cx"> 
</span><del>-    // Low level interface.
-    using Word = WordType;
-    static constexpr unsigned bitsInWord = countOfBits<WordType>;
-    static constexpr unsigned numberOfWords = (bitmapSize + bitsInWord - 1) / bitsInWord;
-    WordType wordAt(size_t wordIndex) const { return bits[wordIndex]; }
-    Word* words() { return bitwise_cast<Word*>(&bits); }
</del><ins>+private:
+    static constexpr unsigned wordSize = sizeof(WordType) * 8;
+    static constexpr unsigned words = (bitmapSize + wordSize - 1) / wordSize;
</ins><span class="cx"> 
</span><del>-private:
</del><span class="cx">     // the literal '1' is of type signed int.  We want to use an unsigned
</span><span class="cx">     // version of the correct size when doing the calculations because if
</span><span class="cx">     // WordType is larger than int, '1 << 31' will first be sign extended
</span><span class="lines">@@ -145,7 +141,7 @@
</span><span class="cx">     // a 64 bit unsigned int would give 0xffff8000
</span><span class="cx">     static constexpr WordType one = 1;
</span><span class="cx"> 
</span><del>-    std::array<WordType, numberOfWords> bits;
</del><ins>+    std::array<WordType, words> bits;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="lines">@@ -157,13 +153,13 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::get(size_t n, Dependency dependency) const
</span><span class="cx"> {
</span><del>-    return !!(dependency.consume(this)->bits[n / bitsInWord] & (one << (n % bitsInWord)));
</del><ins>+    return !!(dependency.consume(this)->bits[n / wordSize] & (one << (n % wordSize)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::set(size_t n)
</span><span class="cx"> {
</span><del>-    bits[n / bitsInWord] |= (one << (n % bitsInWord));
</del><ins>+    bits[n / wordSize] |= (one << (n % wordSize));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="lines">@@ -178,8 +174,8 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::testAndSet(size_t n)
</span><span class="cx"> {
</span><del>-    WordType mask = one << (n % bitsInWord);
-    size_t index = n / bitsInWord;
</del><ins>+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
</ins><span class="cx">     bool result = bits[index] & mask;
</span><span class="cx">     bits[index] |= mask;
</span><span class="cx">     return result;
</span><span class="lines">@@ -188,8 +184,8 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::testAndClear(size_t n)
</span><span class="cx"> {
</span><del>-    WordType mask = one << (n % bitsInWord);
-    size_t index = n / bitsInWord;
</del><ins>+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
</ins><span class="cx">     bool result = bits[index] & mask;
</span><span class="cx">     bits[index] &= ~mask;
</span><span class="cx">     return result;
</span><span class="lines">@@ -198,8 +194,8 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> ALWAYS_INLINE bool Bitmap<bitmapSize, WordType>::concurrentTestAndSet(size_t n, Dependency dependency)
</span><span class="cx"> {
</span><del>-    WordType mask = one << (n % bitsInWord);
-    size_t index = n / bitsInWord;
</del><ins>+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
</ins><span class="cx">     WordType* data = dependency.consume(bits.data()) + index;
</span><span class="cx">     return !bitwise_cast<Atomic<WordType>*>(data)->transactionRelaxed(
</span><span class="cx">         [&] (WordType& value) -> bool {
</span><span class="lines">@@ -214,8 +210,8 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> ALWAYS_INLINE bool Bitmap<bitmapSize, WordType>::concurrentTestAndClear(size_t n, Dependency dependency)
</span><span class="cx"> {
</span><del>-    WordType mask = one << (n % bitsInWord);
-    size_t index = n / bitsInWord;
</del><ins>+    WordType mask = one << (n % wordSize);
+    size_t index = n / wordSize;
</ins><span class="cx">     WordType* data = dependency.consume(bits.data()) + index;
</span><span class="cx">     return !bitwise_cast<Atomic<WordType>*>(data)->transactionRelaxed(
</span><span class="cx">         [&] (WordType& value) -> bool {
</span><span class="lines">@@ -230,7 +226,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::clear(size_t n)
</span><span class="cx"> {
</span><del>-    bits[n / bitsInWord] &= ~(one << (n % bitsInWord));
</del><ins>+    bits[n / wordSize] &= ~(one << (n % wordSize));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="lines">@@ -242,12 +238,12 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::invert()
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] = ~bits[i];
</span><del>-    if constexpr (!!(bitmapSize % bitsInWord)) {
-        constexpr size_t remainingBits = bitmapSize % bitsInWord;
</del><ins>+    if constexpr (!!(bitmapSize % wordSize)) {
+        constexpr size_t remainingBits = bitmapSize % wordSize;
</ins><span class="cx">         constexpr WordType mask = (static_cast<WordType>(1) << remainingBits) - 1;
</span><del>-        bits[numberOfWords - 1] &= mask;
</del><ins>+        bits[words - 1] &= mask;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -254,8 +250,8 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline size_t Bitmap<bitmapSize, WordType>::nextPossiblyUnset(size_t start) const
</span><span class="cx"> {
</span><del>-    if (!~bits[start / bitsInWord])
-        return ((start / bitsInWord) + 1) * bitsInWord;
</del><ins>+    if (!~bits[start / wordSize])
+        return ((start / wordSize) + 1) * wordSize;
</ins><span class="cx">     return start + 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -286,11 +282,11 @@
</span><span class="cx"> inline size_t Bitmap<bitmapSize, WordType>::count(size_t start) const
</span><span class="cx"> {
</span><span class="cx">     size_t result = 0;
</span><del>-    for ( ; (start % bitsInWord); ++start) {
</del><ins>+    for ( ; (start % wordSize); ++start) {
</ins><span class="cx">         if (get(start))
</span><span class="cx">             ++result;
</span><span class="cx">     }
</span><del>-    for (size_t i = start / bitsInWord; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = start / wordSize; i < words; ++i)
</ins><span class="cx">         result += WTF::bitCount(bits[i]);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -298,10 +294,9 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::isEmpty() const
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         if (bits[i])
</span><span class="cx">             return false;
</span><del>-    }
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -308,11 +303,11 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::isFull() const
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         if (~bits[i]) {
</span><del>-            if constexpr (!!(bitmapSize % bitsInWord)) {
-                if (i == numberOfWords - 1) {
-                    constexpr size_t remainingBits = bitmapSize % bitsInWord;
</del><ins>+            if constexpr (!!(bitmapSize % wordSize)) {
+                if (i == words - 1) {
+                    constexpr size_t remainingBits = bitmapSize % wordSize;
</ins><span class="cx">                     constexpr WordType mask = (static_cast<WordType>(1) << remainingBits) - 1;
</span><span class="cx">                     if ((bits[i] & mask) == mask)
</span><span class="cx">                         return true;
</span><span class="lines">@@ -320,7 +315,6 @@
</span><span class="cx">             }
</span><span class="cx">             return false;
</span><span class="cx">         }
</span><del>-    }
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -327,7 +321,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::merge(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] |= other.bits[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -334,7 +328,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::filter(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] &= other.bits[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -341,7 +335,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::exclude(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] &= ~other.bits[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -348,7 +342,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::concurrentFilter(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i) {
</ins><span class="cx">         for (;;) {
</span><span class="cx">             WordType otherBits = other.bits[i];
</span><span class="cx">             if (!otherBits) {
</span><span class="lines">@@ -368,7 +362,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::subsumes(const Bitmap& other) const
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i) {
</ins><span class="cx">         WordType myBits = bits[i];
</span><span class="cx">         WordType otherBits = other.bits[i];
</span><span class="cx">         if ((myBits | otherBits) != myBits)
</span><span class="lines">@@ -381,16 +375,16 @@
</span><span class="cx"> template<typename Func>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::forEachSetBit(const Func& func) const
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i) {
</ins><span class="cx">         WordType word = bits[i];
</span><del>-        size_t base = i * bitsInWord;
-        size_t j = 0;
-        for (; word; ++j) {
</del><ins>+        if (!word)
+            continue;
+        size_t base = i * wordSize;
+        for (size_t j = 0; j < wordSize; ++j) {
</ins><span class="cx">             if (word & 1)
</span><span class="cx">                 func(base + j);
</span><span class="cx">             word >>= 1;
</span><span class="cx">         }
</span><del>-        ASSERT(j <= bitsInWord);
</del><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -398,15 +392,15 @@
</span><span class="cx"> inline size_t Bitmap<bitmapSize, WordType>::findBit(size_t startIndex, bool value) const
</span><span class="cx"> {
</span><span class="cx">     WordType skipValue = -(static_cast<WordType>(value) ^ 1);
</span><del>-    size_t wordIndex = startIndex / bitsInWord;
-    size_t startIndexInWord = startIndex - wordIndex * bitsInWord;
</del><ins>+    size_t wordIndex = startIndex / wordSize;
+    size_t startIndexInWord = startIndex - wordIndex * wordSize;
</ins><span class="cx">     
</span><del>-    while (wordIndex < numberOfWords) {
</del><ins>+    while (wordIndex < words) {
</ins><span class="cx">         WordType word = bits[wordIndex];
</span><span class="cx">         if (word != skipValue) {
</span><span class="cx">             size_t index = startIndexInWord;
</span><del>-            if (findBitInWord(word, index, bitsInWord, value))
-                return wordIndex * bitsInWord + index;
</del><ins>+            if (findBitInWord(word, index, wordSize, value))
+                return wordIndex * wordSize + index;
</ins><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         wordIndex++;
</span><span class="lines">@@ -419,7 +413,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::mergeAndClear(Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i) {
</ins><span class="cx">         bits[i] |= other.bits[i];
</span><span class="cx">         other.bits[i] = 0;
</span><span class="cx">     }
</span><span class="lines">@@ -428,7 +422,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::setAndClear(Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i) {
</ins><span class="cx">         bits[i] = other.bits[i];
</span><span class="cx">         other.bits[i] = 0;
</span><span class="cx">     }
</span><span class="lines">@@ -440,28 +434,28 @@
</span><span class="cx">     ASSERT(start <= end);
</span><span class="cx">     ASSERT(end <= bitmapSize);
</span><span class="cx"> 
</span><del>-    size_t wordIndex = start / bitsInWord;
-    size_t endWordIndex = end / bitsInWord;
-    size_t index = start - wordIndex * bitsInWord;
</del><ins>+    size_t wordIndex = start / wordSize;
+    size_t endWordIndex = end / wordSize;
+    size_t index = start - wordIndex * wordSize;
</ins><span class="cx">     while (wordIndex < endWordIndex) {
</span><del>-        while (index < bitsInWord) {
</del><ins>+        while (index < wordSize) {
</ins><span class="cx">             bits[wordIndex] |= (one << index);
</span><span class="cx">             index += n;
</span><span class="cx">         }
</span><del>-        index -= bitsInWord;
</del><ins>+        index -= wordSize;
</ins><span class="cx">         wordIndex++;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    size_t endIndex = end - endWordIndex * bitsInWord;
</del><ins>+    size_t endIndex = end - endWordIndex * wordSize;
</ins><span class="cx">     while (index < endIndex) {
</span><span class="cx">         bits[wordIndex] |= (one << index);
</span><span class="cx">         index += n;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if constexpr (!!(bitmapSize % bitsInWord)) {
-        constexpr size_t remainingBits = bitmapSize % bitsInWord;
</del><ins>+    if constexpr (!!(bitmapSize % wordSize)) {
+        constexpr size_t remainingBits = bitmapSize % wordSize;
</ins><span class="cx">         constexpr WordType mask = (static_cast<WordType>(1) << remainingBits) - 1;
</span><del>-        bits[numberOfWords - 1] &= mask;
</del><ins>+        bits[words - 1] &= mask;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -468,7 +462,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline bool Bitmap<bitmapSize, WordType>::operator==(const Bitmap& other) const
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i) {
</del><ins>+    for (size_t i = 0; i < words; ++i) {
</ins><span class="cx">         if (bits[i] != other.bits[i])
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="lines">@@ -484,7 +478,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::operator|=(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] |= other.bits[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -491,7 +485,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::operator&=(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] &= other.bits[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -498,7 +492,7 @@
</span><span class="cx"> template<size_t bitmapSize, typename WordType>
</span><span class="cx"> inline void Bitmap<bitmapSize, WordType>::operator^=(const Bitmap& other)
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         bits[i] ^= other.bits[i];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -506,7 +500,7 @@
</span><span class="cx"> inline unsigned Bitmap<bitmapSize, WordType>::hash() const
</span><span class="cx"> {
</span><span class="cx">     unsigned result = 0;
</span><del>-    for (size_t i = 0; i < numberOfWords; ++i)
</del><ins>+    for (size_t i = 0; i < words; ++i)
</ins><span class="cx">         result ^= IntHash<WordType>::hash(bits[i]);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWTFwtfMathExtrash"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/MathExtras.h (265415 => 265416)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/MathExtras.h        2020-08-09 07:36:19 UTC (rev 265415)
+++ trunk/Source/WTF/wtf/MathExtras.h   2020-08-09 11:49:11 UTC (rev 265416)
</span><span class="lines">@@ -593,7 +593,7 @@
</span><span class="cx"> template <typename T>
</span><span class="cx"> constexpr unsigned clzConstexpr(T value)
</span><span class="cx"> {
</span><del>-    constexpr unsigned bitSize = countOfBits<T>;
</del><ins>+    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
</ins><span class="cx"> 
</span><span class="cx">     using UT = typename std::make_unsigned<T>::type;
</span><span class="cx">     UT uValue = value;
</span><span class="lines">@@ -610,13 +610,13 @@
</span><span class="cx"> template<typename T>
</span><span class="cx"> inline unsigned clz(T value)
</span><span class="cx"> {
</span><del>-    constexpr unsigned bitSize = countOfBits<T>;
</del><ins>+    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
</ins><span class="cx"> 
</span><span class="cx">     using UT = typename std::make_unsigned<T>::type;
</span><span class="cx">     UT uValue = value;
</span><span class="cx"> 
</span><span class="cx"> #if COMPILER(GCC_COMPATIBLE)
</span><del>-    constexpr unsigned bitSize64 = countOfBits<uint64_t>;
</del><ins>+    constexpr unsigned bitSize64 = sizeof(uint64_t) * CHAR_BIT;
</ins><span class="cx">     if (uValue)
</span><span class="cx">         return __builtin_clzll(uValue) - (bitSize64 - bitSize);
</span><span class="cx">     return bitSize;
</span><span class="lines">@@ -638,7 +638,7 @@
</span><span class="cx"> template <typename T>
</span><span class="cx"> constexpr unsigned ctzConstexpr(T value)
</span><span class="cx"> {
</span><del>-    constexpr unsigned bitSize = countOfBits<T>;
</del><ins>+    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
</ins><span class="cx"> 
</span><span class="cx">     using UT = typename std::make_unsigned<T>::type;
</span><span class="cx">     UT uValue = value;
</span><span class="lines">@@ -657,7 +657,7 @@
</span><span class="cx"> template<typename T>
</span><span class="cx"> inline unsigned ctz(T value)
</span><span class="cx"> {
</span><del>-    constexpr unsigned bitSize = countOfBits<T>;
</del><ins>+    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
</ins><span class="cx"> 
</span><span class="cx">     using UT = typename std::make_unsigned<T>::type;
</span><span class="cx">     UT uValue = value;
</span><span class="lines">@@ -695,7 +695,7 @@
</span><span class="cx"> template<typename T>
</span><span class="cx"> inline unsigned getMSBSet(T t)
</span><span class="cx"> {
</span><del>-    constexpr unsigned bitSize = countOfBits<T>;
</del><ins>+    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
</ins><span class="cx">     ASSERT(t);
</span><span class="cx">     return bitSize - 1 - clz(t);
</span><span class="cx"> }
</span><span class="lines">@@ -703,14 +703,11 @@
</span><span class="cx"> template<typename T>
</span><span class="cx"> constexpr unsigned getMSBSetConstexpr(T t)
</span><span class="cx"> {
</span><del>-    constexpr unsigned bitSize = countOfBits<T>;
</del><ins>+    constexpr unsigned bitSize = sizeof(T) * CHAR_BIT;
</ins><span class="cx">     ASSERT_UNDER_CONSTEXPR_CONTEXT(t);
</span><span class="cx">     return bitSize - 1 - clzConstexpr(t);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template<typename T> unsigned log2(T value) { return getMSBSet(value); }
-template<typename T> constexpr unsigned log2Constexpr(T value) { return getMSBSetConstexpr(value); }
-
</del><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="cx"> using WTF::shuffleVector;
</span></span></pre>
</div>
</div>

</body>
</html>