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

Side by Side Diff: test/unittests/compiler/tail-call-optimization-unittest.cc

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/compiler/linkage.h" 5 #include "src/compiler/linkage.h"
6 #include "src/compiler/tail-call-optimization.h" 6 #include "src/compiler/tail-call-optimization.h"
7 #include "test/unittests/compiler/graph-unittest.h" 7 #include "test/unittests/compiler/graph-unittest.h"
8 #include "test/unittests/compiler/node-test-utils.h" 8 #include "test/unittests/compiler/node-test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 new (zone()) MachineSignature(1, 1, kMachineSignature), 54 new (zone()) MachineSignature(1, 1, kMachineSignature),
55 new (zone()) LocationSignature(1, 1, kLocationSignature), 0, 55 new (zone()) LocationSignature(1, 1, kLocationSignature), 0,
56 Operator::kNoProperties, 0, CallDescriptor::kSupportsTailCalls); 56 Operator::kNoProperties, 0, CallDescriptor::kSupportsTailCalls);
57 Node* p0 = Parameter(0); 57 Node* p0 = Parameter(0);
58 Node* p1 = Parameter(1); 58 Node* p1 = Parameter(1);
59 Node* call = graph()->NewNode(common()->Call(kCallDescriptor), p0, p1, 59 Node* call = graph()->NewNode(common()->Call(kCallDescriptor), p0, p1,
60 graph()->start(), graph()->start()); 60 graph()->start(), graph()->start());
61 Node* if_success = graph()->NewNode(common()->IfSuccess(), call); 61 Node* if_success = graph()->NewNode(common()->IfSuccess(), call);
62 Node* if_exception = graph()->NewNode(common()->IfException(), call); 62 Node* if_exception = graph()->NewNode(common()->IfException(), call);
63 Node* ret = graph()->NewNode(common()->Return(), call, call, if_success); 63 Node* ret = graph()->NewNode(common()->Return(), call, call, if_success);
64 Node* end = graph()->NewNode(common()->End(), if_exception); 64 Node* end = graph()->NewNode(common()->End(1), if_exception);
65 graph()->SetEnd(end); 65 graph()->SetEnd(end);
66 Reduction r = Reduce(ret); 66 Reduction r = Reduce(ret);
67 ASSERT_FALSE(r.Changed()); 67 ASSERT_FALSE(r.Changed());
68 } 68 }
69 69
70 70
71 TEST_F(TailCallOptimizationTest, CallCodeObject2) { 71 TEST_F(TailCallOptimizationTest, CallCodeObject2) {
72 MachineType kMachineSignature[] = {kMachAnyTagged, kMachAnyTagged}; 72 MachineType kMachineSignature[] = {kMachAnyTagged, kMachAnyTagged};
73 LinkageLocation kLocationSignature[] = {LinkageLocation(0), 73 LinkageLocation kLocationSignature[] = {LinkageLocation(0),
74 LinkageLocation(1)}; 74 LinkageLocation(1)};
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 new (zone()) MachineSignature(1, 1, kMachineSignature), 119 new (zone()) MachineSignature(1, 1, kMachineSignature),
120 new (zone()) LocationSignature(1, 1, kLocationSignature), 0, 120 new (zone()) LocationSignature(1, 1, kLocationSignature), 0,
121 Operator::kNoProperties, 0, CallDescriptor::kSupportsTailCalls); 121 Operator::kNoProperties, 0, CallDescriptor::kSupportsTailCalls);
122 Node* p0 = Parameter(0); 122 Node* p0 = Parameter(0);
123 Node* p1 = Parameter(1); 123 Node* p1 = Parameter(1);
124 Node* call = graph()->NewNode(common()->Call(kCallDescriptor), p0, p1, 124 Node* call = graph()->NewNode(common()->Call(kCallDescriptor), p0, p1,
125 graph()->start(), graph()->start()); 125 graph()->start(), graph()->start());
126 Node* if_success = graph()->NewNode(common()->IfSuccess(), call); 126 Node* if_success = graph()->NewNode(common()->IfSuccess(), call);
127 Node* if_exception = graph()->NewNode(common()->IfException(), call); 127 Node* if_exception = graph()->NewNode(common()->IfException(), call);
128 Node* ret = graph()->NewNode(common()->Return(), call, call, if_success); 128 Node* ret = graph()->NewNode(common()->Return(), call, call, if_success);
129 Node* end = graph()->NewNode(common()->End(), if_exception); 129 Node* end = graph()->NewNode(common()->End(1), if_exception);
130 graph()->SetEnd(end); 130 graph()->SetEnd(end);
131 Reduction r = Reduce(ret); 131 Reduction r = Reduce(ret);
132 ASSERT_FALSE(r.Changed()); 132 ASSERT_FALSE(r.Changed());
133 } 133 }
134 134
135 135
136 TEST_F(TailCallOptimizationTest, CallJSFunction2) { 136 TEST_F(TailCallOptimizationTest, CallJSFunction2) {
137 MachineType kMachineSignature[] = {kMachAnyTagged, kMachAnyTagged}; 137 MachineType kMachineSignature[] = {kMachAnyTagged, kMachAnyTagged};
138 LinkageLocation kLocationSignature[] = {LinkageLocation(0), 138 LinkageLocation kLocationSignature[] = {LinkageLocation(0),
139 LinkageLocation(1)}; 139 LinkageLocation(1)};
(...skipping 11 matching lines...) Expand all
151 Reduction r = Reduce(ret); 151 Reduction r = Reduce(ret);
152 ASSERT_TRUE(r.Changed()); 152 ASSERT_TRUE(r.Changed());
153 EXPECT_THAT(r.replacement(), IsTailCall(kCallDescriptor, p0, p1, 153 EXPECT_THAT(r.replacement(), IsTailCall(kCallDescriptor, p0, p1,
154 graph()->start(), graph()->start())); 154 graph()->start(), graph()->start()));
155 } 155 }
156 156
157 157
158 } // namespace compiler 158 } // namespace compiler
159 } // namespace internal 159 } // namespace internal
160 } // namespace v8 160 } // namespace v8
OLDNEW
« src/compiler/js-inlining.cc ('K') | « test/unittests/compiler/scheduler-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698