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

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

Issue 2080703006: [turbofan] Some strength reduction on Smi/HeapObject checks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « src/globals.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/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);
« no previous file with comments | « src/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698