Index: test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
index 7ef004d975038bdeebe9fa719b2de7ad52c28344..451d4e374fee8aaf6ba85e4fd920265c25ca8ce7 100644 |
--- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc |
+++ b/test/unittests/compiler/js-intrinsic-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/diamond.h" |
#include "src/compiler/js-graph.h" |
@@ -66,6 +67,56 @@ TEST_F(JSIntrinsicLoweringTest, InlineOptimizedConstructDouble) { |
// ----------------------------------------------------------------------------- |
+// %_CreateArrayLiteral |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineCreateArrayLiteral) { |
+ i::FLAG_turbo_deoptimization = false; |
+ Node* const input0 = Parameter(0); |
+ Node* const input1 = Parameter(1); |
+ Node* const input2 = HeapConstant(factory()->NewFixedArray(12)); |
+ Node* const input3 = NumberConstant(ArrayLiteral::kShallowElements); |
+ Node* const context = Parameter(2); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce(graph()->NewNode( |
+ javascript()->CallRuntime(Runtime::kInlineCreateArrayLiteral, 4), input0, |
+ input1, input2, input3, context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT( |
+ r.replacement(), |
+ IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
+ CodeFactory::FastCloneShallowArray(isolate()).code())), |
+ input0, input1, input2, effect, control)); |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
+// %_CreateObjectLiteral |
+ |
+ |
+TEST_F(JSIntrinsicLoweringTest, InlineCreateObjectLiteral) { |
+ i::FLAG_turbo_deoptimization = false; |
+ Node* const input0 = Parameter(0); |
+ Node* const input1 = Parameter(1); |
+ Node* const input2 = HeapConstant(factory()->NewFixedArray(2 * 6)); |
+ Node* const input3 = NumberConstant(ObjectLiteral::kShallowProperties); |
+ Node* const context = Parameter(2); |
+ Node* const effect = graph()->start(); |
+ Node* const control = graph()->start(); |
+ Reduction const r = Reduce(graph()->NewNode( |
+ javascript()->CallRuntime(Runtime::kInlineCreateObjectLiteral, 4), input0, |
+ input1, input2, input3, context, effect, control)); |
+ ASSERT_TRUE(r.Changed()); |
+ EXPECT_THAT( |
+ r.replacement(), |
+ IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
+ CodeFactory::FastCloneShallowObject(isolate(), 6).code())), |
+ input0, input1, input2, effect, control)); |
+} |
+ |
+ |
+// ----------------------------------------------------------------------------- |
// %_DoubleLo |