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

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

Issue 2191883002: [turbofan] Adds speculative opcodes for shift right. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Really fix the merge conflicts. Created 4 years, 5 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 | « test/mjsunit/compiler/turbo-number-feedback.js ('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 4ae44ee97f28f44207195618b40435863c238fbf..64dfeaa0e46a3570086e512db9235a6158f57c2e 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -448,6 +448,24 @@ TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndUnsigned32) {
EXPECT_THAT(r.replacement(), IsNumberShiftLeft(lhs, rhs));
}
+TEST_F(JSTypedLoweringTest, JSShiftLeftWithTypeFeedback) {
+ 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()->ShiftLeft(hints), lhs, rhs, UndefinedConstant(),
+ EmptyFrameState(), EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsSpeculativeNumberShiftLeft(
+ feedback, lhs, rhs, effect, control));
+ }
+}
// -----------------------------------------------------------------------------
// JSShiftRight
@@ -484,6 +502,24 @@ TEST_F(JSTypedLoweringTest, JSShiftRightWithSigned32AndUnsigned32) {
EXPECT_THAT(r.replacement(), IsNumberShiftRight(lhs, rhs));
}
+TEST_F(JSTypedLoweringTest, JSShiftRightWithTypeFeedback) {
+ 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()->ShiftRight(hints), lhs, rhs, UndefinedConstant(),
+ EmptyFrameState(), EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsSpeculativeNumberShiftRight(
+ feedback, lhs, rhs, effect, control));
+ }
+}
// -----------------------------------------------------------------------------
// JSShiftRightLogical
@@ -521,6 +557,24 @@ TEST_F(JSTypedLoweringTest, JSShiftRightLogicalWithUnsigned32AndUnsigned32) {
EXPECT_THAT(r.replacement(), IsNumberShiftRightLogical(lhs, rhs));
}
+TEST_F(JSTypedLoweringTest, JSShiftRightLogicalWithTypeFeedback) {
+ 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()->ShiftRightLogical(hints), lhs, rhs, UndefinedConstant(),
+ EmptyFrameState(), EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsSpeculativeNumberShiftRightLogical(
+ feedback, lhs, rhs, effect, control));
+ }
+}
// -----------------------------------------------------------------------------
// JSLoadContext
@@ -891,43 +945,6 @@ TEST_F(JSTypedLoweringTest, JSSubtractSmis) {
}
// -----------------------------------------------------------------------------
-// JSShiftLeft
-
-TEST_F(JSTypedLoweringTest, JSShiftLeftSmis) {
- BinaryOperationHints const hints(BinaryOperationHints::kSignedSmall,
- BinaryOperationHints::kSignedSmall,
- BinaryOperationHints::kSignedSmall);
- 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()->ShiftLeft(hints), lhs, rhs, UndefinedConstant(),
- EmptyFrameState(), EmptyFrameState(), effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsSpeculativeNumberShiftLeft(BinaryOperationHints::kSignedSmall,
- lhs, rhs, effect, control));
-}
-
-TEST_F(JSTypedLoweringTest, JSShiftLeftNumberOrOddball) {
- BinaryOperationHints const hints(BinaryOperationHints::kNumberOrOddball,
- BinaryOperationHints::kNumberOrOddball,
- BinaryOperationHints::kNumberOrOddball);
- 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()->ShiftLeft(hints), lhs, rhs, UndefinedConstant(),
- EmptyFrameState(), EmptyFrameState(), effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsSpeculativeNumberShiftLeft(
- BinaryOperationHints::kNumberOrOddball, lhs,
- rhs, effect, control));
-}
-
-// -----------------------------------------------------------------------------
// JSInstanceOf
// Test that instanceOf is reduced if and only if the right-hand side is a
// function constant. Functional correctness is ensured elsewhere.
« no previous file with comments | « test/mjsunit/compiler/turbo-number-feedback.js ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698