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

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

Issue 1449373002: [Interpreter] Add support for global loads / stores / calls to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@rmcilroy-0000
Patch Set: Rebase. Created 5 years, 1 month 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/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 897065824b50b22232866bbf49d49915a9dfb3d1..8f7057d2c6808a9c28825ee9fedccabddff4a1b2 100644
--- a/test/unittests/compiler/node-test-utils.cc
+++ b/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;
@@ -1481,6 +1482,115 @@ class IsJSLoadNamedMatcher final : public NodeMatcher {
};
+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<const LoadGlobalParameters>(node).name(), "name",
+ name_matcher_, listener) &&
+ PrintMatchAndExplain(
+ OpParameter<const 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<const 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 IsJSCallFunctionMatcher final : public NodeMatcher {
public:
IsJSCallFunctionMatcher(const std::vector<Matcher<Node*>>& value_matchers,
@@ -2117,6 +2227,28 @@ Matcher<Node*> IsJSLoadNamed(const Handle<Name> name,
}
+Matcher<Node*> IsJSLoadGlobal(const Handle<Name> name,
+ const TypeofMode typeof_mode,
+ const Matcher<Node*>& feedback_vector_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(
+ new IsJSLoadGlobalMatcher(name, typeof_mode, feedback_vector_matcher,
+ effect_matcher, control_matcher));
+}
+
+
+Matcher<Node*> IsJSStoreGlobal(const Handle<Name> name,
+ const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& feedback_vector_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(
+ new IsJSStoreGlobalMatcher(name, value_matcher, feedback_vector_matcher,
+ effect_matcher, control_matcher));
+}
+
+
Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher) {
« no previous file with comments | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698