Changeset 288163 in webkit for trunk/Source/JavaScriptCore/wasm
- Timestamp:
- Jan 18, 2022, 4:50:16 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore/wasm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wasm/WasmTable.cpp
r284935 r288163 43 43 { 44 44 m_length = length; 45 m_mask = WTF::maskForSize(length);46 45 ASSERT(isValidLength(length)); 47 ASSERT(m_mask == WTF::maskForSize(allocatedLength(length)));48 46 } 49 47 … … 143 141 RELEASE_ASSERT(m_owner); 144 142 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()); 150 148 } 151 149 … … 156 154 RELEASE_ASSERT(m_owner); 157 155 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); 159 157 } 160 158 … … 163 161 RELEASE_ASSERT(index < length()); 164 162 RELEASE_ASSERT(m_owner); 165 return m_jsValues.get()[index & m_mask].get();163 return m_jsValues.get()[index].get(); 166 164 } 167 165 … … 211 209 clear(index); 212 210 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; 216 214 } 217 215 218 216 const WasmToWasmImportableFunction& FuncRefTable::function(uint32_t index) const 219 217 { 220 return m_importableFunctions.get()[index & m_mask];218 return m_importableFunctions.get()[index]; 221 219 } 222 220 223 221 Instance* FuncRefTable::instance(uint32_t index) const 224 222 { 225 return m_instances.get()[index & m_mask];223 return m_instances.get()[index]; 226 224 } 227 225 -
trunk/Source/JavaScriptCore/wasm/WasmTable.h
r278340 r288163 53 53 54 54 static ptrdiff_t offsetOfLength() { return OBJECT_OFFSETOF(Table, m_length); } 55 static ptrdiff_t offsetOfMask() { return OBJECT_OFFSETOF(Table, m_mask); }56 55 57 56 static uint32_t allocatedLength(uint32_t length); 58 uint32_t mask() const { return m_mask; }59 57 60 58 template<typename T> T* owner() const { return reinterpret_cast<T*>(m_owner); } … … 89 87 90 88 uint32_t m_length; 91 uint32_t m_mask;92 89 const TableElementType m_type; 93 90 const std::optional<uint32_t> m_maximum;
Note:
See TracChangeset
for help on using the changeset viewer.