⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246487 in webkit


Ignore:
Timestamp:
Jun 16, 2019, 3:06:29 PM (7 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Grown region of WasmTable should be initialized with null
https://bugs.webkit.org/show_bug.cgi?id=198903

Reviewed by Saam Barati.

JSTests:

  • wasm/stress/wasm-table-grow-initialize.js: Added.

(shouldBe):

Source/JavaScriptCore:

Grown region of Wasmtable is now empty. We should initialize it with null.
We also rename Wasm::Table::visitChildren to Wasm::Table::visitAggregate to
align to the naming convention.

  • wasm/WasmTable.cpp:

(JSC::Wasm::Table::grow):
(JSC::Wasm::Table::visitAggregate):
(JSC::Wasm::Table::visitChildren): Deleted.

  • wasm/WasmTable.h:
  • wasm/js/JSWebAssemblyTable.cpp:

(JSC::JSWebAssemblyTable::visitChildren):

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r246408 r246487  
     12019-06-16  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Grown region of WasmTable should be initialized with null
     4        https://bugs.webkit.org/show_bug.cgi?id=198903
     5
     6        Reviewed by Saam Barati.
     7
     8        * wasm/stress/wasm-table-grow-initialize.js: Added.
     9        (shouldBe):
     10
    1112019-06-13  Yusuke Suzuki  <ysuzuki@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r246451 r246487  
     12019-06-16  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Grown region of WasmTable should be initialized with null
     4        https://bugs.webkit.org/show_bug.cgi?id=198903
     5
     6        Reviewed by Saam Barati.
     7
     8        Grown region of Wasmtable is now empty. We should initialize it with null.
     9        We also rename Wasm::Table::visitChildren to Wasm::Table::visitAggregate to
     10        align to the naming convention.
     11
     12        * wasm/WasmTable.cpp:
     13        (JSC::Wasm::Table::grow):
     14        (JSC::Wasm::Table::visitAggregate):
     15        (JSC::Wasm::Table::visitChildren): Deleted.
     16        * wasm/WasmTable.h:
     17        * wasm/js/JSWebAssemblyTable.cpp:
     18        (JSC::JSWebAssemblyTable::visitChildren):
     19
    1202019-06-14  Keith Miller  <keith_miller@apple.com>
    221
  • trunk/Source/JavaScriptCore/wasm/WasmTable.cpp

    r246328 r246487  
    101101        return WTF::nullopt;
    102102
    103     auto checkedGrow = [&] (auto& container) {
     103    auto checkedGrow = [&] (auto& container, auto initializer) {
    104104        if (newLengthChecked.unsafeGet() > allocatedLength(m_length)) {
    105105            Checked reallocSizeChecked = allocatedLength(newLengthChecked.unsafeGet());
     
    111111            container.realloc(reallocSize);
    112112        }
    113         for (uint32_t i = m_length; i < allocatedLength(newLength); ++i)
     113        for (uint32_t i = m_length; i < allocatedLength(newLength); ++i) {
    114114            new (&container.get()[i]) std::remove_reference_t<decltype(*container.get())>();
     115            initializer(container.get()[i]);
     116        }
    115117        return true;
    116118    };
    117119
    118120    if (auto* funcRefTable = asFuncrefTable()) {
    119         if (!checkedGrow(funcRefTable->m_importableFunctions))
     121        if (!checkedGrow(funcRefTable->m_importableFunctions, [] (auto&) { }))
    120122            return WTF::nullopt;
    121         if (!checkedGrow(funcRefTable->m_instances))
     123        if (!checkedGrow(funcRefTable->m_instances, [] (auto&) { }))
    122124            return WTF::nullopt;
    123125    }
    124126
    125     if (!checkedGrow(m_jsValues))
     127    if (!checkedGrow(m_jsValues, [] (WriteBarrier<Unknown>& slot) { slot.setStartingValue(jsNull()); }))
    126128        return WTF::nullopt;
    127129
     
    158160}
    159161
    160 void Table::visitChildren(SlotVisitor& visitor)
     162void Table::visitAggregate(SlotVisitor& visitor)
    161163{
    162164    RELEASE_ASSERT(m_owner);
  • trunk/Source/JavaScriptCore/wasm/WasmTable.h

    r246139 r246487  
    7777    Optional<uint32_t> grow(uint32_t delta);
    7878
    79     void visitChildren(SlotVisitor&);
     79    void visitAggregate(SlotVisitor&);
    8080
    8181protected:
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.cpp

    r246139 r246487  
    8181
    8282    Base::visitChildren(thisObject, visitor);
    83     thisObject->table()->visitChildren(visitor);
     83    thisObject->table()->visitAggregate(visitor);
    8484}
    8585
Note: See TracChangeset for help on using the changeset viewer.