|
| 1 | +2021-04-11 Yusuke Suzuki <ysuzuki@apple.com> |
| 2 | + |
| 3 | + [JSC] Do not copy StringSwitchJumpTable |
| 4 | + https://bugs.webkit.org/show_bug.cgi?id=224414 |
| 5 | + |
| 6 | + Reviewed by Keith Miller. |
| 7 | + |
| 8 | + Previously, we were copying UnlinkedStringJumpTable to CodeBlock's StringJumpTable because we embed CodeLocation pointer |
| 9 | + inside CodeBlock's StringJumpTable. This is copying a mostly identical hashtable to each CodeBlock even in DFG and FTL. This |
| 10 | + even prevents us from inlining op_switch_string in DFG and FTL because (1) we don't want to copy this string tables collected from |
| 11 | + each inlined CodeBlock into a new DFG / FTL CodeBlock and (2) we cannot ref/deref StringImpl inside DFG / FTL compilers so copying |
| 12 | + these tables in the compiler threads need additional "DesiredStringSwitchJumpTable" etc. |
| 13 | + |
| 14 | + In this patch, we stop copying StringSwitchJumpTable. We decouple CodeLocation pointers from the hashtable so that we can use |
| 15 | + UnlinkedStringJumpTable in UnlinkedCodeBlock. UnlinkedStringJumpTable's hashtable inclues m_indexInTable in each entry so that |
| 16 | + we can have array of CodeLocation pointers in CodeBlock's JITData to have JIT jump targets separately. This design prevents us |
| 17 | + from copying unnecessary hashtables, and even this paves the way to inlining switch_string in DFG and FTL. |
| 18 | + |
| 19 | + * bytecode/BytecodeDumper.cpp: |
| 20 | + (JSC::CodeBlockBytecodeDumper<Block>::dumpStringSwitchJumpTables): |
| 21 | + * bytecode/CodeBlock.cpp: |
| 22 | + (JSC::CodeBlock::finishCreation): |
| 23 | + (JSC::CodeBlock::shrinkToFit): |
| 24 | + * bytecode/CodeBlock.h: |
| 25 | + (JSC::CodeBlock::stringSwitchJumpTable): |
| 26 | + (JSC::CodeBlock::numberOfUnlinkedStringSwitchJumpTables const): |
| 27 | + (JSC::CodeBlock::unlinkedStringSwitchJumpTable): |
| 28 | + (JSC::CodeBlock::numberOfStringSwitchJumpTables const): Deleted. |
| 29 | + * bytecode/JumpTable.h: |
| 30 | + (JSC::StringJumpTable::ctiForValue const): |
| 31 | + (JSC::StringJumpTable::offsetForValue): Deleted. |
| 32 | + (JSC::StringJumpTable::ctiForValue): Deleted. |
| 33 | + (JSC::StringJumpTable::clear): Deleted. |
| 34 | + * bytecode/PreciseJumpTargetsInlines.h: |
| 35 | + * bytecode/UnlinkedCodeBlock.h: |
| 36 | + (JSC::UnlinkedStringJumpTable::offsetForValue const): |
| 37 | + (JSC::UnlinkedCodeBlock::numberOfUnlinkedStringSwitchJumpTables const): |
| 38 | + (JSC::UnlinkedCodeBlock::unlinkedStringSwitchJumpTable): |
| 39 | + (JSC::UnlinkedStringJumpTable::offsetForValue): Deleted. |
| 40 | + (JSC::UnlinkedCodeBlock::numberOfStringSwitchJumpTables const): Deleted. |
| 41 | + (JSC::UnlinkedCodeBlock::stringSwitchJumpTable): Deleted. |
| 42 | + * bytecode/UnlinkedCodeBlockGenerator.cpp: |
| 43 | + (JSC::UnlinkedCodeBlockGenerator::finalize): |
| 44 | + * bytecode/UnlinkedCodeBlockGenerator.h: |
| 45 | + (JSC::UnlinkedCodeBlockGenerator::numberOfUnlinkedStringSwitchJumpTables const): |
| 46 | + (JSC::UnlinkedCodeBlockGenerator::addUnlinkedStringSwitchJumpTable): |
| 47 | + (JSC::UnlinkedCodeBlockGenerator::unlinkedStringSwitchJumpTable): |
| 48 | + (JSC::UnlinkedCodeBlockGenerator::numberOfStringSwitchJumpTables const): Deleted. |
| 49 | + (JSC::UnlinkedCodeBlockGenerator::addStringSwitchJumpTable): Deleted. |
| 50 | + (JSC::UnlinkedCodeBlockGenerator::stringSwitchJumpTable): Deleted. |
| 51 | + * bytecompiler/BytecodeGenerator.cpp: |
| 52 | + (JSC::BytecodeGenerator::beginSwitch): |
| 53 | + (JSC::prepareJumpTableForStringSwitch): |
| 54 | + (JSC::BytecodeGenerator::endSwitch): |
| 55 | + * dfg/DFGByteCodeParser.cpp: |
| 56 | + (JSC::DFG::ByteCodeParser::parseBlock): |
| 57 | + * dfg/DFGJITCompiler.cpp: |
| 58 | + (JSC::DFG::JITCompiler::link): |
| 59 | + * dfg/DFGOperations.cpp: |
| 60 | + (JSC::DFG::JSC_DEFINE_JIT_OPERATION): |
| 61 | + * ftl/FTLLowerDFGToB3.cpp: |
| 62 | + (JSC::FTL::DFG::LowerDFGToB3::switchStringSlow): |
| 63 | + * ftl/FTLOperations.cpp: |
| 64 | + (JSC::FTL::JSC_DEFINE_JIT_OPERATION): |
| 65 | + * jit/JIT.cpp: |
| 66 | + (JSC::JIT::link): |
| 67 | + * jit/JIT.h: |
| 68 | + (JSC::SwitchRecord::SwitchRecord): |
| 69 | + * jit/JITOpcodes.cpp: |
| 70 | + (JSC::JIT::emit_op_switch_string): |
| 71 | + * jit/JITOpcodes32_64.cpp: |
| 72 | + (JSC::JIT::emit_op_switch_string): |
| 73 | + * jit/JITOperations.cpp: |
| 74 | + (JSC::JSC_DEFINE_JIT_OPERATION): |
| 75 | + * llint/LLIntSlowPaths.cpp: |
| 76 | + (JSC::LLInt::LLINT_SLOW_PATH_DECL): |
| 77 | + * runtime/CachedTypes.cpp: |
| 78 | + (JSC::CachedStringJumpTable::encode): |
| 79 | + (JSC::CachedStringJumpTable::decode const): |
| 80 | + (JSC::CachedCodeBlockRareData::encode): |
| 81 | + (JSC::CachedCodeBlockRareData::decode const): |
| 82 | + |
1 | 83 | 2021-04-10 Yusuke Suzuki <ysuzuki@apple.com> |
2 | 84 |
|
3 | 85 | [JSC] B3 reduce-double-to-float should reduce only when constant double is canonical one to reduced float value |
|
0 commit comments