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

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

Issue 1104453006: [turbofan] Introduce explicit JSCreateLiteral[Array|Object]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. 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 unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/js-intrinsic-lowering-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/access-builder.h" 6 #include "src/compiler/access-builder.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/js-operator.h" 8 #include "src/compiler/js-operator.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 EXPECT_THAT( 899 EXPECT_THAT(
900 r.replacement(), 900 r.replacement(),
901 IsCall(_, 901 IsCall(_,
902 IsHeapConstant(Unique<HeapObject>::CreateImmovable( 902 IsHeapConstant(Unique<HeapObject>::CreateImmovable(
903 CodeFactory::FastNewClosure(isolate(), shared->language_mode(), 903 CodeFactory::FastNewClosure(isolate(), shared->language_mode(),
904 shared->kind()).code())), 904 shared->kind()).code())),
905 IsHeapConstant(Unique<HeapObject>::CreateImmovable(shared)), 905 IsHeapConstant(Unique<HeapObject>::CreateImmovable(shared)),
906 effect, control)); 906 effect, control));
907 } 907 }
908 908
909
910 // -----------------------------------------------------------------------------
911 // JSCreateLiteralArray
912
913
914 TEST_F(JSTypedLoweringTest, JSCreateLiteralArray) {
915 Node* const input0 = Parameter(0);
916 Node* const input1 = Parameter(1);
917 Node* const input2 = HeapConstant(factory()->NewFixedArray(12));
918 Node* const context = UndefinedConstant();
919 Node* const frame_state = EmptyFrameState();
920 Node* const effect = graph()->start();
921 Node* const control = graph()->start();
922 Reduction const r = Reduce(graph()->NewNode(
923 javascript()->CreateLiteralArray(ArrayLiteral::kShallowElements), input0,
924 input1, input2, context, frame_state, effect, control));
925 ASSERT_TRUE(r.Changed());
926 EXPECT_THAT(
927 r.replacement(),
928 IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable(
929 CodeFactory::FastCloneShallowArray(isolate()).code())),
930 input0, input1, input2, context, frame_state, effect, control));
931 }
932
933
934 // -----------------------------------------------------------------------------
935 // JSCreateLiteralObject
936
937
938 TEST_F(JSTypedLoweringTest, JSCreateLiteralObject) {
939 Node* const input0 = Parameter(0);
940 Node* const input1 = Parameter(1);
941 Node* const input2 = HeapConstant(factory()->NewFixedArray(2 * 6));
942 Node* const context = UndefinedConstant();
943 Node* const frame_state = EmptyFrameState();
944 Node* const effect = graph()->start();
945 Node* const control = graph()->start();
946 Reduction const r = Reduce(graph()->NewNode(
947 javascript()->CreateLiteralObject(ObjectLiteral::kShallowProperties),
948 input0, input1, input2, context, frame_state, effect, control));
949 ASSERT_TRUE(r.Changed());
950 EXPECT_THAT(
951 r.replacement(),
952 IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable(
953 CodeFactory::FastCloneShallowObject(isolate(), 6).code())),
954 input0, input1, input2, _, context, frame_state, effect, control));
955 }
956
909 } // namespace compiler 957 } // namespace compiler
910 } // namespace internal 958 } // namespace internal
911 } // namespace v8 959 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-intrinsic-lowering-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698