Changeset 192292 in webkit
- Timestamp:
- Nov 10, 2015 9:10:43 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r192291 r192292 1 2015-11-10 Benjamin Poulain <bpoulain@apple.com> 2 3 Air should allocate registers 4 https://bugs.webkit.org/show_bug.cgi?id=150457 5 6 Reviewed by Filip Pizlo. 7 8 This is a direct implementation of the Iterated Register Coalescing allocator. 9 10 * JavaScriptCore.xcodeproj/project.pbxproj: 11 * b3/air/AirGenerate.cpp: 12 (JSC::B3::Air::generate): 13 * b3/air/AirInstInlines.h: 14 * b3/air/AirIteratedRegisterCoalescing.cpp: Added. 15 (JSC::B3::Air::MoveInstHelper<Arg::GP>::mayBeCoalescable): 16 (JSC::B3::Air::MoveInstHelper<Arg::FP>::mayBeCoalescable): 17 (JSC::B3::Air::AbsoluteTmpHelper<Arg::GP>::absoluteIndex): 18 (JSC::B3::Air::AbsoluteTmpHelper<Arg::GP>::tmpFromAbsoluteIndex): 19 (JSC::B3::Air::AbsoluteTmpHelper<Arg::FP>::absoluteIndex): 20 (JSC::B3::Air::AbsoluteTmpHelper<Arg::FP>::tmpFromAbsoluteIndex): 21 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::IteratedRegisterCoalescingAllocator): 22 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::build): 23 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::allocate): 24 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::getAlias): 25 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::spilledTmp): 26 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::allocatedReg): 27 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::tmpArraySize): 28 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::initializeDegrees): 29 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::addEdges): 30 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::addEdge): 31 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::makeWorkList): 32 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::simplify): 33 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::forEachAdjacent): 34 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::hasBeenSimplified): 35 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::decrementDegree): 36 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::forEachNodeMoves): 37 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::isMoveRelated): 38 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::enableMovesOnValue): 39 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::enableMovesOnValueAndAdjacents): 40 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::coalesce): 41 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::canBeSafelyCoalesced): 42 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::precoloredCoalescingHeuristic): 43 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::conservativeHeuristic): 44 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::addWorkList): 45 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::combine): 46 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::freeze): 47 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::freezeMoves): 48 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::selectSpill): 49 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::assignColors): 50 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::dumpInterferenceGraphInDot): 51 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::dumpWorkLists): 52 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdge::InterferenceEdge): 53 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdge::first): 54 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdge::second): 55 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdge::operator==): 56 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdge::isHashTableDeletedValue): 57 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdge::hash): 58 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdgeHash::hash): 59 (JSC::B3::Air::IteratedRegisterCoalescingAllocator::InterferenceEdgeHash::equal): 60 (JSC::B3::Air::isUselessMoveInst): 61 (JSC::B3::Air::assignRegisterToTmpInProgram): 62 (JSC::B3::Air::addSpillAndFillToProgram): 63 (JSC::B3::Air::iteratedRegisterCoalescingOnType): 64 (JSC::B3::Air::iteratedRegisterCoalescing): 65 * b3/air/AirIteratedRegisterCoalescing.h: Added. 66 * b3/air/AirTmp.h: 67 (JSC::B3::Air::Tmp::internalValue): 68 (JSC::B3::Air::Tmp::tmpForInternalValue): 69 * b3/testb3.cpp: 70 (JSC::B3::testSpillGP): 71 (JSC::B3::run): 72 1 73 2015-11-10 Filip Pizlo <fpizlo@apple.com> 2 74 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r192273 r192292 1075 1075 2600B5A6152BAAA70091EE5F /* JSStringJoiner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2600B5A4152BAAA70091EE5F /* JSStringJoiner.cpp */; }; 1076 1076 2600B5A7152BAAA70091EE5F /* JSStringJoiner.h in Headers */ = {isa = PBXBuildFile; fileRef = 2600B5A5152BAAA70091EE5F /* JSStringJoiner.h */; }; 1077 26718BA41BE99F780052017B /* AirIteratedRegisterCoalescing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26718BA21BE99F780052017B /* AirIteratedRegisterCoalescing.cpp */; }; 1078 26718BA51BE99F780052017B /* AirIteratedRegisterCoalescing.h in Headers */ = {isa = PBXBuildFile; fileRef = 26718BA31BE99F780052017B /* AirIteratedRegisterCoalescing.h */; }; 1077 1079 2A05ABD51961DF2400341750 /* JSPropertyNameEnumerator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2A05ABD31961DF2400341750 /* JSPropertyNameEnumerator.cpp */; }; 1078 1080 2A05ABD61961DF2400341750 /* JSPropertyNameEnumerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A05ABD41961DF2400341750 /* JSPropertyNameEnumerator.h */; }; … … 3084 3086 2600B5A5152BAAA70091EE5F /* JSStringJoiner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringJoiner.h; sourceTree = "<group>"; }; 3085 3087 264091FA1BE2FD4100684DB2 /* AirOpcode.opcodes */ = {isa = PBXFileReference; lastKnownFileType = text; name = AirOpcode.opcodes; path = b3/air/AirOpcode.opcodes; sourceTree = "<group>"; }; 3088 26718BA21BE99F780052017B /* AirIteratedRegisterCoalescing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirIteratedRegisterCoalescing.cpp; path = b3/air/AirIteratedRegisterCoalescing.cpp; sourceTree = "<group>"; }; 3089 26718BA31BE99F780052017B /* AirIteratedRegisterCoalescing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirIteratedRegisterCoalescing.h; path = b3/air/AirIteratedRegisterCoalescing.h; sourceTree = "<group>"; }; 3086 3090 2A05ABD31961DF2400341750 /* JSPropertyNameEnumerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPropertyNameEnumerator.cpp; sourceTree = "<group>"; }; 3087 3091 2A05ABD41961DF2400341750 /* JSPropertyNameEnumerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPropertyNameEnumerator.h; sourceTree = "<group>"; }; … … 4567 4571 0FEC855B1BDACDC70080FF74 /* AirInst.h */, 4568 4572 0FEC855C1BDACDC70080FF74 /* AirInstInlines.h */, 4573 26718BA21BE99F780052017B /* AirIteratedRegisterCoalescing.cpp */, 4574 26718BA31BE99F780052017B /* AirIteratedRegisterCoalescing.h */, 4569 4575 0FEC855D1BDACDC70080FF74 /* AirLiveness.h */, 4570 4576 264091FA1BE2FD4100684DB2 /* AirOpcode.opcodes */, … … 6653 6659 0FEC851A1BDACDAC0080FF74 /* B3GenericFrequentedBlock.h in Headers */, 6654 6660 0FEC85C31BE167A00080FF74 /* B3HeapRange.h in Headers */, 6661 26718BA51BE99F780052017B /* AirIteratedRegisterCoalescing.h in Headers */, 6655 6662 0FEC851B1BDACDAC0080FF74 /* B3IndexMap.h in Headers */, 6656 6663 0FEC851C1BDACDAC0080FF74 /* B3IndexSet.h in Headers */, … … 8910 8917 7B39F76D1B62DE2E00360FB4 /* WASMModuleParser.cpp in Sources */, 8911 8918 7B39F7721B63574D00360FB4 /* WASMReader.cpp in Sources */, 8919 26718BA41BE99F780052017B /* AirIteratedRegisterCoalescing.cpp in Sources */, 8912 8920 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */, 8913 8921 0F919D2515853CE0004A4E7D /* Watchpoint.cpp in Sources */, -
trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp
r192121 r192292 34 34 #include "AirGenerationContext.h" 35 35 #include "AirHandleCalleeSaves.h" 36 #include "AirIteratedRegisterCoalescing.h" 36 37 #include "AirReportUsedRegisters.h" 37 38 #include "AirSimplifyCFG.h" … … 69 70 // This is where we would have a real register allocator. Then, we could use spillEverything() 70 71 // in place of the register allocator only for testing. 71 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=150457 72 spillEverything(code); 72 iteratedRegisterCoalescing(code); 73 73 74 74 // Prior to this point the prologue and epilogue is implicit. This makes it explicit. It also -
trunk/Source/JavaScriptCore/b3/air/AirInstInlines.h
r192291 r192292 68 68 69 69 functor(stackSlot, role, type); 70 arg = Arg::stack(stackSlot );70 arg = Arg::stack(stackSlot, arg.offset()); 71 71 }); 72 72 } -
trunk/Source/JavaScriptCore/b3/air/AirTmp.h
r191705 r192292 173 173 return WTF::IntHash<int>::hash(m_value); 174 174 } 175 175 176 unsigned internalValue() const { return static_cast<unsigned>(m_value); } 177 178 static Tmp tmpForInternalValue(unsigned index) 179 { 180 Tmp result; 181 result.m_value = static_cast<int>(index); 182 return result; 183 } 184 176 185 private: 177 186 static int encodeGP(unsigned index) -
trunk/Source/JavaScriptCore/b3/testb3.cpp
r192257 r192292 1807 1807 CHECK(compileAndRun<int32_t>(proc, &value - 2, (sizeof(int32_t) * 2) >> logScale) == modelLoad<T>(value)); 1808 1808 } 1809 } 1810 1811 void testSpillGP() 1812 { 1813 Procedure proc; 1814 BasicBlock* root = proc.addBlock(); 1815 1816 Vector<Value*> sources; 1817 sources.append(root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0)); 1818 sources.append(root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)); 1819 1820 for (unsigned i = 0; i < 30; ++i) { 1821 sources.append( 1822 root->appendNew<Value>(proc, Add, Origin(), sources[sources.size() - 1], sources[sources.size() - 2]) 1823 ); 1824 } 1825 1826 Value* total = root->appendNew<Const64Value>(proc, Origin(), 0); 1827 for (Value* value : sources) 1828 total = root->appendNew<Value>(proc, Add, Origin(), total, value); 1829 1830 root->appendNew<ControlValue>(proc, Return, Origin(), total); 1831 compileAndRun<int>(proc, 1, 2); 1809 1832 } 1810 1833 … … 3303 3326 RUN(testLoad<uint16_t>(Load16Z, -1000000000)); 3304 3327 3328 RUN(testSpillGP()); 3329 3305 3330 RUN(testCallSimple(1, 2)); 3306 3331 RUN(testCallFunctionWithHellaArguments());
Note: See TracChangeset
for help on using the changeset viewer.