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

Unified Diff: test/unittests/compiler/common-operator-unittest.cc

Issue 691513002: [turbofan] Introduce new Select operator to improve bounds checking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/mjsunit/asm/int16array-outofbounds.js ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/common-operator-unittest.cc
diff --git a/test/unittests/compiler/common-operator-unittest.cc b/test/unittests/compiler/common-operator-unittest.cc
index fdf73c910f5866b465158753656dbe8d0faa8cee..802d78c3ee7911826fede3b3e1ceae5933dfea87 100644
--- a/test/unittests/compiler/common-operator-unittest.cc
+++ b/test/unittests/compiler/common-operator-unittest.cc
@@ -156,16 +156,19 @@ const double kDoubleValues[] = {-std::numeric_limits<double>::infinity(),
std::numeric_limits<double>::quiet_NaN(),
std::numeric_limits<double>::signaling_NaN()};
+
+const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
+ BranchHint::kFalse};
+
} // namespace
TEST_F(CommonOperatorTest, Branch) {
- static const BranchHint kHints[] = {BranchHint::kNone, BranchHint::kTrue,
- BranchHint::kFalse};
TRACED_FOREACH(BranchHint, hint, kHints) {
const Operator* const op = common()->Branch(hint);
EXPECT_EQ(IrOpcode::kBranch, op->opcode());
EXPECT_EQ(Operator::kFoldable, op->properties());
+ EXPECT_EQ(hint, BranchHintOf(op));
EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
@@ -177,6 +180,30 @@ TEST_F(CommonOperatorTest, Branch) {
}
+TEST_F(CommonOperatorTest, Select) {
+ static const MachineType kTypes[] = {
+ kMachInt8, kMachUint8, kMachInt16, kMachUint16,
+ kMachInt32, kMachUint32, kMachInt64, kMachUint64,
+ kMachFloat32, kMachFloat64, kMachAnyTagged};
+ TRACED_FOREACH(MachineType, type, kTypes) {
+ TRACED_FOREACH(BranchHint, hint, kHints) {
+ const Operator* const op = common()->Select(type, hint);
+ EXPECT_EQ(IrOpcode::kSelect, op->opcode());
+ EXPECT_EQ(Operator::kPure, op->properties());
+ EXPECT_EQ(type, SelectParametersOf(op).type());
+ EXPECT_EQ(hint, SelectParametersOf(op).hint());
+ EXPECT_EQ(3, OperatorProperties::GetValueInputCount(op));
+ EXPECT_EQ(0, OperatorProperties::GetEffectInputCount(op));
+ EXPECT_EQ(0, OperatorProperties::GetControlInputCount(op));
+ EXPECT_EQ(3, OperatorProperties::GetTotalInputCount(op));
+ EXPECT_EQ(1, OperatorProperties::GetValueOutputCount(op));
+ EXPECT_EQ(0, OperatorProperties::GetEffectOutputCount(op));
+ EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
+ }
+ }
+}
+
+
TEST_F(CommonOperatorTest, Float32Constant) {
TRACED_FOREACH(float, value, kFloatValues) {
const Operator* op = common()->Float32Constant(value);
« no previous file with comments | « test/mjsunit/asm/int16array-outofbounds.js ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698