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

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

Issue 2145923002: [turbofan] Properly optimize JSToBoolean with Number inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/compiler/js-typed-lowering.cc ('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 609b443fe1eeea7fa35ab700b7868de8fefb7700..5128a3faba27fc4d1219eed9b02a58c77db8ed65 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -284,6 +284,15 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithOrderedNumber) {
IsBooleanNot(IsNumberEqual(input, IsNumberConstant(0.0))));
}
+TEST_F(JSTypedLoweringTest, JSToBooleanWithNumber) {
+ Node* input = Parameter(Type::Number(), 0);
+ Node* context = Parameter(Type::Any(), 1);
+ Reduction r = Reduce(graph()->NewNode(
+ javascript()->ToBoolean(ToBooleanHint::kAny), input, context));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsNumberLessThan(IsNumberConstant(0.0), IsNumberAbs(input)));
+}
TEST_F(JSTypedLoweringTest, JSToBooleanWithString) {
Node* input = Parameter(Type::String(), 0);
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698