Index: test/unittests/compiler/simplified-operator-reducer-unittest.cc |
diff --git a/test/unittests/compiler/simplified-operator-reducer-unittest.cc b/test/unittests/compiler/simplified-operator-reducer-unittest.cc |
index f90f1c053675ef431d626b509e5b0d6788337ef8..f4d8bac70449ea6c1a7deb8e83f74d7d78c62fdf 100644 |
--- a/test/unittests/compiler/simplified-operator-reducer-unittest.cc |
+++ b/test/unittests/compiler/simplified-operator-reducer-unittest.cc |
@@ -32,7 +32,8 @@ class SimplifiedOperatorReducerTest : public TypedGraphTest { |
JSOperatorBuilder javascript(zone()); |
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(), |
&machine); |
- SimplifiedOperatorReducer reducer(&jsgraph); |
+ GraphReducer graph_reducer(zone(), graph()); |
+ SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph); |
return reducer.Reduce(node); |
} |
@@ -343,7 +344,62 @@ TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) { |
} |
// ----------------------------------------------------------------------------- |
-// TruncateTaggedToWord32 |
+// CheckTaggedPointer |
+ |
+TEST_F(SimplifiedOperatorReducerTest, CheckTaggedPointerWithChangeBitToTagged) { |
+ Node* param0 = Parameter(0); |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* value = graph()->NewNode(simplified()->ChangeBitToTagged(), param0); |
+ Reduction reduction = Reduce(graph()->NewNode( |
+ simplified()->CheckTaggedPointer(), value, effect, control)); |
+ ASSERT_TRUE(reduction.Changed()); |
+ EXPECT_EQ(value, reduction.replacement()); |
+} |
+ |
+TEST_F(SimplifiedOperatorReducerTest, CheckTaggedPointerWithHeapConstant) { |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Handle<HeapObject> kHeapObjects[] = { |
+ factory()->empty_string(), factory()->null_value(), |
+ factory()->species_symbol(), factory()->undefined_value()}; |
+ TRACED_FOREACH(Handle<HeapObject>, object, kHeapObjects) { |
+ Node* value = HeapConstant(object); |
+ Reduction reduction = Reduce(graph()->NewNode( |
+ simplified()->CheckTaggedPointer(), value, effect, control)); |
+ ASSERT_TRUE(reduction.Changed()); |
+ EXPECT_EQ(value, reduction.replacement()); |
+ } |
+} |
+ |
+// ----------------------------------------------------------------------------- |
+// CheckTaggedSigned |
+ |
+TEST_F(SimplifiedOperatorReducerTest, |
+ CheckTaggedSignedWithChangeInt31ToTaggedSigned) { |
+ Node* param0 = Parameter(0); |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* value = |
+ graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0); |
+ Reduction reduction = Reduce(graph()->NewNode( |
+ simplified()->CheckTaggedSigned(), value, effect, control)); |
+ ASSERT_TRUE(reduction.Changed()); |
+ EXPECT_EQ(value, reduction.replacement()); |
+} |
+ |
+TEST_F(SimplifiedOperatorReducerTest, CheckTaggedSignedWithNumberConstant) { |
+ Node* effect = graph()->start(); |
+ Node* control = graph()->start(); |
+ Node* value = NumberConstant(1.0); |
+ Reduction reduction = Reduce(graph()->NewNode( |
+ simplified()->CheckTaggedSigned(), value, effect, control)); |
+ ASSERT_TRUE(reduction.Changed()); |
+ EXPECT_EQ(value, reduction.replacement()); |
+} |
+ |
+// ----------------------------------------------------------------------------- |
+// ObjectIsSmi |
TEST_F(SimplifiedOperatorReducerTest, ObjectIsSmiWithChangeBitToTagged) { |
Node* param0 = Parameter(0); |