Index: src/compiler/node-matchers.h |
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h |
index 1a29bb830e194c9d813b122eb2a0f12367a29f95..48ff3d732326406a04289afddd8a4ce004cf19fc 100644 |
--- a/src/compiler/node-matchers.h |
+++ b/src/compiler/node-matchers.h |
@@ -7,6 +7,8 @@ |
#include <cmath> |
+// TODO(turbofan): Move ExternalReference out of assembler.h |
+#include "src/assembler.h" |
#include "src/compiler/node.h" |
#include "src/compiler/operator.h" |
#include "src/unique.h" |
@@ -155,6 +157,32 @@ struct HeapObjectMatcher FINAL |
}; |
+// A pattern matcher for external reference constants. |
+struct ExternalReferenceMatcher FINAL |
+ : public ValueMatcher<ExternalReference, IrOpcode::kExternalConstant> { |
+ explicit ExternalReferenceMatcher(Node* node) |
+ : ValueMatcher<ExternalReference, IrOpcode::kExternalConstant>(node) {} |
+}; |
+ |
+ |
+// For shorter pattern matching code, this struct matches the inputs to |
+// machine-level load operations. |
+template <typename Object> |
+struct LoadMatcher : public NodeMatcher { |
+ explicit LoadMatcher(Node* node) |
+ : NodeMatcher(node), object_(InputAt(0)), index_(InputAt(1)) {} |
+ |
+ typedef Object ObjectMatcher; |
+ |
+ Object const& object() const { return object_; } |
+ IntPtrMatcher const& index() const { return index_; } |
+ |
+ private: |
+ Object const object_; |
+ IntPtrMatcher const index_; |
+}; |
+ |
+ |
// For shorter pattern matching code, this struct matches both the left and |
// right hand sides of a binary operation and can put constants on the right |
// if they appear on the left hand side of a commutative operation. |