Changeset 258965 in webkit
- Timestamp:
- Mar 24, 2020, 5:51:44 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/wasm/stress/terminal-jump-switch-target.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r258963 r258965 1 2020-03-24 Tadeu Zagallo <tzagallo@apple.com> 2 3 LLIntGenerator must link switch jumps to otherwise redundant labels 4 https://bugs.webkit.org/show_bug.cgi?id=209333 5 <rdar://problem/60827987> 6 7 Reviewed by Saam Barati. 8 9 * wasm/stress/terminal-jump-switch-target.js: Added. 10 1 11 2020-03-24 Alexey Shvayka <shvaikalesh@gmail.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r258964 r258965 1 2020-03-24 Tadeu Zagallo <tzagallo@apple.com> 2 3 LLIntGenerator must link switch jumps to otherwise redundant labels 4 https://bugs.webkit.org/show_bug.cgi?id=209333 5 <rdar://problem/60827987> 6 7 Reviewed by Saam Barati. 8 9 The LLIntGenerator optimizes jumps at the end of blocks. It does so when a block ends, by checking if 10 the last instruction emitted was a jump, if it pointed to the end of the current block and if it was 11 the only jump that pointed there. If all those conditions are satisfied, the jump is removed and it's 12 not necessary to emit the label at the end of block, since the only jump that pointed to it was removed. 13 However, switches (br_table) are handled specially by the LLIntGenerator and therefore are not counted 14 in Label::unresolvedJumps, which was used to check whether we could skip emitting the label. 15 The end result is that we might skip linking a switch jump if it points to a block that ends with a jump. 16 17 18 * wasm/WasmLLIntGenerator.cpp: 19 (JSC::Wasm::LLIntGenerator::addEndToUnreachable): 20 (JSC::Wasm::LLIntGenerator::linkSwitchTargets): 21 (JSC::GenericLabel<Wasm::GeneratorTraits>::setLocation): 22 1 23 2020-03-24 Saam Barati <sbarati@apple.com> 2 24 -
trunk/Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
r254735 r258965 260 260 LLIntCallInformation callInformationForCaller(const Signature&); 261 261 Vector<VirtualRegister, 2> callInformationForCallee(const Signature&); 262 void linkSwitchTargets(Label&, unsigned location); 262 263 263 264 VirtualRegister virtualRegisterForWasmLocal(uint32_t index) … … 992 993 993 994 if (m_lastOpcodeID == wasm_jmp && data.m_continuation->unresolvedJumps().size() == 1 && data.m_continuation->unresolvedJumps()[0] == static_cast<int>(m_lastInstruction.offset())) { 995 linkSwitchTargets(*data.m_continuation, m_lastInstruction.offset()); 994 996 m_lastOpcodeID = wasm_unreachable; 995 997 m_writer.rewind(m_lastInstruction); … … 1211 1213 } 1212 1214 1215 void LLIntGenerator::linkSwitchTargets(Label& label, unsigned location) 1216 { 1217 auto it = m_switches.find(&label); 1218 if (it != m_switches.end()) { 1219 for (const auto& entry : it->value) { 1220 ASSERT(!*entry.jumpTarget); 1221 *entry.jumpTarget = location - entry.offset; 1222 } 1223 m_switches.remove(it); 1224 } 1225 } 1226 1213 1227 } 1214 1228 … … 1221 1235 1222 1236 Wasm::LLIntGenerator* llintGenerator = static_cast<Wasm::LLIntGenerator*>(&generator); 1223 1224 auto it = llintGenerator->m_switches.find(this); 1225 if (it != llintGenerator->m_switches.end()) { 1226 for (const auto& entry : it->value) { 1227 ASSERT(!*entry.jumpTarget); 1228 *entry.jumpTarget = m_location - entry.offset; 1229 } 1230 llintGenerator->m_switches.remove(it); 1231 } 1232 1237 llintGenerator->linkSwitchTargets(*this, m_location); 1233 1238 1234 1239 for (auto offset : m_unresolvedJumps) {
Note:
See TracChangeset
for help on using the changeset viewer.