Changeset 249319 in webkit
- Timestamp:
- Aug 30, 2019 3:00:31 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r249317 r249319 1 2019-08-30 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] DFG ByteCodeParser should not copy JIT-related part of SimpleJumpTable 4 https://bugs.webkit.org/show_bug.cgi?id=201331 5 6 Reviewed by Mark Lam. 7 8 * stress/simple-jump-table-copy.js: Added. 9 (let.code): 10 (g2): 11 1 12 2019-08-30 Yusuke Suzuki <ysuzuki@apple.com> 2 13 -
trunk/Source/JavaScriptCore/ChangeLog
r249317 r249319 1 2019-08-30 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] DFG ByteCodeParser should not copy JIT-related part of SimpleJumpTable 4 https://bugs.webkit.org/show_bug.cgi?id=201331 5 6 Reviewed by Mark Lam. 7 8 SimpleJumpTable's non-JIT part is not changed after CodeBlock is finalized well. On the other hand, JIT related part is allocated on-demand. 9 For example, ctiOffsets can be grown by Baseline JIT compiler. There is race condition as follows. 10 11 1. DFG ByteCodeParser is inlining and copying SimpleJumpTable 12 2. Baseline JIT compiler is expanding JIT-related part of SimpleJumpTable 13 14 Then, (1) reads the broken Vector, and crashes. Since JIT-related part is unnecessary in (1), we should not clone that. 15 This patch adds CodeBlock::addSwitchJumpTableFromProfiledCodeBlock, which only copies non JIT-related part of the given SimpleJumpTable offered 16 by profiled CodeBlock. 17 18 * bytecode/CodeBlock.h: 19 (JSC::CodeBlock::addSwitchJumpTableFromProfiledCodeBlock): 20 * bytecode/JumpTable.h: 21 (JSC::SimpleJumpTable::cloneNonJITPart const): 22 (JSC::SimpleJumpTable::clear): 23 * dfg/DFGByteCodeParser.cpp: 24 (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry): 25 1 26 2019-08-30 Yusuke Suzuki <ysuzuki@apple.com> 2 27 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r249175 r249319 599 599 m_rareData->m_switchJumpTables.clear(); 600 600 } 601 #if ENABLE(DFG_JIT) 602 void addSwitchJumpTableFromProfiledCodeBlock(SimpleJumpTable& profiled) 603 { 604 createRareDataIfNecessary(); 605 m_rareData->m_switchJumpTables.append(profiled.cloneNonJITPart()); 606 } 607 #endif 601 608 602 609 size_t numberOfStringSwitchJumpTables() const { return m_rareData ? m_rareData->m_stringSwitchJumpTables.size() : 0; } -
trunk/Source/JavaScriptCore/bytecode/JumpTable.h
r230748 r249319 78 78 79 79 struct SimpleJumpTable { 80 // FIXME: The two Vectors can be combin d into one Vector<OffsetLocation>80 // FIXME: The two Vectors can be combined into one Vector<OffsetLocation> 81 81 Vector<int32_t> branchOffsets; 82 int32_t min ;82 int32_t min { INT32_MIN }; 83 83 #if ENABLE(JIT) 84 84 Vector<CodeLocationLabel<JSSwitchPtrTag>> ctiOffsets; 85 85 CodeLocationLabel<JSSwitchPtrTag> ctiDefault; 86 #endif 87 88 #if ENABLE(DFG_JIT) 89 // JIT part can be later expanded without taking a lock while non-JIT part is stable after CodeBlock is finalized. 90 SimpleJumpTable cloneNonJITPart() const 91 { 92 SimpleJumpTable result; 93 result.branchOffsets = branchOffsets; 94 result.min = min; 95 return result; 96 } 86 97 #endif 87 98 … … 107 118 } 108 119 #endif 109 120 121 #if ENABLE(DFG_JIT) 110 122 void clear() 111 123 { 112 124 branchOffsets.clear(); 113 #if ENABLE(JIT)114 125 ctiOffsets.clear(); 126 } 115 127 #endif 116 }117 128 }; 118 129 -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r249317 r249319 7117 7117 for (unsigned i = 0; i < codeBlock->numberOfSwitchJumpTables(); ++i) { 7118 7118 m_switchRemap[i] = byteCodeParser->m_codeBlock->numberOfSwitchJumpTables(); 7119 byteCodeParser->m_codeBlock->addSwitchJumpTable () = codeBlock->switchJumpTable(i);7119 byteCodeParser->m_codeBlock->addSwitchJumpTableFromProfiledCodeBlock(codeBlock->switchJumpTable(i)); 7120 7120 } 7121 7121 } else {
Note: See TracChangeset
for help on using the changeset viewer.