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

Side by Side Diff: test/unittests/compiler/js-context-relaxation-unittest.cc

Issue 1410853007: [turbofan] Remove use of CallFunctionStub from TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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-builtin-reducer-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 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/js-context-relaxation.h" 5 #include "src/compiler/js-context-relaxation.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 RelaxJSCallFunctionShallowFrameStateChainNoCrossCtx) { 76 RelaxJSCallFunctionShallowFrameStateChainNoCrossCtx) {
77 Node* const input0 = Parameter(0); 77 Node* const input0 = Parameter(0);
78 Node* const input1 = Parameter(1); 78 Node* const input1 = Parameter(1);
79 Node* const context = Parameter(2); 79 Node* const context = Parameter(2);
80 Node* const outer_context = Parameter(3); 80 Node* const outer_context = Parameter(3);
81 Node* const frame_state = 81 Node* const frame_state =
82 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 82 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
83 Node* const effect = graph()->start(); 83 Node* const effect = graph()->start();
84 Node* const control = graph()->start(); 84 Node* const control = graph()->start();
85 Node* node = graph()->NewNode( 85 Node* node = graph()->NewNode(
86 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 86 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
87 VectorSlotPair()), 87 context, frame_state, frame_state, effect, control);
88 input0, input1, context, frame_state, frame_state, effect, control);
89 Reduction const r = Reduce(node); 88 Reduction const r = Reduce(node);
90 EXPECT_TRUE(r.Changed()); 89 EXPECT_TRUE(r.Changed());
91 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 90 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
92 } 91 }
93 92
94 TEST_F(JSContextRelaxationTest, 93 TEST_F(JSContextRelaxationTest,
95 RelaxJSCallFunctionShallowFrameStateChainCrossCtx) { 94 RelaxJSCallFunctionShallowFrameStateChainCrossCtx) {
96 Node* const input0 = Parameter(0); 95 Node* const input0 = Parameter(0);
97 Node* const input1 = Parameter(1); 96 Node* const input1 = Parameter(1);
98 Node* const context = Parameter(2); 97 Node* const context = Parameter(2);
99 Node* const outer_context = Parameter(3); 98 Node* const outer_context = Parameter(3);
100 Node* const frame_state = 99 Node* const frame_state =
101 ShallowFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT); 100 ShallowFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT);
102 Node* const effect = graph()->start(); 101 Node* const effect = graph()->start();
103 Node* const control = graph()->start(); 102 Node* const control = graph()->start();
104 Node* node = graph()->NewNode( 103 Node* node = graph()->NewNode(
105 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 104 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
106 VectorSlotPair()), 105 context, frame_state, frame_state, effect, control);
107 input0, input1, context, frame_state, frame_state, effect, control);
108 Reduction const r = Reduce(node); 106 Reduction const r = Reduce(node);
109 EXPECT_FALSE(r.Changed()); 107 EXPECT_FALSE(r.Changed());
110 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); 108 EXPECT_EQ(context, NodeProperties::GetContextInput(node));
111 } 109 }
112 110
113 TEST_F(JSContextRelaxationTest, 111 TEST_F(JSContextRelaxationTest,
114 RelaxJSCallFunctionDeepFrameStateChainNoCrossCtx) { 112 RelaxJSCallFunctionDeepFrameStateChainNoCrossCtx) {
115 Node* const input0 = Parameter(0); 113 Node* const input0 = Parameter(0);
116 Node* const input1 = Parameter(1); 114 Node* const input1 = Parameter(1);
117 Node* const context = Parameter(2); 115 Node* const context = Parameter(2);
118 Node* const outer_context = Parameter(3); 116 Node* const outer_context = Parameter(3);
119 Node* const frame_state = 117 Node* const frame_state =
120 DeepFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 118 DeepFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
121 Node* const effect = graph()->start(); 119 Node* const effect = graph()->start();
122 Node* const control = graph()->start(); 120 Node* const control = graph()->start();
123 Node* node = graph()->NewNode( 121 Node* node = graph()->NewNode(
124 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 122 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
125 VectorSlotPair()), 123 context, frame_state, frame_state, effect, control);
126 input0, input1, context, frame_state, frame_state, effect, control);
127 Reduction const r = Reduce(node); 124 Reduction const r = Reduce(node);
128 EXPECT_TRUE(r.Changed()); 125 EXPECT_TRUE(r.Changed());
129 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 126 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
130 } 127 }
131 128
132 TEST_F(JSContextRelaxationTest, 129 TEST_F(JSContextRelaxationTest,
133 RelaxJSCallFunctionDeepFrameStateChainCrossCtx) { 130 RelaxJSCallFunctionDeepFrameStateChainCrossCtx) {
134 Node* const input0 = Parameter(0); 131 Node* const input0 = Parameter(0);
135 Node* const input1 = Parameter(1); 132 Node* const input1 = Parameter(1);
136 Node* const context = Parameter(2); 133 Node* const context = Parameter(2);
137 Node* const outer_context = Parameter(3); 134 Node* const outer_context = Parameter(3);
138 Node* const frame_state = 135 Node* const frame_state =
139 DeepFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT); 136 DeepFrameStateChain(outer_context, CALL_CHANGES_NATIVE_CONTEXT);
140 Node* const effect = graph()->start(); 137 Node* const effect = graph()->start();
141 Node* const control = graph()->start(); 138 Node* const control = graph()->start();
142 Node* node = graph()->NewNode( 139 Node* node = graph()->NewNode(
143 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 140 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
144 VectorSlotPair()), 141 context, frame_state, frame_state, effect, control);
145 input0, input1, context, frame_state, frame_state, effect, control);
146 Reduction const r = Reduce(node); 142 Reduction const r = Reduce(node);
147 EXPECT_FALSE(r.Changed()); 143 EXPECT_FALSE(r.Changed());
148 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); 144 EXPECT_EQ(context, NodeProperties::GetContextInput(node));
149 } 145 }
150 146
151 TEST_F(JSContextRelaxationTest, 147 TEST_F(JSContextRelaxationTest,
152 RelaxJSCallFunctionDeepContextChainFullRelaxForCatch) { 148 RelaxJSCallFunctionDeepContextChainFullRelaxForCatch) {
153 Node* const input0 = Parameter(0); 149 Node* const input0 = Parameter(0);
154 Node* const input1 = Parameter(1); 150 Node* const input1 = Parameter(1);
155 Node* const context = Parameter(2); 151 Node* const context = Parameter(2);
156 Node* const outer_context = Parameter(3); 152 Node* const outer_context = Parameter(3);
157 const Operator* op = javascript()->CreateCatchContext(Handle<String>()); 153 const Operator* op = javascript()->CreateCatchContext(Handle<String>());
158 Node* const effect = graph()->start(); 154 Node* const effect = graph()->start();
159 Node* const control = graph()->start(); 155 Node* const control = graph()->start();
160 Node* nested_context = graph()->NewNode( 156 Node* nested_context = graph()->NewNode(
161 op, graph()->start(), graph()->start(), outer_context, effect, control); 157 op, graph()->start(), graph()->start(), outer_context, effect, control);
162 Node* const frame_state_2 = 158 Node* const frame_state_2 =
163 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 159 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
164 Node* node = graph()->NewNode( 160 Node* node = graph()->NewNode(
165 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 161 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
166 VectorSlotPair()), 162 context, frame_state_2, frame_state_2, effect, control);
167 input0, input1, context, frame_state_2, frame_state_2, effect, control);
168 Reduction const r = Reduce(node); 163 Reduction const r = Reduce(node);
169 EXPECT_TRUE(r.Changed()); 164 EXPECT_TRUE(r.Changed());
170 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 165 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
171 } 166 }
172 167
173 168
174 TEST_F(JSContextRelaxationTest, 169 TEST_F(JSContextRelaxationTest,
175 RelaxJSCallFunctionDeepContextChainFullRelaxForWith) { 170 RelaxJSCallFunctionDeepContextChainFullRelaxForWith) {
176 Node* const input0 = Parameter(0); 171 Node* const input0 = Parameter(0);
177 Node* const input1 = Parameter(1); 172 Node* const input1 = Parameter(1);
178 Node* const context = Parameter(2); 173 Node* const context = Parameter(2);
179 Node* const outer_context = Parameter(3); 174 Node* const outer_context = Parameter(3);
180 const Operator* op = javascript()->CreateWithContext(); 175 const Operator* op = javascript()->CreateWithContext();
181 Node* const frame_state_1 = 176 Node* const frame_state_1 =
182 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 177 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
183 Node* const effect = graph()->start(); 178 Node* const effect = graph()->start();
184 Node* const control = graph()->start(); 179 Node* const control = graph()->start();
185 Node* nested_context = 180 Node* nested_context =
186 graph()->NewNode(op, graph()->start(), graph()->start(), outer_context, 181 graph()->NewNode(op, graph()->start(), graph()->start(), outer_context,
187 frame_state_1, effect, control); 182 frame_state_1, effect, control);
188 Node* const frame_state_2 = 183 Node* const frame_state_2 =
189 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 184 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
190 Node* node = graph()->NewNode( 185 Node* node = graph()->NewNode(
191 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 186 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
192 VectorSlotPair()), 187 context, frame_state_2, frame_state_2, effect, control);
193 input0, input1, context, frame_state_2, frame_state_2, effect, control);
194 Reduction const r = Reduce(node); 188 Reduction const r = Reduce(node);
195 EXPECT_TRUE(r.Changed()); 189 EXPECT_TRUE(r.Changed());
196 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 190 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
197 } 191 }
198 192
199 193
200 TEST_F(JSContextRelaxationTest, 194 TEST_F(JSContextRelaxationTest,
201 RelaxJSCallFunctionDeepContextChainFullRelaxForBlock) { 195 RelaxJSCallFunctionDeepContextChainFullRelaxForBlock) {
202 Node* const input0 = Parameter(0); 196 Node* const input0 = Parameter(0);
203 Node* const input1 = Parameter(1); 197 Node* const input1 = Parameter(1);
204 Node* const context = Parameter(2); 198 Node* const context = Parameter(2);
205 Node* const outer_context = Parameter(3); 199 Node* const outer_context = Parameter(3);
206 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null(); 200 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null();
207 const Operator* op = javascript()->CreateBlockContext(scope_info); 201 const Operator* op = javascript()->CreateBlockContext(scope_info);
208 Node* const effect = graph()->start(); 202 Node* const effect = graph()->start();
209 Node* const control = graph()->start(); 203 Node* const control = graph()->start();
210 Node* nested_context = 204 Node* nested_context =
211 graph()->NewNode(op, graph()->start(), outer_context, effect, control); 205 graph()->NewNode(op, graph()->start(), outer_context, effect, control);
212 Node* const frame_state_2 = 206 Node* const frame_state_2 =
213 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 207 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
214 Node* node = graph()->NewNode( 208 Node* node = graph()->NewNode(
215 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 209 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
216 VectorSlotPair()), 210 context, frame_state_2, frame_state_2, effect, control);
217 input0, input1, context, frame_state_2, frame_state_2, effect, control);
218 Reduction const r = Reduce(node); 211 Reduction const r = Reduce(node);
219 EXPECT_TRUE(r.Changed()); 212 EXPECT_TRUE(r.Changed());
220 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); 213 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node));
221 } 214 }
222 215
223 216
224 TEST_F(JSContextRelaxationTest, 217 TEST_F(JSContextRelaxationTest,
225 RelaxJSCallFunctionDeepContextChainPartialRelaxForScript) { 218 RelaxJSCallFunctionDeepContextChainPartialRelaxForScript) {
226 Node* const input0 = Parameter(0); 219 Node* const input0 = Parameter(0);
227 Node* const input1 = Parameter(1); 220 Node* const input1 = Parameter(1);
228 Node* const context = Parameter(2); 221 Node* const context = Parameter(2);
229 Node* const outer_context = Parameter(3); 222 Node* const outer_context = Parameter(3);
230 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null(); 223 Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::null();
231 const Operator* op = javascript()->CreateScriptContext(scope_info); 224 const Operator* op = javascript()->CreateScriptContext(scope_info);
232 Node* const frame_state_1 = 225 Node* const frame_state_1 =
233 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); 226 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT);
234 Node* const effect = graph()->start(); 227 Node* const effect = graph()->start();
235 Node* const control = graph()->start(); 228 Node* const control = graph()->start();
236 Node* nested_context = graph()->NewNode(op, graph()->start(), outer_context, 229 Node* nested_context = graph()->NewNode(op, graph()->start(), outer_context,
237 frame_state_1, effect, control); 230 frame_state_1, effect, control);
238 Node* const frame_state_2 = 231 Node* const frame_state_2 =
239 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 232 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
240 Node* node = graph()->NewNode( 233 Node* node = graph()->NewNode(
241 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 234 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
242 VectorSlotPair()), 235 context, frame_state_2, frame_state_2, effect, control);
243 input0, input1, context, frame_state_2, frame_state_2, effect, control);
244 Reduction const r = Reduce(node); 236 Reduction const r = Reduce(node);
245 EXPECT_TRUE(r.Changed()); 237 EXPECT_TRUE(r.Changed());
246 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node)); 238 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node));
247 } 239 }
248 240
249 241
250 TEST_F(JSContextRelaxationTest, 242 TEST_F(JSContextRelaxationTest,
251 RelaxJSCallFunctionDeepContextChainPartialRelaxForModule) { 243 RelaxJSCallFunctionDeepContextChainPartialRelaxForModule) {
252 Node* const input0 = Parameter(0); 244 Node* const input0 = Parameter(0);
253 Node* const input1 = Parameter(1); 245 Node* const input1 = Parameter(1);
254 Node* const context = Parameter(2); 246 Node* const context = Parameter(2);
255 Node* const outer_context = Parameter(3); 247 Node* const outer_context = Parameter(3);
256 const Operator* op = javascript()->CreateModuleContext(); 248 const Operator* op = javascript()->CreateModuleContext();
257 Node* const effect = graph()->start(); 249 Node* const effect = graph()->start();
258 Node* const control = graph()->start(); 250 Node* const control = graph()->start();
259 Node* nested_context = graph()->NewNode( 251 Node* nested_context = graph()->NewNode(
260 op, graph()->start(), graph()->start(), outer_context, effect, control); 252 op, graph()->start(), graph()->start(), outer_context, effect, control);
261 Node* const frame_state_2 = 253 Node* const frame_state_2 =
262 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 254 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
263 Node* node = graph()->NewNode( 255 Node* node = graph()->NewNode(
264 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 256 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
265 VectorSlotPair()), 257 context, frame_state_2, frame_state_2, effect, control);
266 input0, input1, context, frame_state_2, frame_state_2, effect, control);
267 Reduction const r = Reduce(node); 258 Reduction const r = Reduce(node);
268 EXPECT_TRUE(r.Changed()); 259 EXPECT_TRUE(r.Changed());
269 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node)); 260 EXPECT_EQ(nested_context, NodeProperties::GetContextInput(node));
270 } 261 }
271 262
272 263
273 TEST_F(JSContextRelaxationTest, 264 TEST_F(JSContextRelaxationTest,
274 RelaxJSCallFunctionDeepContextChainPartialNoRelax) { 265 RelaxJSCallFunctionDeepContextChainPartialNoRelax) {
275 Node* const input0 = Parameter(0); 266 Node* const input0 = Parameter(0);
276 Node* const input1 = Parameter(1); 267 Node* const input1 = Parameter(1);
277 Node* const context = Parameter(2); 268 Node* const context = Parameter(2);
278 Node* const outer_context = Parameter(3); 269 Node* const outer_context = Parameter(3);
279 const Operator* op = javascript()->CreateFunctionContext(0); 270 const Operator* op = javascript()->CreateFunctionContext(0);
280 Node* const effect = graph()->start(); 271 Node* const effect = graph()->start();
281 Node* const control = graph()->start(); 272 Node* const control = graph()->start();
282 Node* nested_context = 273 Node* nested_context =
283 graph()->NewNode(op, graph()->start(), outer_context, effect, control); 274 graph()->NewNode(op, graph()->start(), outer_context, effect, control);
284 Node* const frame_state_2 = 275 Node* const frame_state_2 =
285 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); 276 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT);
286 Node* node = graph()->NewNode( 277 Node* node = graph()->NewNode(
287 javascript()->CallFunction(2, NO_CALL_FUNCTION_FLAGS, STRICT, 278 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1,
288 VectorSlotPair()), 279 context, frame_state_2, frame_state_2, effect, control);
289 input0, input1, context, frame_state_2, frame_state_2, effect, control);
290 Reduction const r = Reduce(node); 280 Reduction const r = Reduce(node);
291 EXPECT_FALSE(r.Changed()); 281 EXPECT_FALSE(r.Changed());
292 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); 282 EXPECT_EQ(context, NodeProperties::GetContextInput(node));
293 } 283 }
294 284
295 } // namespace compiler 285 } // namespace compiler
296 } // namespace internal 286 } // namespace internal
297 } // namespace v8 287 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-builtin-reducer-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698