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

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

Issue 2201073002: [turbofan] Adds speculative operator for bitwise and, or and xor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handles kSigned32 feedback. Created 4 years, 4 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/verifier.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 e6cec06458b60313217237e74b8428dfe378c683..36e065f40ff4db45d15c8e93cd945f1a3c8b4e69 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -1006,6 +1006,72 @@ TEST_F(JSTypedLoweringTest, JSInstanceOfNoSpecialization) {
ASSERT_EQ(instanceOf, dummy->InputAt(0));
}
+// -----------------------------------------------------------------------------
+// JSBitwiseAnd
+
+TEST_F(JSTypedLoweringTest, JSBitwiseAndWithTypeFeedback) {
+ BinaryOperationHints::Hint const feedback_types[] = {
+ BinaryOperationHints::kSignedSmall,
+ BinaryOperationHints::kNumberOrOddball};
+ for (BinaryOperationHints::Hint feedback : feedback_types) {
+ BinaryOperationHints const hints(feedback, feedback, feedback);
+ Node* lhs = Parameter(Type::Number(), 2);
+ Node* rhs = Parameter(Type::Number(), 3);
+ Node* effect = graph()->start();
+ Node* control = graph()->start();
+ Reduction r = Reduce(graph()->NewNode(
+ javascript()->BitwiseAnd(hints), lhs, rhs, UndefinedConstant(),
+ EmptyFrameState(), EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseAnd(
+ feedback, lhs, rhs, effect, control));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// JSBitwiseOr
+
+TEST_F(JSTypedLoweringTest, JSBitwiseOrWithTypeFeedback) {
+ BinaryOperationHints::Hint const feedback_types[] = {
+ BinaryOperationHints::kSignedSmall,
+ BinaryOperationHints::kNumberOrOddball};
+ for (BinaryOperationHints::Hint feedback : feedback_types) {
+ BinaryOperationHints const hints(feedback, feedback, feedback);
+ Node* lhs = Parameter(Type::Number(), 2);
+ Node* rhs = Parameter(Type::Number(), 3);
+ Node* effect = graph()->start();
+ Node* control = graph()->start();
+ Reduction r = Reduce(graph()->NewNode(
+ javascript()->BitwiseOr(hints), lhs, rhs, UndefinedConstant(),
+ EmptyFrameState(), EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseOr(
+ feedback, lhs, rhs, effect, control));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// JSBitwiseXor
+
+TEST_F(JSTypedLoweringTest, JSBitwiseXorWithTypeFeedback) {
+ BinaryOperationHints::Hint const feedback_types[] = {
+ BinaryOperationHints::kSignedSmall,
+ BinaryOperationHints::kNumberOrOddball};
+ for (BinaryOperationHints::Hint feedback : feedback_types) {
+ BinaryOperationHints const hints(feedback, feedback, feedback);
+ Node* lhs = Parameter(Type::Number(), 2);
+ Node* rhs = Parameter(Type::Number(), 3);
+ Node* effect = graph()->start();
+ Node* control = graph()->start();
+ Reduction r = Reduce(graph()->NewNode(
+ javascript()->BitwiseXor(hints), lhs, rhs, UndefinedConstant(),
+ EmptyFrameState(), EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsSpeculativeNumberBitwiseXor(
+ feedback, lhs, rhs, effect, control));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698