Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: test/unittests/compiler/node-test-utils.cc

Issue 763963002: [turbofan] Add checked load/store operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reapply fix. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/unittests/compiler/node-test-utils.cc
diff --git a/test/unittests/compiler/node-test-utils.cc b/test/unittests/compiler/node-test-utils.cc
index cb50807ce93182fa13a666c8fa62f40b4fec9d56..e58d9c85579482eb7335b8f5bdd4f0b5754679aa 100644
--- a/test/unittests/compiler/node-test-utils.cc
+++ b/test/unittests/compiler/node-test-utils.cc
@@ -533,19 +533,146 @@ class IsLoadFieldMatcher FINAL : public NodeMatcher {
};
+class IsLoadBufferMatcher FINAL : public NodeMatcher {
+ public:
+ IsLoadBufferMatcher(const Matcher<BufferAccess>& access_matcher,
+ const Matcher<Node*>& buffer_matcher,
+ const Matcher<Node*>& offset_matcher,
+ const Matcher<Node*>& length_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher)
+ : NodeMatcher(IrOpcode::kLoadBuffer),
+ access_matcher_(access_matcher),
+ buffer_matcher_(buffer_matcher),
+ offset_matcher_(offset_matcher),
+ length_matcher_(length_matcher),
+ effect_matcher_(effect_matcher),
+ control_matcher_(control_matcher) {}
+
+ virtual void DescribeTo(std::ostream* os) const OVERRIDE {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose access (";
+ access_matcher_.DescribeTo(os);
+ *os << "), buffer (";
+ buffer_matcher_.DescribeTo(os);
+ *os << "), offset (";
+ offset_matcher_.DescribeTo(os);
+ *os << "), length (";
+ length_matcher_.DescribeTo(os);
+ *os << "), effect (";
+ effect_matcher_.DescribeTo(os);
+ *os << ") and control (";
+ control_matcher_.DescribeTo(os);
+ *os << ")";
+ }
+
+ virtual bool MatchAndExplain(Node* node,
+ MatchResultListener* listener) const OVERRIDE {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(BufferAccessOf(node->op()), "access",
+ access_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
+ "buffer", buffer_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
+ "offset", offset_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
+ "length", length_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
+ effect_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node),
+ "control", control_matcher_, listener));
+ }
+
+ private:
+ const Matcher<BufferAccess> access_matcher_;
+ const Matcher<Node*> buffer_matcher_;
+ const Matcher<Node*> offset_matcher_;
+ const Matcher<Node*> length_matcher_;
+ const Matcher<Node*> effect_matcher_;
+ const Matcher<Node*> control_matcher_;
+};
+
+
+class IsStoreBufferMatcher FINAL : public NodeMatcher {
+ public:
+ IsStoreBufferMatcher(const Matcher<BufferAccess>& access_matcher,
+ const Matcher<Node*>& buffer_matcher,
+ const Matcher<Node*>& offset_matcher,
+ const Matcher<Node*>& length_matcher,
+ const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher)
+ : NodeMatcher(IrOpcode::kStoreBuffer),
+ access_matcher_(access_matcher),
+ buffer_matcher_(buffer_matcher),
+ offset_matcher_(offset_matcher),
+ length_matcher_(length_matcher),
+ value_matcher_(value_matcher),
+ effect_matcher_(effect_matcher),
+ control_matcher_(control_matcher) {}
+
+ virtual void DescribeTo(std::ostream* os) const OVERRIDE {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose access (";
+ access_matcher_.DescribeTo(os);
+ *os << "), buffer (";
+ buffer_matcher_.DescribeTo(os);
+ *os << "), offset (";
+ offset_matcher_.DescribeTo(os);
+ *os << "), length (";
+ length_matcher_.DescribeTo(os);
+ *os << "), value (";
+ value_matcher_.DescribeTo(os);
+ *os << "), effect (";
+ effect_matcher_.DescribeTo(os);
+ *os << ") and control (";
+ control_matcher_.DescribeTo(os);
+ *os << ")";
+ }
+
+ virtual bool MatchAndExplain(Node* node,
+ MatchResultListener* listener) const OVERRIDE {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(BufferAccessOf(node->op()), "access",
+ access_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
+ "buffer", buffer_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
+ "offset", offset_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
+ "length", length_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
+ "value", value_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
+ effect_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node),
+ "control", control_matcher_, listener));
+ }
+
+ private:
+ const Matcher<BufferAccess> access_matcher_;
+ const Matcher<Node*> buffer_matcher_;
+ const Matcher<Node*> offset_matcher_;
+ const Matcher<Node*> length_matcher_;
+ const Matcher<Node*> value_matcher_;
+ const Matcher<Node*> effect_matcher_;
+ const Matcher<Node*> control_matcher_;
+};
+
+
class IsLoadElementMatcher FINAL : public NodeMatcher {
public:
IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& length_matcher,
- const Matcher<Node*>& effect_matcher)
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kLoadElement),
access_matcher_(access_matcher),
base_matcher_(base_matcher),
index_matcher_(index_matcher),
- length_matcher_(length_matcher),
- effect_matcher_(effect_matcher) {}
+ effect_matcher_(effect_matcher),
+ control_matcher_(control_matcher) {}
virtual void DescribeTo(std::ostream* os) const OVERRIDE {
NodeMatcher::DescribeTo(os);
@@ -555,10 +682,10 @@ class IsLoadElementMatcher FINAL : public NodeMatcher {
base_matcher_.DescribeTo(os);
*os << "), index (";
index_matcher_.DescribeTo(os);
- *os << "), length (";
- length_matcher_.DescribeTo(os);
- *os << ") and effect (";
+ *os << "), effect (";
effect_matcher_.DescribeTo(os);
+ *os << ") and control (";
+ control_matcher_.DescribeTo(os);
*os << ")";
}
@@ -571,18 +698,18 @@ class IsLoadElementMatcher FINAL : public NodeMatcher {
base_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
"index", index_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
- "length", length_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
- effect_matcher_, listener));
+ effect_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node),
+ "control", control_matcher_, listener));
}
private:
const Matcher<ElementAccess> access_matcher_;
const Matcher<Node*> base_matcher_;
const Matcher<Node*> index_matcher_;
- const Matcher<Node*> length_matcher_;
const Matcher<Node*> effect_matcher_;
+ const Matcher<Node*> control_matcher_;
};
@@ -591,7 +718,6 @@ class IsStoreElementMatcher FINAL : public NodeMatcher {
IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& length_matcher,
const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
@@ -599,7 +725,6 @@ class IsStoreElementMatcher FINAL : public NodeMatcher {
access_matcher_(access_matcher),
base_matcher_(base_matcher),
index_matcher_(index_matcher),
- length_matcher_(length_matcher),
value_matcher_(value_matcher),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
@@ -612,8 +737,6 @@ class IsStoreElementMatcher FINAL : public NodeMatcher {
base_matcher_.DescribeTo(os);
*os << "), index (";
index_matcher_.DescribeTo(os);
- *os << "), length (";
- length_matcher_.DescribeTo(os);
*os << "), value (";
value_matcher_.DescribeTo(os);
*os << "), effect (";
@@ -633,8 +756,6 @@ class IsStoreElementMatcher FINAL : public NodeMatcher {
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
"index", index_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
- "length", length_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
"value", value_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
effect_matcher_, listener) &&
@@ -646,7 +767,6 @@ class IsStoreElementMatcher FINAL : public NodeMatcher {
const Matcher<ElementAccess> access_matcher_;
const Matcher<Node*> base_matcher_;
const Matcher<Node*> index_matcher_;
- const Matcher<Node*> length_matcher_;
const Matcher<Node*> value_matcher_;
const Matcher<Node*> effect_matcher_;
const Matcher<Node*> control_matcher_;
@@ -1012,27 +1132,51 @@ Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher,
}
+Matcher<Node*> IsLoadBuffer(const Matcher<BufferAccess>& access_matcher,
+ const Matcher<Node*>& buffer_matcher,
+ const Matcher<Node*>& offset_matcher,
+ const Matcher<Node*>& length_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(new IsLoadBufferMatcher(access_matcher, buffer_matcher,
+ offset_matcher, length_matcher,
+ effect_matcher, control_matcher));
+}
+
+
+Matcher<Node*> IsStoreBuffer(const Matcher<BufferAccess>& access_matcher,
+ const Matcher<Node*>& buffer_matcher,
+ const Matcher<Node*>& offset_matcher,
+ const Matcher<Node*>& length_matcher,
+ const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(new IsStoreBufferMatcher(
+ access_matcher, buffer_matcher, offset_matcher, length_matcher,
+ value_matcher, effect_matcher, control_matcher));
+}
+
+
Matcher<Node*> IsLoadElement(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& length_matcher,
- const Matcher<Node*>& effect_matcher) {
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
return MakeMatcher(new IsLoadElementMatcher(access_matcher, base_matcher,
- index_matcher, length_matcher,
- effect_matcher));
+ index_matcher, effect_matcher,
+ control_matcher));
}
Matcher<Node*> IsStoreElement(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
- const Matcher<Node*>& length_matcher,
const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher) {
return MakeMatcher(new IsStoreElementMatcher(
- access_matcher, base_matcher, index_matcher, length_matcher,
- value_matcher, effect_matcher, control_matcher));
+ access_matcher, base_matcher, index_matcher, value_matcher,
+ effect_matcher, control_matcher));
}
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | test/unittests/compiler/simplified-operator-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698