Ignore:
Timestamp:
Jan 18, 2022, 4:50:16 PM (3 years ago)
Author:
[email protected]
Message:

[JSC] Remove Wasm::Table's m_mask
https://bugs.webkit.org/show_bug.cgi?id=235329

Reviewed by Mark Lam.

This patch removes m_mask in Wasm::Table.
The mask is removed in the other places, but forgot
removing that in Wasm::Table.

  • wasm/WasmTable.cpp:

(JSC::Wasm::Table::setLength):
(JSC::Wasm::Table::clear):
(JSC::Wasm::Table::set):
(JSC::Wasm::Table::get const):
(JSC::Wasm::FuncRefTable::setFunction):
(JSC::Wasm::FuncRefTable::function const):
(JSC::Wasm::FuncRefTable::instance const):

  • wasm/WasmTable.h:

(JSC::Wasm::Table::offsetOfLength):
(JSC::Wasm::Table::offsetOfMask): Deleted.
(JSC::Wasm::Table::mask const): Deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wasm/WasmTable.cpp

    r284935 r288163  
    4343{
    4444    m_length = length;
    45     m_mask = WTF::maskForSize(length);
    4645    ASSERT(isValidLength(length));
    47     ASSERT(m_mask == WTF::maskForSize(allocatedLength(length)));
    4846}
    4947
     
    143141    RELEASE_ASSERT(m_owner);
    144142    if (auto* funcRefTable = asFuncrefTable()) {
    145         funcRefTable->m_importableFunctions.get()[index & m_mask] = WasmToWasmImportableFunction();
    146         ASSERT(funcRefTable->m_importableFunctions.get()[index & m_mask].signatureIndex == Wasm::Signature::invalidIndex); // We rely on this in compiled code.
    147         funcRefTable->m_instances.get()[index & m_mask] = nullptr;
    148     }
    149     m_jsValues.get()[index & m_mask].setStartingValue(jsNull());
     143        funcRefTable->m_importableFunctions.get()[index] = WasmToWasmImportableFunction();
     144        ASSERT(funcRefTable->m_importableFunctions.get()[index].signatureIndex == Wasm::Signature::invalidIndex); // We rely on this in compiled code.
     145        funcRefTable->m_instances.get()[index] = nullptr;
     146    }
     147    m_jsValues.get()[index].setStartingValue(jsNull());
    150148}
    151149
     
    156154    RELEASE_ASSERT(m_owner);
    157155    clear(index);
    158     m_jsValues.get()[index & m_mask].set(m_owner->vm(), m_owner, value);
     156    m_jsValues.get()[index].set(m_owner->vm(), m_owner, value);
    159157}
    160158
     
    163161    RELEASE_ASSERT(index < length());
    164162    RELEASE_ASSERT(m_owner);
    165     return m_jsValues.get()[index & m_mask].get();
     163    return m_jsValues.get()[index].get();
    166164}
    167165
     
    211209    clear(index);
    212210    if (optionalWrapper)
    213         m_jsValues.get()[index & m_mask].set(m_owner->vm(), m_owner, optionalWrapper);
    214     m_importableFunctions.get()[index & m_mask] = function;
    215     m_instances.get()[index & m_mask] = instance;
     211        m_jsValues.get()[index].set(m_owner->vm(), m_owner, optionalWrapper);
     212    m_importableFunctions.get()[index] = function;
     213    m_instances.get()[index] = instance;
    216214}
    217215
    218216const WasmToWasmImportableFunction& FuncRefTable::function(uint32_t index) const
    219217{
    220     return m_importableFunctions.get()[index & m_mask];
     218    return m_importableFunctions.get()[index];
    221219}
    222220
    223221Instance* FuncRefTable::instance(uint32_t index) const
    224222{
    225     return m_instances.get()[index & m_mask];
     223    return m_instances.get()[index];
    226224}
    227225
Note: See TracChangeset for help on using the changeset viewer.