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

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

Issue 1557883002: Optimized TurboFan support for rest args. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code comments, unit tests. Created 4 years, 11 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 | « src/compiler/js-typed-lowering.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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 closure, context, frame_state, effect, control)); 945 closure, context, frame_state, effect, control));
946 ASSERT_TRUE(r.Changed()); 946 ASSERT_TRUE(r.Changed());
947 EXPECT_THAT(r.replacement(), 947 EXPECT_THAT(r.replacement(),
948 IsCall(_, IsHeapConstant(CodeFactory::ArgumentsAccess( 948 IsCall(_, IsHeapConstant(CodeFactory::ArgumentsAccess(
949 isolate(), false, false) 949 isolate(), false, false)
950 .code()), 950 .code()),
951 closure, IsNumberConstant(0), _, effect, control)); 951 closure, IsNumberConstant(0), _, effect, control));
952 } 952 }
953 953
954 954
955 TEST_F(JSTypedLoweringTest, JSCreateArgumentsRestArrayViaStub) {
956 Node* const closure = Parameter(Type::Any());
957 Node* const context = UndefinedConstant();
958 Node* const effect = graph()->start();
959 Node* const control = graph()->start();
960 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
961 Node* const frame_state = FrameState(shared, graph()->start());
962 Reduction r = Reduce(graph()->NewNode(
963 javascript()->CreateArguments(CreateArgumentsParameters::kRestArray, 0),
964 closure, context, frame_state, effect, control));
965 ASSERT_TRUE(r.Changed());
966 EXPECT_THAT(
967 r.replacement(),
968 IsCall(_,
969 IsHeapConstant(CodeFactory::RestArgumentsAccess(isolate()).code()),
970 IsNumberConstant(0), _, IsNumberConstant(0), _, effect, control));
971 }
972
973
955 TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedMapped) { 974 TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedMapped) {
956 Node* const closure = Parameter(Type::Any()); 975 Node* const closure = Parameter(Type::Any());
957 Node* const context = UndefinedConstant(); 976 Node* const context = UndefinedConstant();
958 Node* const effect = graph()->start(); 977 Node* const effect = graph()->start();
959 Node* const control = graph()->start(); 978 Node* const control = graph()->start();
960 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); 979 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
961 Node* const frame_state_outer = FrameState(shared, graph()->start()); 980 Node* const frame_state_outer = FrameState(shared, graph()->start());
962 Node* const frame_state_inner = FrameState(shared, frame_state_outer); 981 Node* const frame_state_inner = FrameState(shared, frame_state_outer);
963 Reduction r = Reduce( 982 Reduction r = Reduce(
964 graph()->NewNode(javascript()->CreateArguments( 983 graph()->NewNode(javascript()->CreateArguments(
965 CreateArgumentsParameters::kMappedArguments, 0), 984 CreateArgumentsParameters::kMappedArguments, 0),
966 closure, context, frame_state_inner, effect, control)); 985 closure, context, frame_state_inner, effect, control));
967 ASSERT_TRUE(r.Changed()); 986 ASSERT_TRUE(r.Changed());
968 EXPECT_THAT(r.replacement(), 987 EXPECT_THAT(r.replacement(),
969 IsFinishRegion( 988 IsFinishRegion(
970 IsAllocate(IsNumberConstant(Heap::kSloppyArgumentsObjectSize), 989 IsAllocate(IsNumberConstant(Heap::kSloppyArgumentsObjectSize),
971 IsBeginRegion(effect), control), 990 _, control),
972 _)); 991 _));
973 } 992 }
974 993
975 994
976 TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedUnmapped) { 995 TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedUnmapped) {
977 Node* const closure = Parameter(Type::Any()); 996 Node* const closure = Parameter(Type::Any());
978 Node* const context = UndefinedConstant(); 997 Node* const context = UndefinedConstant();
979 Node* const effect = graph()->start(); 998 Node* const effect = graph()->start();
980 Node* const control = graph()->start(); 999 Node* const control = graph()->start();
981 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); 1000 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
982 Node* const frame_state_outer = FrameState(shared, graph()->start()); 1001 Node* const frame_state_outer = FrameState(shared, graph()->start());
983 Node* const frame_state_inner = FrameState(shared, frame_state_outer); 1002 Node* const frame_state_inner = FrameState(shared, frame_state_outer);
984 Reduction r = Reduce( 1003 Reduction r = Reduce(
985 graph()->NewNode(javascript()->CreateArguments( 1004 graph()->NewNode(javascript()->CreateArguments(
986 CreateArgumentsParameters::kUnmappedArguments, 0), 1005 CreateArgumentsParameters::kUnmappedArguments, 0),
987 closure, context, frame_state_inner, effect, control)); 1006 closure, context, frame_state_inner, effect, control));
988 ASSERT_TRUE(r.Changed()); 1007 ASSERT_TRUE(r.Changed());
989 EXPECT_THAT(r.replacement(), 1008 EXPECT_THAT(r.replacement(),
990 IsFinishRegion( 1009 IsFinishRegion(
991 IsAllocate(IsNumberConstant(Heap::kStrictArgumentsObjectSize), 1010 IsAllocate(IsNumberConstant(Heap::kStrictArgumentsObjectSize),
992 IsBeginRegion(effect), control), 1011 _, control),
993 _)); 1012 _));
994 } 1013 }
995 1014
996 1015
1016 TEST_F(JSTypedLoweringTest, JSCreateArgumentsInlinedRestArray) {
1017 Node* const closure = Parameter(Type::Any());
1018 Node* const context = UndefinedConstant();
1019 Node* const effect = graph()->start();
1020 Node* const control = graph()->start();
1021 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
1022 Node* const frame_state_outer = FrameState(shared, graph()->start());
1023 Node* const frame_state_inner = FrameState(shared, frame_state_outer);
1024 Reduction r = Reduce(graph()->NewNode(
1025 javascript()->CreateArguments(CreateArgumentsParameters::kRestArray, 0),
1026 closure, context, frame_state_inner, effect, control));
1027 ASSERT_TRUE(r.Changed());
1028 EXPECT_THAT(r.replacement(),
1029 IsFinishRegion(
1030 IsAllocate(IsNumberConstant(JSArray::kSize), _, control), _));
1031 }
1032
1033
997 // ----------------------------------------------------------------------------- 1034 // -----------------------------------------------------------------------------
998 // JSCreateClosure 1035 // JSCreateClosure
999 1036
1000 1037
1001 TEST_F(JSTypedLoweringTest, JSCreateClosure) { 1038 TEST_F(JSTypedLoweringTest, JSCreateClosure) {
1002 Node* const context = UndefinedConstant(); 1039 Node* const context = UndefinedConstant();
1003 Node* const effect = graph()->start(); 1040 Node* const effect = graph()->start();
1004 Node* const control = graph()->start(); 1041 Node* const control = graph()->start();
1005 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); 1042 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared());
1006 Reduction r = 1043 Reduction r =
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, 1250 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context,
1214 frame_state, effect, control); 1251 frame_state, effect, control);
1215 Reduction r = Reduce(instanceOf); 1252 Reduction r = Reduce(instanceOf);
1216 ASSERT_FALSE(r.Changed()); 1253 ASSERT_FALSE(r.Changed());
1217 ASSERT_EQ(instanceOf, dummy->InputAt(0)); 1254 ASSERT_EQ(instanceOf, dummy->InputAt(0));
1218 } 1255 }
1219 1256
1220 } // namespace compiler 1257 } // namespace compiler
1221 } // namespace internal 1258 } // namespace internal
1222 } // namespace v8 1259 } // namespace v8
OLDNEW
« 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