<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[204920] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/204920">204920</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-08-24 12:35:41 -0700 (Wed, 24 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[JSC] Move generic data structures out of B3
https://bugs.webkit.org/show_bug.cgi?id=161155
Reviewed by Saam Barati.
Source/JavaScriptCore:
Move B3's good generic data structures to WTF.
They can be used for the other kind of basic blocks and nodes.
For example, the generator patch[1] will make BytecodeBasicBlock usable with these structures.
[1]: https://bugs.webkit.org/show_bug.cgi?id=152723
* JavaScriptCore.xcodeproj/project.pbxproj:
* b3/B3BasicBlockUtils.h:
* b3/B3BlockWorklist.h:
* b3/B3CFG.h:
* b3/B3DuplicateTails.cpp:
* b3/B3FixSSA.cpp:
* b3/B3FixSSA.h:
* b3/B3IndexMap.h:
(JSC::B3::IndexMap::IndexMap): Deleted.
(JSC::B3::IndexMap::resize): Deleted.
(JSC::B3::IndexMap::clear): Deleted.
(JSC::B3::IndexMap::size): Deleted.
(JSC::B3::IndexMap::operator[]): Deleted.
* b3/B3IndexSet.h:
(JSC::B3::IndexSet::IndexSet): Deleted.
(JSC::B3::IndexSet::add): Deleted.
(JSC::B3::IndexSet::addAll): Deleted.
(JSC::B3::IndexSet::remove): Deleted.
(JSC::B3::IndexSet::contains): Deleted.
(JSC::B3::IndexSet::size): Deleted.
(JSC::B3::IndexSet::isEmpty): Deleted.
(JSC::B3::IndexSet::Iterable::Iterable): Deleted.
(JSC::B3::IndexSet::Iterable::iterator::iterator): Deleted.
(JSC::B3::IndexSet::Iterable::iterator::operator*): Deleted.
(JSC::B3::IndexSet::Iterable::iterator::operator++): Deleted.
(JSC::B3::IndexSet::Iterable::iterator::operator==): Deleted.
(JSC::B3::IndexSet::Iterable::iterator::operator!=): Deleted.
(JSC::B3::IndexSet::Iterable::begin): Deleted.
(JSC::B3::IndexSet::Iterable::end): Deleted.
(JSC::B3::IndexSet::values): Deleted.
(JSC::B3::IndexSet::indices): Deleted.
(JSC::B3::IndexSet::dump): Deleted.
* b3/B3LowerToAir.cpp:
* b3/B3PhiChildren.h:
* b3/B3Procedure.h:
(JSC::B3::Procedure::iterator::iterator): Deleted.
(JSC::B3::Procedure::iterator::operator*): Deleted.
(JSC::B3::Procedure::iterator::operator++): Deleted.
(JSC::B3::Procedure::iterator::operator==): Deleted.
(JSC::B3::Procedure::iterator::operator!=): Deleted.
(JSC::B3::Procedure::iterator::findNext): Deleted.
* b3/B3ReduceDoubleToFloat.cpp:
* b3/B3ReduceStrength.cpp:
* b3/B3SSACalculator.h:
* b3/B3UseCounts.h:
* b3/air/AirCode.h:
* b3/air/AirEliminateDeadCode.cpp:
* b3/air/AirFixObviousSpills.cpp:
* b3/air/AirFixPartialRegisterStalls.cpp:
* b3/air/AirGenerate.cpp:
* b3/air/AirGenerationContext.h:
* b3/air/AirLiveness.h:
* b3/air/AirSpillEverything.cpp:
Source/WTF:
Add IndexSet, IndexMap, and IndexedContainerIterator.
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/IndexMap.h: Copied from Source/JavaScriptCore/b3/B3IndexMap.h.
(WTF::IndexMap::IndexMap):
(WTF::IndexMap::resize):
(WTF::IndexMap::clear):
(WTF::IndexMap::size):
(WTF::IndexMap::operator[]):
* wtf/IndexSet.h: Renamed from Source/JavaScriptCore/b3/B3IndexSet.h.
(WTF::IndexSet::IndexSet):
(WTF::IndexSet::add):
(WTF::IndexSet::addAll):
(WTF::IndexSet::remove):
(WTF::IndexSet::contains):
(WTF::IndexSet::size):
(WTF::IndexSet::isEmpty):
(WTF::IndexSet::Iterable::Iterable):
(WTF::IndexSet::Iterable::iterator::iterator):
(WTF::IndexSet::Iterable::iterator::operator*):
(WTF::IndexSet::Iterable::iterator::operator++):
(WTF::IndexSet::Iterable::iterator::operator==):
(WTF::IndexSet::Iterable::iterator::operator!=):
(WTF::IndexSet::Iterable::begin):
(WTF::IndexSet::Iterable::end):
(WTF::IndexSet::values):
(WTF::IndexSet::indices):
(WTF::IndexSet::dump):
* wtf/IndexedContainerIterator.h: Renamed from Source/JavaScriptCore/b3/B3IndexMap.h.
(WTF::IndexedContainerIterator::IndexedContainerIterator):
(WTF::IndexedContainerIterator::operator++):
(WTF::IndexedContainerIterator::operator==):
(WTF::IndexedContainerIterator::operator!=):
(WTF::IndexedContainerIterator::findNext):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3BasicBlockUtilsh">trunk/Source/JavaScriptCore/b3/B3BasicBlockUtils.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3BlockWorklisth">trunk/Source/JavaScriptCore/b3/B3BlockWorklist.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3CFGh">trunk/Source/JavaScriptCore/b3/B3CFG.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3DuplicateTailscpp">trunk/Source/JavaScriptCore/b3/B3DuplicateTails.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3FixSSAcpp">trunk/Source/JavaScriptCore/b3/B3FixSSA.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3FixSSAh">trunk/Source/JavaScriptCore/b3/B3FixSSA.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3LowerToAircpp">trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3PhiChildrenh">trunk/Source/JavaScriptCore/b3/B3PhiChildren.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3Procedureh">trunk/Source/JavaScriptCore/b3/B3Procedure.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3ReduceDoubleToFloatcpp">trunk/Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3ReduceStrengthcpp">trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3SSACalculatorh">trunk/Source/JavaScriptCore/b3/B3SSACalculator.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3UseCountsh">trunk/Source/JavaScriptCore/b3/B3UseCounts.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirCodeh">trunk/Source/JavaScriptCore/b3/air/AirCode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirEliminateDeadCodecpp">trunk/Source/JavaScriptCore/b3/air/AirEliminateDeadCode.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirFixObviousSpillscpp">trunk/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirFixPartialRegisterStallscpp">trunk/Source/JavaScriptCore/b3/air/AirFixPartialRegisterStalls.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirGeneratecpp">trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirGenerationContexth">trunk/Source/JavaScriptCore/b3/air/AirGenerationContext.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirLivenessh">trunk/Source/JavaScriptCore/b3/air/AirLiveness.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3airAirSpillEverythingcpp">trunk/Source/JavaScriptCore/b3/air/AirSpillEverything.cpp</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFxcodeprojprojectpbxproj">trunk/Source/WTF/WTF.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWTFwtfCMakeListstxt">trunk/Source/WTF/wtf/CMakeLists.txt</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWTFwtfIndexMaph">trunk/Source/WTF/wtf/IndexMap.h</a></li>
<li><a href="#trunkSourceWTFwtfIndexSeth">trunk/Source/WTF/wtf/IndexSet.h</a></li>
<li><a href="#trunkSourceWTFwtfIndexedContainerIteratorh">trunk/Source/WTF/wtf/IndexedContainerIterator.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreb3B3IndexMaph">trunk/Source/JavaScriptCore/b3/B3IndexMap.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreb3B3IndexSeth">trunk/Source/JavaScriptCore/b3/B3IndexSet.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -1,3 +1,70 @@
</span><ins>+2016-08-24 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [JSC] Move generic data structures out of B3
+ https://bugs.webkit.org/show_bug.cgi?id=161155
+
+ Reviewed by Saam Barati.
+
+ Move B3's good generic data structures to WTF.
+ They can be used for the other kind of basic blocks and nodes.
+ For example, the generator patch[1] will make BytecodeBasicBlock usable with these structures.
+
+ [1]: https://bugs.webkit.org/show_bug.cgi?id=152723
+
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * b3/B3BasicBlockUtils.h:
+ * b3/B3BlockWorklist.h:
+ * b3/B3CFG.h:
+ * b3/B3DuplicateTails.cpp:
+ * b3/B3FixSSA.cpp:
+ * b3/B3FixSSA.h:
+ * b3/B3IndexMap.h:
+ (JSC::B3::IndexMap::IndexMap): Deleted.
+ (JSC::B3::IndexMap::resize): Deleted.
+ (JSC::B3::IndexMap::clear): Deleted.
+ (JSC::B3::IndexMap::size): Deleted.
+ (JSC::B3::IndexMap::operator[]): Deleted.
+ * b3/B3IndexSet.h:
+ (JSC::B3::IndexSet::IndexSet): Deleted.
+ (JSC::B3::IndexSet::add): Deleted.
+ (JSC::B3::IndexSet::addAll): Deleted.
+ (JSC::B3::IndexSet::remove): Deleted.
+ (JSC::B3::IndexSet::contains): Deleted.
+ (JSC::B3::IndexSet::size): Deleted.
+ (JSC::B3::IndexSet::isEmpty): Deleted.
+ (JSC::B3::IndexSet::Iterable::Iterable): Deleted.
+ (JSC::B3::IndexSet::Iterable::iterator::iterator): Deleted.
+ (JSC::B3::IndexSet::Iterable::iterator::operator*): Deleted.
+ (JSC::B3::IndexSet::Iterable::iterator::operator++): Deleted.
+ (JSC::B3::IndexSet::Iterable::iterator::operator==): Deleted.
+ (JSC::B3::IndexSet::Iterable::iterator::operator!=): Deleted.
+ (JSC::B3::IndexSet::Iterable::begin): Deleted.
+ (JSC::B3::IndexSet::Iterable::end): Deleted.
+ (JSC::B3::IndexSet::values): Deleted.
+ (JSC::B3::IndexSet::indices): Deleted.
+ (JSC::B3::IndexSet::dump): Deleted.
+ * b3/B3LowerToAir.cpp:
+ * b3/B3PhiChildren.h:
+ * b3/B3Procedure.h:
+ (JSC::B3::Procedure::iterator::iterator): Deleted.
+ (JSC::B3::Procedure::iterator::operator*): Deleted.
+ (JSC::B3::Procedure::iterator::operator++): Deleted.
+ (JSC::B3::Procedure::iterator::operator==): Deleted.
+ (JSC::B3::Procedure::iterator::operator!=): Deleted.
+ (JSC::B3::Procedure::iterator::findNext): Deleted.
+ * b3/B3ReduceDoubleToFloat.cpp:
+ * b3/B3ReduceStrength.cpp:
+ * b3/B3SSACalculator.h:
+ * b3/B3UseCounts.h:
+ * b3/air/AirCode.h:
+ * b3/air/AirEliminateDeadCode.cpp:
+ * b3/air/AirFixObviousSpills.cpp:
+ * b3/air/AirFixPartialRegisterStalls.cpp:
+ * b3/air/AirGenerate.cpp:
+ * b3/air/AirGenerationContext.h:
+ * b3/air/AirLiveness.h:
+ * b3/air/AirSpillEverything.cpp:
+
</ins><span class="cx"> 2016-08-24 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, roll out r204901, r204897, r204866, r204856, r204854.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -786,8 +786,6 @@
</span><span class="cx">                 0FEC85181BDACDAC0080FF74 /* B3Generate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC84CE1BDACDAC0080FF74 /* B3Generate.cpp */; };
</span><span class="cx">                 0FEC85191BDACDAC0080FF74 /* B3Generate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC84CF1BDACDAC0080FF74 /* B3Generate.h */; };
</span><span class="cx">                 0FEC851A1BDACDAC0080FF74 /* B3GenericFrequentedBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC84D01BDACDAC0080FF74 /* B3GenericFrequentedBlock.h */; };
</span><del>-                0FEC851B1BDACDAC0080FF74 /* B3IndexMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC84D11BDACDAC0080FF74 /* B3IndexMap.h */; };
-                0FEC851C1BDACDAC0080FF74 /* B3IndexSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC84D21BDACDAC0080FF74 /* B3IndexSet.h */; };
</del><span class="cx">                 0FEC851D1BDACDAC0080FF74 /* B3LowerToAir.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC84D31BDACDAC0080FF74 /* B3LowerToAir.cpp */; };
</span><span class="cx">                 0FEC851E1BDACDAC0080FF74 /* B3LowerToAir.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEC84D41BDACDAC0080FF74 /* B3LowerToAir.h */; };
</span><span class="cx">                 0FEC851F1BDACDAC0080FF74 /* B3MemoryValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEC84D51BDACDAC0080FF74 /* B3MemoryValue.cpp */; };
</span><span class="lines">@@ -3013,8 +3011,6 @@
</span><span class="cx">                 0FEC84CE1BDACDAC0080FF74 /* B3Generate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3Generate.cpp; path = b3/B3Generate.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 0FEC84CF1BDACDAC0080FF74 /* B3Generate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3Generate.h; path = b3/B3Generate.h; sourceTree = "<group>"; };
</span><span class="cx">                 0FEC84D01BDACDAC0080FF74 /* B3GenericFrequentedBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3GenericFrequentedBlock.h; path = b3/B3GenericFrequentedBlock.h; sourceTree = "<group>"; };
</span><del>-                0FEC84D11BDACDAC0080FF74 /* B3IndexMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3IndexMap.h; path = b3/B3IndexMap.h; sourceTree = "<group>"; };
-                0FEC84D21BDACDAC0080FF74 /* B3IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3IndexSet.h; path = b3/B3IndexSet.h; sourceTree = "<group>"; };
</del><span class="cx">                 0FEC84D31BDACDAC0080FF74 /* B3LowerToAir.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3LowerToAir.cpp; path = b3/B3LowerToAir.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 0FEC84D41BDACDAC0080FF74 /* B3LowerToAir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = B3LowerToAir.h; path = b3/B3LowerToAir.h; sourceTree = "<group>"; };
</span><span class="cx">                 0FEC84D51BDACDAC0080FF74 /* B3MemoryValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = B3MemoryValue.cpp; path = b3/B3MemoryValue.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -4812,8 +4808,6 @@
</span><span class="cx">                                 0FEC84D01BDACDAC0080FF74 /* B3GenericFrequentedBlock.h */,
</span><span class="cx">                                 0FEC85BF1BE167A00080FF74 /* B3HeapRange.cpp */,
</span><span class="cx">                                 0FEC85C01BE167A00080FF74 /* B3HeapRange.h */,
</span><del>-                                0FEC84D11BDACDAC0080FF74 /* B3IndexMap.h */,
-                                0FEC84D21BDACDAC0080FF74 /* B3IndexSet.h */,
</del><span class="cx">                                 DC69B99A1D15F90F002E3C00 /* B3InferSwitches.cpp */,
</span><span class="cx">                                 DC69B99B1D15F90F002E3C00 /* B3InferSwitches.h */,
</span><span class="cx">                                 0FEC85B41BE1462F0080FF74 /* B3InsertionSet.cpp */,
</span><span class="lines">@@ -7177,8 +7171,6 @@
</span><span class="cx">                                 0FEC85C31BE167A00080FF74 /* B3HeapRange.h in Headers */,
</span><span class="cx">                                 26718BA51BE99F780052017B /* AirIteratedRegisterCoalescing.h in Headers */,
</span><span class="cx">                                 0F96303C1D4192CD005609D9 /* DestructionMode.h in Headers */,
</span><del>-                                0FEC851B1BDACDAC0080FF74 /* B3IndexMap.h in Headers */,
-                                0FEC851C1BDACDAC0080FF74 /* B3IndexSet.h in Headers */,
</del><span class="cx">                                 0FEC85BA1BE1462F0080FF74 /* B3InsertionSet.h in Headers */,
</span><span class="cx">                                 0FEC85BB1BE1462F0080FF74 /* B3InsertionSetInlines.h in Headers */,
</span><span class="cx">                                 0FEC851E1BDACDAC0080FF74 /* B3LowerToAir.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3BasicBlockUtilsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3BasicBlockUtils.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3BasicBlockUtils.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3BasicBlockUtils.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><del>-#include "B3IndexSet.h"
</del><span class="cx"> #include <wtf/GraphNodeWorklist.h>
</span><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3BlockWorklisth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3BlockWorklist.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3BlockWorklist.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3BlockWorklist.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -28,13 +28,14 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><del>-#include "B3BasicBlock.h"
-#include "B3IndexSet.h"
</del><span class="cx"> #include <wtf/GraphNodeWorklist.h>
</span><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span><ins>+class BasicBlock;
+
</ins><span class="cx"> typedef GraphNodeWorklist<BasicBlock*, IndexSet<BasicBlock>> BlockWorklist;
</span><span class="cx">
</span><span class="cx"> // When you say BlockWith<int> you should read it as "block with an int".
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3CFGh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3CFG.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3CFG.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3CFG.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><span class="cx"> #include "B3BasicBlock.h"
</span><del>-#include "B3IndexMap.h"
-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3Procedure.h"
</span><ins>+#include <wtf/IndexMap.h>
+#include <wtf/IndexSet.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3DuplicateTailscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3DuplicateTails.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3DuplicateTails.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3DuplicateTails.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include "B3BreakCriticalEdges.h"
</span><span class="cx"> #include "B3Dominators.h"
</span><span class="cx"> #include "B3FixSSA.h"
</span><del>-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3InsertionSetInlines.h"
</span><span class="cx"> #include "B3PhaseScope.h"
</span><span class="cx"> #include "B3ProcedureInlines.h"
</span><span class="lines">@@ -39,6 +38,7 @@
</span><span class="cx"> #include "B3SwitchValue.h"
</span><span class="cx"> #include "B3UpsilonValue.h"
</span><span class="cx"> #include "B3ValueInlines.h"
</span><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3FixSSAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3FixSSA.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3FixSSA.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3FixSSA.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "B3BasicBlockInlines.h"
</span><span class="cx"> #include "B3BreakCriticalEdges.h"
</span><span class="cx"> #include "B3Dominators.h"
</span><del>-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3InsertionSetInlines.h"
</span><span class="cx"> #include "B3PhaseScope.h"
</span><span class="cx"> #include "B3ProcedureInlines.h"
</span><span class="lines">@@ -41,6 +40,7 @@
</span><span class="cx"> #include "B3Variable.h"
</span><span class="cx"> #include "B3VariableValue.h"
</span><span class="cx"> #include <wtf/CommaPrinter.h>
</span><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3FixSSAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3FixSSA.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3FixSSA.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3FixSSA.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -28,8 +28,9 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><del>-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3Value.h"
</span><ins>+#include <wtf/IndexSet.h>
+#include <wtf/Vector.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3IndexMaph"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/b3/B3IndexMap.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3IndexMap.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3IndexMap.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -1,87 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015-2016 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.
- */
-
-#ifndef B3IndexMap_h
-#define B3IndexMap_h
-
-#if ENABLE(B3_JIT)
-
-#include <wtf/Vector.h>
-
-namespace JSC { namespace B3 {
-
-// This is a map for keys that have an index(). It's super efficient for BasicBlocks. It's only
-// efficient for Values if you don't create too many of these maps, since Values can have very
-// sparse indices and there are a lot of Values.
-
-template<typename Key, typename Value>
-class IndexMap {
-public:
- explicit IndexMap(size_t size = 0)
- {
- m_vector.fill(Value(), size);
- }
-
- void resize(size_t size)
- {
- m_vector.fill(Value(), size);
- }
-
- void clear()
- {
- m_vector.fill(Value(), m_vector.size());
- }
-
- size_t size() const { return m_vector.size(); }
-
- Value& operator[](size_t index)
- {
- return m_vector[index];
- }
-
- const Value& operator[](size_t index) const
- {
- return m_vector[index];
- }
-
- Value& operator[](Key* key)
- {
- return m_vector[key->index()];
- }
-
- const Value& operator[](Key* key) const
- {
- return m_vector[key->index()];
- }
-
-private:
- Vector<Value> m_vector;
-};
-
-} } // namespace JSC::B3
-
-#endif // ENABLE(B3_JIT)
-
-#endif // B3IndexMap_h
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3IndexSeth"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/b3/B3IndexSet.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3IndexSet.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3IndexSet.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -1,165 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015-2016 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.
- */
-
-#ifndef B3IndexSet_h
-#define B3IndexSet_h
-
-#include <wtf/BitVector.h>
-#include <wtf/CommaPrinter.h>
-
-namespace JSC { namespace B3 {
-
-// This is a set for things that have an index(). It's super efficient for BasicBlocks. It's only
-// efficient for Values if you don't create too many of these sets, since Values can have very sparse
-// indices and there are a lot of Values.
-
-// If you want a set of BasicBlocks, you do IndexSet<BasicBlock>. So, T = BasicBlock.
-template<typename T>
-class IndexSet {
-public:
- IndexSet()
- {
- }
-
- bool add(T* value)
- {
- return !m_set.set(value->index());
- }
-
- template<typename Iterable>
- bool addAll(const Iterable& iterable)
- {
- bool result = false;
- for (T* value : iterable)
- result |= add(value);
- return result;
- }
-
- bool remove(T* value)
- {
- return m_set.clear(value->index());
- }
-
- bool contains(T* value) const
- {
- if (!value)
- return false;
- return m_set.get(value->index());
- }
-
- size_t size() const
- {
- return m_set.bitCount();
- }
-
- bool isEmpty() const
- {
- return !size();
- }
-
- template<typename CollectionType>
- class Iterable {
- public:
- Iterable(const CollectionType& collection, const BitVector& set)
- : m_collection(collection)
- , m_set(set)
- {
- }
-
- class iterator {
- public:
- iterator()
- : m_collection(nullptr)
- {
- }
-
- iterator(const CollectionType& collection, BitVector::iterator iter)
- : m_collection(&collection)
- , m_iter(iter)
- {
- }
-
- T* operator*()
- {
- return m_collection->at(*m_iter);
- }
-
- iterator& operator++()
- {
- ++m_iter;
- return *this;
- }
-
- bool operator==(const iterator& other) const
- {
- return m_iter == other.m_iter;
- }
-
- bool operator!=(const iterator& other) const
- {
- return !(*this == other);
- }
-
- private:
- const CollectionType* m_collection;
- BitVector::iterator m_iter;
- };
-
- iterator begin() const { return iterator(m_collection, m_set.begin()); }
- iterator end() const { return iterator(m_collection, m_set.end()); }
-
- private:
- const CollectionType& m_collection;
- const BitVector& m_set;
- };
-
- // For basic blocks, you do:
- // indexSet.values(procedure);
- //
- // For values, you do:
- // indexSet.values(procedure.values());
- template<typename CollectionType>
- Iterable<CollectionType> values(const CollectionType& collection) const
- {
- return Iterable<CollectionType>(collection, indices());
- }
-
- const BitVector& indices() const { return m_set; }
-
- void dump(PrintStream& out) const
- {
- CommaPrinter comma;
- for (size_t index : indices())
- out.print(comma, T::dumpPrefix, index);
- }
-
-private:
- BitVector m_set;
-};
-
-} } // namespace JSC::B3
-
-#endif // B3IndexSet_h
-
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3LowerToAircpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3LowerToAir.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -40,8 +40,6 @@
</span><span class="cx"> #include "B3CheckSpecial.h"
</span><span class="cx"> #include "B3Commutativity.h"
</span><span class="cx"> #include "B3Dominators.h"
</span><del>-#include "B3IndexMap.h"
-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3MemoryValue.h"
</span><span class="cx"> #include "B3PatchpointSpecial.h"
</span><span class="cx"> #include "B3PatchpointValue.h"
</span><span class="lines">@@ -55,6 +53,8 @@
</span><span class="cx"> #include "B3ValueInlines.h"
</span><span class="cx"> #include "B3Variable.h"
</span><span class="cx"> #include "B3VariableValue.h"
</span><ins>+#include <wtf/IndexMap.h>
+#include <wtf/IndexSet.h>
</ins><span class="cx"> #include <wtf/ListDump.h>
</span><span class="cx">
</span><span class="cx"> #if COMPILER(GCC) && ASSERT_DISABLED
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3PhiChildrenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3PhiChildren.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3PhiChildren.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3PhiChildren.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -28,10 +28,10 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><del>-#include "B3IndexMap.h"
</del><span class="cx"> #include "B3Procedure.h"
</span><span class="cx"> #include "B3UpsilonValue.h"
</span><span class="cx"> #include <wtf/GraphNodeWorklist.h>
</span><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3Procedureh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3Procedure.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3Procedure.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3Procedure.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include <wtf/Bag.h>
</span><span class="cx"> #include <wtf/FastMalloc.h>
</span><span class="cx"> #include <wtf/HashSet.h>
</span><ins>+#include <wtf/IndexedContainerIterator.h>
</ins><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/PrintStream.h>
</span><span class="cx"> #include <wtf/SharedTask.h>
</span><span class="lines">@@ -133,54 +134,8 @@
</span><span class="cx"> BasicBlock* at(unsigned index) const { return m_blocks[index].get(); }
</span><span class="cx"> BasicBlock* operator[](unsigned index) const { return at(index); }
</span><span class="cx">
</span><del>- class iterator {
- public:
- iterator()
- : m_procedure(nullptr)
- , m_index(0)
- {
- }
</del><ins>+ typedef WTF::IndexedContainerIterator<Procedure> iterator;
</ins><span class="cx">
</span><del>- iterator(const Procedure& procedure, unsigned index)
- : m_procedure(&procedure)
- , m_index(findNext(index))
- {
- }
-
- BasicBlock* operator*()
- {
- return m_procedure->at(m_index);
- }
-
- iterator& operator++()
- {
- m_index = findNext(m_index + 1);
- return *this;
- }
-
- bool operator==(const iterator& other) const
- {
- ASSERT(m_procedure == other.m_procedure);
- return m_index == other.m_index;
- }
-
- bool operator!=(const iterator& other) const
- {
- return !(*this == other);
- }
-
- private:
- unsigned findNext(unsigned index)
- {
- while (index < m_procedure->size() && !m_procedure->at(index))
- index++;
- return index;
- }
-
- const Procedure* m_procedure;
- unsigned m_index;
- };
-
</del><span class="cx"> iterator begin() const { return iterator(*this, 0); }
</span><span class="cx"> iterator end() const { return iterator(*this, size()); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3ReduceDoubleToFloatcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3ReduceDoubleToFloat.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -29,11 +29,11 @@
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><span class="cx"> #include "B3BasicBlock.h"
</span><del>-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3InsertionSetInlines.h"
</span><span class="cx"> #include "B3PhaseScope.h"
</span><span class="cx"> #include "B3UseCounts.h"
</span><span class="cx"> #include "B3ValueInlines.h"
</span><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3ReduceStrengthcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3ReduceStrength.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include "B3BlockInsertionSet.h"
</span><span class="cx"> #include "B3ComputeDivisionMagic.h"
</span><span class="cx"> #include "B3Dominators.h"
</span><del>-#include "B3IndexSet.h"
</del><span class="cx"> #include "B3InsertionSetInlines.h"
</span><span class="cx"> #include "B3MemoryValue.h"
</span><span class="cx"> #include "B3PhaseScope.h"
</span><span class="lines">@@ -48,6 +47,7 @@
</span><span class="cx"> #include "B3VariableValue.h"
</span><span class="cx"> #include <wtf/GraphNodeWorklist.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3SSACalculatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3SSACalculator.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3SSACalculator.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3SSACalculator.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><span class="cx"> #include "B3Dominators.h"
</span><del>-#include "B3IndexMap.h"
</del><span class="cx"> #include "B3ProcedureInlines.h"
</span><span class="cx"> #include <wtf/Bag.h>
</span><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx"> #include <wtf/SegmentedVector.h>
</span><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3B3UseCountsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/B3UseCounts.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/B3UseCounts.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/B3UseCounts.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><del>-#include "B3IndexMap.h"
</del><span class="cx"> #include "B3Value.h"
</span><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirCodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirCode.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirCode.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirCode.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -33,11 +33,11 @@
</span><span class="cx"> #include "AirSpecial.h"
</span><span class="cx"> #include "AirStackSlot.h"
</span><span class="cx"> #include "AirTmp.h"
</span><del>-#include "B3IndexMap.h"
</del><span class="cx"> #include "B3SparseCollection.h"
</span><span class="cx"> #include "CCallHelpers.h"
</span><span class="cx"> #include "RegisterAtOffsetList.h"
</span><span class="cx"> #include "StackAlignment.h"
</span><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirEliminateDeadCodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirEliminateDeadCode.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirEliminateDeadCode.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirEliminateDeadCode.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> #include "AirCode.h"
</span><span class="cx"> #include "AirInstInlines.h"
</span><span class="cx"> #include "AirPhaseScope.h"
</span><del>-#include "B3IndexSet.h"
</del><ins>+#include <wtf/IndexSet.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 { namespace Air {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirFixObviousSpillscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx"> #include "AirCode.h"
</span><span class="cx"> #include "AirInstInlines.h"
</span><span class="cx"> #include "AirPhaseScope.h"
</span><del>-#include "B3IndexMap.h"
</del><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx"> #include <wtf/ListDump.h>
</span><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 { namespace Air {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirFixPartialRegisterStallscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirFixPartialRegisterStalls.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirFixPartialRegisterStalls.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirFixPartialRegisterStalls.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -34,9 +34,9 @@
</span><span class="cx"> #include "AirInst.h"
</span><span class="cx"> #include "AirInstInlines.h"
</span><span class="cx"> #include "AirPhaseScope.h"
</span><del>-#include "B3IndexMap.h"
-#include "B3IndexSet.h"
</del><span class="cx"> #include "MacroAssembler.h"
</span><ins>+#include <wtf/IndexMap.h>
+#include <wtf/IndexSet.h>
</ins><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 { namespace Air {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirGeneratecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirGenerate.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -48,7 +48,6 @@
</span><span class="cx"> #include "AirSpillEverything.h"
</span><span class="cx"> #include "AirValidate.h"
</span><span class="cx"> #include "B3Common.h"
</span><del>-#include "B3IndexMap.h"
</del><span class="cx"> #include "B3Procedure.h"
</span><span class="cx"> #include "B3TimingScope.h"
</span><span class="cx"> #include "B3ValueInlines.h"
</span><span class="lines">@@ -55,6 +54,7 @@
</span><span class="cx"> #include "CCallHelpers.h"
</span><span class="cx"> #include "DisallowMacroScratchRegisterUsage.h"
</span><span class="cx"> #include "LinkBuffer.h"
</span><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 { namespace Air {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirGenerationContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirGenerationContext.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirGenerationContext.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirGenerationContext.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -29,9 +29,9 @@
</span><span class="cx"> #if ENABLE(B3_JIT)
</span><span class="cx">
</span><span class="cx"> #include "AirBasicBlock.h"
</span><del>-#include "B3IndexMap.h"
</del><span class="cx"> #include "CCallHelpers.h"
</span><span class="cx"> #include <wtf/Box.h>
</span><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx"> #include <wtf/SharedTask.h>
</span><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirLivenessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirLiveness.h (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirLiveness.h        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirLiveness.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -33,8 +33,8 @@
</span><span class="cx"> #include "AirInstInlines.h"
</span><span class="cx"> #include "AirStackSlot.h"
</span><span class="cx"> #include "AirTmpInlines.h"
</span><del>-#include "B3IndexMap.h"
-#include "B3IndexSet.h"
</del><ins>+#include <wtf/IndexMap.h>
+#include <wtf/IndexSet.h>
</ins><span class="cx"> #include <wtf/IndexSparseSet.h>
</span><span class="cx"> #include <wtf/ListDump.h>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreb3airAirSpillEverythingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/b3/air/AirSpillEverything.cpp (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/b3/air/AirSpillEverything.cpp        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/JavaScriptCore/b3/air/AirSpillEverything.cpp        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> #include "AirLiveness.h"
</span><span class="cx"> #include "AirPhaseScope.h"
</span><span class="cx"> #include "AirRegisterPriority.h"
</span><del>-#include "B3IndexMap.h"
</del><ins>+#include <wtf/IndexMap.h>
</ins><span class="cx">
</span><span class="cx"> namespace JSC { namespace B3 { namespace Air {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/WTF/ChangeLog        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-08-24 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [JSC] Move generic data structures out of B3
+ https://bugs.webkit.org/show_bug.cgi?id=161155
+
+ Reviewed by Saam Barati.
+
+ Add IndexSet, IndexMap, and IndexedContainerIterator.
+
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/IndexMap.h: Copied from Source/JavaScriptCore/b3/B3IndexMap.h.
+ (WTF::IndexMap::IndexMap):
+ (WTF::IndexMap::resize):
+ (WTF::IndexMap::clear):
+ (WTF::IndexMap::size):
+ (WTF::IndexMap::operator[]):
+ * wtf/IndexSet.h: Renamed from Source/JavaScriptCore/b3/B3IndexSet.h.
+ (WTF::IndexSet::IndexSet):
+ (WTF::IndexSet::add):
+ (WTF::IndexSet::addAll):
+ (WTF::IndexSet::remove):
+ (WTF::IndexSet::contains):
+ (WTF::IndexSet::size):
+ (WTF::IndexSet::isEmpty):
+ (WTF::IndexSet::Iterable::Iterable):
+ (WTF::IndexSet::Iterable::iterator::iterator):
+ (WTF::IndexSet::Iterable::iterator::operator*):
+ (WTF::IndexSet::Iterable::iterator::operator++):
+ (WTF::IndexSet::Iterable::iterator::operator==):
+ (WTF::IndexSet::Iterable::iterator::operator!=):
+ (WTF::IndexSet::Iterable::begin):
+ (WTF::IndexSet::Iterable::end):
+ (WTF::IndexSet::values):
+ (WTF::IndexSet::indices):
+ (WTF::IndexSet::dump):
+ * wtf/IndexedContainerIterator.h: Renamed from Source/JavaScriptCore/b3/B3IndexMap.h.
+ (WTF::IndexedContainerIterator::IndexedContainerIterator):
+ (WTF::IndexedContainerIterator::operator++):
+ (WTF::IndexedContainerIterator::operator==):
+ (WTF::IndexedContainerIterator::operator!=):
+ (WTF::IndexedContainerIterator::findNext):
+
</ins><span class="cx"> 2016-08-24 Andreas Kling <akling@apple.com>
</span><span class="cx">
</span><span class="cx"> Add WTF::isFastMallocEnabled().
</span></span></pre></div>
<a id="trunkSourceWTFWTFxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -336,6 +336,9 @@
</span><span class="cx">                 FE8925B01D00DAEC0046907E /* Indenter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE8925AF1D00DAEC0046907E /* Indenter.h */; };
</span><span class="cx">                 FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
</span><span class="cx">                 FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
</span><ins>+                C8B0E1A1E01A486EB95E0D11 /* IndexSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */; };
+                C916B975F02F4F7E8B4AB12D /* IndexMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B43383A5D0B463C9433D933 /* IndexMap.h */; };
+                4B2680DD9B974402899ED572 /* IndexedContainerIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C67C542589348E285B49699 /* IndexedContainerIterator.h */; };
</ins><span class="cx"> /* End PBXBuildFile section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXContainerItemProxy section */
</span><span class="lines">@@ -684,6 +687,9 @@
</span><span class="cx">                 FE8925AF1D00DAEC0046907E /* Indenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Indenter.h; sourceTree = "<group>"; };
</span><span class="cx">                 FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
</span><ins>+                3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IndexSet.h; path = IndexSet.h; sourceTree = "<group>"; };
+                5B43383A5D0B463C9433D933 /* IndexMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IndexMap.h; path = IndexMap.h; sourceTree = "<group>"; };
+                9C67C542589348E285B49699 /* IndexedContainerIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IndexedContainerIterator.h; path = IndexedContainerIterator.h; sourceTree = "<group>"; };
</ins><span class="cx"> /* End PBXFileReference section */
</span><span class="cx">
</span><span class="cx"> /* Begin PBXFrameworksBuildPhase section */
</span><span class="lines">@@ -1044,6 +1050,9 @@
</span><span class="cx">                                 E4A0AD381A96245500536DF6 /* WorkQueue.h */,
</span><span class="cx">                                 A8A4737A151A825B004123FF /* WTFThreadData.cpp */,
</span><span class="cx">                                 A8A4737B151A825B004123FF /* WTFThreadData.h */,
</span><ins>+                                3137E1D7DBD84AC38FAE4D34 /* IndexSet.h */,
+                                5B43383A5D0B463C9433D933 /* IndexMap.h */,
+                                9C67C542589348E285B49699 /* IndexedContainerIterator.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = wtf;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -1443,6 +1452,9 @@
</span><span class="cx">                                 A8A47446151A825B004123FF /* WTFString.h in Headers */,
</span><span class="cx">                                 A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
</span><span class="cx">                                 CE73E02519DCB7AB00580D5C /* XPCSPI.h in Headers */,
</span><ins>+                                C8B0E1A1E01A486EB95E0D11 /* IndexSet.h in Headers */,
+                                C916B975F02F4F7E8B4AB12D /* IndexMap.h in Headers */,
+                                4B2680DD9B974402899ED572 /* IndexedContainerIterator.h in Headers */,
</ins><span class="cx">                         );
</span><span class="cx">                         runOnlyForDeploymentPostprocessing = 0;
</span><span class="cx">                 };
</span></span></pre></div>
<a id="trunkSourceWTFwtfCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/CMakeLists.txt (204919 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/CMakeLists.txt        2016-08-24 19:29:52 UTC (rev 204919)
+++ trunk/Source/WTF/wtf/CMakeLists.txt        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -45,6 +45,10 @@
</span><span class="cx"> HashTable.h
</span><span class="cx"> HashTraits.h
</span><span class="cx"> HexNumber.h
</span><ins>+ IndexMap.h
+ IndexSet.h
+ IndexSparseSet.h
+ IndexedContainerIterator.h
</ins><span class="cx"> IteratorAdaptors.h
</span><span class="cx"> IteratorRange.h
</span><span class="cx"> ListHashSet.h
</span></span></pre></div>
<a id="trunkSourceWTFwtfIndexMaphfromrev204919trunkSourceJavaScriptCoreb3B3IndexMaph"></a>
<div class="copfile"><h4>Copied: trunk/Source/WTF/wtf/IndexMap.h (from rev 204919, trunk/Source/JavaScriptCore/b3/B3IndexMap.h) (0 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/IndexMap.h         (rev 0)
+++ trunk/Source/WTF/wtf/IndexMap.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+/*
+ * Copyright (C) 2015-2016 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
+
+#include <wtf/Vector.h>
+
+namespace WTF {
+
+// This is a map for keys that have an index(). It's super efficient for BasicBlocks. It's only
+// efficient for Values if you don't create too many of these maps, since Values can have very
+// sparse indices and there are a lot of Values.
+
+template<typename Key, typename Value>
+class IndexMap {
+public:
+ explicit IndexMap(size_t size = 0)
+ {
+ m_vector.fill(Value(), size);
+ }
+
+ void resize(size_t size)
+ {
+ m_vector.fill(Value(), size);
+ }
+
+ void clear()
+ {
+ m_vector.fill(Value(), m_vector.size());
+ }
+
+ size_t size() const { return m_vector.size(); }
+
+ Value& operator[](size_t index)
+ {
+ return m_vector[index];
+ }
+
+ const Value& operator[](size_t index) const
+ {
+ return m_vector[index];
+ }
+
+ Value& operator[](Key* key)
+ {
+ return m_vector[key->index()];
+ }
+
+ const Value& operator[](Key* key) const
+ {
+ return m_vector[key->index()];
+ }
+
+private:
+ Vector<Value> m_vector;
+};
+
+} // namespace WTF
+
+using WTF::IndexMap;
</ins></span></pre></div>
<a id="trunkSourceWTFwtfIndexSethfromrev204919trunkSourceJavaScriptCoreb3B3IndexSeth"></a>
<div class="copfile"><h4>Copied: trunk/Source/WTF/wtf/IndexSet.h (from rev 204919, trunk/Source/JavaScriptCore/b3/B3IndexSet.h) (0 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/IndexSet.h         (rev 0)
+++ trunk/Source/WTF/wtf/IndexSet.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -0,0 +1,163 @@
</span><ins>+/*
+ * Copyright (C) 2015-2016 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
+
+#include <wtf/BitVector.h>
+#include <wtf/CommaPrinter.h>
+
+namespace WTF {
+
+// This is a set for things that have an index(). It's super efficient for BasicBlocks. It's only
+// efficient for Values if you don't create too many of these sets, since Values can have very sparse
+// indices and there are a lot of Values.
+
+// If you want a set of BasicBlocks, you do IndexSet<BasicBlock>. So, T = BasicBlock.
+template<typename T>
+class IndexSet {
+public:
+ IndexSet()
+ {
+ }
+
+ bool add(T* value)
+ {
+ return !m_set.set(value->index());
+ }
+
+ template<typename Iterable>
+ bool addAll(const Iterable& iterable)
+ {
+ bool result = false;
+ for (T* value : iterable)
+ result |= add(value);
+ return result;
+ }
+
+ bool remove(T* value)
+ {
+ return m_set.clear(value->index());
+ }
+
+ bool contains(T* value) const
+ {
+ if (!value)
+ return false;
+ return m_set.get(value->index());
+ }
+
+ size_t size() const
+ {
+ return m_set.bitCount();
+ }
+
+ bool isEmpty() const
+ {
+ return !size();
+ }
+
+ template<typename CollectionType>
+ class Iterable {
+ public:
+ Iterable(const CollectionType& collection, const BitVector& set)
+ : m_collection(collection)
+ , m_set(set)
+ {
+ }
+
+ class iterator {
+ public:
+ iterator()
+ : m_collection(nullptr)
+ {
+ }
+
+ iterator(const CollectionType& collection, BitVector::iterator iter)
+ : m_collection(&collection)
+ , m_iter(iter)
+ {
+ }
+
+ T* operator*()
+ {
+ return m_collection->at(*m_iter);
+ }
+
+ iterator& operator++()
+ {
+ ++m_iter;
+ return *this;
+ }
+
+ bool operator==(const iterator& other) const
+ {
+ return m_iter == other.m_iter;
+ }
+
+ bool operator!=(const iterator& other) const
+ {
+ return !(*this == other);
+ }
+
+ private:
+ const CollectionType* m_collection;
+ BitVector::iterator m_iter;
+ };
+
+ iterator begin() const { return iterator(m_collection, m_set.begin()); }
+ iterator end() const { return iterator(m_collection, m_set.end()); }
+
+ private:
+ const CollectionType& m_collection;
+ const BitVector& m_set;
+ };
+
+ // For basic blocks, you do:
+ // indexSet.values(procedure);
+ //
+ // For values, you do:
+ // indexSet.values(procedure.values());
+ template<typename CollectionType>
+ Iterable<CollectionType> values(const CollectionType& collection) const
+ {
+ return Iterable<CollectionType>(collection, indices());
+ }
+
+ const BitVector& indices() const { return m_set; }
+
+ void dump(PrintStream& out) const
+ {
+ CommaPrinter comma;
+ for (size_t index : indices())
+ out.print(comma, T::dumpPrefix, index);
+ }
+
+private:
+ BitVector m_set;
+};
+
+} // namespace WTF
+
+using WTF::IndexSet;
</ins></span></pre></div>
<a id="trunkSourceWTFwtfIndexedContainerIteratorhfromrev204919trunkSourceJavaScriptCoreb3B3IndexMaph"></a>
<div class="copfile"><h4>Copied: trunk/Source/WTF/wtf/IndexedContainerIterator.h (from rev 204919, trunk/Source/JavaScriptCore/b3/B3IndexMap.h) (0 => 204920)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/IndexedContainerIterator.h         (rev 0)
+++ trunk/Source/WTF/wtf/IndexedContainerIterator.h        2016-08-24 19:35:41 UTC (rev 204920)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2015-2016 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
+
+#include <type_traits>
+
+namespace WTF {
+
+template<class Container>
+class IndexedContainerIterator {
+public:
+ IndexedContainerIterator()
+ : m_container(nullptr)
+ , m_index(0)
+ {
+ }
+
+ IndexedContainerIterator(const Container& container, unsigned index)
+ : m_container(&container)
+ , m_index(findNext(index))
+ {
+ }
+
+ auto operator*() -> typename std::result_of<decltype(&Container::at)(const Container, unsigned)>::type
+ {
+ return m_container->at(m_index);
+ }
+
+ IndexedContainerIterator& operator++()
+ {
+ m_index = findNext(m_index + 1);
+ return *this;
+ }
+
+ bool operator==(const IndexedContainerIterator& other) const
+ {
+ ASSERT(m_container == other.m_container);
+ return m_index == other.m_index;
+ }
+
+ bool operator!=(const IndexedContainerIterator& other) const
+ {
+ return !(*this == other);
+ }
+
+private:
+ unsigned findNext(unsigned index)
+ {
+ while (index < m_container->size() && !m_container->at(index))
+ index++;
+ return index;
+ }
+
+ const Container* m_container;
+ unsigned m_index;
+};
+
+} // namespace WTF
</ins></span></pre>
</div>
</div>
</body>
</html>