Chromium Code Reviews| Index: test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
| diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
| index 8adbc54ac2d9c530ae3c018cc99a014b46815dba..b9244e86b5237ca025d7f9f6eb02547729837780 100644 |
| --- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
| +++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "src/compiler/access-builder.h" |
| +#include "src/compiler/diamond.h" |
| #include "src/compiler/js-graph.h" |
| #include "src/compiler/js-intrinsic-lowering.h" |
| #include "src/compiler/js-operator.h" |
| @@ -10,6 +11,7 @@ |
| #include "test/unittests/compiler/node-test-utils.h" |
| #include "testing/gmock-support.h" |
| + |
| using testing::_; |
| using testing::AllOf; |
| using testing::BitEq; |
| @@ -243,6 +245,30 @@ TEST_F(JSIntrinsicLoweringTest, InlineJSValueGetValue) { |
| // ----------------------------------------------------------------------------- |
| +// %_Likely |
| + |
| +TEST_F(JSIntrinsicLoweringTest, Likely) { |
| + Node* const input = Parameter(0); |
| + Node* const context = Parameter(1); |
| + Node* const effect = graph()->start(); |
| + Node* const control = graph()->start(); |
| + Node* const likely = |
| + graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineLikely, 1), |
| + input, context, effect, control); |
| + Node* const to_boolean = |
| + graph()->NewNode(javascript()->ToBoolean(), likely, context); |
| + Diamond d(graph(), common(), to_boolean); |
| + graph()->SetEnd(graph()->NewNode(common()->End(), d.merge)); |
| + |
| + ASSERT_TRUE(BranchHint::kNone == BranchHintOf(d.branch->op())); |
|
Michael Starzinger
2015/03/31 12:49:03
nit: ASSERT_EQ
Sven Panne
2015/03/31 13:01:34
Done.
|
| + Reduction const r = Reduce(likely); |
| + ASSERT_TRUE(r.Changed()); |
| + ASSERT_TRUE(input->op()->Equals(r.replacement()->op())); |
|
Michael Starzinger
2015/03/31 12:49:03
nit: EXPECT_THAT(r.replacement(), input)
Sven Panne
2015/03/31 13:01:34
Done.
|
| + ASSERT_TRUE(BranchHint::kTrue == BranchHintOf(d.branch->op())); |
|
Michael Starzinger
2015/03/31 12:49:03
nit: EXPECT_EQ
Sven Panne
2015/03/31 13:01:35
Done.
|
| +} |
| + |
| + |
| +// ----------------------------------------------------------------------------- |
| // %_MathFloor |
| @@ -313,6 +339,30 @@ TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) { |
| // ----------------------------------------------------------------------------- |
| +// %_Unlikely |
| + |
| +TEST_F(JSIntrinsicLoweringTest, Unlikely) { |
| + Node* const input = Parameter(0); |
| + Node* const context = Parameter(1); |
| + Node* const effect = graph()->start(); |
| + Node* const control = graph()->start(); |
| + Node* const unlikely = |
| + graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineUnlikely, 1), |
| + input, context, effect, control); |
| + Node* const to_boolean = |
| + graph()->NewNode(javascript()->ToBoolean(), unlikely, context); |
| + Diamond d(graph(), common(), to_boolean); |
| + graph()->SetEnd(graph()->NewNode(common()->End(), d.merge)); |
| + |
| + ASSERT_TRUE(BranchHint::kNone == BranchHintOf(d.branch->op())); |
|
Michael Starzinger
2015/03/31 12:49:03
nit: Same as the three comments above.
|
| + Reduction const r = Reduce(unlikely); |
| + ASSERT_TRUE(r.Changed()); |
| + ASSERT_TRUE(input->op()->Equals(r.replacement()->op())); |
| + ASSERT_TRUE(BranchHint::kFalse == BranchHintOf(d.branch->op())); |
| +} |
| + |
| + |
| +// ----------------------------------------------------------------------------- |
| // %_ValueOf |