summaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/compiler/node-test-utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/unittests/compiler/node-test-utils.cc')
-rw-r--r--deps/v8/test/unittests/compiler/node-test-utils.cc120
1 files changed, 76 insertions, 44 deletions
diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc
index 34afc8822b..54168ee70b 100644
--- a/deps/v8/test/unittests/compiler/node-test-utils.cc
+++ b/deps/v8/test/unittests/compiler/node-test-utils.cc
@@ -12,6 +12,7 @@
#include "src/compiler/node-properties.h"
#include "src/compiler/simplified-operator.h"
#include "src/handles-inl.h"
+#include "src/objects.h"
using testing::_;
using testing::MakeMatcher;
@@ -410,7 +411,7 @@ class IsConstantMatcher final : public NodeMatcher {
class IsSelectMatcher final : public NodeMatcher {
public:
- IsSelectMatcher(const Matcher<MachineType>& type_matcher,
+ IsSelectMatcher(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher)
@@ -422,7 +423,7 @@ class IsSelectMatcher final : public NodeMatcher {
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
- *os << " whose type (";
+ *os << " whose representation (";
type_matcher_.DescribeTo(os);
*os << "), value0 (";
value0_matcher_.DescribeTo(os);
@@ -434,19 +435,20 @@ class IsSelectMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
- return (NodeMatcher::MatchAndExplain(node, listener) &&
- PrintMatchAndExplain(OpParameter<SelectParameters>(node).type(),
- "type", type_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));
+ return (
+ NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(SelectParametersOf(node->op()).representation(),
+ "representation", type_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));
}
private:
- const Matcher<MachineType> type_matcher_;
+ const Matcher<MachineRepresentation> type_matcher_;
const Matcher<Node*> value0_matcher_;
const Matcher<Node*> value1_matcher_;
const Matcher<Node*> value2_matcher_;
@@ -455,7 +457,7 @@ class IsSelectMatcher final : public NodeMatcher {
class IsPhiMatcher final : public NodeMatcher {
public:
- IsPhiMatcher(const Matcher<MachineType>& type_matcher,
+ IsPhiMatcher(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& control_matcher)
@@ -467,7 +469,7 @@ class IsPhiMatcher final : public NodeMatcher {
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
- *os << " whose type (";
+ *os << " whose representation (";
type_matcher_.DescribeTo(os);
*os << "), value0 (";
value0_matcher_.DescribeTo(os);
@@ -480,8 +482,8 @@ class IsPhiMatcher final : public NodeMatcher {
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
- PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
- type_matcher_, listener) &&
+ PrintMatchAndExplain(PhiRepresentationOf(node->op()),
+ "representation", type_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"value0", value0_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
@@ -491,7 +493,7 @@ class IsPhiMatcher final : public NodeMatcher {
}
private:
- const Matcher<MachineType> type_matcher_;
+ const Matcher<MachineRepresentation> type_matcher_;
const Matcher<Node*> value0_matcher_;
const Matcher<Node*> value1_matcher_;
const Matcher<Node*> control_matcher_;
@@ -500,7 +502,7 @@ class IsPhiMatcher final : public NodeMatcher {
class IsPhi2Matcher final : public NodeMatcher {
public:
- IsPhi2Matcher(const Matcher<MachineType>& type_matcher,
+ IsPhi2Matcher(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher,
@@ -514,7 +516,7 @@ class IsPhi2Matcher final : public NodeMatcher {
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
- *os << " whose type (";
+ *os << " whose representation (";
type_matcher_.DescribeTo(os);
*os << "), value0 (";
value0_matcher_.DescribeTo(os);
@@ -529,8 +531,8 @@ class IsPhi2Matcher final : public NodeMatcher {
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
- PrintMatchAndExplain(OpParameter<MachineType>(node), "type",
- type_matcher_, listener) &&
+ PrintMatchAndExplain(PhiRepresentationOf(node->op()),
+ "representation", type_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"value0", value0_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
@@ -542,7 +544,7 @@ class IsPhi2Matcher final : public NodeMatcher {
}
private:
- const Matcher<MachineType> type_matcher_;
+ const Matcher<MachineRepresentation> type_matcher_;
const Matcher<Node*> value0_matcher_;
const Matcher<Node*> value1_matcher_;
const Matcher<Node*> value2_matcher_;
@@ -706,10 +708,18 @@ class IsCallMatcher final : public NodeMatcher {
return false;
}
}
- return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
- effect_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetControlInput(node),
- "control", control_matcher_, listener));
+ Node* effect_node = nullptr;
+ Node* control_node = nullptr;
+ if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
+ effect_node = NodeProperties::GetEffectInput(node);
+ }
+ if (NodeProperties::FirstControlIndex(node) < node->InputCount()) {
+ control_node = NodeProperties::GetControlInput(node);
+ }
+ return (PrintMatchAndExplain(effect_node, "effect", effect_matcher_,
+ listener) &&
+ PrintMatchAndExplain(control_node, "control", control_matcher_,
+ listener));
}
private:
@@ -764,10 +774,18 @@ class IsTailCallMatcher final : public NodeMatcher {
return false;
}
}
- return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
- effect_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetControlInput(node),
- "control", control_matcher_, listener));
+ Node* effect_node = nullptr;
+ Node* control_node = nullptr;
+ if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
+ effect_node = NodeProperties::GetEffectInput(node);
+ }
+ if (NodeProperties::FirstControlIndex(node) < node->InputCount()) {
+ control_node = NodeProperties::GetControlInput(node);
+ }
+ return (PrintMatchAndExplain(effect_node, "effect", effect_matcher_,
+ listener) &&
+ PrintMatchAndExplain(control_node, "control", control_matcher_,
+ listener));
}
private:
@@ -1194,6 +1212,14 @@ class IsLoadMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
+ Node* effect_node = nullptr;
+ Node* control_node = nullptr;
+ if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
+ effect_node = NodeProperties::GetEffectInput(node);
+ }
+ if (NodeProperties::FirstControlIndex(node) < node->InputCount()) {
+ control_node = NodeProperties::GetControlInput(node);
+ }
return (NodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<LoadRepresentation>(node), "rep",
rep_matcher_, listener) &&
@@ -1201,10 +1227,10 @@ class IsLoadMatcher final : public NodeMatcher {
base_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
"index", index_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
- effect_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetControlInput(node),
- "control", control_matcher_, listener));
+ PrintMatchAndExplain(effect_node, "effect", effect_matcher_,
+ listener) &&
+ PrintMatchAndExplain(control_node, "control", control_matcher_,
+ listener));
}
private:
@@ -1250,6 +1276,14 @@ class IsStoreMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
+ Node* effect_node = nullptr;
+ Node* control_node = nullptr;
+ if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) {
+ effect_node = NodeProperties::GetEffectInput(node);
+ }
+ if (NodeProperties::FirstControlIndex(node) < node->InputCount()) {
+ control_node = NodeProperties::GetControlInput(node);
+ }
return (NodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<StoreRepresentation>(node), "rep",
rep_matcher_, listener) &&
@@ -1259,10 +1293,10 @@ class IsStoreMatcher final : public NodeMatcher {
"index", index_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
"value", value_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
- effect_matcher_, listener) &&
- PrintMatchAndExplain(NodeProperties::GetControlInput(node),
- "control", control_matcher_, listener));
+ PrintMatchAndExplain(effect_node, "effect", effect_matcher_,
+ listener) &&
+ PrintMatchAndExplain(control_node, "control", control_matcher_,
+ listener));
}
private:
@@ -1404,6 +1438,7 @@ class IsUnopMatcher final : public NodeMatcher {
const Matcher<Node*> input_matcher_;
};
+
class IsParameterMatcher final : public NodeMatcher {
public:
explicit IsParameterMatcher(const Matcher<int>& index_matcher)
@@ -1592,7 +1627,7 @@ Matcher<Node*> IsNumberConstant(const Matcher<double>& value_matcher) {
}
-Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
+Matcher<Node*> IsSelect(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher) {
@@ -1601,7 +1636,7 @@ Matcher<Node*> IsSelect(const Matcher<MachineType>& type_matcher,
}
-Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
+Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& merge_matcher) {
@@ -1610,7 +1645,7 @@ Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
}
-Matcher<Node*> IsPhi(const Matcher<MachineType>& type_matcher,
+Matcher<Node*> IsPhi(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher,
@@ -2022,7 +2057,6 @@ IS_BINOP_MATCHER(Word64And)
IS_BINOP_MATCHER(Word64Or)
IS_BINOP_MATCHER(Word64Sar)
IS_BINOP_MATCHER(Word64Shl)
-IS_BINOP_MATCHER(Word64Shr)
IS_BINOP_MATCHER(Word64Equal)
IS_BINOP_MATCHER(Int32AddWithOverflow)
IS_BINOP_MATCHER(Int32Add)
@@ -2034,7 +2068,6 @@ IS_BINOP_MATCHER(Uint32LessThan)
IS_BINOP_MATCHER(Uint32LessThanOrEqual)
IS_BINOP_MATCHER(Int64Add)
IS_BINOP_MATCHER(Int64Sub)
-IS_BINOP_MATCHER(Int64Mul)
IS_BINOP_MATCHER(JSAdd)
IS_BINOP_MATCHER(Float32Max)
IS_BINOP_MATCHER(Float32Min)
@@ -2063,7 +2096,6 @@ IS_UNOP_MATCHER(ChangeUint32ToUint64)
IS_UNOP_MATCHER(TruncateFloat64ToFloat32)
IS_UNOP_MATCHER(TruncateFloat64ToInt32)
IS_UNOP_MATCHER(TruncateInt64ToInt32)
-IS_UNOP_MATCHER(RoundInt64ToFloat64)
IS_UNOP_MATCHER(Float32Abs)
IS_UNOP_MATCHER(Float64Abs)
IS_UNOP_MATCHER(Float64Sqrt)