Commit d6ead37d authored by Mostyn Bramley-Moore's avatar Mostyn Bramley-Moore Committed by Commit Bot

[jumbo] add unittests jumbo support

TBR=jkummerow@chromium.org

Bug: chromium:746958
Change-Id: I7500b6206c4ceb087672de5b61b7e7ad234bb425
Reviewed-on: https://chromium-review.googlesource.com/690397
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48213}
parent e52b4a62
......@@ -7,6 +7,30 @@ import("../../gni/v8.gni")
v8_executable("unittests") {
testonly = true
# TODO(machenbach): Translate from gyp.
#['OS=="aix"', {
# 'ldflags': [ '-Wl,-bbigtoc' ],
#}],
deps = [
":unittests_sources",
"../..:v8_for_testing",
"../..:v8_libbase",
"../..:v8_libplatform",
"//build/config:exe_and_shlib_deps",
"//build/win:default_exe_manifest",
"//testing/gmock",
"//testing/gtest",
]
configs = [
"../..:external_config",
"../..:internal_config_base",
]
}
v8_source_set("unittests_sources") {
testonly = true
sources = [
"../../test/common/wasm/wasm-macro-gen.h",
"../../testing/gmock-support.h",
......@@ -168,6 +192,15 @@ v8_executable("unittests") {
"zone/zone-unittest.cc",
]
if (use_jumbo_build) {
jumbo_excluded_sources = [
# TODO(mostynb@opera.com): figure out how to make this build in both
# modes. Template issues on windows if we add a functional_unittest
# namespace as with the other files.
"base/functional-unittest.cc",
]
}
if (v8_current_cpu == "arm") {
sources += [ "compiler/arm/instruction-selector-arm-unittest.cc" ]
} else if (v8_current_cpu == "arm64") {
......@@ -191,11 +224,6 @@ v8_executable("unittests") {
"../..:internal_config_base",
]
# TODO(machenbach): Translate from gyp.
#['OS=="aix"', {
# 'ldflags': [ '-Wl,-bbigtoc' ],
#}],
deps = [
"../..:v8_for_testing",
"../..:v8_libbase",
......
......@@ -11,6 +11,7 @@
#include "test/unittests/test-utils.h"
namespace v8 {
namespace remote_object_unittest {
typedef TestWithIsolate RemoteObjectTest;
......@@ -115,4 +116,5 @@ TEST_F(RemoteObjectTest, ClassOf) {
EXPECT_STREQ("test_class", *result);
}
} // namespace remote_object_unittest
} // namespace v8
......@@ -10,6 +10,7 @@
namespace v8 {
namespace base {
namespace logging_unittest {
namespace {
......@@ -243,5 +244,6 @@ TEST(LoggingDeathTest, V8_DcheckCanBeOverridden) {
"Dread pirate");
}
} // namespace logging_unittest
} // namespace base
} // namespace v8
......@@ -8,6 +8,7 @@
namespace v8 {
namespace base {
namespace template_utils_unittest {
////////////////////////////
// Test make_array.
......@@ -100,5 +101,6 @@ static_assert(has_output_operator<TestClass2>::value,
static_assert(!has_output_operator<const TestClass2>::value,
"const TestClass2 can not be output");
} // namespace template_utils_unittest
} // namespace base
} // namespace v8
......@@ -17,6 +17,7 @@ using testing::StrictMock;
namespace v8 {
namespace internal {
namespace compiler {
namespace common_operator_reducer_unittest {
class CommonOperatorReducerTest : public GraphTest {
public:
......@@ -491,6 +492,7 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat64Abs) {
EXPECT_THAT(r.replacement(), IsFloat64Abs(p0));
}
} // namespace common_operator_reducer_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -13,7 +13,7 @@
namespace v8 {
namespace internal {
namespace compiler {
namespace common_operator_unittest {
// -----------------------------------------------------------------------------
// Shared operators.
......@@ -387,6 +387,7 @@ TEST_F(CommonOperatorTest, Projection) {
}
}
} // namespace common_operator_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -14,6 +14,7 @@ using testing::StrictMock;
namespace v8 {
namespace internal {
namespace compiler {
namespace dead_code_elimination_unittest {
class DeadCodeEliminationTest : public GraphTest {
public:
......@@ -368,6 +369,7 @@ TEST_F(DeadCodeEliminationTest, TerminateWithDeadControlInput) {
EXPECT_THAT(r.replacement(), IsDead());
}
} // namespace dead_code_elimination_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -21,6 +21,7 @@ using testing::UnorderedElementsAre;
namespace v8 {
namespace internal {
namespace compiler {
namespace graph_reducer_unittest {
namespace {
......@@ -872,6 +873,7 @@ TEST_F(GraphReducerTest, Order) {
}
}
} // namespace graph_reducer_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -10,6 +10,7 @@
namespace v8 {
namespace internal {
namespace compiler {
namespace instruction_unittest {
namespace {
......@@ -170,6 +171,7 @@ TEST_F(InstructionTest, PrepareInsertAfter) {
}
}
} // namespace instruction_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -11,6 +11,7 @@
namespace v8 {
namespace internal {
namespace compiler {
namespace js_operator_unittest {
// -----------------------------------------------------------------------------
// Shared operators.
......@@ -112,6 +113,7 @@ TEST_P(JSSharedOperatorTest, Properties) {
INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest,
::testing::ValuesIn(kSharedOperators));
} // namespace js_operator_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -12,6 +12,7 @@ using testing::Contains;
namespace v8 {
namespace internal {
namespace compiler {
namespace node_cache_unittest {
typedef GraphTest NodeCacheTest;
......@@ -154,6 +155,7 @@ TEST_F(NodeCacheTest, GetCachedNodes_int64) {
}
}
} // namespace node_cache_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -14,6 +14,7 @@ using testing::IsNull;
namespace v8 {
namespace internal {
namespace compiler {
namespace node_properties_unittest {
class NodePropertiesTest : public TestWithZone {
public:
......@@ -118,6 +119,7 @@ TEST_F(NodePropertiesTest, CollectControlProjections_Switch) {
EXPECT_EQ(if_default, result[2]);
}
} // namespace node_properties_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -47,10 +47,9 @@ bool PrintMatchAndExplain(const T& value, const std::string& value_name,
return true;
}
class NodeMatcher : public MatcherInterface<Node*> {
class TestNodeMatcher : public MatcherInterface<Node*> {
public:
explicit NodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {}
explicit TestNodeMatcher(IrOpcode::Value opcode) : opcode_(opcode) {}
void DescribeTo(std::ostream* os) const override {
*os << "is a " << IrOpcode::Mnemonic(opcode_) << " node";
......@@ -74,17 +73,16 @@ class NodeMatcher : public MatcherInterface<Node*> {
const IrOpcode::Value opcode_;
};
class IsBranchMatcher final : public NodeMatcher {
class IsBranchMatcher final : public TestNodeMatcher {
public:
IsBranchMatcher(const Matcher<Node*>& value_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kBranch),
: TestNodeMatcher(IrOpcode::kBranch),
value_matcher_(value_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
*os << ") and control (";
......@@ -93,7 +91,7 @@ class IsBranchMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"value", value_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
......@@ -105,17 +103,16 @@ class IsBranchMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsSwitchMatcher final : public NodeMatcher {
class IsSwitchMatcher final : public TestNodeMatcher {
public:
IsSwitchMatcher(const Matcher<Node*>& value_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kSwitch),
: TestNodeMatcher(IrOpcode::kSwitch),
value_matcher_(value_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
*os << ") and control (";
......@@ -124,7 +121,7 @@ class IsSwitchMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"value", value_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
......@@ -136,17 +133,16 @@ class IsSwitchMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsIfValueMatcher final : public NodeMatcher {
class IsIfValueMatcher final : public TestNodeMatcher {
public:
IsIfValueMatcher(const Matcher<int32_t>& value_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kIfValue),
: TestNodeMatcher(IrOpcode::kIfValue),
value_matcher_(value_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
*os << ") and control (";
......@@ -155,7 +151,7 @@ class IsIfValueMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<int32_t>(node->op()), "value",
value_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
......@@ -167,22 +163,21 @@ class IsIfValueMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsControl1Matcher final : public NodeMatcher {
class IsControl1Matcher final : public TestNodeMatcher {
public:
IsControl1Matcher(IrOpcode::Value opcode,
const Matcher<Node*>& control_matcher)
: NodeMatcher(opcode), control_matcher_(control_matcher) {}
: TestNodeMatcher(opcode), control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose control (";
control_matcher_.DescribeTo(os);
*os << ")";
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
"control", control_matcher_, listener));
}
......@@ -191,18 +186,17 @@ class IsControl1Matcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsControl2Matcher final : public NodeMatcher {
class IsControl2Matcher final : public TestNodeMatcher {
public:
IsControl2Matcher(IrOpcode::Value opcode,
const Matcher<Node*>& control0_matcher,
const Matcher<Node*>& control1_matcher)
: NodeMatcher(opcode),
: TestNodeMatcher(opcode),
control0_matcher_(control0_matcher),
control1_matcher_(control1_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose control0 (";
control0_matcher_.DescribeTo(os);
*os << ") and control1 (";
......@@ -211,7 +205,7 @@ class IsControl2Matcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0),
"control0", control0_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1),
......@@ -223,20 +217,19 @@ class IsControl2Matcher final : public NodeMatcher {
const Matcher<Node*> control1_matcher_;
};
class IsControl3Matcher final : public NodeMatcher {
class IsControl3Matcher final : public TestNodeMatcher {
public:
IsControl3Matcher(IrOpcode::Value opcode,
const Matcher<Node*>& control0_matcher,
const Matcher<Node*>& control1_matcher,
const Matcher<Node*>& control2_matcher)
: NodeMatcher(opcode),
: TestNodeMatcher(opcode),
control0_matcher_(control0_matcher),
control1_matcher_(control1_matcher),
control2_matcher_(control2_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose control0 (";
control0_matcher_.DescribeTo(os);
*os << ") and control1 (";
......@@ -247,7 +240,7 @@ class IsControl3Matcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0),
"control0", control0_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node, 1),
......@@ -262,21 +255,21 @@ class IsControl3Matcher final : public NodeMatcher {
const Matcher<Node*> control2_matcher_;
};
class IsBeginRegionMatcher final : public NodeMatcher {
class IsBeginRegionMatcher final : public TestNodeMatcher {
public:
explicit IsBeginRegionMatcher(const Matcher<Node*>& effect_matcher)
: NodeMatcher(IrOpcode::kBeginRegion), effect_matcher_(effect_matcher) {}
: TestNodeMatcher(IrOpcode::kBeginRegion),
effect_matcher_(effect_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose effect (";
effect_matcher_.DescribeTo(os);
*os << ")";
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
effect_matcher_, listener));
}
......@@ -285,17 +278,16 @@ class IsBeginRegionMatcher final : public NodeMatcher {
const Matcher<Node*> effect_matcher_;
};
class IsFinishRegionMatcher final : public NodeMatcher {
class IsFinishRegionMatcher final : public TestNodeMatcher {
public:
IsFinishRegionMatcher(const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher)
: NodeMatcher(IrOpcode::kFinishRegion),
: TestNodeMatcher(IrOpcode::kFinishRegion),
value_matcher_(value_matcher),
effect_matcher_(effect_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
*os << ") and effect (";
......@@ -304,7 +296,7 @@ class IsFinishRegionMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"value", value_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
......@@ -316,13 +308,12 @@ class IsFinishRegionMatcher final : public NodeMatcher {
const Matcher<Node*> effect_matcher_;
};
class IsReturnMatcher final : public NodeMatcher {
class IsReturnMatcher final : public TestNodeMatcher {
public:
IsReturnMatcher(const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kReturn),
: TestNodeMatcher(IrOpcode::kReturn),
value_matcher_(value_matcher),
value2_matcher_(_),
effect_matcher_(effect_matcher),
......@@ -333,7 +324,7 @@ class IsReturnMatcher final : public NodeMatcher {
const Matcher<Node*>& value2_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kReturn),
: TestNodeMatcher(IrOpcode::kReturn),
value_matcher_(value_matcher),
value2_matcher_(value2_matcher),
effect_matcher_(effect_matcher),
......@@ -341,7 +332,7 @@ class IsReturnMatcher final : public NodeMatcher {
has_second_return_value_(true) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
if (has_second_return_value_) {
......@@ -356,7 +347,7 @@ class IsReturnMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1),
"value", value_matcher_, listener) &&
(!has_second_return_value_ ||
......@@ -376,17 +367,16 @@ class IsReturnMatcher final : public NodeMatcher {
bool has_second_return_value_;
};
class IsTerminateMatcher final : public NodeMatcher {
class IsTerminateMatcher final : public TestNodeMatcher {
public:
IsTerminateMatcher(const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kTerminate),
: TestNodeMatcher(IrOpcode::kTerminate),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose effect (";
effect_matcher_.DescribeTo(os);
*os << ") and control (";
......@@ -395,7 +385,7 @@ class IsTerminateMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
effect_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
......@@ -407,16 +397,16 @@ class IsTerminateMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsTypeGuardMatcher final : public NodeMatcher {
class IsTypeGuardMatcher final : public TestNodeMatcher {
public:
IsTypeGuardMatcher(const Matcher<Node*>& value_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kTypeGuard),
: TestNodeMatcher(IrOpcode::kTypeGuard),
value_matcher_(value_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
*os << ") and control (";
......@@ -425,7 +415,7 @@ class IsTypeGuardMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"value", value_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetControlInput(node),
......@@ -438,20 +428,20 @@ class IsTypeGuardMatcher final : public NodeMatcher {
};
template <typename T>
class IsConstantMatcher final : public NodeMatcher {
class IsConstantMatcher final : public TestNodeMatcher {
public:
IsConstantMatcher(IrOpcode::Value opcode, const Matcher<T>& value_matcher)
: NodeMatcher(opcode), value_matcher_(value_matcher) {}
: TestNodeMatcher(opcode), value_matcher_(value_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose value (";
value_matcher_.DescribeTo(os);
*os << ")";
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<T>(node), "value", value_matcher_,
listener));
}
......@@ -460,21 +450,20 @@ class IsConstantMatcher final : public NodeMatcher {
const Matcher<T> value_matcher_;
};
class IsSelectMatcher final : public NodeMatcher {
class IsSelectMatcher final : public TestNodeMatcher {
public:
IsSelectMatcher(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher)
: NodeMatcher(IrOpcode::kSelect),
: TestNodeMatcher(IrOpcode::kSelect),
type_matcher_(type_matcher),
value0_matcher_(value0_matcher),
value1_matcher_(value1_matcher),
value2_matcher_(value2_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose representation (";
type_matcher_.DescribeTo(os);
*os << "), value0 (";
......@@ -488,7 +477,7 @@ class IsSelectMatcher final : public NodeMatcher {
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (
NodeMatcher::MatchAndExplain(node, listener) &&
TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(SelectParametersOf(node->op()).representation(),
"representation", type_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "value0",
......@@ -506,21 +495,20 @@ class IsSelectMatcher final : public NodeMatcher {
const Matcher<Node*> value2_matcher_;
};
class IsPhiMatcher final : public NodeMatcher {
class IsPhiMatcher final : public TestNodeMatcher {
public:
IsPhiMatcher(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kPhi),
: TestNodeMatcher(IrOpcode::kPhi),
type_matcher_(type_matcher),
value0_matcher_(value0_matcher),
value1_matcher_(value1_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose representation (";
type_matcher_.DescribeTo(os);
*os << "), value0 (";
......@@ -533,7 +521,7 @@ class IsPhiMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(PhiRepresentationOf(node->op()),
"representation", type_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
......@@ -551,15 +539,14 @@ class IsPhiMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsPhi2Matcher final : public NodeMatcher {
class IsPhi2Matcher final : public TestNodeMatcher {
public:
IsPhi2Matcher(const Matcher<MachineRepresentation>& type_matcher,
const Matcher<Node*>& value0_matcher,
const Matcher<Node*>& value1_matcher,
const Matcher<Node*>& value2_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kPhi),
: TestNodeMatcher(IrOpcode::kPhi),
type_matcher_(type_matcher),
value0_matcher_(value0_matcher),
value1_matcher_(value1_matcher),
......@@ -567,7 +554,7 @@ class IsPhi2Matcher final : public NodeMatcher {
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose representation (";
type_matcher_.DescribeTo(os);
*os << "), value0 (";
......@@ -582,7 +569,7 @@ class IsPhi2Matcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(PhiRepresentationOf(node->op()),
"representation", type_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
......@@ -603,19 +590,18 @@ class IsPhi2Matcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsEffectPhiMatcher final : public NodeMatcher {
class IsEffectPhiMatcher final : public TestNodeMatcher {
public:
IsEffectPhiMatcher(const Matcher<Node*>& effect0_matcher,
const Matcher<Node*>& effect1_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kEffectPhi),
: TestNodeMatcher(IrOpcode::kEffectPhi),
effect0_matcher_(effect0_matcher),
effect1_matcher_(effect1_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << "), effect0 (";
effect0_matcher_.DescribeTo(os);
*os << "), effect1 (";
......@@ -626,7 +612,7 @@ class IsEffectPhiMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0),
"effect0", effect0_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1),
......@@ -641,17 +627,16 @@ class IsEffectPhiMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsProjectionMatcher final : public NodeMatcher {
class IsProjectionMatcher final : public TestNodeMatcher {
public:
IsProjectionMatcher(const Matcher<size_t>& index_matcher,
const Matcher<Node*>& base_matcher)
: NodeMatcher(IrOpcode::kProjection),
: TestNodeMatcher(IrOpcode::kProjection),
index_matcher_(index_matcher),
base_matcher_(base_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose index (";
index_matcher_.DescribeTo(os);
*os << ") and base (";
......@@ -660,7 +645,7 @@ class IsProjectionMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<size_t>(node), "index",
index_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
......@@ -672,21 +657,20 @@ class IsProjectionMatcher final : public NodeMatcher {
const Matcher<Node*> base_matcher_;
};
class IsCallMatcher final : public NodeMatcher {
class IsCallMatcher final : public TestNodeMatcher {
public:
IsCallMatcher(const Matcher<const CallDescriptor*>& descriptor_matcher,
const std::vector<Matcher<Node*>>& value_matchers,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kCall),
: TestNodeMatcher(IrOpcode::kCall),
descriptor_matcher_(descriptor_matcher),
value_matchers_(value_matchers),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
for (size_t i = 0; i < value_matchers_.size(); ++i) {
if (i == 0) {
*os << " whose value0 (";
......@@ -703,7 +687,7 @@ class IsCallMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
if (!NodeMatcher::MatchAndExplain(node, listener) ||
if (!TestNodeMatcher::MatchAndExplain(node, listener) ||
!PrintMatchAndExplain(OpParameter<const CallDescriptor*>(node),
"descriptor", descriptor_matcher_, listener)) {
return false;
......@@ -738,21 +722,20 @@ class IsCallMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsTailCallMatcher final : public NodeMatcher {
class IsTailCallMatcher final : public TestNodeMatcher {
public:
IsTailCallMatcher(const Matcher<CallDescriptor const*>& descriptor_matcher,
const std::vector<Matcher<Node*>>& value_matchers,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kTailCall),
: TestNodeMatcher(IrOpcode::kTailCall),
descriptor_matcher_(descriptor_matcher),
value_matchers_(value_matchers),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
for (size_t i = 0; i < value_matchers_.size(); ++i) {
if (i == 0) {
*os << " whose value0 (";
......@@ -769,7 +752,7 @@ class IsTailCallMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
if (!NodeMatcher::MatchAndExplain(node, listener) ||
if (!TestNodeMatcher::MatchAndExplain(node, listener) ||
!PrintMatchAndExplain(OpParameter<CallDescriptor const*>(node),
"descriptor", descriptor_matcher_, listener)) {
return false;
......@@ -804,7 +787,7 @@ class IsTailCallMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsSpeculativeBinopMatcher final : public NodeMatcher {
class IsSpeculativeBinopMatcher final : public TestNodeMatcher {
public:
IsSpeculativeBinopMatcher(IrOpcode::Value opcode,
const Matcher<NumberOperationHint>& hint_matcher,
......@@ -812,7 +795,7 @@ class IsSpeculativeBinopMatcher final : public NodeMatcher {
const Matcher<Node*>& rhs_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(opcode),
: TestNodeMatcher(opcode),
hint_matcher_(hint_matcher),
lhs_matcher_(lhs_matcher),
rhs_matcher_(rhs_matcher),
......@@ -820,7 +803,7 @@ class IsSpeculativeBinopMatcher final : public NodeMatcher {
control_matcher_(control_matcher) {}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
// TODO(bmeurer): The type parameter is currently ignored.
PrintMatchAndExplain(OpParameter<NumberOperationHint>(node->op()),
"hints", hint_matcher_, listener) &&
......@@ -843,18 +826,18 @@ class IsSpeculativeBinopMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsAllocateMatcher final : public NodeMatcher {
class IsAllocateMatcher final : public TestNodeMatcher {
public:
IsAllocateMatcher(const Matcher<Node*>& size_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kAllocate),
: TestNodeMatcher(IrOpcode::kAllocate),
size_matcher_(size_matcher),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "size",
size_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
......@@ -869,21 +852,20 @@ class IsAllocateMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsLoadFieldMatcher final : public NodeMatcher {
class IsLoadFieldMatcher final : public TestNodeMatcher {
public:
IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kLoadField),
: TestNodeMatcher(IrOpcode::kLoadField),
access_matcher_(access_matcher),
base_matcher_(base_matcher),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose access (";
access_matcher_.DescribeTo(os);
*os << "), base (";
......@@ -896,7 +878,7 @@ class IsLoadFieldMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
access_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
......@@ -914,15 +896,14 @@ class IsLoadFieldMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsStoreFieldMatcher final : public NodeMatcher {
class IsStoreFieldMatcher final : public TestNodeMatcher {
public:
IsStoreFieldMatcher(const Matcher<FieldAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kStoreField),
: TestNodeMatcher(IrOpcode::kStoreField),
access_matcher_(access_matcher),
base_matcher_(base_matcher),
value_matcher_(value_matcher),
......@@ -930,7 +911,7 @@ class IsStoreFieldMatcher final : public NodeMatcher {
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose access (";
access_matcher_.DescribeTo(os);
*os << "), base (";
......@@ -945,7 +926,7 @@ class IsStoreFieldMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<FieldAccess>(node), "access",
access_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
......@@ -966,14 +947,14 @@ class IsStoreFieldMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsLoadElementMatcher final : public NodeMatcher {
class IsLoadElementMatcher final : public TestNodeMatcher {
public:
IsLoadElementMatcher(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
const Matcher<Node*>& index_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kLoadElement),
: TestNodeMatcher(IrOpcode::kLoadElement),
access_matcher_(access_matcher),
base_matcher_(base_matcher),
index_matcher_(index_matcher),
......@@ -981,7 +962,7 @@ class IsLoadElementMatcher final : public NodeMatcher {
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose access (";
access_matcher_.DescribeTo(os);
*os << "), base (";
......@@ -996,7 +977,7 @@ class IsLoadElementMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access",
access_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
......@@ -1017,8 +998,7 @@ class IsLoadElementMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsStoreElementMatcher final : public NodeMatcher {
class IsStoreElementMatcher final : public TestNodeMatcher {
public:
IsStoreElementMatcher(const Matcher<ElementAccess>& access_matcher,
const Matcher<Node*>& base_matcher,
......@@ -1026,7 +1006,7 @@ class IsStoreElementMatcher final : public NodeMatcher {
const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kStoreElement),
: TestNodeMatcher(IrOpcode::kStoreElement),
access_matcher_(access_matcher),
base_matcher_(base_matcher),
index_matcher_(index_matcher),
......@@ -1035,7 +1015,7 @@ class IsStoreElementMatcher final : public NodeMatcher {
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose access (";
access_matcher_.DescribeTo(os);
*os << "), base (";
......@@ -1052,7 +1032,7 @@ class IsStoreElementMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<ElementAccess>(node), "access",
access_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
......@@ -1077,14 +1057,14 @@ class IsStoreElementMatcher final : public NodeMatcher {
};
#define LOAD_MATCHER(kLoad) \
class Is##kLoad##Matcher final : public NodeMatcher { \
class Is##kLoad##Matcher final : public TestNodeMatcher { \
public: \
Is##kLoad##Matcher(const Matcher<kLoad##Representation>& rep_matcher, \
const Matcher<Node*>& base_matcher, \
const Matcher<Node*>& index_matcher, \
const Matcher<Node*>& effect_matcher, \
const Matcher<Node*>& control_matcher) \
: NodeMatcher(IrOpcode::k##kLoad), \
: TestNodeMatcher(IrOpcode::k##kLoad), \
rep_matcher_(rep_matcher), \
base_matcher_(base_matcher), \
index_matcher_(index_matcher), \
......@@ -1092,7 +1072,7 @@ class IsStoreElementMatcher final : public NodeMatcher {
control_matcher_(control_matcher) {} \
\
void DescribeTo(std::ostream* os) const final { \
NodeMatcher::DescribeTo(os); \
TestNodeMatcher::DescribeTo(os); \
*os << " whose rep ("; \
rep_matcher_.DescribeTo(os); \
*os << "), base ("; \
......@@ -1116,7 +1096,7 @@ class IsStoreElementMatcher final : public NodeMatcher {
if (NodeProperties::FirstControlIndex(node) < node->InputCount()) { \
control_node = NodeProperties::GetControlInput(node); \
} \
return (NodeMatcher::MatchAndExplain(node, listener) && \
return (TestNodeMatcher::MatchAndExplain(node, listener) && \
PrintMatchAndExplain(OpParameter<kLoad##Representation>(node), \
"rep", rep_matcher_, listener) && \
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), \
......@@ -1141,7 +1121,7 @@ LOAD_MATCHER(Load)
LOAD_MATCHER(UnalignedLoad)
#define STORE_MATCHER(kStore) \
class Is##kStore##Matcher final : public NodeMatcher { \
class Is##kStore##Matcher final : public TestNodeMatcher { \
public: \
Is##kStore##Matcher(const Matcher<kStore##Representation>& rep_matcher, \
const Matcher<Node*>& base_matcher, \
......@@ -1149,7 +1129,7 @@ LOAD_MATCHER(UnalignedLoad)
const Matcher<Node*>& value_matcher, \
const Matcher<Node*>& effect_matcher, \
const Matcher<Node*>& control_matcher) \
: NodeMatcher(IrOpcode::k##kStore), \
: TestNodeMatcher(IrOpcode::k##kStore), \
rep_matcher_(rep_matcher), \
base_matcher_(base_matcher), \
index_matcher_(index_matcher), \
......@@ -1158,7 +1138,7 @@ LOAD_MATCHER(UnalignedLoad)
control_matcher_(control_matcher) {} \
\
void DescribeTo(std::ostream* os) const final { \
NodeMatcher::DescribeTo(os); \
TestNodeMatcher::DescribeTo(os); \
*os << " whose rep ("; \
rep_matcher_.DescribeTo(os); \
*os << "), base ("; \
......@@ -1184,7 +1164,7 @@ LOAD_MATCHER(UnalignedLoad)
if (NodeProperties::FirstControlIndex(node) < node->InputCount()) { \
control_node = NodeProperties::GetControlInput(node); \
} \
return (NodeMatcher::MatchAndExplain(node, listener) && \
return (TestNodeMatcher::MatchAndExplain(node, listener) && \
PrintMatchAndExplain(OpParameter<kStore##Representation>(node), \
"rep", rep_matcher_, listener) && \
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), \
......@@ -1211,21 +1191,21 @@ LOAD_MATCHER(UnalignedLoad)
STORE_MATCHER(Store)
STORE_MATCHER(UnalignedStore)
class IsStackSlotMatcher final : public NodeMatcher {
class IsStackSlotMatcher final : public TestNodeMatcher {
public:
explicit IsStackSlotMatcher(
const Matcher<StackSlotRepresentation>& rep_matcher)
: NodeMatcher(IrOpcode::kStackSlot), rep_matcher_(rep_matcher) {}
: TestNodeMatcher(IrOpcode::kStackSlot), rep_matcher_(rep_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose rep (";
rep_matcher_.DescribeTo(os);
*os << ")";
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<StackSlotRepresentation>(node),
"rep", rep_matcher_, listener));
}
......@@ -1234,20 +1214,20 @@ class IsStackSlotMatcher final : public NodeMatcher {
const Matcher<StackSlotRepresentation> rep_matcher_;
};
class IsToNumberMatcher final : public NodeMatcher {
class IsToNumberMatcher final : public TestNodeMatcher {
public:
IsToNumberMatcher(const Matcher<Node*>& base_matcher,
const Matcher<Node*>& context_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher)
: NodeMatcher(IrOpcode::kJSToNumber),
: TestNodeMatcher(IrOpcode::kJSToNumber),
base_matcher_(base_matcher),
context_matcher_(context_matcher),
effect_matcher_(effect_matcher),
control_matcher_(control_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose base (";
base_matcher_.DescribeTo(os);
*os << "), context (";
......@@ -1260,7 +1240,7 @@ class IsToNumberMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base",
base_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetContextInput(node),
......@@ -1278,17 +1258,16 @@ class IsToNumberMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
class IsLoadContextMatcher final : public NodeMatcher {
class IsLoadContextMatcher final : public TestNodeMatcher {
public:
IsLoadContextMatcher(const Matcher<ContextAccess>& access_matcher,
const Matcher<Node*>& context_matcher)
: NodeMatcher(IrOpcode::kJSLoadContext),
: TestNodeMatcher(IrOpcode::kJSLoadContext),
access_matcher_(access_matcher),
context_matcher_(context_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose access (";
access_matcher_.DescribeTo(os);
*os << ") and context (";
......@@ -1297,7 +1276,7 @@ class IsLoadContextMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(OpParameter<ContextAccess>(node), "access",
access_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetContextInput(node),
......@@ -1309,20 +1288,20 @@ class IsLoadContextMatcher final : public NodeMatcher {
const Matcher<Node*> context_matcher_;
};
class IsQuadopMatcher final : public NodeMatcher {
class IsQuadopMatcher final : public TestNodeMatcher {
public:
IsQuadopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& a_matcher,
const Matcher<Node*>& b_matcher,
const Matcher<Node*>& c_matcher,
const Matcher<Node*>& d_matcher)
: NodeMatcher(opcode),
: TestNodeMatcher(opcode),
a_matcher_(a_matcher),
b_matcher_(b_matcher),
c_matcher_(c_matcher),
d_matcher_(d_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose a (";
a_matcher_.DescribeTo(os);
*os << ") and b (";
......@@ -1335,7 +1314,7 @@ class IsQuadopMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "a",
a_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "b",
......@@ -1353,18 +1332,18 @@ class IsQuadopMatcher final : public NodeMatcher {
const Matcher<Node*> d_matcher_;
};
class IsTernopMatcher final : public NodeMatcher {
class IsTernopMatcher final : public TestNodeMatcher {
public:
IsTernopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& mid_matcher,
const Matcher<Node*>& rhs_matcher)
: NodeMatcher(opcode),
: TestNodeMatcher(opcode),
lhs_matcher_(lhs_matcher),
mid_matcher_(mid_matcher),
rhs_matcher_(rhs_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose lhs (";
lhs_matcher_.DescribeTo(os);
*os << ") and mid (";
......@@ -1375,7 +1354,7 @@ class IsTernopMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs",
lhs_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "mid",
......@@ -1390,16 +1369,16 @@ class IsTernopMatcher final : public NodeMatcher {
const Matcher<Node*> rhs_matcher_;
};
class IsBinopMatcher final : public NodeMatcher {
class IsBinopMatcher final : public TestNodeMatcher {
public:
IsBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher)
: NodeMatcher(opcode),
: TestNodeMatcher(opcode),
lhs_matcher_(lhs_matcher),
rhs_matcher_(rhs_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose lhs (";
lhs_matcher_.DescribeTo(os);
*os << ") and rhs (";
......@@ -1408,7 +1387,7 @@ class IsBinopMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs",
lhs_matcher_, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs",
......@@ -1420,21 +1399,20 @@ class IsBinopMatcher final : public NodeMatcher {
const Matcher<Node*> rhs_matcher_;
};
class IsUnopMatcher final : public NodeMatcher {
class IsUnopMatcher final : public TestNodeMatcher {
public:
IsUnopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& input_matcher)
: NodeMatcher(opcode), input_matcher_(input_matcher) {}
: TestNodeMatcher(opcode), input_matcher_(input_matcher) {}
void DescribeTo(std::ostream* os) const final {
NodeMatcher::DescribeTo(os);
TestNodeMatcher::DescribeTo(os);
*os << " whose input (";
input_matcher_.DescribeTo(os);
*os << ")";
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
"input", input_matcher_, listener));
}
......@@ -1443,11 +1421,10 @@ class IsUnopMatcher final : public NodeMatcher {
const Matcher<Node*> input_matcher_;
};
class IsParameterMatcher final : public NodeMatcher {
class IsParameterMatcher final : public TestNodeMatcher {
public:
explicit IsParameterMatcher(const Matcher<int>& index_matcher)
: NodeMatcher(IrOpcode::kParameter), index_matcher_(index_matcher) {}
: TestNodeMatcher(IrOpcode::kParameter), index_matcher_(index_matcher) {}
void DescribeTo(std::ostream* os) const override {
*os << "is a Parameter node with index(";
......@@ -1456,7 +1433,7 @@ class IsParameterMatcher final : public NodeMatcher {
}
bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
return (NodeMatcher::MatchAndExplain(node, listener) &&
return (TestNodeMatcher::MatchAndExplain(node, listener) &&
PrintMatchAndExplain(ParameterIndexOf(node->op()), "index",
index_matcher_, listener));
}
......@@ -1468,7 +1445,7 @@ class IsParameterMatcher final : public NodeMatcher {
} // namespace
Matcher<Node*> IsDead() {
return MakeMatcher(new NodeMatcher(IrOpcode::kDead));
return MakeMatcher(new TestNodeMatcher(IrOpcode::kDead));
}
Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) {
......@@ -2050,11 +2027,11 @@ Matcher<Node*> IsParameter(const Matcher<int> index_matcher) {
Matcher<Node*> IsLoadFramePointer() {
return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer));
return MakeMatcher(new TestNodeMatcher(IrOpcode::kLoadFramePointer));
}
Matcher<Node*> IsLoadParentFramePointer() {
return MakeMatcher(new NodeMatcher(IrOpcode::kLoadParentFramePointer));
return MakeMatcher(new TestNodeMatcher(IrOpcode::kLoadParentFramePointer));
}
#define IS_QUADOP_MATCHER(Name) \
......
......@@ -19,6 +19,7 @@ using testing::BitEq;
namespace v8 {
namespace internal {
namespace compiler {
namespace simplified_operator_reducer_unittest {
class SimplifiedOperatorReducerTest : public GraphTest {
public:
......@@ -498,6 +499,7 @@ TEST_F(SimplifiedOperatorReducerTest, ObjectIsSmiWithNumberConstant) {
}
}
} // namespace simplified_operator_reducer_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -22,6 +22,7 @@ using testing::IsNaN;
namespace v8 {
namespace internal {
namespace compiler {
namespace typed_optimization_unittest {
namespace {
......@@ -219,6 +220,7 @@ TEST_F(TypedOptimizationTest, JSToBooleanWithNonZeroPlainNumber) {
EXPECT_THAT(r.replacement(), IsTrueConstant());
}
} // namespace typed_optimization_unittest
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -11,6 +11,7 @@ using testing::StrictMock;
namespace v8 {
namespace platform {
namespace default_platform_unittest {
namespace {
......@@ -166,5 +167,6 @@ TEST(DefaultPlatformTest, PendingIdleTasksAreDestroyedOnShutdown) {
}
}
} // namespace default_platform_unittest
} // namespace platform
} // namespace v8
......@@ -13,6 +13,7 @@ using testing::StrictMock;
namespace v8 {
namespace platform {
namespace task_queue_unittest {
namespace {
......@@ -56,5 +57,6 @@ TEST(TaskQueueTest, TerminateMultipleReaders) {
thread2.Join();
}
} // namespace task_queue_unittest
} // namespace platform
} // namespace v8
......@@ -24,6 +24,25 @@ struct MockTask : public Task {
} // namespace
// Needs to be in v8::platform due to BlockUntilQueueEmptyForTesting
// being private.
TEST(WorkerThreadTest, PostSingleTask) {
TaskQueue queue;
WorkerThread thread1(&queue);
WorkerThread thread2(&queue);
InSequence s;
StrictMock<MockTask>* task = new StrictMock<MockTask>;
EXPECT_CALL(*task, Run());
EXPECT_CALL(*task, Die());
queue.Append(task);
// The next call should not time out.
queue.BlockUntilQueueEmptyForTesting();
queue.Terminate();
}
namespace worker_thread_unittest {
TEST(WorkerThreadTest, Basic) {
static const size_t kNumTasks = 10;
......@@ -44,21 +63,6 @@ TEST(WorkerThreadTest, Basic) {
queue.Terminate();
}
TEST(WorkerThreadTest, PostSingleTask) {
TaskQueue queue;
WorkerThread thread1(&queue);
WorkerThread thread2(&queue);
InSequence s;
StrictMock<MockTask>* task = new StrictMock<MockTask>;
EXPECT_CALL(*task, Run());
EXPECT_CALL(*task, Die());
queue.Append(task);
// The next call should not time out.
queue.BlockUntilQueueEmptyForTesting();
queue.Terminate();
}
} // namespace worker_thread_unittest
} // namespace platform
} // namespace v8
......@@ -22,6 +22,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace function_body_decoder_unittest {
#define B1(a) WASM_BLOCK(a)
#define B2(a, b) WASM_BLOCK(a, b)
......@@ -2950,6 +2951,7 @@ TEST_F(BytecodeIteratorTest, WithLocalDecls) {
#undef EXPECT_VERIFIES
#undef EXPECT_FAILURE
} // namespace function_body_decoder_unittest
} // namespace wasm
} // namespace internal
} // namespace v8
......@@ -15,6 +15,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace module_decoder_unittest {
#define WASM_INIT_EXPR_I32V_1(val) WASM_I32V_1(val), kExprEnd
#define WASM_INIT_EXPR_I32V_2(val) WASM_I32V_2(val), kExprEnd
......@@ -1812,6 +1813,7 @@ TEST_F(WasmModuleCustomSectionTest, TwoKnownTwoUnknownSections) {
#undef EXPECT_OFF_END_FAILURE
#undef EXPECT_OK
} // namespace module_decoder_unittest
} // namespace wasm
} // namespace internal
} // namespace v8
......@@ -10,8 +10,9 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace wasm_heap_unittest {
class DisjointAllocationPoolTest : public testing::Test {
class DisjointAllocationPoolTest : public ::testing::Test {
public:
Address A(size_t n) { return reinterpret_cast<Address>(n); }
void CheckLooksLike(const DisjointAllocationPool& mem,
......@@ -150,6 +151,7 @@ TEST_F(DisjointAllocationPoolTest, MergingSkipLargerSrcWithGap) {
CheckLooksLike(a, {{10, 15}, {20, 35}, {36, 40}});
}
} // namespace wasm_heap_unittest
} // namespace wasm
} // namespace internal
} // namespace v8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment