summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/dfg/DFGAdjacencyList.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/dfg/DFGAdjacencyList.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGAdjacencyList.h')
-rw-r--r--Source/JavaScriptCore/dfg/DFGAdjacencyList.h65
1 files changed, 56 insertions, 9 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGAdjacencyList.h b/Source/JavaScriptCore/dfg/DFGAdjacencyList.h
index dc3cccb3f..4efbdeb74 100644
--- a/Source/JavaScriptCore/dfg/DFGAdjacencyList.h
+++ b/Source/JavaScriptCore/dfg/DFGAdjacencyList.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,10 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DFGAdjacencyList_h
-#define DFGAdjacencyList_h
-
-#include <wtf/Platform.h>
+#pragma once
#if ENABLE(DFG_JIT)
@@ -54,7 +51,7 @@ public:
}
}
- AdjacencyList(Kind kind, Edge child1, Edge child2, Edge child3)
+ AdjacencyList(Kind kind, Edge child1, Edge child2 = Edge(), Edge child3 = Edge())
{
ASSERT_UNUSED(kind, kind == Fixed);
initialize(child1, child2, child3);
@@ -67,6 +64,8 @@ public:
setNumChildren(numChildren);
}
+ bool isEmpty() const { return !child1(); }
+
const Edge& child(unsigned i) const
{
ASSERT(i < Size);
@@ -132,7 +131,7 @@ public:
setChild(i, child(i + 1));
setChild(Size - 1, Edge());
}
-
+
unsigned firstChild() const
{
return m_words[0].m_encodedWord;
@@ -151,6 +150,56 @@ public:
m_words[1].m_encodedWord = numChildren;
}
+ AdjacencyList sanitized() const
+ {
+ return AdjacencyList(Fixed, child1().sanitized(), child2().sanitized(), child3().sanitized());
+ }
+
+ AdjacencyList justChecks() const
+ {
+ AdjacencyList result(Fixed);
+ unsigned sourceIndex = 0;
+ unsigned targetIndex = 0;
+ while (sourceIndex < AdjacencyList::Size) {
+ Edge edge = child(sourceIndex++);
+ if (!edge)
+ break;
+ if (edge.willHaveCheck())
+ result.child(targetIndex++) = edge;
+ }
+ return result;
+ }
+
+ unsigned hash() const
+ {
+ unsigned result = 0;
+ if (!child1())
+ return result;
+
+ result += child1().hash();
+
+ if (!child2())
+ return result;
+
+ result *= 3;
+ result += child2().hash();
+
+ if (!child3())
+ return result;
+
+ result *= 3;
+ result += child3().hash();
+
+ return result;
+ }
+
+ bool operator==(const AdjacencyList& other) const
+ {
+ return child1() == other.child1()
+ && child2() == other.child2()
+ && child3() == other.child3();
+ }
+
private:
Edge m_words[Size];
};
@@ -158,5 +207,3 @@ private:
} } // namespace JSC::DFG
#endif // ENABLE(DFG_JIT)
-
-#endif // DFGAdjacencyList_h