[webkit-reviews] review granted: [Bug 204028] [WebAssembly] LLIntGenerator should not retain VirtualRegisters used for constants : [Attachment 383188] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 8 17:57:41 PST 2019
Yusuke Suzuki <ysuzuki at apple.com> has granted Tadeu Zagallo
<tzagallo at apple.com>'s request for review:
Bug 204028: [WebAssembly] LLIntGenerator should not retain VirtualRegisters
used for constants
https://bugs.webkit.org/show_bug.cgi?id=204028
Attachment 383188: Patch
https://bugs.webkit.org/attachment.cgi?id=383188&action=review
--- Comment #6 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 383188
--> https://bugs.webkit.org/attachment.cgi?id=383188
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=383188&action=review
r=me with nit.
> Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp:510
> + if (auto it = m_constantMap.find(value); it != m_constantMap.end())
> + source = it->second;
> + else {
> + source = VirtualRegister(FirstConstantRegisterIndex +
m_codeBlock->m_constants.size());
> + m_codeBlock->m_constants.append(value);
> + m_constantMap.emplace(value, source);
> + }
We are looking up dictionary twice and it is unnecessary, (1) one for
m_constantMap.find, and (2) one for m_constantMap.emplace.
You can use the return-value of std::unrodered_map::emplace to avoid looking up
unordered_map twice here, since emplace does nothing if entry already exists.
More information about the webkit-reviews
mailing list