diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/dfg/DFGNaturalLoops.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGNaturalLoops.h')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGNaturalLoops.h | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGNaturalLoops.h b/Source/JavaScriptCore/dfg/DFGNaturalLoops.h index 7ad0b0bdc..3f5e58080 100644 --- a/Source/JavaScriptCore/dfg/DFGNaturalLoops.h +++ b/Source/JavaScriptCore/dfg/DFGNaturalLoops.h @@ -23,16 +23,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DFGNaturalLoops_h -#define DFGNaturalLoops_h - -#include <wtf/Platform.h> +#pragma once #if ENABLE(DFG_JIT) -#include "DFGAnalysis.h" #include "DFGBasicBlock.h" #include "DFGCommon.h" +#include "DFGDominators.h" +#include <wtf/FastMalloc.h> +#include <wtf/Noncopyable.h> namespace JSC { namespace DFG { @@ -90,21 +89,19 @@ private: unsigned m_index; }; -class NaturalLoops : public Analysis<NaturalLoops> { +class NaturalLoops { + WTF_MAKE_NONCOPYABLE(NaturalLoops); + WTF_MAKE_FAST_ALLOCATED; public: - NaturalLoops(); + NaturalLoops(Graph&); ~NaturalLoops(); - void compute(Graph&); - unsigned numLoops() const { - ASSERT(isValid()); return m_loops.size(); } const NaturalLoop& loop(unsigned i) const { - ASSERT(isValid()); return m_loops[i]; } @@ -112,7 +109,6 @@ public: // loop it belongs to. const NaturalLoop* headerOf(BasicBlock* block) const { - ASSERT(isValid()); const NaturalLoop* loop = innerMostLoopOf(block); if (!loop) return 0; @@ -127,7 +123,6 @@ public: const NaturalLoop* innerMostLoopOf(BasicBlock* block) const { - ASSERT(isValid()); unsigned index = block->innerMostLoopIndices[0]; if (index == UINT_MAX) return 0; @@ -136,7 +131,6 @@ public: const NaturalLoop* innerMostOuterLoop(const NaturalLoop& loop) const { - ASSERT(isValid()); if (loop.m_outerLoopIndex == UINT_MAX) return 0; return &m_loops[loop.m_outerLoopIndex]; @@ -144,7 +138,6 @@ public: bool belongsTo(BasicBlock* block, const NaturalLoop& candidateLoop) const { - ASSERT(isValid()); // It's faster to do this test using the loop itself, if it's small. if (candidateLoop.size() < 4) return candidateLoop.contains(block); @@ -156,6 +149,14 @@ public: return false; } + unsigned loopDepth(BasicBlock* block) const + { + unsigned depth = 0; + for (const NaturalLoop* loop = innerMostLoopOf(block); loop; loop = innerMostOuterLoop(*loop)) + depth++; + return depth; + } + // Return the indices of all loops this belongs to. Vector<const NaturalLoop*> loopsOf(BasicBlock*) const; @@ -169,6 +170,3 @@ private: } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT) - -#endif // DFGNaturalLoops_h - |