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

Unified Diff: test/compiler-unittests/graph-unittest.cc

Issue 479163002: [turbofan] Add new ControlEffect and Finish operators. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « test/compiler-unittests/graph-unittest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/compiler-unittests/graph-unittest.cc
diff --git a/test/compiler-unittests/graph-unittest.cc b/test/compiler-unittests/graph-unittest.cc
index 6c946de590aa2ce45e8a3d6c86a05bdb065d18f2..e5b413c545260c519d8697a1556702ec85a499c7 100644
--- a/test/compiler-unittests/graph-unittest.cc
+++ b/test/compiler-unittests/graph-unittest.cc
@@ -22,6 +22,12 @@ inline std::ostream& operator<<(std::ostream& os,
const PrintableUnique<T>& value) {
return os << value.string();
}
+inline std::ostream& operator<<(std::ostream& os,
+ const ExternalReference& value) {
+ OStringStream ost;
+ compiler::StaticParameterTraits<ExternalReference>::PrintTo(ost, value);
+ return os << ost.c_str();
+}
namespace compiler {
@@ -66,7 +72,8 @@ class NodeMatcher : public MatcherInterface<Node*> {
return false;
}
if (node->opcode() != opcode_) {
- *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode());
+ *listener << "whose opcode is " << IrOpcode::Mnemonic(node->opcode())
+ << " but should have been " << IrOpcode::Mnemonic(opcode_);
return false;
}
return true;
@@ -141,10 +148,11 @@ class IsMergeMatcher V8_FINAL : public NodeMatcher {
};
-class IsIfTrueMatcher V8_FINAL : public NodeMatcher {
+class IsControl1Matcher V8_FINAL : public NodeMatcher {
public:
- explicit IsIfTrueMatcher(const Matcher<Node*>& control_matcher)
- : NodeMatcher(IrOpcode::kIfTrue), control_matcher_(control_matcher) {}
+ IsControl1Matcher(IrOpcode::Value opcode,
+ const Matcher<Node*>& control_matcher)
+ : NodeMatcher(opcode), control_matcher_(control_matcher) {}
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE {
NodeMatcher::DescribeTo(os);
@@ -165,27 +173,35 @@ class IsIfTrueMatcher V8_FINAL : public NodeMatcher {
};
-class IsIfFalseMatcher V8_FINAL : public NodeMatcher {
+class IsFinishMatcher V8_FINAL : public NodeMatcher {
public:
- explicit IsIfFalseMatcher(const Matcher<Node*>& control_matcher)
- : NodeMatcher(IrOpcode::kIfFalse), control_matcher_(control_matcher) {}
+ IsFinishMatcher(const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& effect_matcher)
+ : NodeMatcher(IrOpcode::kFinish),
+ value_matcher_(value_matcher),
+ effect_matcher_(effect_matcher) {}
virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE {
NodeMatcher::DescribeTo(os);
- *os << " whose control (";
- control_matcher_.DescribeTo(os);
+ *os << " whose value (";
+ value_matcher_.DescribeTo(os);
+ *os << ") and effect (";
+ effect_matcher_.DescribeTo(os);
*os << ")";
}
virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const
V8_OVERRIDE {
return (NodeMatcher::MatchAndExplain(node, listener) &&
- PrintMatchAndExplain(NodeProperties::GetControlInput(node),
- "control", control_matcher_, listener));
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
+ "value", value_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
+ effect_matcher_, listener));
}
private:
- const Matcher<Node*> control_matcher_;
+ const Matcher<Node*> value_matcher_;
+ const Matcher<Node*> effect_matcher_;
};
@@ -285,6 +301,71 @@ class IsProjectionMatcher V8_FINAL : public NodeMatcher {
};
+class IsCallMatcher V8_FINAL : public NodeMatcher {
+ public:
+ IsCallMatcher(const Matcher<CallDescriptor*>& descriptor_matcher,
+ const Matcher<Node*>& value0_matcher,
+ const Matcher<Node*>& value1_matcher,
+ const Matcher<Node*>& value2_matcher,
+ const Matcher<Node*>& value3_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher)
+ : NodeMatcher(IrOpcode::kCall),
+ descriptor_matcher_(descriptor_matcher),
+ value0_matcher_(value0_matcher),
+ value1_matcher_(value1_matcher),
+ value2_matcher_(value2_matcher),
+ value3_matcher_(value3_matcher),
+ effect_matcher_(effect_matcher),
+ control_matcher_(control_matcher) {}
+
+ virtual void DescribeTo(std::ostream* os) const V8_OVERRIDE {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose value0 (";
+ value0_matcher_.DescribeTo(os);
+ *os << ") and value1 (";
+ value1_matcher_.DescribeTo(os);
+ *os << ") and value2 (";
+ value2_matcher_.DescribeTo(os);
+ *os << ") and value3 (";
+ value3_matcher_.DescribeTo(os);
+ *os << ") and effect (";
+ effect_matcher_.DescribeTo(os);
+ *os << ") and control (";
+ control_matcher_.DescribeTo(os);
+ *os << ")";
+ }
+
+ virtual bool MatchAndExplain(Node* node, MatchResultListener* listener) const
+ V8_OVERRIDE {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(OpParameter<CallDescriptor*>(node),
+ "descriptor", descriptor_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
+ "value0", value0_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
+ "value1", value1_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
+ "value2", value2_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
+ "value3", value3_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
+ effect_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node),
+ "control", control_matcher_, listener));
+ }
+
+ private:
+ const Matcher<CallDescriptor*> descriptor_matcher_;
+ const Matcher<Node*> value0_matcher_;
+ const Matcher<Node*> value1_matcher_;
+ const Matcher<Node*> value2_matcher_;
+ const Matcher<Node*> value3_matcher_;
+ const Matcher<Node*> effect_matcher_;
+ const Matcher<Node*> control_matcher_;
+};
+
+
class IsLoadMatcher V8_FINAL : public NodeMatcher {
public:
IsLoadMatcher(const Matcher<MachineType>& type_matcher,
@@ -470,18 +551,32 @@ Matcher<Node*> IsMerge(const Matcher<Node*>& control0_matcher,
Matcher<Node*> IsIfTrue(const Matcher<Node*>& control_matcher) {
- return MakeMatcher(new IsIfTrueMatcher(control_matcher));
+ return MakeMatcher(new IsControl1Matcher(IrOpcode::kIfTrue, control_matcher));
}
Matcher<Node*> IsIfFalse(const Matcher<Node*>& control_matcher) {
- return MakeMatcher(new IsIfFalseMatcher(control_matcher));
+ return MakeMatcher(
+ new IsControl1Matcher(IrOpcode::kIfFalse, control_matcher));
}
-Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher) {
+Matcher<Node*> IsControlEffect(const Matcher<Node*>& control_matcher) {
return MakeMatcher(
- new IsConstantMatcher<int32_t>(IrOpcode::kInt32Constant, value_matcher));
+ new IsControl1Matcher(IrOpcode::kControlEffect, control_matcher));
+}
+
+
+Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& effect_matcher) {
+ return MakeMatcher(new IsFinishMatcher(value_matcher, effect_matcher));
+}
+
+
+Matcher<Node*> IsExternalConstant(
+ const Matcher<ExternalReference>& value_matcher) {
+ return MakeMatcher(new IsConstantMatcher<ExternalReference>(
+ IrOpcode::kExternalConstant, value_matcher));
}
@@ -492,6 +587,18 @@ Matcher<Node*> IsHeapConstant(
}
+Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher) {
+ return MakeMatcher(
+ new IsConstantMatcher<int32_t>(IrOpcode::kInt32Constant, value_matcher));
+}
+
+
+Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher) {
+ return MakeMatcher(
+ new IsConstantMatcher<double>(IrOpcode::kNumberConstant, value_matcher));
+}
+
+
Matcher<Node*> IsPhi(const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& merge_matcher) {
@@ -506,6 +613,19 @@ Matcher<Node*> IsProjection(const Matcher<int32_t>& index_matcher,
}
+Matcher<Node*> IsCall(const Matcher<CallDescriptor*>& descriptor_matcher,
+ const Matcher<Node*>& value0_matcher,
+ const Matcher<Node*>& value1_matcher,
+ const Matcher<Node*>& value2_matcher,
+ const Matcher<Node*>& value3_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(new IsCallMatcher(
+ descriptor_matcher, value0_matcher, value1_matcher, value2_matcher,
+ value3_matcher, effect_matcher, control_matcher));
+}
+
+
Matcher<Node*> IsLoad(const Matcher<MachineType>& type_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
« no previous file with comments | « test/compiler-unittests/graph-unittest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698