Title: [288163] trunk/Source/_javascript_Core
Revision
288163
Author
[email protected]
Date
2022-01-18 16:50:16 -0800 (Tue, 18 Jan 2022)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (288162 => 288163)


--- trunk/Source/_javascript_Core/ChangeLog	2022-01-19 00:27:43 UTC (rev 288162)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-01-19 00:50:16 UTC (rev 288163)
@@ -1,3 +1,27 @@
+2022-01-18  Yusuke Suzuki  <[email protected]>
+
+        [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.
+
 2022-01-18  Alex Christensen  <[email protected]>
 
         Use c++2a instead of gnu++2a for Cocoa builds

Modified: trunk/Source/_javascript_Core/wasm/WasmTable.cpp (288162 => 288163)


--- trunk/Source/_javascript_Core/wasm/WasmTable.cpp	2022-01-19 00:27:43 UTC (rev 288162)
+++ trunk/Source/_javascript_Core/wasm/WasmTable.cpp	2022-01-19 00:50:16 UTC (rev 288163)
@@ -42,9 +42,7 @@
 void Table::setLength(uint32_t length)
 {
     m_length = length;
-    m_mask = WTF::maskForSize(length);
     ASSERT(isValidLength(length));
-    ASSERT(m_mask == WTF::maskForSize(allocatedLength(length)));
 }
 
 Table::Table(uint32_t initial, std::optional<uint32_t> maximum, TableElementType type)
@@ -142,11 +140,11 @@
     RELEASE_ASSERT(index < length());
     RELEASE_ASSERT(m_owner);
     if (auto* funcRefTable = asFuncrefTable()) {
-        funcRefTable->m_importableFunctions.get()[index & m_mask] = WasmToWasmImportableFunction();
-        ASSERT(funcRefTable->m_importableFunctions.get()[index & m_mask].signatureIndex == Wasm::Signature::invalidIndex); // We rely on this in compiled code.
-        funcRefTable->m_instances.get()[index & m_mask] = nullptr;
+        funcRefTable->m_importableFunctions.get()[index] = WasmToWasmImportableFunction();
+        ASSERT(funcRefTable->m_importableFunctions.get()[index].signatureIndex == Wasm::Signature::invalidIndex); // We rely on this in compiled code.
+        funcRefTable->m_instances.get()[index] = nullptr;
     }
-    m_jsValues.get()[index & m_mask].setStartingValue(jsNull());
+    m_jsValues.get()[index].setStartingValue(jsNull());
 }
 
 void Table::set(uint32_t index, JSValue value)
@@ -155,7 +153,7 @@
     RELEASE_ASSERT(isExternrefTable());
     RELEASE_ASSERT(m_owner);
     clear(index);
-    m_jsValues.get()[index & m_mask].set(m_owner->vm(), m_owner, value);
+    m_jsValues.get()[index].set(m_owner->vm(), m_owner, value);
 }
 
 JSValue Table::get(uint32_t index) const
@@ -162,7 +160,7 @@
 {
     RELEASE_ASSERT(index < length());
     RELEASE_ASSERT(m_owner);
-    return m_jsValues.get()[index & m_mask].get();
+    return m_jsValues.get()[index].get();
 }
 
 template<typename Visitor>
@@ -210,19 +208,19 @@
     RELEASE_ASSERT(m_owner);
     clear(index);
     if (optionalWrapper)
-        m_jsValues.get()[index & m_mask].set(m_owner->vm(), m_owner, optionalWrapper);
-    m_importableFunctions.get()[index & m_mask] = function;
-    m_instances.get()[index & m_mask] = instance;
+        m_jsValues.get()[index].set(m_owner->vm(), m_owner, optionalWrapper);
+    m_importableFunctions.get()[index] = function;
+    m_instances.get()[index] = instance;
 }
 
 const WasmToWasmImportableFunction& FuncRefTable::function(uint32_t index) const
 {
-    return m_importableFunctions.get()[index & m_mask];
+    return m_importableFunctions.get()[index];
 }
 
 Instance* FuncRefTable::instance(uint32_t index) const
 {
-    return m_instances.get()[index & m_mask];
+    return m_instances.get()[index];
 }
 
 void FuncRefTable::copyFunction(const FuncRefTable* srcTable, uint32_t dstIndex, uint32_t srcIndex)

Modified: trunk/Source/_javascript_Core/wasm/WasmTable.h (288162 => 288163)


--- trunk/Source/_javascript_Core/wasm/WasmTable.h	2022-01-19 00:27:43 UTC (rev 288162)
+++ trunk/Source/_javascript_Core/wasm/WasmTable.h	2022-01-19 00:50:16 UTC (rev 288163)
@@ -52,10 +52,8 @@
     uint32_t length() const { return m_length; }
 
     static ptrdiff_t offsetOfLength() { return OBJECT_OFFSETOF(Table, m_length); }
-    static ptrdiff_t offsetOfMask() { return OBJECT_OFFSETOF(Table, m_mask); }
 
     static uint32_t allocatedLength(uint32_t length);
-    uint32_t mask() const { return m_mask; }
 
     template<typename T> T* owner() const { return reinterpret_cast<T*>(m_owner); }
     void setOwner(JSObject* owner)
@@ -88,7 +86,6 @@
     void setLength(uint32_t);
 
     uint32_t m_length;
-    uint32_t m_mask;
     const TableElementType m_type;
     const std::optional<uint32_t> m_maximum;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to