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

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

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