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

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

Issue 1092353002: [strong] Disallow implicit conversions for binary arithmetic operations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase :( 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
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 6ba205850b6211fd3beb31bc8c70e855f3ab26a3..aaeff5319637464fbb474b22796f7a56e6ada7cc 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -114,7 +114,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithBoolean) {
Node* input = Parameter(Type::Boolean(), 0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsBooleanNot(input));
}
@@ -124,7 +125,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithOrderedNumber) {
Node* input = Parameter(Type::OrderedNumber(), 0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberEqual(input, IsNumberConstant(0)));
}
@@ -153,7 +155,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithFalsish) {
0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsTrueConstant());
}
@@ -168,7 +171,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithTruish) {
0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsFalseConstant());
}
@@ -178,7 +182,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithNonZeroPlainNumber) {
Node* input = Parameter(Type::Range(1.0, 42.0, zone()), 0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsFalseConstant());
}
@@ -188,7 +193,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithString) {
Node* input = Parameter(Type::String(), 0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
@@ -202,7 +208,8 @@ TEST_F(JSTypedLoweringTest, JSUnaryNotWithAny) {
Node* input = Parameter(Type::Any(), 0);
Node* context = Parameter(Type::Any(), 1);
Reduction r =
- Reduce(graph()->NewNode(javascript()->UnaryNot(), input, context));
+ Reduce(graph()->NewNode(javascript()->UnaryNot(LanguageMode::SLOPPY),
+ input, context));
ASSERT_FALSE(r.Changed());
}
@@ -455,8 +462,9 @@ TEST_F(JSTypedLoweringTest, JSShiftLeftWithSigned32AndConstant) {
Node* const control = graph()->start();
TRACED_FORRANGE(double, rhs, 0, 31) {
Reduction r =
- Reduce(graph()->NewNode(javascript()->ShiftLeft(), lhs,
- NumberConstant(rhs), context, effect, control));
+ 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))));
@@ -470,8 +478,9 @@ 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(), lhs, rhs,
- context, effect, control));
+ 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))));
@@ -489,7 +498,8 @@ TEST_F(JSTypedLoweringTest, JSShiftRightWithSigned32AndConstant) {
Node* const control = graph()->start();
TRACED_FORRANGE(double, rhs, 0, 31) {
Reduction r =
- Reduce(graph()->NewNode(javascript()->ShiftRight(), lhs,
+ Reduce(graph()->NewNode(javascript()->
+ ShiftRight(LanguageMode::SLOPPY), lhs,
NumberConstant(rhs), context, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
@@ -504,8 +514,9 @@ 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(), lhs, rhs,
- context, effect, control));
+ 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))));
@@ -516,15 +527,18 @@ TEST_F(JSTypedLoweringTest, JSShiftRightWithSigned32AndUnsigned32) {
// JSShiftRightLogical
-TEST_F(JSTypedLoweringTest, JSShiftRightLogicalWithUnsigned32AndConstant) {
+TEST_F(JSTypedLoweringTest,
+ JSShiftRightLogicalWithUnsigned32AndConstant) {
Node* const lhs = Parameter(Type::Unsigned32());
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
TRACED_FORRANGE(double, rhs, 0, 31) {
Reduction r =
- Reduce(graph()->NewNode(javascript()->ShiftRightLogical(), lhs,
- NumberConstant(rhs), context, effect, control));
+ 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))));
@@ -532,14 +546,16 @@ TEST_F(JSTypedLoweringTest, JSShiftRightLogicalWithUnsigned32AndConstant) {
}
-TEST_F(JSTypedLoweringTest, JSShiftRightLogicalWithUnsigned32AndUnsigned32) {
+TEST_F(JSTypedLoweringTest,
+ JSShiftRightLogicalWithUnsigned32AndUnsigned32) {
Node* const lhs = Parameter(Type::Unsigned32());
Node* const rhs = Parameter(Type::Unsigned32());
Node* const context = UndefinedConstant();
Node* const effect = graph()->start();
Node* const control = graph()->start();
- Reduction r = Reduce(graph()->NewNode(javascript()->ShiftRightLogical(), lhs,
- rhs, context, effect, control));
+ 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))));

Powered by Google App Engine
This is Rietveld 408576698