Changeset 293265 in webkit
- Timestamp:
- Apr 22, 2022, 4:21:38 PM (4 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
wasm/WasmSlowPaths.cpp (modified) (2 diffs)
-
wasm/WasmTypeDefinition.h (modified) (2 diffs)
-
wasm/WasmTypeDefinitionInlines.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r293252 r293265 1 2022-04-22 Dmitry Bezhetskov <dbezhetskov@igalia.com> 2 3 [Refactoring] Reduce number of const and reinterpret casts 4 https://bugs.webkit.org/show_bug.cgi?id=239648 5 6 Reviewed by Yusuke Suzuki. 7 8 The statement 9 "reinterpret_cast<TypeDefinition*>(const_cast<char*>(functionType.m_payload) 10 - sizeof(TypeDefinition))" 11 is dangerous and it produces warning on some platfroms. 12 There is way to avoid it and this patch is doint that. 13 14 * wasm/WasmSlowPaths.cpp: 15 (JSC::LLInt::doWasmCallIndirect): 16 (JSC::LLInt::doWasmCallRef): 17 * wasm/WasmTypeDefinition.h: 18 (JSC::Wasm::FunctionSignature::operator== const): 19 * wasm/WasmTypeDefinitionInlines.h: 20 1 21 2022-04-22 Geza Lore <glore@igalia.com> 2 22 -
trunk/Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
r292929 r293265 501 501 502 502 const auto& callSignature = CALLEE()->signature(typeIndex); 503 if ( function.typeIndex != Wasm::TypeInformation::get(callSignature))503 if (callSignature != Wasm::TypeInformation::getFunctionSignature(function.typeIndex)) 504 504 WASM_THROW(Wasm::ExceptionType::BadSignature); 505 505 … … 542 542 calleeInstance->setCachedStackLimit(callerInstance->cachedStackLimit()); 543 543 544 ASSERT( function.typeIndex == Wasm::TypeInformation::get(CALLEE()->signature(typeIndex)));544 ASSERT(Wasm::TypeInformation::getFunctionSignature(function.typeIndex) == CALLEE()->signature(typeIndex)); 545 545 UNUSED_PARAM(typeIndex); 546 546 WASM_CALL_RETURN(calleeInstance, function.entrypointLoadLocation->executableAddress(), WasmEntryPtrTag); -
trunk/Source/JavaScriptCore/wasm/WasmTypeDefinition.h
r292773 r293265 61 61 Type argumentType(FunctionArgCount i) const { return const_cast<FunctionSignature*>(this)->getArgumentType(i); } 62 62 63 bool operator==(const FunctionSignature& other) const 64 { 65 // Function signatures are unique because it is just an view class over TypeDefinition and 66 // so, we can compare two signatures with just payload pointers comparision. 67 // Other checks probably aren't necessary but it's good to be paranoid. 68 return m_payload == other.m_payload && m_argCount == other.m_argCount && m_retCount == other.m_retCount; 69 } 70 63 71 WTF::String toString() const; 64 72 void dump(WTF::PrintStream& out) const; … … 218 226 static TypeIndex get(const TypeDefinition&); 219 227 220 static TypeIndex get(const FunctionSignature&);221 228 static const FunctionSignature& getFunctionSignature(TypeIndex); 222 229 -
trunk/Source/JavaScriptCore/wasm/WasmTypeDefinitionInlines.h
r292773 r293265 65 65 } 66 66 67 inline TypeIndex TypeInformation::get(const FunctionSignature& functionType)68 {69 return get(*reinterpret_cast<TypeDefinition*>(const_cast<char*>(functionType.m_payload) - sizeof(TypeDefinition)));70 }71 72 67 } } // namespace JSC::Wasm 73 68
Note:
See TracChangeset
for help on using the changeset viewer.