| 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 9b030324be87344bf60f9d4571139d147819f0d6..00050075c676b9ccb861af5c359dc21bdfda3d4a 100644
|
| --- a/test/unittests/compiler/node-test-utils.cc
|
| +++ b/test/unittests/compiler/node-test-utils.cc
|
| @@ -1473,7 +1473,114 @@ class IsJSDeletePropertyMatcher final : public NodeMatcher {
|
| };
|
|
|
|
|
| -// TODO(mythria): Check if we can use the same matcher for Load and Store
|
| +class IsJSLoadGlobalMatcher final : public NodeMatcher {
|
| + public:
|
| + IsJSLoadGlobalMatcher(const Matcher<Handle<Name>>& name_matcher,
|
| + const Matcher<TypeofMode> typeof_mode_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher)
|
| + : NodeMatcher(IrOpcode::kJSLoadGlobal),
|
| + name_matcher_(name_matcher),
|
| + typeof_mode_matcher_(typeof_mode_matcher),
|
| + feedback_vector_matcher_(feedback_vector_matcher),
|
| + effect_matcher_(effect_matcher),
|
| + control_matcher_(control_matcher) {}
|
| +
|
| + void DescribeTo(std::ostream* os) const final {
|
| + NodeMatcher::DescribeTo(os);
|
| + *os << " whose name (";
|
| + name_matcher_.DescribeTo(os);
|
| + *os << "), typeof mode (";
|
| + typeof_mode_matcher_.DescribeTo(os);
|
| + *os << "), feedback vector (";
|
| + feedback_vector_matcher_.DescribeTo(os);
|
| + *os << "), effect (";
|
| + effect_matcher_.DescribeTo(os);
|
| + *os << "), and control (";
|
| + control_matcher_.DescribeTo(os);
|
| + *os << ")";
|
| + }
|
| +
|
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
| + return (NodeMatcher::MatchAndExplain(node, listener) &&
|
| + PrintMatchAndExplain(OpParameter<LoadGlobalParameters>(node).name(),
|
| + "name", name_matcher_, listener) &&
|
| + PrintMatchAndExplain(
|
| + OpParameter<LoadGlobalParameters>(node).typeof_mode(),
|
| + "typeof mode", typeof_mode_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
| + "feedback vector", feedback_vector_matcher_,
|
| + listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
| + effect_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
| + "control", control_matcher_, listener));
|
| + }
|
| +
|
| + private:
|
| + const Matcher<Handle<Name>> name_matcher_;
|
| + const Matcher<TypeofMode> typeof_mode_matcher_;
|
| + const Matcher<Node*> feedback_vector_matcher_;
|
| + const Matcher<Node*> effect_matcher_;
|
| + const Matcher<Node*> control_matcher_;
|
| +};
|
| +
|
| +
|
| +class IsJSStoreGlobalMatcher final : public NodeMatcher {
|
| + public:
|
| + IsJSStoreGlobalMatcher(const Matcher<Handle<Name>>& name_matcher,
|
| + const Matcher<Node*>& value_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher)
|
| + : NodeMatcher(IrOpcode::kJSStoreGlobal),
|
| + name_matcher_(name_matcher),
|
| + value_matcher_(value_matcher),
|
| + feedback_vector_matcher_(feedback_vector_matcher),
|
| + effect_matcher_(effect_matcher),
|
| + control_matcher_(control_matcher) {}
|
| +
|
| + void DescribeTo(std::ostream* os) const final {
|
| + NodeMatcher::DescribeTo(os);
|
| + *os << " whose name (";
|
| + name_matcher_.DescribeTo(os);
|
| + *os << "), value (";
|
| + value_matcher_.DescribeTo(os);
|
| + *os << "), feedback vector (";
|
| + feedback_vector_matcher_.DescribeTo(os);
|
| + *os << "), effect (";
|
| + effect_matcher_.DescribeTo(os);
|
| + *os << "), and control (";
|
| + control_matcher_.DescribeTo(os);
|
| + *os << ")";
|
| + }
|
| +
|
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
| + return (
|
| + NodeMatcher::MatchAndExplain(node, listener) &&
|
| + PrintMatchAndExplain(OpParameter<StoreGlobalParameters>(node).name(),
|
| + "name", name_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "value",
|
| + value_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
| + "feedback vector", feedback_vector_matcher_,
|
| + listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
| + effect_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node), "control",
|
| + control_matcher_, listener));
|
| + }
|
| +
|
| + private:
|
| + const Matcher<Handle<Name>> name_matcher_;
|
| + const Matcher<Node*> value_matcher_;
|
| + const Matcher<Node*> feedback_vector_matcher_;
|
| + const Matcher<Node*> effect_matcher_;
|
| + const Matcher<Node*> control_matcher_;
|
| +};
|
| +
|
| +
|
| class IsJSLoadNamedMatcher final : public NodeMatcher {
|
| public:
|
| IsJSLoadNamedMatcher(const Matcher<Handle<Name>>& name_matcher,
|
| @@ -1527,26 +1634,83 @@ class IsJSLoadNamedMatcher final : public NodeMatcher {
|
| };
|
|
|
|
|
| -class IsJSLoadGlobalMatcher final : public NodeMatcher {
|
| +class IsJSLoadPropertyMatcher final : public NodeMatcher {
|
| public:
|
| - IsJSLoadGlobalMatcher(const Matcher<Handle<Name>>& name_matcher,
|
| - const Matcher<TypeofMode> typeof_mode_matcher,
|
| + IsJSLoadPropertyMatcher(const Matcher<Node*>& object_matcher,
|
| + const Matcher<Node*>& key_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher)
|
| + : NodeMatcher(IrOpcode::kJSLoadProperty),
|
| + object_matcher_(object_matcher),
|
| + key_matcher_(key_matcher),
|
| + feedback_vector_matcher_(feedback_vector_matcher),
|
| + effect_matcher_(effect_matcher),
|
| + control_matcher_(control_matcher) {}
|
| +
|
| + void DescribeTo(std::ostream* os) const final {
|
| + NodeMatcher::DescribeTo(os);
|
| + *os << " whose object (";
|
| + object_matcher_.DescribeTo(os);
|
| + *os << "), key (";
|
| + key_matcher_.DescribeTo(os);
|
| + *os << "), feedback vector (";
|
| + feedback_vector_matcher_.DescribeTo(os);
|
| + *os << "), effect (";
|
| + effect_matcher_.DescribeTo(os);
|
| + *os << "), and control (";
|
| + control_matcher_.DescribeTo(os);
|
| + *os << ")";
|
| + }
|
| +
|
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
| + return (NodeMatcher::MatchAndExplain(node, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
| + "object", object_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "key",
|
| + key_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
| + "feedback vector", feedback_vector_matcher_,
|
| + listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
| + effect_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
| + "control", control_matcher_, listener));
|
| + }
|
| +
|
| + private:
|
| + const Matcher<Node*> object_matcher_;
|
| + const Matcher<Node*> key_matcher_;
|
| + const Matcher<Node*> feedback_vector_matcher_;
|
| + const Matcher<Node*> effect_matcher_;
|
| + const Matcher<Node*> control_matcher_;
|
| +};
|
| +
|
| +
|
| +class IsJSStoreNamedMatcher final : public NodeMatcher {
|
| + public:
|
| + IsJSStoreNamedMatcher(const Matcher<Handle<Name>>& name_matcher,
|
| + const Matcher<Node*>& object_matcher,
|
| + const Matcher<Node*>& value_matcher,
|
| const Matcher<Node*>& feedback_vector_matcher,
|
| const Matcher<Node*>& effect_matcher,
|
| const Matcher<Node*>& control_matcher)
|
| - : NodeMatcher(IrOpcode::kJSLoadGlobal),
|
| + : NodeMatcher(IrOpcode::kJSStoreNamed),
|
| name_matcher_(name_matcher),
|
| - typeof_mode_matcher_(typeof_mode_matcher),
|
| + object_matcher_(object_matcher),
|
| + value_matcher_(value_matcher),
|
| feedback_vector_matcher_(feedback_vector_matcher),
|
| effect_matcher_(effect_matcher),
|
| control_matcher_(control_matcher) {}
|
|
|
| void DescribeTo(std::ostream* os) const final {
|
| NodeMatcher::DescribeTo(os);
|
| - *os << " whose name (";
|
| + *os << " whose object (";
|
| + object_matcher_.DescribeTo(os);
|
| + *os << "), name (";
|
| name_matcher_.DescribeTo(os);
|
| - *os << "), typeof mode (";
|
| - typeof_mode_matcher_.DescribeTo(os);
|
| + *os << "), value (";
|
| + value_matcher_.DescribeTo(os);
|
| *os << "), feedback vector (";
|
| feedback_vector_matcher_.DescribeTo(os);
|
| *os << "), effect (";
|
| @@ -1558,12 +1722,13 @@ class IsJSLoadGlobalMatcher final : public NodeMatcher {
|
|
|
| bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
| return (NodeMatcher::MatchAndExplain(node, listener) &&
|
| - PrintMatchAndExplain(OpParameter<LoadGlobalParameters>(node).name(),
|
| - "name", name_matcher_, listener) &&
|
| - PrintMatchAndExplain(
|
| - OpParameter<LoadGlobalParameters>(node).typeof_mode(),
|
| - "typeof mode", typeof_mode_matcher_, listener) &&
|
| + PrintMatchAndExplain(OpParameter<NamedAccess>(node).name(), "Name",
|
| + name_matcher_, listener) &&
|
| PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
| + "object", object_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
| + "value", value_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
| "feedback vector", feedback_vector_matcher_,
|
| listener) &&
|
| PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
| @@ -1574,22 +1739,25 @@ class IsJSLoadGlobalMatcher final : public NodeMatcher {
|
|
|
| private:
|
| const Matcher<Handle<Name>> name_matcher_;
|
| - const Matcher<TypeofMode> typeof_mode_matcher_;
|
| + const Matcher<Node*> object_matcher_;
|
| + const Matcher<Node*> value_matcher_;
|
| const Matcher<Node*> feedback_vector_matcher_;
|
| const Matcher<Node*> effect_matcher_;
|
| const Matcher<Node*> control_matcher_;
|
| };
|
|
|
|
|
| -class IsJSStoreGlobalMatcher final : public NodeMatcher {
|
| +class IsJSStorePropertyMatcher final : public NodeMatcher {
|
| public:
|
| - IsJSStoreGlobalMatcher(const Matcher<Handle<Name>>& name_matcher,
|
| - const Matcher<Node*>& value_matcher,
|
| - const Matcher<Node*>& feedback_vector_matcher,
|
| - const Matcher<Node*>& effect_matcher,
|
| - const Matcher<Node*>& control_matcher)
|
| - : NodeMatcher(IrOpcode::kJSStoreGlobal),
|
| - name_matcher_(name_matcher),
|
| + IsJSStorePropertyMatcher(const Matcher<Node*>& object_matcher,
|
| + const Matcher<Node*>& key_matcher,
|
| + const Matcher<Node*>& value_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher)
|
| + : NodeMatcher(IrOpcode::kJSStoreProperty),
|
| + object_matcher_(object_matcher),
|
| + key_matcher_(key_matcher),
|
| value_matcher_(value_matcher),
|
| feedback_vector_matcher_(feedback_vector_matcher),
|
| effect_matcher_(effect_matcher),
|
| @@ -1597,8 +1765,10 @@ class IsJSStoreGlobalMatcher final : public NodeMatcher {
|
|
|
| void DescribeTo(std::ostream* os) const final {
|
| NodeMatcher::DescribeTo(os);
|
| - *os << " whose name (";
|
| - name_matcher_.DescribeTo(os);
|
| + *os << " whose object (";
|
| + object_matcher_.DescribeTo(os);
|
| + *os << "), key (";
|
| + key_matcher_.DescribeTo(os);
|
| *os << "), value (";
|
| value_matcher_.DescribeTo(os);
|
| *os << "), feedback vector (";
|
| @@ -1606,28 +1776,28 @@ class IsJSStoreGlobalMatcher final : public NodeMatcher {
|
| *os << "), effect (";
|
| effect_matcher_.DescribeTo(os);
|
| *os << "), and control (";
|
| - control_matcher_.DescribeTo(os);
|
| - *os << ")";
|
| }
|
|
|
| bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
|
| - return (
|
| - NodeMatcher::MatchAndExplain(node, listener) &&
|
| - PrintMatchAndExplain(OpParameter<StoreGlobalParameters>(node).name(),
|
| - "name", name_matcher_, listener) &&
|
| - PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "value",
|
| - value_matcher_, listener) &&
|
| - PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
|
| - "feedback vector", feedback_vector_matcher_,
|
| - listener) &&
|
| - PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
| - effect_matcher_, listener) &&
|
| - PrintMatchAndExplain(NodeProperties::GetControlInput(node), "control",
|
| - control_matcher_, listener));
|
| + return (NodeMatcher::MatchAndExplain(node, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
|
| + "object", object_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "key",
|
| + key_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2),
|
| + "value", value_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3),
|
| + "feedback vector", feedback_vector_matcher_,
|
| + listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
|
| + effect_matcher_, listener) &&
|
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node),
|
| + "control", control_matcher_, listener));
|
| }
|
|
|
| private:
|
| - const Matcher<Handle<Name>> name_matcher_;
|
| + const Matcher<Node*> object_matcher_;
|
| + const Matcher<Node*> key_matcher_;
|
| const Matcher<Node*> value_matcher_;
|
| const Matcher<Node*> feedback_vector_matcher_;
|
| const Matcher<Node*> effect_matcher_;
|
| @@ -2310,6 +2480,40 @@ Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers,
|
| }
|
|
|
|
|
| +Matcher<Node*> IsJSLoadProperty(const Matcher<Node*>& object_matcher,
|
| + const Matcher<Node*>& key_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher) {
|
| + return MakeMatcher(new IsJSLoadPropertyMatcher(
|
| + object_matcher, key_matcher, feedback_vector_matcher, effect_matcher,
|
| + control_matcher));
|
| +}
|
| +
|
| +
|
| +Matcher<Node*> IsJSStoreNamed(const Handle<Name> name,
|
| + const Matcher<Node*>& object_matcher,
|
| + const Matcher<Node*>& value_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher) {
|
| + return MakeMatcher(new IsJSStoreNamedMatcher(
|
| + _, object_matcher, value_matcher, feedback_vector_matcher, effect_matcher,
|
| + control_matcher));
|
| +}
|
| +
|
| +
|
| +Matcher<Node*> IsJSStoreProperty(const Matcher<Node*>& object_matcher,
|
| + const Matcher<Node*>& key_matcher,
|
| + const Matcher<Node*>& value_matcher,
|
| + const Matcher<Node*>& feedback_vector_matcher,
|
| + const Matcher<Node*>& effect_matcher,
|
| + const Matcher<Node*>& control_matcher) {
|
| + return MakeMatcher(new IsJSStorePropertyMatcher(
|
| + object_matcher, key_matcher, value_matcher, feedback_vector_matcher,
|
| + effect_matcher, control_matcher));
|
| +}
|
| +
|
| #define IS_BINOP_MATCHER(Name) \
|
| Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
|
| const Matcher<Node*>& rhs_matcher) { \
|
|
|