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

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

Issue 2494073002: [turbofan] Optimize ToName conversion. (Closed)
Patch Set: Created 4 years, 1 month 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 0b9935081bd99f87b2530130d572fc297453aa35..bded0c9fd82b59b2644fbf1e875266ebdf4cbad6 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -126,8 +126,42 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) {
// -----------------------------------------------------------------------------
-// JSToNumber
+// JSToName
+
+TEST_F(JSTypedLoweringTest, JSToNameWithString) {
+ Node* const input = Parameter(Type::String(), 0);
+ Node* const context = Parameter(Type::Any(), 1);
+ Node* const effect = graph()->start();
+ Node* const control = graph()->start();
+ Reduction r = Reduce(graph()->NewNode(javascript()->ToName(), input, context,
+ EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_EQ(input, r.replacement());
+}
+TEST_F(JSTypedLoweringTest, JSToNameWithSymbol) {
+ Node* const input = Parameter(Type::Symbol(), 0);
+ Node* const context = Parameter(Type::Any(), 1);
+ Node* const effect = graph()->start();
+ Node* const control = graph()->start();
+ Reduction r = Reduce(graph()->NewNode(javascript()->ToName(), input, context,
+ EmptyFrameState(), effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_EQ(input, r.replacement());
+}
+
+TEST_F(JSTypedLoweringTest, JSToNameWithAny) {
+ Node* const input = Parameter(Type::Any(), 0);
+ Node* const context = Parameter(Type::Any(), 1);
+ Node* const effect = graph()->start();
+ Node* const control = graph()->start();
+ Reduction r = Reduce(graph()->NewNode(javascript()->ToName(), input, context,
+ EmptyFrameState(), effect, control));
+ ASSERT_FALSE(r.Changed());
+}
+
+// -----------------------------------------------------------------------------
+// JSToNumber
TEST_F(JSTypedLoweringTest, JSToNumberWithPlainPrimitive) {
Node* const input = Parameter(Type::PlainPrimitive(), 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