Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (214108 => 214109)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2017-03-17 17:58:18 UTC (rev 214109)
@@ -78,6 +78,7 @@
b3/air/AirArg.cpp
b3/air/AirBasicBlock.cpp
b3/air/AirBlockInsertionSet.cpp
+ b3/air/AirBreakCriticalEdges.cpp
b3/air/AirCCallSpecial.cpp
b3/air/AirCCallingConvention.cpp
b3/air/AirCode.cpp
Modified: trunk/Source/_javascript_Core/ChangeLog (214108 => 214109)
--- trunk/Source/_javascript_Core/ChangeLog 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-03-17 17:58:18 UTC (rev 214109)
@@ -1,3 +1,39 @@
+2017-03-11 Filip Pizlo <[email protected]>
+
+ Air should be powerful enough to support Tmp-splitting
+ https://bugs.webkit.org/show_bug.cgi?id=169515
+
+ Reviewed by Saam Barati.
+
+ In the process of implementing the Tmp-splitting optimization, I made some small
+ clean-ups. They don't affect anything - it's basically moving code around and adding
+ utility functions.
+
+ * CMakeLists.txt:
+ * _javascript_Core.xcodeproj/project.pbxproj:
+ * assembler/LinkBuffer.cpp:
+ (JSC::LinkBuffer::allocate): testb3 was sometimes failing its checkDoesNotUseInstruction check because of uninitialized memory. This initializes the internal fragmentation slop of every JIT allocation.
+ * b3/air/AirAllocateRegistersByGraphColoring.cpp:
+ * b3/air/AirAllocateRegistersByGraphColoring.h:
+ (JSC::B3::Air::useIRC): It's useful to be able to query which register allocator we're using.
+ * b3/air/AirArg.cpp:
+ (WTF::printInternal):
+ * b3/air/AirArg.h:
+ (JSC::B3::Air::Arg::temperature): The temperature of a role is a useful concept to have factored out.
+ * b3/air/AirBreakCriticalEdges.cpp: Added.
+ (JSC::B3::Air::breakCriticalEdges): I was surprised that we didn't have this already. It's a pretty fundamental CFG utility.
+ * b3/air/AirBreakCriticalEdges.h: Added.
+ * b3/air/AirGenerate.cpp:
+ * b3/air/AirInsertionSet.h: You can't use & if you want copy-constructibility, which seems to be a prerequisite to IndexMap<BasicBlock, InsertionSet>.
+ (JSC::B3::Air::InsertionSet::InsertionSet):
+ (JSC::B3::Air::InsertionSet::code):
+ * b3/air/AirLiveness.h: Teach Liveness to track only warm liveness.
+ (JSC::B3::Air::TmpLivenessAdapter::acceptsRole):
+ (JSC::B3::Air::StackSlotLivenessAdapter::acceptsRole):
+ (JSC::B3::Air::RegLivenessAdapter::acceptsRole):
+ (JSC::B3::Air::AbstractLiveness::AbstractLiveness):
+ (JSC::B3::Air::AbstractLiveness::LocalCalc::execute):
+
2017-03-16 Mark Lam <[email protected]>
Fix exception scope verification failures in GenericArgumentsInlines.h.
Modified: trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj (214108 => 214109)
--- trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/_javascript_Core.xcodeproj/project.pbxproj 2017-03-17 17:58:18 UTC (rev 214109)
@@ -533,6 +533,8 @@
0F766D3815AE4A1C008F363E /* StructureStubClearingWatchpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F766D3615AE4A1A008F363E /* StructureStubClearingWatchpoint.cpp */; };
0F766D3915AE4A1F008F363E /* StructureStubClearingWatchpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F7700921402FF3C0078EB39 /* SamplingCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7700911402FF280078EB39 /* SamplingCounter.cpp */; };
+ 0F79C7C91E74C93900EB34D1 /* AirBreakCriticalEdges.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F79C7C51E74C93600EB34D1 /* AirBreakCriticalEdges.cpp */; };
+ 0F79C7CA1E74C93B00EB34D1 /* AirBreakCriticalEdges.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F79C7C61E74C93600EB34D1 /* AirBreakCriticalEdges.h */; };
0F7B294B14C3CD2F007C3DB1 /* DFGCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E1F14172C2F00179C94 /* DFGCapabilities.h */; };
0F7B294D14C3CD4C007C3DB1 /* DFGCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FC0977E1469EBC400CF2442 /* DFGCommon.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F7C39FB1C8F629300480151 /* RegExpInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7C39FA1C8F629300480151 /* RegExpInlines.h */; };
@@ -3041,6 +3043,8 @@
0F766D3715AE4A1A008F363E /* StructureStubClearingWatchpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StructureStubClearingWatchpoint.h; sourceTree = "<group>"; };
0F77008E1402FDD60078EB39 /* SamplingCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingCounter.h; sourceTree = "<group>"; };
0F7700911402FF280078EB39 /* SamplingCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SamplingCounter.cpp; sourceTree = "<group>"; };
+ 0F79C7C51E74C93600EB34D1 /* AirBreakCriticalEdges.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AirBreakCriticalEdges.cpp; path = b3/air/AirBreakCriticalEdges.cpp; sourceTree = "<group>"; };
+ 0F79C7C61E74C93600EB34D1 /* AirBreakCriticalEdges.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AirBreakCriticalEdges.h; path = b3/air/AirBreakCriticalEdges.h; sourceTree = "<group>"; };
0F7C39FA1C8F629300480151 /* RegExpInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpInlines.h; sourceTree = "<group>"; };
0F7C39FC1C8F659500480151 /* RegExpObjectInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpObjectInlines.h; sourceTree = "<group>"; };
0F7C39FE1C90C55B00480151 /* DFGOpInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOpInfo.h; path = dfg/DFGOpInfo.h; sourceTree = "<group>"; };
@@ -5519,6 +5523,8 @@
0F2C63B91E63440800C13839 /* AirBlockInsertionSet.cpp */,
0F2C63BA1E63440800C13839 /* AirBlockInsertionSet.h */,
0FB3878B1BFBC44D00E3AB1E /* AirBlockWorklist.h */,
+ 0F79C7C51E74C93600EB34D1 /* AirBreakCriticalEdges.cpp */,
+ 0F79C7C61E74C93600EB34D1 /* AirBreakCriticalEdges.h */,
0F6183201C45BF070072450B /* AirCCallingConvention.cpp */,
0F6183211C45BF070072450B /* AirCCallingConvention.h */,
0FEC854E1BDACDC70080FF74 /* AirCCallSpecial.cpp */,
@@ -9297,6 +9303,7 @@
FE3022D71E42857300BAC493 /* VMInspector.h in Headers */,
53F40E931D5A4AB30099A1B6 /* WasmB3IRGenerator.h in Headers */,
AD4B1DFA1DF244E20071AE32 /* WasmBinding.h in Headers */,
+ 0F79C7CA1E74C93B00EB34D1 /* AirBreakCriticalEdges.h in Headers */,
53FD04D41D7AB291003287D3 /* WasmCallingConvention.h in Headers */,
79DAE27A1E03C82200B526AA /* WasmExceptionType.h in Headers */,
7BC547D31B6959A100959B58 /* WasmFormat.h in Headers */,
@@ -9980,6 +9987,7 @@
0F6B8ADC1C4EFAC300969052 /* B3SSACalculator.cpp in Sources */,
0F33FCF71C136E2500323F67 /* B3StackmapGenerationParams.cpp in Sources */,
0FEC85301BDACDAC0080FF74 /* B3StackmapSpecial.cpp in Sources */,
+ 0F79C7C91E74C93900EB34D1 /* AirBreakCriticalEdges.cpp in Sources */,
0F338DF11BE93AD10013C88F /* B3StackmapValue.cpp in Sources */,
0F9495871C57F47500413A48 /* B3StackSlot.cpp in Sources */,
0FEC85371BDACDAC0080FF74 /* B3SwitchCase.cpp in Sources */,
Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp (214108 => 214109)
--- trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp 2017-03-17 17:58:18 UTC (rev 214109)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -237,6 +237,11 @@
return;
}
+ while (initialSize % jitAllocationGranule) {
+ macroAssembler.breakpoint();
+ initialSize = macroAssembler.m_assembler.codeSize();
+ }
+
ASSERT(m_vm != nullptr);
m_executableMemory = m_vm->executableAllocator.allocate(*m_vm, initialSize, ownerUID, effort);
if (!m_executableMemory)
Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp (214108 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.cpp 2017-03-17 17:58:18 UTC (rev 214109)
@@ -1849,11 +1849,11 @@
};
bool done;
- if ((isARM64() || Options::airForceBriggsAllocator()) && !Options::airForceIRCAllocator()) {
- ColoringAllocator<bank, Briggs> allocator(m_code, m_tmpWidth, m_useCounts, unspillableTmps);
+ if (useIRC()) {
+ ColoringAllocator<bank, IRC> allocator(m_code, m_tmpWidth, m_useCounts, unspillableTmps);
done = doAllocation(allocator);
} else {
- ColoringAllocator<bank, IRC> allocator(m_code, m_tmpWidth, m_useCounts, unspillableTmps);
+ ColoringAllocator<bank, Briggs> allocator(m_code, m_tmpWidth, m_useCounts, unspillableTmps);
done = doAllocation(allocator);
}
if (done)
Modified: trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.h (214108 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.h 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/b3/air/AirAllocateRegistersByGraphColoring.h 2017-03-17 17:58:18 UTC (rev 214109)
@@ -27,10 +27,19 @@
#if ENABLE(B3_JIT)
+#include "CPU.h"
+#include "Options.h"
+
namespace JSC { namespace B3 { namespace Air {
class Code;
+inline bool useIRC()
+{
+ return Options::airForceIRCAllocator()
+ || (!isARM64() && !Options::airForceBriggsAllocator());
+}
+
// We have two register allocators, both fundamentally derived from Chaitin's Yorktown
// allocator:
// http://cs.gmu.edu/~white/CS640/p98-chaitin.pdf
Modified: trunk/Source/_javascript_Core/b3/air/AirArg.cpp (214108 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirArg.cpp 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/b3/air/AirArg.cpp 2017-03-17 17:58:18 UTC (rev 214109)
@@ -268,6 +268,20 @@
RELEASE_ASSERT_NOT_REACHED();
}
+void printInternal(PrintStream& out, Arg::Temperature temperature)
+{
+ switch (temperature) {
+ case Arg::Cold:
+ out.print("Cold");
+ return;
+ case Arg::Warm:
+ out.print("Warm");
+ return;
+ }
+
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
void printInternal(PrintStream& out, Arg::Role role)
{
switch (role) {
Modified: trunk/Source/_javascript_Core/b3/air/AirArg.h (214108 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirArg.h 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/b3/air/AirArg.h 2017-03-17 17:58:18 UTC (rev 214109)
@@ -87,6 +87,11 @@
Special,
WidthArg
};
+
+ enum Temperature : int8_t {
+ Cold,
+ Warm
+ };
enum Role : int8_t {
// Use means that the Inst will read from this value before doing anything else.
@@ -243,6 +248,11 @@
}
ASSERT_NOT_REACHED();
}
+
+ static Temperature temperature(Role role)
+ {
+ return isColdUse(role) ? Cold : Warm;
+ }
// Returns true if the Role implies that the Inst will Use the Arg before doing anything else.
static bool isEarlyUse(Role role)
@@ -1343,6 +1353,7 @@
namespace WTF {
JS_EXPORT_PRIVATE void printInternal(PrintStream&, JSC::B3::Air::Arg::Kind);
+JS_EXPORT_PRIVATE void printInternal(PrintStream&, JSC::B3::Air::Arg::Temperature);
JS_EXPORT_PRIVATE void printInternal(PrintStream&, JSC::B3::Air::Arg::Role);
JS_EXPORT_PRIVATE void printInternal(PrintStream&, JSC::B3::Air::Arg::Signedness);
Added: trunk/Source/_javascript_Core/b3/air/AirBreakCriticalEdges.cpp (0 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirBreakCriticalEdges.cpp (rev 0)
+++ trunk/Source/_javascript_Core/b3/air/AirBreakCriticalEdges.cpp 2017-03-17 17:58:18 UTC (rev 214109)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AirBreakCriticalEdges.h"
+
+#if ENABLE(B3_JIT)
+
+#include "AirBlockInsertionSet.h"
+#include "AirCode.h"
+#include "AirInstInlines.h"
+
+namespace JSC { namespace B3 { namespace Air {
+
+void breakCriticalEdges(Code& code)
+{
+ BlockInsertionSet insertionSet(code);
+
+ for (BasicBlock* block : code) {
+ if (block->numSuccessors() <= 1)
+ continue;
+
+ for (BasicBlock*& successor : block->successorBlocks()) {
+ if (successor->numPredecessors() <= 1)
+ continue;
+
+ BasicBlock* pad = insertionSet.insertBefore(successor, successor->frequency());
+ pad->append(Jump, successor->at(0).origin);
+ pad->setSuccessors(successor);
+ pad->addPredecessor(block);
+ successor->replacePredecessor(block, pad);
+ successor = pad;
+ }
+ }
+
+ insertionSet.execute();
+}
+
+} } } // namespace JSC::B3::Air
+
+#endif // ENABLE(B3_JIT)
+
Added: trunk/Source/_javascript_Core/b3/air/AirBreakCriticalEdges.h (0 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirBreakCriticalEdges.h (rev 0)
+++ trunk/Source/_javascript_Core/b3/air/AirBreakCriticalEdges.h 2017-03-17 17:58:18 UTC (rev 214109)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(B3_JIT)
+
+namespace JSC { namespace B3 { namespace Air {
+
+class Code;
+
+void breakCriticalEdges(Code&);
+
+} } } // namespace JSC::B3::Air
+
+#endif // ENABLE(B3_JIT)
+
Modified: trunk/Source/_javascript_Core/b3/air/AirInsertionSet.h (214108 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirInsertionSet.h 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/b3/air/AirInsertionSet.h 2017-03-17 17:58:18 UTC (rev 214109)
@@ -41,11 +41,11 @@
class InsertionSet {
public:
InsertionSet(Code& code)
- : m_code(code)
+ : m_code(&code)
{
}
- Code& code() { return m_code; }
+ Code& code() { return *m_code; }
template<typename T>
void appendInsertion(T&& insertion)
@@ -76,7 +76,7 @@
void execute(BasicBlock*);
private:
- Code& m_code;
+ Code* m_code; // Pointer so that this can be copied.
Vector<Insertion, 8> m_insertions;
};
Modified: trunk/Source/_javascript_Core/b3/air/AirLiveness.h (214108 => 214109)
--- trunk/Source/_javascript_Core/b3/air/AirLiveness.h 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/_javascript_Core/b3/air/AirLiveness.h 2017-03-17 17:58:18 UTC (rev 214109)
@@ -39,7 +39,7 @@
namespace JSC { namespace B3 { namespace Air {
-template<Bank adapterBank>
+template<Bank adapterBank, Arg::Temperature minimumTemperature = Arg::Cold>
struct TmpLivenessAdapter {
typedef Tmp Thing;
typedef HashSet<unsigned> IndexSet;
@@ -52,6 +52,7 @@
return AbsoluteTmpMapper<adapterBank>::absoluteIndex(numTmps);
}
static bool acceptsBank(Bank bank) { return bank == adapterBank; }
+ static bool acceptsRole(Arg::Role role) { return Arg::temperature(role) >= minimumTemperature; }
static unsigned valueToIndex(Tmp tmp) { return AbsoluteTmpMapper<adapterBank>::absoluteIndex(tmp); }
static Tmp indexToValue(unsigned index) { return AbsoluteTmpMapper<adapterBank>::tmpFromAbsoluteIndex(index); }
};
@@ -70,6 +71,7 @@
return code.stackSlots().size();
}
static bool acceptsBank(Bank) { return true; }
+ static bool acceptsRole(Arg::Role) { return true; }
static unsigned valueToIndex(StackSlot* stackSlot) { return stackSlot->index(); }
StackSlot* indexToValue(unsigned index) { return m_code.stackSlots()[index]; }
@@ -89,6 +91,7 @@
}
static bool acceptsBank(Bank) { return true; }
+ static bool acceptsRole(Arg::Role) { return true; }
static unsigned valueToIndex(Reg reg) { return reg.index(); }
Reg indexToValue(unsigned index) { return Reg::fromIndex(index); }
};
@@ -111,7 +114,9 @@
block->last().forEach<typename Adapter::Thing>(
[&] (typename Adapter::Thing& thing, Arg::Role role, Bank bank, Width) {
- if (Arg::isLateUse(role) && Adapter::acceptsBank(bank))
+ if (Arg::isLateUse(role)
+ && Adapter::acceptsBank(bank)
+ && Adapter::acceptsRole(role))
liveAtTail.add(Adapter::valueToIndex(thing));
});
}
@@ -140,7 +145,9 @@
// Handle the early def's of the first instruction.
block->at(0).forEach<typename Adapter::Thing>(
[&] (typename Adapter::Thing& thing, Arg::Role role, Bank bank, Width) {
- if (Arg::isEarlyDef(role) && Adapter::acceptsBank(bank))
+ if (Arg::isEarlyDef(role)
+ && Adapter::acceptsBank(bank)
+ && Adapter::acceptsRole(role))
m_workset.remove(Adapter::valueToIndex(thing));
});
@@ -255,7 +262,9 @@
Inst& nextInst = m_block->at(instIndex + 1);
nextInst.forEach<typename Adapter::Thing>(
[&] (typename Adapter::Thing& thing, Arg::Role role, Bank bank, Width) {
- if (Arg::isEarlyDef(role) && Adapter::acceptsBank(bank))
+ if (Arg::isEarlyDef(role)
+ && Adapter::acceptsBank(bank)
+ && Adapter::acceptsRole(role))
workset.remove(Adapter::valueToIndex(thing));
});
}
@@ -263,7 +272,9 @@
// Then handle def's.
inst.forEach<typename Adapter::Thing>(
[&] (typename Adapter::Thing& thing, Arg::Role role, Bank bank, Width) {
- if (Arg::isLateDef(role) && Adapter::acceptsBank(bank))
+ if (Arg::isLateDef(role)
+ && Adapter::acceptsBank(bank)
+ && Adapter::acceptsRole(role))
workset.remove(Adapter::valueToIndex(thing));
});
@@ -270,7 +281,9 @@
// Then handle use's.
inst.forEach<typename Adapter::Thing>(
[&] (typename Adapter::Thing& thing, Arg::Role role, Bank bank, Width) {
- if (Arg::isEarlyUse(role) && Adapter::acceptsBank(bank))
+ if (Arg::isEarlyUse(role)
+ && Adapter::acceptsBank(bank)
+ && Adapter::acceptsRole(role))
workset.add(Adapter::valueToIndex(thing));
});
@@ -279,12 +292,14 @@
Inst& prevInst = m_block->at(instIndex - 1);
prevInst.forEach<typename Adapter::Thing>(
[&] (typename Adapter::Thing& thing, Arg::Role role, Bank bank, Width) {
- if (Arg::isLateUse(role) && Adapter::acceptsBank(bank))
+ if (Arg::isLateUse(role)
+ && Adapter::acceptsBank(bank)
+ && Adapter::acceptsRole(role))
workset.add(Adapter::valueToIndex(thing));
});
}
}
-
+
private:
AbstractLiveness& m_liveness;
BasicBlock* m_block;
@@ -379,8 +394,8 @@
IndexMap<BasicBlock, typename Adapter::IndexSet> m_liveAtTail;
};
-template<Bank bank>
-using TmpLiveness = AbstractLiveness<TmpLivenessAdapter<bank>>;
+template<Bank bank, Arg::Temperature minimumTemperature = Arg::Cold>
+using TmpLiveness = AbstractLiveness<TmpLivenessAdapter<bank, minimumTemperature>>;
typedef AbstractLiveness<TmpLivenessAdapter<GP>> GPLiveness;
typedef AbstractLiveness<TmpLivenessAdapter<FP>> FPLiveness;
Modified: trunk/Source/WTF/ChangeLog (214108 => 214109)
--- trunk/Source/WTF/ChangeLog 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/WTF/ChangeLog 2017-03-17 17:58:18 UTC (rev 214109)
@@ -1,3 +1,19 @@
+2017-03-11 Filip Pizlo <[email protected]>
+
+ Air should be powerful enough to support Tmp-splitting
+ https://bugs.webkit.org/show_bug.cgi?id=169515
+
+ Reviewed by Saam Barati.
+
+ Teach IndexMap how to handle types that don't have a default constructor. This makes it
+ easy to create a IndexMap<BasicBlock, InsertionSet>, which is a super powerful
+ construct.
+
+ * wtf/IndexMap.h:
+ (WTF::IndexMap::IndexMap):
+ (WTF::IndexMap::resize):
+ (WTF::IndexMap::clear):
+
2017-03-16 Simon Fraser <[email protected]>
Improve the system tracing points
Modified: trunk/Source/WTF/wtf/IndexMap.h (214108 => 214109)
--- trunk/Source/WTF/wtf/IndexMap.h 2017-03-17 17:16:51 UTC (rev 214108)
+++ trunk/Source/WTF/wtf/IndexMap.h 2017-03-17 17:58:18 UTC (rev 214109)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -36,19 +36,26 @@
template<typename Key, typename Value>
class IndexMap {
public:
- explicit IndexMap(size_t size = 0)
+ IndexMap()
{
- m_vector.fill(Value(), size);
}
+
+ template<typename... Args>
+ explicit IndexMap(size_t size, Args&&... args)
+ {
+ m_vector.fill(Value(std::forward<Args>(args)...), size);
+ }
- void resize(size_t size)
+ template<typename... Args>
+ void resize(size_t size, Args&&... args)
{
- m_vector.fill(Value(), size);
+ m_vector.fill(Value(std::forward<Args>(args)...), size);
}
- void clear()
+ template<typename... Args>
+ void clear(Args&&... args)
{
- m_vector.fill(Value(), m_vector.size());
+ m_vector.fill(Value(std::forward<Args>(args)...), m_vector.size());
}
size_t size() const { return m_vector.size(); }