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

Unified Diff: test/unittests/compiler/js-typed-lowering-unittest.cc

Issue 811653004: [turbofan] Improve typed lowering of JSBitwiseAnd. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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/compiler/js-typed-lowering.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/js-typed-lowering-unittest.cc
diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc
index 97ff106329770269274b74bfeef435ed7e63e0a3..af70284aef96b1a04ae1949f35512767ccb3baac 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -397,6 +397,51 @@ TEST_F(JSTypedLoweringTest, JSStrictEqualWithTheHole) {
// -----------------------------------------------------------------------------
+// JSBitwiseAnd
+
+
+TEST_F(JSTypedLoweringTest, JSBitwiseAndWithBitish) {
+ Node* const context = Parameter(Type::Any(), 2);
+ Node* const effect = graph()->start();
+ Node* const control = graph()->start();
+ Handle<Object> zero = factory()->NewNumber(0);
+ Handle<Object> one = factory()->NewNumber(1);
+ {
+ Node* const lhs = Parameter(Type::Range(one, one, zone()), 0);
+ Node* const rhs = Parameter(Type::Range(zero, one, zone()), 1);
+ Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_EQ(rhs, r.replacement());
+ }
+ {
+ Node* const lhs = Parameter(Type::Range(one, one, zone()), 0);
+ Node* const rhs = Parameter(Type::Boolean(), 1);
+ Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsBooleanToNumber(rhs));
+ }
+ {
+ Node* const lhs = Parameter(Type::Range(zero, one, zone()), 0);
+ Node* const rhs = Parameter(Type::Range(one, one, zone()), 1);
+ Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_EQ(lhs, r.replacement());
+ }
+ {
+ Node* const lhs = Parameter(Type::Boolean(), 0);
+ Node* const rhs = Parameter(Type::Range(one, one, zone()), 1);
+ Reduction r = Reduce(graph()->NewNode(javascript()->BitwiseAnd(), lhs, rhs,
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsBooleanToNumber(lhs));
+ }
+}
+
+
+// -----------------------------------------------------------------------------
// JSShiftLeft
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698