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 8652ed83934e4e437c8966da0de981dd49b8088b..e269db06a4be1522e5c91cf3ebc66d7ab7ea5c8c 100644 |
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc |
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc |
@@ -2,6 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "src/code-factory.h" |
#include "src/compiler/access-builder.h" |
#include "src/compiler/js-graph.h" |
#include "src/compiler/js-operator.h" |
@@ -14,6 +15,7 @@ |
#include "test/unittests/compiler/node-test-utils.h" |
#include "testing/gmock-support.h" |
+using testing::_; |
using testing::BitEq; |
using testing::IsNaN; |
@@ -880,6 +882,30 @@ TEST_F(JSTypedLoweringTest, JSLoadNamedGlobalConstants) { |
} |
} |
+ |
+// ----------------------------------------------------------------------------- |
+// JSCreateClosure |
+ |
+ |
+TEST_F(JSTypedLoweringTest, JSCreateClosure) { |
+ Node* const context = UndefinedConstant(); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
+ Reduction r = |
+ Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED), |
+ context, context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT( |
+ r.replacement(), |
+ IsCall(_, |
+ IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
+ CodeFactory::FastNewClosure(isolate(), shared->language_mode(), |
+ shared->kind()).code())), |
+ IsHeapConstant(Unique<HeapObject>::CreateImmovable(shared)), |
+ effect, control)); |
+} |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |