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

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

Issue 1102923002: [strong] Disallow implicit conversions for bitwise ops, shifts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 2 Created 5 years, 8 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/strong/implicit-conversions.js ('k') | no next file » | 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 aa4d81c41dfd558be9c089ec3d799c7aca574d84..8c46f99f267d1472c30715f6a954f1806d8c0da0 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -456,13 +456,15 @@ TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) {
Node* const effect = graph()->start();
Node* const control = graph()->start();
TRACED_FORRANGE(double, rhs, 0, 31) {
- Reduction r =
- Reduce(graph()->NewNode(javascript()->ShiftLeft(LanguageMode::SLOPPY),
- lhs, NumberConstant(rhs), context, effect,
- control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsWord32Shl(lhs, IsNumberConstant(BitEq(rhs))));
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ Reduction r =
+ Reduce(graph()->NewNode(javascript()->ShiftLeft(language_mode), lhs,
+ NumberConstant(rhs), context, effect,
+ control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsWord32Shl(lhs, IsNumberConstant(BitEq(rhs))));
+ }
}
}
@@ -473,12 +475,14 @@ TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndUnsigned32) {
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
- Reduction r =
- Reduce(graph()->NewNode(javascript()->ShiftLeft(LanguageMode::SLOPPY),
- lhs, rhs, context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsWord32Shl(lhs, IsWord32And(rhs, IsInt32Constant(0x1f))));
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ Reduction r =
+ Reduce(graph()->NewNode(javascript()->ShiftLeft(language_mode), lhs,
+ rhs, context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsWord32Shl(lhs, IsWord32And(rhs, IsInt32Constant(0x1f))));
+ }
}
@@ -492,13 +496,15 @@ TEST_F(JSTypedLoweringTest, JSShiftRightWithSigned32AndConstant) {
Node* const effect = graph()->start();
Node* const control = graph()->start();
TRACED_FORRANGE(double, rhs, 0, 31) {
- Reduction r =
- Reduce(graph()->NewNode(javascript()->
- ShiftRight(LanguageMode::SLOPPY), lhs,
- NumberConstant(rhs), context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsWord32Sar(lhs, IsNumberConstant(BitEq(rhs))));
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ Reduction r =
+ Reduce(graph()->NewNode(javascript()-> ShiftRight(language_mode), lhs,
+ NumberConstant(rhs), context, effect,
+ control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsWord32Sar(lhs, IsNumberConstant(BitEq(rhs))));
+ }
}
}
@@ -509,12 +515,14 @@ TEST_F(JSTypedLoweringTest, JSShiftRightWithSigned32AndUnsigned32) {
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
- Reduction r = Reduce(graph()->NewNode(javascript()->
- ShiftRight(LanguageMode::SLOPPY),
- lhs, rhs, context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsWord32Sar(lhs, IsWord32And(rhs, IsInt32Constant(0x1f))));
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ Reduction r = Reduce(graph()->NewNode(javascript()->
+ ShiftRight(language_mode), lhs, rhs,
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsWord32Sar(lhs, IsWord32And(rhs, IsInt32Constant(0x1f))));
+ }
}
@@ -529,14 +537,16 @@ TEST_F(JSTypedLoweringTest,
Node* const effect = graph()->start();
Node* const control = graph()->start();
TRACED_FORRANGE(double, rhs, 0, 31) {
- Reduction r =
- Reduce(graph()->NewNode(javascript()->
- ShiftRightLogical(LanguageMode::SLOPPY),
- lhs, NumberConstant(rhs), context, effect,
- control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsWord32Shr(lhs, IsNumberConstant(BitEq(rhs))));
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ Reduction r =
+ Reduce(graph()->NewNode(javascript()->
+ ShiftRightLogical(language_mode), lhs,
+ NumberConstant(rhs), context, effect,
+ control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsWord32Shr(lhs, IsNumberConstant(BitEq(rhs))));
+ }
}
}
@@ -548,12 +558,14 @@ TEST_F(JSTypedLoweringTest,
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
- Reduction r = Reduce(graph()->NewNode(javascript()->
- ShiftRightLogical(LanguageMode::SLOPPY),
- lhs, rhs, context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsWord32Shr(lhs, IsWord32And(rhs, IsInt32Constant(0x1f))));
+ TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) {
+ Reduction r = Reduce(graph()->NewNode(javascript()->
+ ShiftRightLogical(language_mode), lhs,
+ rhs, context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsWord32Shr(lhs, IsWord32And(rhs, IsInt32Constant(0x1f))));
+ }
}
« no previous file with comments | « test/mjsunit/strong/implicit-conversions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698