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

Side by Side Diff: test/unittests/compiler/js-builtin-reducer-unittest.cc

Issue 2666783007: [turbo] Rename CallFunction* JSOperators to Call*. (Closed)
Patch Set: Created 3 years, 10 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/verifier.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/compiler/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 TEST_F(JSBuiltinReducerTest, GlobalIsFiniteWithNumber) { 117 TEST_F(JSBuiltinReducerTest, GlobalIsFiniteWithNumber) {
118 Node* function = GlobalFunction("isFinite"); 118 Node* function = GlobalFunction("isFinite");
119 119
120 Node* effect = graph()->start(); 120 Node* effect = graph()->start();
121 Node* control = graph()->start(); 121 Node* control = graph()->start();
122 Node* context = UndefinedConstant(); 122 Node* context = UndefinedConstant();
123 Node* frame_state = graph()->start(); 123 Node* frame_state = graph()->start();
124 TRACED_FOREACH(Type*, t0, kNumberTypes) { 124 TRACED_FOREACH(Type*, t0, kNumberTypes) {
125 Node* p0 = Parameter(t0, 0); 125 Node* p0 = Parameter(t0, 0);
126 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 126 Node* call =
127 UndefinedConstant(), p0, context, frame_state, 127 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
128 effect, control); 128 p0, context, frame_state, effect, control);
129 Reduction r = Reduce(call); 129 Reduction r = Reduce(call);
130 130
131 ASSERT_TRUE(r.Changed()); 131 ASSERT_TRUE(r.Changed());
132 EXPECT_THAT(r.replacement(), IsNumberEqual(IsNumberSubtract(p0, p0), 132 EXPECT_THAT(r.replacement(), IsNumberEqual(IsNumberSubtract(p0, p0),
133 IsNumberSubtract(p0, p0))); 133 IsNumberSubtract(p0, p0)));
134 } 134 }
135 } 135 }
136 136
137 TEST_F(JSBuiltinReducerTest, GlobalIsFiniteWithPlainPrimitive) { 137 TEST_F(JSBuiltinReducerTest, GlobalIsFiniteWithPlainPrimitive) {
138 Node* function = GlobalFunction("isFinite"); 138 Node* function = GlobalFunction("isFinite");
139 139
140 Node* effect = graph()->start(); 140 Node* effect = graph()->start();
141 Node* control = graph()->start(); 141 Node* control = graph()->start();
142 Node* context = UndefinedConstant(); 142 Node* context = UndefinedConstant();
143 Node* frame_state = graph()->start(); 143 Node* frame_state = graph()->start();
144 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 144 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
145 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 145 Node* call =
146 UndefinedConstant(), p0, context, frame_state, 146 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
147 effect, control); 147 context, frame_state, effect, control);
148 Reduction r = Reduce(call); 148 Reduction r = Reduce(call);
149 149
150 ASSERT_TRUE(r.Changed()); 150 ASSERT_TRUE(r.Changed());
151 EXPECT_THAT(r.replacement(), 151 EXPECT_THAT(r.replacement(),
152 IsNumberEqual(IsNumberSubtract(IsPlainPrimitiveToNumber(p0), 152 IsNumberEqual(IsNumberSubtract(IsPlainPrimitiveToNumber(p0),
153 IsPlainPrimitiveToNumber(p0)), 153 IsPlainPrimitiveToNumber(p0)),
154 IsNumberSubtract(IsPlainPrimitiveToNumber(p0), 154 IsNumberSubtract(IsPlainPrimitiveToNumber(p0),
155 IsPlainPrimitiveToNumber(p0)))); 155 IsPlainPrimitiveToNumber(p0))));
156 } 156 }
157 157
158 // ----------------------------------------------------------------------------- 158 // -----------------------------------------------------------------------------
159 // isNaN 159 // isNaN
160 160
161 TEST_F(JSBuiltinReducerTest, GlobalIsNaNWithNumber) { 161 TEST_F(JSBuiltinReducerTest, GlobalIsNaNWithNumber) {
162 Node* function = GlobalFunction("isNaN"); 162 Node* function = GlobalFunction("isNaN");
163 163
164 Node* effect = graph()->start(); 164 Node* effect = graph()->start();
165 Node* control = graph()->start(); 165 Node* control = graph()->start();
166 Node* context = UndefinedConstant(); 166 Node* context = UndefinedConstant();
167 Node* frame_state = graph()->start(); 167 Node* frame_state = graph()->start();
168 TRACED_FOREACH(Type*, t0, kNumberTypes) { 168 TRACED_FOREACH(Type*, t0, kNumberTypes) {
169 Node* p0 = Parameter(t0, 0); 169 Node* p0 = Parameter(t0, 0);
170 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 170 Node* call =
171 UndefinedConstant(), p0, context, frame_state, 171 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
172 effect, control); 172 p0, context, frame_state, effect, control);
173 Reduction r = Reduce(call); 173 Reduction r = Reduce(call);
174 174
175 ASSERT_TRUE(r.Changed()); 175 ASSERT_TRUE(r.Changed());
176 EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0))); 176 EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0)));
177 } 177 }
178 } 178 }
179 179
180 TEST_F(JSBuiltinReducerTest, GlobalIsNaNWithPlainPrimitive) { 180 TEST_F(JSBuiltinReducerTest, GlobalIsNaNWithPlainPrimitive) {
181 Node* function = GlobalFunction("isNaN"); 181 Node* function = GlobalFunction("isNaN");
182 182
183 Node* effect = graph()->start(); 183 Node* effect = graph()->start();
184 Node* control = graph()->start(); 184 Node* control = graph()->start();
185 Node* context = UndefinedConstant(); 185 Node* context = UndefinedConstant();
186 Node* frame_state = graph()->start(); 186 Node* frame_state = graph()->start();
187 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 187 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
188 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 188 Node* call =
189 UndefinedConstant(), p0, context, frame_state, 189 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
190 effect, control); 190 context, frame_state, effect, control);
191 Reduction r = Reduce(call); 191 Reduction r = Reduce(call);
192 192
193 ASSERT_TRUE(r.Changed()); 193 ASSERT_TRUE(r.Changed());
194 EXPECT_THAT(r.replacement(), 194 EXPECT_THAT(r.replacement(),
195 IsBooleanNot(IsNumberEqual(IsPlainPrimitiveToNumber(p0), 195 IsBooleanNot(IsNumberEqual(IsPlainPrimitiveToNumber(p0),
196 IsPlainPrimitiveToNumber(p0)))); 196 IsPlainPrimitiveToNumber(p0))));
197 } 197 }
198 198
199 // ----------------------------------------------------------------------------- 199 // -----------------------------------------------------------------------------
200 // Math.abs 200 // Math.abs
201 201
202 TEST_F(JSBuiltinReducerTest, MathAbsWithNumber) { 202 TEST_F(JSBuiltinReducerTest, MathAbsWithNumber) {
203 Node* function = MathFunction("abs"); 203 Node* function = MathFunction("abs");
204 204
205 Node* effect = graph()->start(); 205 Node* effect = graph()->start();
206 Node* control = graph()->start(); 206 Node* control = graph()->start();
207 Node* context = UndefinedConstant(); 207 Node* context = UndefinedConstant();
208 Node* frame_state = graph()->start(); 208 Node* frame_state = graph()->start();
209 TRACED_FOREACH(Type*, t0, kNumberTypes) { 209 TRACED_FOREACH(Type*, t0, kNumberTypes) {
210 Node* p0 = Parameter(t0, 0); 210 Node* p0 = Parameter(t0, 0);
211 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 211 Node* call =
212 UndefinedConstant(), p0, context, frame_state, 212 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
213 effect, control); 213 p0, context, frame_state, effect, control);
214 Reduction r = Reduce(call); 214 Reduction r = Reduce(call);
215 215
216 ASSERT_TRUE(r.Changed()); 216 ASSERT_TRUE(r.Changed());
217 EXPECT_THAT(r.replacement(), IsNumberAbs(p0)); 217 EXPECT_THAT(r.replacement(), IsNumberAbs(p0));
218 } 218 }
219 } 219 }
220 220
221 TEST_F(JSBuiltinReducerTest, MathAbsWithPlainPrimitive) { 221 TEST_F(JSBuiltinReducerTest, MathAbsWithPlainPrimitive) {
222 Node* function = MathFunction("abs"); 222 Node* function = MathFunction("abs");
223 223
224 Node* effect = graph()->start(); 224 Node* effect = graph()->start();
225 Node* control = graph()->start(); 225 Node* control = graph()->start();
226 Node* context = UndefinedConstant(); 226 Node* context = UndefinedConstant();
227 Node* frame_state = graph()->start(); 227 Node* frame_state = graph()->start();
228 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 228 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
229 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 229 Node* call =
230 UndefinedConstant(), p0, context, frame_state, 230 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
231 effect, control); 231 context, frame_state, effect, control);
232 Reduction r = Reduce(call); 232 Reduction r = Reduce(call);
233 233
234 ASSERT_TRUE(r.Changed()); 234 ASSERT_TRUE(r.Changed());
235 EXPECT_THAT(r.replacement(), IsNumberAbs(IsPlainPrimitiveToNumber(p0))); 235 EXPECT_THAT(r.replacement(), IsNumberAbs(IsPlainPrimitiveToNumber(p0)));
236 } 236 }
237 237
238 // ----------------------------------------------------------------------------- 238 // -----------------------------------------------------------------------------
239 // Math.acos 239 // Math.acos
240 240
241 TEST_F(JSBuiltinReducerTest, MathAcosWithNumber) { 241 TEST_F(JSBuiltinReducerTest, MathAcosWithNumber) {
242 Node* function = MathFunction("acos"); 242 Node* function = MathFunction("acos");
243 243
244 Node* effect = graph()->start(); 244 Node* effect = graph()->start();
245 Node* control = graph()->start(); 245 Node* control = graph()->start();
246 Node* context = UndefinedConstant(); 246 Node* context = UndefinedConstant();
247 Node* frame_state = graph()->start(); 247 Node* frame_state = graph()->start();
248 TRACED_FOREACH(Type*, t0, kNumberTypes) { 248 TRACED_FOREACH(Type*, t0, kNumberTypes) {
249 Node* p0 = Parameter(t0, 0); 249 Node* p0 = Parameter(t0, 0);
250 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 250 Node* call =
251 UndefinedConstant(), p0, context, frame_state, 251 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
252 effect, control); 252 p0, context, frame_state, effect, control);
253 Reduction r = Reduce(call); 253 Reduction r = Reduce(call);
254 254
255 ASSERT_TRUE(r.Changed()); 255 ASSERT_TRUE(r.Changed());
256 EXPECT_THAT(r.replacement(), IsNumberAcos(p0)); 256 EXPECT_THAT(r.replacement(), IsNumberAcos(p0));
257 } 257 }
258 } 258 }
259 259
260 TEST_F(JSBuiltinReducerTest, MathAcosWithPlainPrimitive) { 260 TEST_F(JSBuiltinReducerTest, MathAcosWithPlainPrimitive) {
261 Node* function = MathFunction("acos"); 261 Node* function = MathFunction("acos");
262 262
263 Node* effect = graph()->start(); 263 Node* effect = graph()->start();
264 Node* control = graph()->start(); 264 Node* control = graph()->start();
265 Node* context = UndefinedConstant(); 265 Node* context = UndefinedConstant();
266 Node* frame_state = graph()->start(); 266 Node* frame_state = graph()->start();
267 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 267 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
268 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 268 Node* call =
269 UndefinedConstant(), p0, context, frame_state, 269 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
270 effect, control); 270 context, frame_state, effect, control);
271 Reduction r = Reduce(call); 271 Reduction r = Reduce(call);
272 272
273 ASSERT_TRUE(r.Changed()); 273 ASSERT_TRUE(r.Changed());
274 EXPECT_THAT(r.replacement(), IsNumberAcos(IsPlainPrimitiveToNumber(p0))); 274 EXPECT_THAT(r.replacement(), IsNumberAcos(IsPlainPrimitiveToNumber(p0)));
275 } 275 }
276 276
277 // ----------------------------------------------------------------------------- 277 // -----------------------------------------------------------------------------
278 // Math.acosh 278 // Math.acosh
279 279
280 TEST_F(JSBuiltinReducerTest, MathAcoshWithNumber) { 280 TEST_F(JSBuiltinReducerTest, MathAcoshWithNumber) {
281 Node* function = MathFunction("acosh"); 281 Node* function = MathFunction("acosh");
282 282
283 Node* effect = graph()->start(); 283 Node* effect = graph()->start();
284 Node* control = graph()->start(); 284 Node* control = graph()->start();
285 Node* context = UndefinedConstant(); 285 Node* context = UndefinedConstant();
286 Node* frame_state = graph()->start(); 286 Node* frame_state = graph()->start();
287 TRACED_FOREACH(Type*, t0, kNumberTypes) { 287 TRACED_FOREACH(Type*, t0, kNumberTypes) {
288 Node* p0 = Parameter(t0, 0); 288 Node* p0 = Parameter(t0, 0);
289 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 289 Node* call =
290 UndefinedConstant(), p0, context, frame_state, 290 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
291 effect, control); 291 p0, context, frame_state, effect, control);
292 Reduction r = Reduce(call); 292 Reduction r = Reduce(call);
293 293
294 ASSERT_TRUE(r.Changed()); 294 ASSERT_TRUE(r.Changed());
295 EXPECT_THAT(r.replacement(), IsNumberAcosh(p0)); 295 EXPECT_THAT(r.replacement(), IsNumberAcosh(p0));
296 } 296 }
297 } 297 }
298 298
299 TEST_F(JSBuiltinReducerTest, MathAcoshWithPlainPrimitive) { 299 TEST_F(JSBuiltinReducerTest, MathAcoshWithPlainPrimitive) {
300 Node* function = MathFunction("acosh"); 300 Node* function = MathFunction("acosh");
301 301
302 Node* effect = graph()->start(); 302 Node* effect = graph()->start();
303 Node* control = graph()->start(); 303 Node* control = graph()->start();
304 Node* context = UndefinedConstant(); 304 Node* context = UndefinedConstant();
305 Node* frame_state = graph()->start(); 305 Node* frame_state = graph()->start();
306 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 306 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
307 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 307 Node* call =
308 UndefinedConstant(), p0, context, frame_state, 308 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
309 effect, control); 309 context, frame_state, effect, control);
310 Reduction r = Reduce(call); 310 Reduction r = Reduce(call);
311 311
312 ASSERT_TRUE(r.Changed()); 312 ASSERT_TRUE(r.Changed());
313 EXPECT_THAT(r.replacement(), IsNumberAcosh(IsPlainPrimitiveToNumber(p0))); 313 EXPECT_THAT(r.replacement(), IsNumberAcosh(IsPlainPrimitiveToNumber(p0)));
314 } 314 }
315 315
316 // ----------------------------------------------------------------------------- 316 // -----------------------------------------------------------------------------
317 // Math.asin 317 // Math.asin
318 318
319 TEST_F(JSBuiltinReducerTest, MathAsinWithNumber) { 319 TEST_F(JSBuiltinReducerTest, MathAsinWithNumber) {
320 Node* function = MathFunction("asin"); 320 Node* function = MathFunction("asin");
321 321
322 Node* effect = graph()->start(); 322 Node* effect = graph()->start();
323 Node* control = graph()->start(); 323 Node* control = graph()->start();
324 Node* context = UndefinedConstant(); 324 Node* context = UndefinedConstant();
325 Node* frame_state = graph()->start(); 325 Node* frame_state = graph()->start();
326 TRACED_FOREACH(Type*, t0, kNumberTypes) { 326 TRACED_FOREACH(Type*, t0, kNumberTypes) {
327 Node* p0 = Parameter(t0, 0); 327 Node* p0 = Parameter(t0, 0);
328 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 328 Node* call =
329 UndefinedConstant(), p0, context, frame_state, 329 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
330 effect, control); 330 p0, context, frame_state, effect, control);
331 Reduction r = Reduce(call); 331 Reduction r = Reduce(call);
332 332
333 ASSERT_TRUE(r.Changed()); 333 ASSERT_TRUE(r.Changed());
334 EXPECT_THAT(r.replacement(), IsNumberAsin(p0)); 334 EXPECT_THAT(r.replacement(), IsNumberAsin(p0));
335 } 335 }
336 } 336 }
337 337
338 TEST_F(JSBuiltinReducerTest, MathAsinWithPlainPrimitive) { 338 TEST_F(JSBuiltinReducerTest, MathAsinWithPlainPrimitive) {
339 Node* function = MathFunction("asin"); 339 Node* function = MathFunction("asin");
340 340
341 Node* effect = graph()->start(); 341 Node* effect = graph()->start();
342 Node* control = graph()->start(); 342 Node* control = graph()->start();
343 Node* context = UndefinedConstant(); 343 Node* context = UndefinedConstant();
344 Node* frame_state = graph()->start(); 344 Node* frame_state = graph()->start();
345 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 345 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
346 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 346 Node* call =
347 UndefinedConstant(), p0, context, frame_state, 347 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
348 effect, control); 348 context, frame_state, effect, control);
349 Reduction r = Reduce(call); 349 Reduction r = Reduce(call);
350 350
351 ASSERT_TRUE(r.Changed()); 351 ASSERT_TRUE(r.Changed());
352 EXPECT_THAT(r.replacement(), IsNumberAsin(IsPlainPrimitiveToNumber(p0))); 352 EXPECT_THAT(r.replacement(), IsNumberAsin(IsPlainPrimitiveToNumber(p0)));
353 } 353 }
354 354
355 // ----------------------------------------------------------------------------- 355 // -----------------------------------------------------------------------------
356 // Math.asinh 356 // Math.asinh
357 357
358 TEST_F(JSBuiltinReducerTest, MathAsinhWithNumber) { 358 TEST_F(JSBuiltinReducerTest, MathAsinhWithNumber) {
359 Node* function = MathFunction("asinh"); 359 Node* function = MathFunction("asinh");
360 360
361 Node* effect = graph()->start(); 361 Node* effect = graph()->start();
362 Node* control = graph()->start(); 362 Node* control = graph()->start();
363 Node* context = UndefinedConstant(); 363 Node* context = UndefinedConstant();
364 Node* frame_state = graph()->start(); 364 Node* frame_state = graph()->start();
365 TRACED_FOREACH(Type*, t0, kNumberTypes) { 365 TRACED_FOREACH(Type*, t0, kNumberTypes) {
366 Node* p0 = Parameter(t0, 0); 366 Node* p0 = Parameter(t0, 0);
367 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 367 Node* call =
368 UndefinedConstant(), p0, context, frame_state, 368 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
369 effect, control); 369 p0, context, frame_state, effect, control);
370 Reduction r = Reduce(call); 370 Reduction r = Reduce(call);
371 371
372 ASSERT_TRUE(r.Changed()); 372 ASSERT_TRUE(r.Changed());
373 EXPECT_THAT(r.replacement(), IsNumberAsinh(p0)); 373 EXPECT_THAT(r.replacement(), IsNumberAsinh(p0));
374 } 374 }
375 } 375 }
376 376
377 TEST_F(JSBuiltinReducerTest, MathAsinhWithPlainPrimitive) { 377 TEST_F(JSBuiltinReducerTest, MathAsinhWithPlainPrimitive) {
378 Node* function = MathFunction("asinh"); 378 Node* function = MathFunction("asinh");
379 379
380 Node* effect = graph()->start(); 380 Node* effect = graph()->start();
381 Node* control = graph()->start(); 381 Node* control = graph()->start();
382 Node* context = UndefinedConstant(); 382 Node* context = UndefinedConstant();
383 Node* frame_state = graph()->start(); 383 Node* frame_state = graph()->start();
384 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 384 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
385 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 385 Node* call =
386 UndefinedConstant(), p0, context, frame_state, 386 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
387 effect, control); 387 context, frame_state, effect, control);
388 Reduction r = Reduce(call); 388 Reduction r = Reduce(call);
389 389
390 ASSERT_TRUE(r.Changed()); 390 ASSERT_TRUE(r.Changed());
391 EXPECT_THAT(r.replacement(), IsNumberAsinh(IsPlainPrimitiveToNumber(p0))); 391 EXPECT_THAT(r.replacement(), IsNumberAsinh(IsPlainPrimitiveToNumber(p0)));
392 } 392 }
393 393
394 // ----------------------------------------------------------------------------- 394 // -----------------------------------------------------------------------------
395 // Math.atan 395 // Math.atan
396 396
397 TEST_F(JSBuiltinReducerTest, MathAtanWithNumber) { 397 TEST_F(JSBuiltinReducerTest, MathAtanWithNumber) {
398 Node* function = MathFunction("atan"); 398 Node* function = MathFunction("atan");
399 399
400 Node* effect = graph()->start(); 400 Node* effect = graph()->start();
401 Node* control = graph()->start(); 401 Node* control = graph()->start();
402 Node* context = UndefinedConstant(); 402 Node* context = UndefinedConstant();
403 Node* frame_state = graph()->start(); 403 Node* frame_state = graph()->start();
404 TRACED_FOREACH(Type*, t0, kNumberTypes) { 404 TRACED_FOREACH(Type*, t0, kNumberTypes) {
405 Node* p0 = Parameter(t0, 0); 405 Node* p0 = Parameter(t0, 0);
406 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 406 Node* call =
407 UndefinedConstant(), p0, context, frame_state, 407 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
408 effect, control); 408 p0, context, frame_state, effect, control);
409 Reduction r = Reduce(call); 409 Reduction r = Reduce(call);
410 410
411 ASSERT_TRUE(r.Changed()); 411 ASSERT_TRUE(r.Changed());
412 EXPECT_THAT(r.replacement(), IsNumberAtan(p0)); 412 EXPECT_THAT(r.replacement(), IsNumberAtan(p0));
413 } 413 }
414 } 414 }
415 415
416 TEST_F(JSBuiltinReducerTest, MathAtanWithPlainPrimitive) { 416 TEST_F(JSBuiltinReducerTest, MathAtanWithPlainPrimitive) {
417 Node* function = MathFunction("atan"); 417 Node* function = MathFunction("atan");
418 418
419 Node* effect = graph()->start(); 419 Node* effect = graph()->start();
420 Node* control = graph()->start(); 420 Node* control = graph()->start();
421 Node* context = UndefinedConstant(); 421 Node* context = UndefinedConstant();
422 Node* frame_state = graph()->start(); 422 Node* frame_state = graph()->start();
423 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 423 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
424 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 424 Node* call =
425 UndefinedConstant(), p0, context, frame_state, 425 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
426 effect, control); 426 context, frame_state, effect, control);
427 Reduction r = Reduce(call); 427 Reduction r = Reduce(call);
428 428
429 ASSERT_TRUE(r.Changed()); 429 ASSERT_TRUE(r.Changed());
430 EXPECT_THAT(r.replacement(), IsNumberAtan(IsPlainPrimitiveToNumber(p0))); 430 EXPECT_THAT(r.replacement(), IsNumberAtan(IsPlainPrimitiveToNumber(p0)));
431 } 431 }
432 432
433 // ----------------------------------------------------------------------------- 433 // -----------------------------------------------------------------------------
434 // Math.atanh 434 // Math.atanh
435 435
436 TEST_F(JSBuiltinReducerTest, MathAtanhWithNumber) { 436 TEST_F(JSBuiltinReducerTest, MathAtanhWithNumber) {
437 Node* function = MathFunction("atanh"); 437 Node* function = MathFunction("atanh");
438 438
439 Node* effect = graph()->start(); 439 Node* effect = graph()->start();
440 Node* control = graph()->start(); 440 Node* control = graph()->start();
441 Node* context = UndefinedConstant(); 441 Node* context = UndefinedConstant();
442 Node* frame_state = graph()->start(); 442 Node* frame_state = graph()->start();
443 TRACED_FOREACH(Type*, t0, kNumberTypes) { 443 TRACED_FOREACH(Type*, t0, kNumberTypes) {
444 Node* p0 = Parameter(t0, 0); 444 Node* p0 = Parameter(t0, 0);
445 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 445 Node* call =
446 UndefinedConstant(), p0, context, frame_state, 446 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
447 effect, control); 447 p0, context, frame_state, effect, control);
448 Reduction r = Reduce(call); 448 Reduction r = Reduce(call);
449 449
450 ASSERT_TRUE(r.Changed()); 450 ASSERT_TRUE(r.Changed());
451 EXPECT_THAT(r.replacement(), IsNumberAtanh(p0)); 451 EXPECT_THAT(r.replacement(), IsNumberAtanh(p0));
452 } 452 }
453 } 453 }
454 454
455 TEST_F(JSBuiltinReducerTest, MathAtanhWithPlainPrimitive) { 455 TEST_F(JSBuiltinReducerTest, MathAtanhWithPlainPrimitive) {
456 Node* function = MathFunction("atanh"); 456 Node* function = MathFunction("atanh");
457 457
458 Node* effect = graph()->start(); 458 Node* effect = graph()->start();
459 Node* control = graph()->start(); 459 Node* control = graph()->start();
460 Node* context = UndefinedConstant(); 460 Node* context = UndefinedConstant();
461 Node* frame_state = graph()->start(); 461 Node* frame_state = graph()->start();
462 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 462 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
463 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 463 Node* call =
464 UndefinedConstant(), p0, context, frame_state, 464 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
465 effect, control); 465 context, frame_state, effect, control);
466 Reduction r = Reduce(call); 466 Reduction r = Reduce(call);
467 467
468 ASSERT_TRUE(r.Changed()); 468 ASSERT_TRUE(r.Changed());
469 EXPECT_THAT(r.replacement(), IsNumberAtanh(IsPlainPrimitiveToNumber(p0))); 469 EXPECT_THAT(r.replacement(), IsNumberAtanh(IsPlainPrimitiveToNumber(p0)));
470 } 470 }
471 471
472 // ----------------------------------------------------------------------------- 472 // -----------------------------------------------------------------------------
473 // Math.atan2 473 // Math.atan2
474 474
475 TEST_F(JSBuiltinReducerTest, MathAtan2WithNumber) { 475 TEST_F(JSBuiltinReducerTest, MathAtan2WithNumber) {
476 Node* function = MathFunction("atan2"); 476 Node* function = MathFunction("atan2");
477 477
478 Node* effect = graph()->start(); 478 Node* effect = graph()->start();
479 Node* control = graph()->start(); 479 Node* control = graph()->start();
480 Node* context = UndefinedConstant(); 480 Node* context = UndefinedConstant();
481 Node* frame_state = graph()->start(); 481 Node* frame_state = graph()->start();
482 TRACED_FOREACH(Type*, t0, kNumberTypes) { 482 TRACED_FOREACH(Type*, t0, kNumberTypes) {
483 Node* p0 = Parameter(t0, 0); 483 Node* p0 = Parameter(t0, 0);
484 TRACED_FOREACH(Type*, t1, kNumberTypes) { 484 TRACED_FOREACH(Type*, t1, kNumberTypes) {
485 Node* p1 = Parameter(t1, 0); 485 Node* p1 = Parameter(t1, 0);
486 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 486 Node* call =
487 UndefinedConstant(), p0, p1, context, 487 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(),
488 frame_state, effect, control); 488 p0, p1, context, frame_state, effect, control);
489 Reduction r = Reduce(call); 489 Reduction r = Reduce(call);
490 490
491 ASSERT_TRUE(r.Changed()); 491 ASSERT_TRUE(r.Changed());
492 EXPECT_THAT(r.replacement(), IsNumberAtan2(p0, p1)); 492 EXPECT_THAT(r.replacement(), IsNumberAtan2(p0, p1));
493 } 493 }
494 } 494 }
495 } 495 }
496 496
497 TEST_F(JSBuiltinReducerTest, MathAtan2WithPlainPrimitive) { 497 TEST_F(JSBuiltinReducerTest, MathAtan2WithPlainPrimitive) {
498 Node* function = MathFunction("atan2"); 498 Node* function = MathFunction("atan2");
499 499
500 Node* effect = graph()->start(); 500 Node* effect = graph()->start();
501 Node* control = graph()->start(); 501 Node* control = graph()->start();
502 Node* context = UndefinedConstant(); 502 Node* context = UndefinedConstant();
503 Node* frame_state = graph()->start(); 503 Node* frame_state = graph()->start();
504 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 504 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
505 Node* p1 = Parameter(Type::PlainPrimitive(), 0); 505 Node* p1 = Parameter(Type::PlainPrimitive(), 0);
506 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 506 Node* call =
507 UndefinedConstant(), p0, p1, context, 507 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
508 frame_state, effect, control); 508 p1, context, frame_state, effect, control);
509 Reduction r = Reduce(call); 509 Reduction r = Reduce(call);
510 510
511 ASSERT_TRUE(r.Changed()); 511 ASSERT_TRUE(r.Changed());
512 EXPECT_THAT(r.replacement(), IsNumberAtan2(IsPlainPrimitiveToNumber(p0), 512 EXPECT_THAT(r.replacement(), IsNumberAtan2(IsPlainPrimitiveToNumber(p0),
513 IsPlainPrimitiveToNumber(p1))); 513 IsPlainPrimitiveToNumber(p1)));
514 } 514 }
515 515
516 // ----------------------------------------------------------------------------- 516 // -----------------------------------------------------------------------------
517 // Math.ceil 517 // Math.ceil
518 518
519 TEST_F(JSBuiltinReducerTest, MathCeilWithNumber) { 519 TEST_F(JSBuiltinReducerTest, MathCeilWithNumber) {
520 Node* function = MathFunction("ceil"); 520 Node* function = MathFunction("ceil");
521 521
522 Node* effect = graph()->start(); 522 Node* effect = graph()->start();
523 Node* control = graph()->start(); 523 Node* control = graph()->start();
524 Node* context = UndefinedConstant(); 524 Node* context = UndefinedConstant();
525 Node* frame_state = graph()->start(); 525 Node* frame_state = graph()->start();
526 TRACED_FOREACH(Type*, t0, kNumberTypes) { 526 TRACED_FOREACH(Type*, t0, kNumberTypes) {
527 Node* p0 = Parameter(t0, 0); 527 Node* p0 = Parameter(t0, 0);
528 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 528 Node* call =
529 UndefinedConstant(), p0, context, frame_state, 529 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
530 effect, control); 530 p0, context, frame_state, effect, control);
531 Reduction r = Reduce(call); 531 Reduction r = Reduce(call);
532 532
533 ASSERT_TRUE(r.Changed()); 533 ASSERT_TRUE(r.Changed());
534 EXPECT_THAT(r.replacement(), IsNumberCeil(p0)); 534 EXPECT_THAT(r.replacement(), IsNumberCeil(p0));
535 } 535 }
536 } 536 }
537 537
538 TEST_F(JSBuiltinReducerTest, MathCeilWithPlainPrimitive) { 538 TEST_F(JSBuiltinReducerTest, MathCeilWithPlainPrimitive) {
539 Node* function = MathFunction("ceil"); 539 Node* function = MathFunction("ceil");
540 540
541 Node* effect = graph()->start(); 541 Node* effect = graph()->start();
542 Node* control = graph()->start(); 542 Node* control = graph()->start();
543 Node* context = UndefinedConstant(); 543 Node* context = UndefinedConstant();
544 Node* frame_state = graph()->start(); 544 Node* frame_state = graph()->start();
545 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 545 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
546 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 546 Node* call =
547 UndefinedConstant(), p0, context, frame_state, 547 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
548 effect, control); 548 context, frame_state, effect, control);
549 Reduction r = Reduce(call); 549 Reduction r = Reduce(call);
550 550
551 ASSERT_TRUE(r.Changed()); 551 ASSERT_TRUE(r.Changed());
552 EXPECT_THAT(r.replacement(), IsNumberCeil(IsPlainPrimitiveToNumber(p0))); 552 EXPECT_THAT(r.replacement(), IsNumberCeil(IsPlainPrimitiveToNumber(p0)));
553 } 553 }
554 554
555 // ----------------------------------------------------------------------------- 555 // -----------------------------------------------------------------------------
556 // Math.clz32 556 // Math.clz32
557 557
558 TEST_F(JSBuiltinReducerTest, MathClz32WithUnsigned32) { 558 TEST_F(JSBuiltinReducerTest, MathClz32WithUnsigned32) {
559 Node* function = MathFunction("clz32"); 559 Node* function = MathFunction("clz32");
560 560
561 Node* effect = graph()->start(); 561 Node* effect = graph()->start();
562 Node* control = graph()->start(); 562 Node* control = graph()->start();
563 Node* context = UndefinedConstant(); 563 Node* context = UndefinedConstant();
564 Node* frame_state = graph()->start(); 564 Node* frame_state = graph()->start();
565 Node* p0 = Parameter(Type::Unsigned32(), 0); 565 Node* p0 = Parameter(Type::Unsigned32(), 0);
566 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 566 Node* call =
567 UndefinedConstant(), p0, context, frame_state, 567 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
568 effect, control); 568 context, frame_state, effect, control);
569 Reduction r = Reduce(call); 569 Reduction r = Reduce(call);
570 570
571 ASSERT_TRUE(r.Changed()); 571 ASSERT_TRUE(r.Changed());
572 EXPECT_THAT(r.replacement(), IsNumberClz32(p0)); 572 EXPECT_THAT(r.replacement(), IsNumberClz32(p0));
573 } 573 }
574 574
575 TEST_F(JSBuiltinReducerTest, MathClz32WithNumber) { 575 TEST_F(JSBuiltinReducerTest, MathClz32WithNumber) {
576 Node* function = MathFunction("clz32"); 576 Node* function = MathFunction("clz32");
577 577
578 Node* effect = graph()->start(); 578 Node* effect = graph()->start();
579 Node* control = graph()->start(); 579 Node* control = graph()->start();
580 Node* context = UndefinedConstant(); 580 Node* context = UndefinedConstant();
581 Node* frame_state = graph()->start(); 581 Node* frame_state = graph()->start();
582 Node* p0 = Parameter(Type::Number(), 0); 582 Node* p0 = Parameter(Type::Number(), 0);
583 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 583 Node* call =
584 UndefinedConstant(), p0, context, frame_state, 584 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
585 effect, control); 585 context, frame_state, effect, control);
586 Reduction r = Reduce(call); 586 Reduction r = Reduce(call);
587 587
588 ASSERT_TRUE(r.Changed()); 588 ASSERT_TRUE(r.Changed());
589 EXPECT_THAT(r.replacement(), IsNumberClz32(IsNumberToUint32(p0))); 589 EXPECT_THAT(r.replacement(), IsNumberClz32(IsNumberToUint32(p0)));
590 } 590 }
591 591
592 TEST_F(JSBuiltinReducerTest, MathClz32WithPlainPrimitive) { 592 TEST_F(JSBuiltinReducerTest, MathClz32WithPlainPrimitive) {
593 Node* function = MathFunction("clz32"); 593 Node* function = MathFunction("clz32");
594 594
595 Node* effect = graph()->start(); 595 Node* effect = graph()->start();
596 Node* control = graph()->start(); 596 Node* control = graph()->start();
597 Node* context = UndefinedConstant(); 597 Node* context = UndefinedConstant();
598 Node* frame_state = graph()->start(); 598 Node* frame_state = graph()->start();
599 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 599 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
600 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 600 Node* call =
601 UndefinedConstant(), p0, context, frame_state, 601 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
602 effect, control); 602 context, frame_state, effect, control);
603 Reduction r = Reduce(call); 603 Reduction r = Reduce(call);
604 604
605 ASSERT_TRUE(r.Changed()); 605 ASSERT_TRUE(r.Changed());
606 EXPECT_THAT(r.replacement(), 606 EXPECT_THAT(r.replacement(),
607 IsNumberClz32(IsNumberToUint32(IsPlainPrimitiveToNumber(p0)))); 607 IsNumberClz32(IsNumberToUint32(IsPlainPrimitiveToNumber(p0))));
608 } 608 }
609 609
610 // ----------------------------------------------------------------------------- 610 // -----------------------------------------------------------------------------
611 // Math.cos 611 // Math.cos
612 612
613 TEST_F(JSBuiltinReducerTest, MathCosWithNumber) { 613 TEST_F(JSBuiltinReducerTest, MathCosWithNumber) {
614 Node* function = MathFunction("cos"); 614 Node* function = MathFunction("cos");
615 615
616 Node* effect = graph()->start(); 616 Node* effect = graph()->start();
617 Node* control = graph()->start(); 617 Node* control = graph()->start();
618 Node* context = UndefinedConstant(); 618 Node* context = UndefinedConstant();
619 Node* frame_state = graph()->start(); 619 Node* frame_state = graph()->start();
620 TRACED_FOREACH(Type*, t0, kNumberTypes) { 620 TRACED_FOREACH(Type*, t0, kNumberTypes) {
621 Node* p0 = Parameter(t0, 0); 621 Node* p0 = Parameter(t0, 0);
622 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 622 Node* call =
623 UndefinedConstant(), p0, context, frame_state, 623 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
624 effect, control); 624 p0, context, frame_state, effect, control);
625 Reduction r = Reduce(call); 625 Reduction r = Reduce(call);
626 626
627 ASSERT_TRUE(r.Changed()); 627 ASSERT_TRUE(r.Changed());
628 EXPECT_THAT(r.replacement(), IsNumberCos(p0)); 628 EXPECT_THAT(r.replacement(), IsNumberCos(p0));
629 } 629 }
630 } 630 }
631 631
632 TEST_F(JSBuiltinReducerTest, MathCosWithPlainPrimitive) { 632 TEST_F(JSBuiltinReducerTest, MathCosWithPlainPrimitive) {
633 Node* function = MathFunction("cos"); 633 Node* function = MathFunction("cos");
634 634
635 Node* effect = graph()->start(); 635 Node* effect = graph()->start();
636 Node* control = graph()->start(); 636 Node* control = graph()->start();
637 Node* context = UndefinedConstant(); 637 Node* context = UndefinedConstant();
638 Node* frame_state = graph()->start(); 638 Node* frame_state = graph()->start();
639 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 639 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
640 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 640 Node* call =
641 UndefinedConstant(), p0, context, frame_state, 641 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
642 effect, control); 642 context, frame_state, effect, control);
643 Reduction r = Reduce(call); 643 Reduction r = Reduce(call);
644 644
645 ASSERT_TRUE(r.Changed()); 645 ASSERT_TRUE(r.Changed());
646 EXPECT_THAT(r.replacement(), IsNumberCos(IsPlainPrimitiveToNumber(p0))); 646 EXPECT_THAT(r.replacement(), IsNumberCos(IsPlainPrimitiveToNumber(p0)));
647 } 647 }
648 648
649 // ----------------------------------------------------------------------------- 649 // -----------------------------------------------------------------------------
650 // Math.cosh 650 // Math.cosh
651 651
652 TEST_F(JSBuiltinReducerTest, MathCoshWithNumber) { 652 TEST_F(JSBuiltinReducerTest, MathCoshWithNumber) {
653 Node* function = MathFunction("cosh"); 653 Node* function = MathFunction("cosh");
654 654
655 Node* effect = graph()->start(); 655 Node* effect = graph()->start();
656 Node* control = graph()->start(); 656 Node* control = graph()->start();
657 Node* context = UndefinedConstant(); 657 Node* context = UndefinedConstant();
658 Node* frame_state = graph()->start(); 658 Node* frame_state = graph()->start();
659 TRACED_FOREACH(Type*, t0, kNumberTypes) { 659 TRACED_FOREACH(Type*, t0, kNumberTypes) {
660 Node* p0 = Parameter(t0, 0); 660 Node* p0 = Parameter(t0, 0);
661 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 661 Node* call =
662 UndefinedConstant(), p0, context, frame_state, 662 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
663 effect, control); 663 p0, context, frame_state, effect, control);
664 Reduction r = Reduce(call); 664 Reduction r = Reduce(call);
665 665
666 ASSERT_TRUE(r.Changed()); 666 ASSERT_TRUE(r.Changed());
667 EXPECT_THAT(r.replacement(), IsNumberCosh(p0)); 667 EXPECT_THAT(r.replacement(), IsNumberCosh(p0));
668 } 668 }
669 } 669 }
670 670
671 TEST_F(JSBuiltinReducerTest, MathCoshWithPlainPrimitive) { 671 TEST_F(JSBuiltinReducerTest, MathCoshWithPlainPrimitive) {
672 Node* function = MathFunction("cosh"); 672 Node* function = MathFunction("cosh");
673 673
674 Node* effect = graph()->start(); 674 Node* effect = graph()->start();
675 Node* control = graph()->start(); 675 Node* control = graph()->start();
676 Node* context = UndefinedConstant(); 676 Node* context = UndefinedConstant();
677 Node* frame_state = graph()->start(); 677 Node* frame_state = graph()->start();
678 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 678 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
679 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 679 Node* call =
680 UndefinedConstant(), p0, context, frame_state, 680 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
681 effect, control); 681 context, frame_state, effect, control);
682 Reduction r = Reduce(call); 682 Reduction r = Reduce(call);
683 683
684 ASSERT_TRUE(r.Changed()); 684 ASSERT_TRUE(r.Changed());
685 EXPECT_THAT(r.replacement(), IsNumberCosh(IsPlainPrimitiveToNumber(p0))); 685 EXPECT_THAT(r.replacement(), IsNumberCosh(IsPlainPrimitiveToNumber(p0)));
686 } 686 }
687 687
688 // ----------------------------------------------------------------------------- 688 // -----------------------------------------------------------------------------
689 // Math.exp 689 // Math.exp
690 690
691 TEST_F(JSBuiltinReducerTest, MathExpWithNumber) { 691 TEST_F(JSBuiltinReducerTest, MathExpWithNumber) {
692 Node* function = MathFunction("exp"); 692 Node* function = MathFunction("exp");
693 693
694 Node* effect = graph()->start(); 694 Node* effect = graph()->start();
695 Node* control = graph()->start(); 695 Node* control = graph()->start();
696 Node* context = UndefinedConstant(); 696 Node* context = UndefinedConstant();
697 Node* frame_state = graph()->start(); 697 Node* frame_state = graph()->start();
698 TRACED_FOREACH(Type*, t0, kNumberTypes) { 698 TRACED_FOREACH(Type*, t0, kNumberTypes) {
699 Node* p0 = Parameter(t0, 0); 699 Node* p0 = Parameter(t0, 0);
700 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 700 Node* call =
701 UndefinedConstant(), p0, context, frame_state, 701 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
702 effect, control); 702 p0, context, frame_state, effect, control);
703 Reduction r = Reduce(call); 703 Reduction r = Reduce(call);
704 704
705 ASSERT_TRUE(r.Changed()); 705 ASSERT_TRUE(r.Changed());
706 EXPECT_THAT(r.replacement(), IsNumberExp(p0)); 706 EXPECT_THAT(r.replacement(), IsNumberExp(p0));
707 } 707 }
708 } 708 }
709 709
710 TEST_F(JSBuiltinReducerTest, MathExpWithPlainPrimitive) { 710 TEST_F(JSBuiltinReducerTest, MathExpWithPlainPrimitive) {
711 Node* function = MathFunction("exp"); 711 Node* function = MathFunction("exp");
712 712
713 Node* effect = graph()->start(); 713 Node* effect = graph()->start();
714 Node* control = graph()->start(); 714 Node* control = graph()->start();
715 Node* context = UndefinedConstant(); 715 Node* context = UndefinedConstant();
716 Node* frame_state = graph()->start(); 716 Node* frame_state = graph()->start();
717 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 717 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
718 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 718 Node* call =
719 UndefinedConstant(), p0, context, frame_state, 719 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
720 effect, control); 720 context, frame_state, effect, control);
721 Reduction r = Reduce(call); 721 Reduction r = Reduce(call);
722 722
723 ASSERT_TRUE(r.Changed()); 723 ASSERT_TRUE(r.Changed());
724 EXPECT_THAT(r.replacement(), IsNumberExp(IsPlainPrimitiveToNumber(p0))); 724 EXPECT_THAT(r.replacement(), IsNumberExp(IsPlainPrimitiveToNumber(p0)));
725 } 725 }
726 726
727 // ----------------------------------------------------------------------------- 727 // -----------------------------------------------------------------------------
728 // Math.floor 728 // Math.floor
729 729
730 TEST_F(JSBuiltinReducerTest, MathFloorWithNumber) { 730 TEST_F(JSBuiltinReducerTest, MathFloorWithNumber) {
731 Node* function = MathFunction("floor"); 731 Node* function = MathFunction("floor");
732 732
733 Node* effect = graph()->start(); 733 Node* effect = graph()->start();
734 Node* control = graph()->start(); 734 Node* control = graph()->start();
735 Node* context = UndefinedConstant(); 735 Node* context = UndefinedConstant();
736 Node* frame_state = graph()->start(); 736 Node* frame_state = graph()->start();
737 TRACED_FOREACH(Type*, t0, kNumberTypes) { 737 TRACED_FOREACH(Type*, t0, kNumberTypes) {
738 Node* p0 = Parameter(t0, 0); 738 Node* p0 = Parameter(t0, 0);
739 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 739 Node* call =
740 UndefinedConstant(), p0, context, frame_state, 740 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
741 effect, control); 741 p0, context, frame_state, effect, control);
742 Reduction r = Reduce(call); 742 Reduction r = Reduce(call);
743 743
744 ASSERT_TRUE(r.Changed()); 744 ASSERT_TRUE(r.Changed());
745 EXPECT_THAT(r.replacement(), IsNumberFloor(p0)); 745 EXPECT_THAT(r.replacement(), IsNumberFloor(p0));
746 } 746 }
747 } 747 }
748 748
749 TEST_F(JSBuiltinReducerTest, MathFloorWithPlainPrimitive) { 749 TEST_F(JSBuiltinReducerTest, MathFloorWithPlainPrimitive) {
750 Node* function = MathFunction("floor"); 750 Node* function = MathFunction("floor");
751 751
752 Node* effect = graph()->start(); 752 Node* effect = graph()->start();
753 Node* control = graph()->start(); 753 Node* control = graph()->start();
754 Node* context = UndefinedConstant(); 754 Node* context = UndefinedConstant();
755 Node* frame_state = graph()->start(); 755 Node* frame_state = graph()->start();
756 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 756 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
757 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 757 Node* call =
758 UndefinedConstant(), p0, context, frame_state, 758 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
759 effect, control); 759 context, frame_state, effect, control);
760 Reduction r = Reduce(call); 760 Reduction r = Reduce(call);
761 761
762 ASSERT_TRUE(r.Changed()); 762 ASSERT_TRUE(r.Changed());
763 EXPECT_THAT(r.replacement(), IsNumberFloor(IsPlainPrimitiveToNumber(p0))); 763 EXPECT_THAT(r.replacement(), IsNumberFloor(IsPlainPrimitiveToNumber(p0)));
764 } 764 }
765 765
766 // ----------------------------------------------------------------------------- 766 // -----------------------------------------------------------------------------
767 // Math.fround 767 // Math.fround
768 768
769 TEST_F(JSBuiltinReducerTest, MathFroundWithNumber) { 769 TEST_F(JSBuiltinReducerTest, MathFroundWithNumber) {
770 Node* function = MathFunction("fround"); 770 Node* function = MathFunction("fround");
771 771
772 Node* effect = graph()->start(); 772 Node* effect = graph()->start();
773 Node* control = graph()->start(); 773 Node* control = graph()->start();
774 Node* context = UndefinedConstant(); 774 Node* context = UndefinedConstant();
775 Node* frame_state = graph()->start(); 775 Node* frame_state = graph()->start();
776 TRACED_FOREACH(Type*, t0, kNumberTypes) { 776 TRACED_FOREACH(Type*, t0, kNumberTypes) {
777 Node* p0 = Parameter(t0, 0); 777 Node* p0 = Parameter(t0, 0);
778 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 778 Node* call =
779 UndefinedConstant(), p0, context, frame_state, 779 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
780 effect, control); 780 p0, context, frame_state, effect, control);
781 Reduction r = Reduce(call); 781 Reduction r = Reduce(call);
782 782
783 ASSERT_TRUE(r.Changed()); 783 ASSERT_TRUE(r.Changed());
784 EXPECT_THAT(r.replacement(), IsNumberFround(p0)); 784 EXPECT_THAT(r.replacement(), IsNumberFround(p0));
785 } 785 }
786 } 786 }
787 787
788 TEST_F(JSBuiltinReducerTest, MathFroundWithPlainPrimitive) { 788 TEST_F(JSBuiltinReducerTest, MathFroundWithPlainPrimitive) {
789 Node* function = MathFunction("fround"); 789 Node* function = MathFunction("fround");
790 790
791 Node* effect = graph()->start(); 791 Node* effect = graph()->start();
792 Node* control = graph()->start(); 792 Node* control = graph()->start();
793 Node* context = UndefinedConstant(); 793 Node* context = UndefinedConstant();
794 Node* frame_state = graph()->start(); 794 Node* frame_state = graph()->start();
795 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 795 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
796 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 796 Node* call =
797 UndefinedConstant(), p0, context, frame_state, 797 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
798 effect, control); 798 context, frame_state, effect, control);
799 Reduction r = Reduce(call); 799 Reduction r = Reduce(call);
800 800
801 ASSERT_TRUE(r.Changed()); 801 ASSERT_TRUE(r.Changed());
802 EXPECT_THAT(r.replacement(), IsNumberFround(IsPlainPrimitiveToNumber(p0))); 802 EXPECT_THAT(r.replacement(), IsNumberFround(IsPlainPrimitiveToNumber(p0)));
803 } 803 }
804 804
805 // ----------------------------------------------------------------------------- 805 // -----------------------------------------------------------------------------
806 // Math.imul 806 // Math.imul
807 807
808 TEST_F(JSBuiltinReducerTest, MathImulWithUnsigned32) { 808 TEST_F(JSBuiltinReducerTest, MathImulWithUnsigned32) {
809 Node* function = MathFunction("imul"); 809 Node* function = MathFunction("imul");
810 810
811 Node* effect = graph()->start(); 811 Node* effect = graph()->start();
812 Node* control = graph()->start(); 812 Node* control = graph()->start();
813 Node* context = UndefinedConstant(); 813 Node* context = UndefinedConstant();
814 Node* frame_state = graph()->start(); 814 Node* frame_state = graph()->start();
815 Node* p0 = Parameter(Type::Unsigned32(), 0); 815 Node* p0 = Parameter(Type::Unsigned32(), 0);
816 Node* p1 = Parameter(Type::Unsigned32(), 1); 816 Node* p1 = Parameter(Type::Unsigned32(), 1);
817 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 817 Node* call =
818 UndefinedConstant(), p0, p1, context, 818 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
819 frame_state, effect, control); 819 p1, context, frame_state, effect, control);
820 Reduction r = Reduce(call); 820 Reduction r = Reduce(call);
821 821
822 ASSERT_TRUE(r.Changed()); 822 ASSERT_TRUE(r.Changed());
823 EXPECT_THAT(r.replacement(), IsNumberImul(p0, p1)); 823 EXPECT_THAT(r.replacement(), IsNumberImul(p0, p1));
824 } 824 }
825 825
826 TEST_F(JSBuiltinReducerTest, MathImulWithNumber) { 826 TEST_F(JSBuiltinReducerTest, MathImulWithNumber) {
827 Node* function = MathFunction("imul"); 827 Node* function = MathFunction("imul");
828 828
829 Node* effect = graph()->start(); 829 Node* effect = graph()->start();
830 Node* control = graph()->start(); 830 Node* control = graph()->start();
831 Node* context = UndefinedConstant(); 831 Node* context = UndefinedConstant();
832 Node* frame_state = graph()->start(); 832 Node* frame_state = graph()->start();
833 Node* p0 = Parameter(Type::Number(), 0); 833 Node* p0 = Parameter(Type::Number(), 0);
834 Node* p1 = Parameter(Type::Number(), 1); 834 Node* p1 = Parameter(Type::Number(), 1);
835 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 835 Node* call =
836 UndefinedConstant(), p0, p1, context, 836 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
837 frame_state, effect, control); 837 p1, context, frame_state, effect, control);
838 Reduction r = Reduce(call); 838 Reduction r = Reduce(call);
839 839
840 ASSERT_TRUE(r.Changed()); 840 ASSERT_TRUE(r.Changed());
841 EXPECT_THAT(r.replacement(), 841 EXPECT_THAT(r.replacement(),
842 IsNumberImul(IsNumberToUint32(p0), IsNumberToUint32(p1))); 842 IsNumberImul(IsNumberToUint32(p0), IsNumberToUint32(p1)));
843 } 843 }
844 844
845 TEST_F(JSBuiltinReducerTest, MathImulWithPlainPrimitive) { 845 TEST_F(JSBuiltinReducerTest, MathImulWithPlainPrimitive) {
846 Node* function = MathFunction("imul"); 846 Node* function = MathFunction("imul");
847 847
848 Node* effect = graph()->start(); 848 Node* effect = graph()->start();
849 Node* control = graph()->start(); 849 Node* control = graph()->start();
850 Node* context = UndefinedConstant(); 850 Node* context = UndefinedConstant();
851 Node* frame_state = graph()->start(); 851 Node* frame_state = graph()->start();
852 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 852 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
853 Node* p1 = Parameter(Type::PlainPrimitive(), 1); 853 Node* p1 = Parameter(Type::PlainPrimitive(), 1);
854 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 854 Node* call =
855 UndefinedConstant(), p0, p1, context, 855 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
856 frame_state, effect, control); 856 p1, context, frame_state, effect, control);
857 Reduction r = Reduce(call); 857 Reduction r = Reduce(call);
858 858
859 ASSERT_TRUE(r.Changed()); 859 ASSERT_TRUE(r.Changed());
860 EXPECT_THAT(r.replacement(), 860 EXPECT_THAT(r.replacement(),
861 IsNumberImul(IsNumberToUint32(IsPlainPrimitiveToNumber(p0)), 861 IsNumberImul(IsNumberToUint32(IsPlainPrimitiveToNumber(p0)),
862 IsNumberToUint32(IsPlainPrimitiveToNumber(p1)))); 862 IsNumberToUint32(IsPlainPrimitiveToNumber(p1))));
863 } 863 }
864 864
865 // ----------------------------------------------------------------------------- 865 // -----------------------------------------------------------------------------
866 // Math.log 866 // Math.log
867 867
868 TEST_F(JSBuiltinReducerTest, MathLogWithNumber) { 868 TEST_F(JSBuiltinReducerTest, MathLogWithNumber) {
869 Node* function = MathFunction("log"); 869 Node* function = MathFunction("log");
870 870
871 Node* effect = graph()->start(); 871 Node* effect = graph()->start();
872 Node* control = graph()->start(); 872 Node* control = graph()->start();
873 Node* context = UndefinedConstant(); 873 Node* context = UndefinedConstant();
874 Node* frame_state = graph()->start(); 874 Node* frame_state = graph()->start();
875 TRACED_FOREACH(Type*, t0, kNumberTypes) { 875 TRACED_FOREACH(Type*, t0, kNumberTypes) {
876 Node* p0 = Parameter(t0, 0); 876 Node* p0 = Parameter(t0, 0);
877 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 877 Node* call =
878 UndefinedConstant(), p0, context, frame_state, 878 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
879 effect, control); 879 p0, context, frame_state, effect, control);
880 Reduction r = Reduce(call); 880 Reduction r = Reduce(call);
881 881
882 ASSERT_TRUE(r.Changed()); 882 ASSERT_TRUE(r.Changed());
883 EXPECT_THAT(r.replacement(), IsNumberLog(p0)); 883 EXPECT_THAT(r.replacement(), IsNumberLog(p0));
884 } 884 }
885 } 885 }
886 886
887 TEST_F(JSBuiltinReducerTest, MathLogWithPlainPrimitive) { 887 TEST_F(JSBuiltinReducerTest, MathLogWithPlainPrimitive) {
888 Node* function = MathFunction("log"); 888 Node* function = MathFunction("log");
889 889
890 Node* effect = graph()->start(); 890 Node* effect = graph()->start();
891 Node* control = graph()->start(); 891 Node* control = graph()->start();
892 Node* context = UndefinedConstant(); 892 Node* context = UndefinedConstant();
893 Node* frame_state = graph()->start(); 893 Node* frame_state = graph()->start();
894 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 894 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
895 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 895 Node* call =
896 UndefinedConstant(), p0, context, frame_state, 896 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
897 effect, control); 897 context, frame_state, effect, control);
898 Reduction r = Reduce(call); 898 Reduction r = Reduce(call);
899 899
900 ASSERT_TRUE(r.Changed()); 900 ASSERT_TRUE(r.Changed());
901 EXPECT_THAT(r.replacement(), IsNumberLog(IsPlainPrimitiveToNumber(p0))); 901 EXPECT_THAT(r.replacement(), IsNumberLog(IsPlainPrimitiveToNumber(p0)));
902 } 902 }
903 903
904 // ----------------------------------------------------------------------------- 904 // -----------------------------------------------------------------------------
905 // Math.log1p 905 // Math.log1p
906 906
907 TEST_F(JSBuiltinReducerTest, MathLog1pWithNumber) { 907 TEST_F(JSBuiltinReducerTest, MathLog1pWithNumber) {
908 Node* function = MathFunction("log1p"); 908 Node* function = MathFunction("log1p");
909 909
910 Node* effect = graph()->start(); 910 Node* effect = graph()->start();
911 Node* control = graph()->start(); 911 Node* control = graph()->start();
912 Node* context = UndefinedConstant(); 912 Node* context = UndefinedConstant();
913 Node* frame_state = graph()->start(); 913 Node* frame_state = graph()->start();
914 TRACED_FOREACH(Type*, t0, kNumberTypes) { 914 TRACED_FOREACH(Type*, t0, kNumberTypes) {
915 Node* p0 = Parameter(t0, 0); 915 Node* p0 = Parameter(t0, 0);
916 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 916 Node* call =
917 UndefinedConstant(), p0, context, frame_state, 917 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
918 effect, control); 918 p0, context, frame_state, effect, control);
919 Reduction r = Reduce(call); 919 Reduction r = Reduce(call);
920 920
921 ASSERT_TRUE(r.Changed()); 921 ASSERT_TRUE(r.Changed());
922 EXPECT_THAT(r.replacement(), IsNumberLog1p(p0)); 922 EXPECT_THAT(r.replacement(), IsNumberLog1p(p0));
923 } 923 }
924 } 924 }
925 925
926 TEST_F(JSBuiltinReducerTest, MathLog1pWithPlainPrimitive) { 926 TEST_F(JSBuiltinReducerTest, MathLog1pWithPlainPrimitive) {
927 Node* function = MathFunction("log1p"); 927 Node* function = MathFunction("log1p");
928 928
929 Node* effect = graph()->start(); 929 Node* effect = graph()->start();
930 Node* control = graph()->start(); 930 Node* control = graph()->start();
931 Node* context = UndefinedConstant(); 931 Node* context = UndefinedConstant();
932 Node* frame_state = graph()->start(); 932 Node* frame_state = graph()->start();
933 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 933 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
934 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 934 Node* call =
935 UndefinedConstant(), p0, context, frame_state, 935 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
936 effect, control); 936 context, frame_state, effect, control);
937 Reduction r = Reduce(call); 937 Reduction r = Reduce(call);
938 938
939 ASSERT_TRUE(r.Changed()); 939 ASSERT_TRUE(r.Changed());
940 EXPECT_THAT(r.replacement(), IsNumberLog1p(IsPlainPrimitiveToNumber(p0))); 940 EXPECT_THAT(r.replacement(), IsNumberLog1p(IsPlainPrimitiveToNumber(p0)));
941 } 941 }
942 942
943 // ----------------------------------------------------------------------------- 943 // -----------------------------------------------------------------------------
944 // Math.max 944 // Math.max
945 945
946 TEST_F(JSBuiltinReducerTest, MathMaxWithNoArguments) { 946 TEST_F(JSBuiltinReducerTest, MathMaxWithNoArguments) {
947 Node* function = MathFunction("max"); 947 Node* function = MathFunction("max");
948 948
949 Node* effect = graph()->start(); 949 Node* effect = graph()->start();
950 Node* control = graph()->start(); 950 Node* control = graph()->start();
951 Node* context = UndefinedConstant(); 951 Node* context = UndefinedConstant();
952 Node* frame_state = graph()->start(); 952 Node* frame_state = graph()->start();
953 Node* call = graph()->NewNode(javascript()->CallFunction(2), function, 953 Node* call =
954 UndefinedConstant(), context, frame_state, 954 graph()->NewNode(javascript()->Call(2), function, UndefinedConstant(),
955 effect, control); 955 context, frame_state, effect, control);
956 Reduction r = Reduce(call); 956 Reduction r = Reduce(call);
957 957
958 ASSERT_TRUE(r.Changed()); 958 ASSERT_TRUE(r.Changed());
959 EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY)); 959 EXPECT_THAT(r.replacement(), IsNumberConstant(-V8_INFINITY));
960 } 960 }
961 961
962 TEST_F(JSBuiltinReducerTest, MathMaxWithNumber) { 962 TEST_F(JSBuiltinReducerTest, MathMaxWithNumber) {
963 Node* function = MathFunction("max"); 963 Node* function = MathFunction("max");
964 964
965 Node* effect = graph()->start(); 965 Node* effect = graph()->start();
966 Node* control = graph()->start(); 966 Node* control = graph()->start();
967 Node* context = UndefinedConstant(); 967 Node* context = UndefinedConstant();
968 Node* frame_state = graph()->start(); 968 Node* frame_state = graph()->start();
969 TRACED_FOREACH(Type*, t0, kNumberTypes) { 969 TRACED_FOREACH(Type*, t0, kNumberTypes) {
970 Node* p0 = Parameter(t0, 0); 970 Node* p0 = Parameter(t0, 0);
971 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 971 Node* call =
972 UndefinedConstant(), p0, context, frame_state, 972 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
973 effect, control); 973 p0, context, frame_state, effect, control);
974 Reduction r = Reduce(call); 974 Reduction r = Reduce(call);
975 975
976 ASSERT_TRUE(r.Changed()); 976 ASSERT_TRUE(r.Changed());
977 EXPECT_THAT(r.replacement(), p0); 977 EXPECT_THAT(r.replacement(), p0);
978 } 978 }
979 } 979 }
980 980
981 TEST_F(JSBuiltinReducerTest, MathMaxWithPlainPrimitive) { 981 TEST_F(JSBuiltinReducerTest, MathMaxWithPlainPrimitive) {
982 Node* function = MathFunction("max"); 982 Node* function = MathFunction("max");
983 983
984 Node* effect = graph()->start(); 984 Node* effect = graph()->start();
985 Node* control = graph()->start(); 985 Node* control = graph()->start();
986 Node* context = UndefinedConstant(); 986 Node* context = UndefinedConstant();
987 Node* frame_state = graph()->start(); 987 Node* frame_state = graph()->start();
988 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 988 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
989 Node* p1 = Parameter(Type::PlainPrimitive(), 1); 989 Node* p1 = Parameter(Type::PlainPrimitive(), 1);
990 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 990 Node* call =
991 UndefinedConstant(), p0, p1, context, 991 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
992 frame_state, effect, control); 992 p1, context, frame_state, effect, control);
993 Reduction r = Reduce(call); 993 Reduction r = Reduce(call);
994 994
995 ASSERT_TRUE(r.Changed()); 995 ASSERT_TRUE(r.Changed());
996 EXPECT_THAT(r.replacement(), IsNumberMax(IsPlainPrimitiveToNumber(p0), 996 EXPECT_THAT(r.replacement(), IsNumberMax(IsPlainPrimitiveToNumber(p0),
997 IsPlainPrimitiveToNumber(p1))); 997 IsPlainPrimitiveToNumber(p1)));
998 } 998 }
999 999
1000 // ----------------------------------------------------------------------------- 1000 // -----------------------------------------------------------------------------
1001 // Math.min 1001 // Math.min
1002 1002
1003 TEST_F(JSBuiltinReducerTest, MathMinWithNoArguments) { 1003 TEST_F(JSBuiltinReducerTest, MathMinWithNoArguments) {
1004 Node* function = MathFunction("min"); 1004 Node* function = MathFunction("min");
1005 1005
1006 Node* effect = graph()->start(); 1006 Node* effect = graph()->start();
1007 Node* control = graph()->start(); 1007 Node* control = graph()->start();
1008 Node* context = UndefinedConstant(); 1008 Node* context = UndefinedConstant();
1009 Node* frame_state = graph()->start(); 1009 Node* frame_state = graph()->start();
1010 Node* call = graph()->NewNode(javascript()->CallFunction(2), function, 1010 Node* call =
1011 UndefinedConstant(), context, frame_state, 1011 graph()->NewNode(javascript()->Call(2), function, UndefinedConstant(),
1012 effect, control); 1012 context, frame_state, effect, control);
1013 Reduction r = Reduce(call); 1013 Reduction r = Reduce(call);
1014 1014
1015 ASSERT_TRUE(r.Changed()); 1015 ASSERT_TRUE(r.Changed());
1016 EXPECT_THAT(r.replacement(), IsNumberConstant(V8_INFINITY)); 1016 EXPECT_THAT(r.replacement(), IsNumberConstant(V8_INFINITY));
1017 } 1017 }
1018 1018
1019 TEST_F(JSBuiltinReducerTest, MathMinWithNumber) { 1019 TEST_F(JSBuiltinReducerTest, MathMinWithNumber) {
1020 Node* function = MathFunction("min"); 1020 Node* function = MathFunction("min");
1021 1021
1022 Node* effect = graph()->start(); 1022 Node* effect = graph()->start();
1023 Node* control = graph()->start(); 1023 Node* control = graph()->start();
1024 Node* context = UndefinedConstant(); 1024 Node* context = UndefinedConstant();
1025 Node* frame_state = graph()->start(); 1025 Node* frame_state = graph()->start();
1026 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1026 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1027 Node* p0 = Parameter(t0, 0); 1027 Node* p0 = Parameter(t0, 0);
1028 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1028 Node* call =
1029 UndefinedConstant(), p0, context, frame_state, 1029 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1030 effect, control); 1030 p0, context, frame_state, effect, control);
1031 Reduction r = Reduce(call); 1031 Reduction r = Reduce(call);
1032 1032
1033 ASSERT_TRUE(r.Changed()); 1033 ASSERT_TRUE(r.Changed());
1034 EXPECT_THAT(r.replacement(), p0); 1034 EXPECT_THAT(r.replacement(), p0);
1035 } 1035 }
1036 } 1036 }
1037 1037
1038 TEST_F(JSBuiltinReducerTest, MathMinWithPlainPrimitive) { 1038 TEST_F(JSBuiltinReducerTest, MathMinWithPlainPrimitive) {
1039 Node* function = MathFunction("min"); 1039 Node* function = MathFunction("min");
1040 1040
1041 Node* effect = graph()->start(); 1041 Node* effect = graph()->start();
1042 Node* control = graph()->start(); 1042 Node* control = graph()->start();
1043 Node* context = UndefinedConstant(); 1043 Node* context = UndefinedConstant();
1044 Node* frame_state = graph()->start(); 1044 Node* frame_state = graph()->start();
1045 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1045 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1046 Node* p1 = Parameter(Type::PlainPrimitive(), 1); 1046 Node* p1 = Parameter(Type::PlainPrimitive(), 1);
1047 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 1047 Node* call =
1048 UndefinedConstant(), p0, p1, context, 1048 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
1049 frame_state, effect, control); 1049 p1, context, frame_state, effect, control);
1050 Reduction r = Reduce(call); 1050 Reduction r = Reduce(call);
1051 1051
1052 ASSERT_TRUE(r.Changed()); 1052 ASSERT_TRUE(r.Changed());
1053 EXPECT_THAT(r.replacement(), IsNumberMin(IsPlainPrimitiveToNumber(p0), 1053 EXPECT_THAT(r.replacement(), IsNumberMin(IsPlainPrimitiveToNumber(p0),
1054 IsPlainPrimitiveToNumber(p1))); 1054 IsPlainPrimitiveToNumber(p1)));
1055 } 1055 }
1056 1056
1057 // ----------------------------------------------------------------------------- 1057 // -----------------------------------------------------------------------------
1058 // Math.round 1058 // Math.round
1059 1059
1060 TEST_F(JSBuiltinReducerTest, MathRoundWithNumber) { 1060 TEST_F(JSBuiltinReducerTest, MathRoundWithNumber) {
1061 Node* function = MathFunction("round"); 1061 Node* function = MathFunction("round");
1062 1062
1063 Node* effect = graph()->start(); 1063 Node* effect = graph()->start();
1064 Node* control = graph()->start(); 1064 Node* control = graph()->start();
1065 Node* context = UndefinedConstant(); 1065 Node* context = UndefinedConstant();
1066 Node* frame_state = graph()->start(); 1066 Node* frame_state = graph()->start();
1067 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1067 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1068 Node* p0 = Parameter(t0, 0); 1068 Node* p0 = Parameter(t0, 0);
1069 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1069 Node* call =
1070 UndefinedConstant(), p0, context, frame_state, 1070 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1071 effect, control); 1071 p0, context, frame_state, effect, control);
1072 Reduction r = Reduce(call); 1072 Reduction r = Reduce(call);
1073 1073
1074 ASSERT_TRUE(r.Changed()); 1074 ASSERT_TRUE(r.Changed());
1075 EXPECT_THAT(r.replacement(), IsNumberRound(p0)); 1075 EXPECT_THAT(r.replacement(), IsNumberRound(p0));
1076 } 1076 }
1077 } 1077 }
1078 1078
1079 TEST_F(JSBuiltinReducerTest, MathRoundWithPlainPrimitive) { 1079 TEST_F(JSBuiltinReducerTest, MathRoundWithPlainPrimitive) {
1080 Node* function = MathFunction("round"); 1080 Node* function = MathFunction("round");
1081 1081
1082 Node* effect = graph()->start(); 1082 Node* effect = graph()->start();
1083 Node* control = graph()->start(); 1083 Node* control = graph()->start();
1084 Node* context = UndefinedConstant(); 1084 Node* context = UndefinedConstant();
1085 Node* frame_state = graph()->start(); 1085 Node* frame_state = graph()->start();
1086 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1086 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1087 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1087 Node* call =
1088 UndefinedConstant(), p0, context, frame_state, 1088 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1089 effect, control); 1089 context, frame_state, effect, control);
1090 Reduction r = Reduce(call); 1090 Reduction r = Reduce(call);
1091 1091
1092 ASSERT_TRUE(r.Changed()); 1092 ASSERT_TRUE(r.Changed());
1093 EXPECT_THAT(r.replacement(), IsNumberRound(IsPlainPrimitiveToNumber(p0))); 1093 EXPECT_THAT(r.replacement(), IsNumberRound(IsPlainPrimitiveToNumber(p0)));
1094 } 1094 }
1095 1095
1096 // ----------------------------------------------------------------------------- 1096 // -----------------------------------------------------------------------------
1097 // Math.pow 1097 // Math.pow
1098 1098
1099 TEST_F(JSBuiltinReducerTest, MathPowWithNumber) { 1099 TEST_F(JSBuiltinReducerTest, MathPowWithNumber) {
1100 Node* function = MathFunction("pow"); 1100 Node* function = MathFunction("pow");
1101 1101
1102 Node* effect = graph()->start(); 1102 Node* effect = graph()->start();
1103 Node* control = graph()->start(); 1103 Node* control = graph()->start();
1104 Node* context = UndefinedConstant(); 1104 Node* context = UndefinedConstant();
1105 Node* frame_state = graph()->start(); 1105 Node* frame_state = graph()->start();
1106 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1106 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1107 Node* p0 = Parameter(t0, 0); 1107 Node* p0 = Parameter(t0, 0);
1108 TRACED_FOREACH(Type*, t1, kNumberTypes) { 1108 TRACED_FOREACH(Type*, t1, kNumberTypes) {
1109 Node* p1 = Parameter(t1, 0); 1109 Node* p1 = Parameter(t1, 0);
1110 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 1110 Node* call =
1111 UndefinedConstant(), p0, p1, context, 1111 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(),
1112 frame_state, effect, control); 1112 p0, p1, context, frame_state, effect, control);
1113 Reduction r = Reduce(call); 1113 Reduction r = Reduce(call);
1114 1114
1115 ASSERT_TRUE(r.Changed()); 1115 ASSERT_TRUE(r.Changed());
1116 EXPECT_THAT(r.replacement(), IsNumberPow(p0, p1)); 1116 EXPECT_THAT(r.replacement(), IsNumberPow(p0, p1));
1117 } 1117 }
1118 } 1118 }
1119 } 1119 }
1120 1120
1121 TEST_F(JSBuiltinReducerTest, MathPowWithPlainPrimitive) { 1121 TEST_F(JSBuiltinReducerTest, MathPowWithPlainPrimitive) {
1122 Node* function = MathFunction("pow"); 1122 Node* function = MathFunction("pow");
1123 1123
1124 Node* effect = graph()->start(); 1124 Node* effect = graph()->start();
1125 Node* control = graph()->start(); 1125 Node* control = graph()->start();
1126 Node* context = UndefinedConstant(); 1126 Node* context = UndefinedConstant();
1127 Node* frame_state = graph()->start(); 1127 Node* frame_state = graph()->start();
1128 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1128 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1129 Node* p1 = Parameter(Type::PlainPrimitive(), 0); 1129 Node* p1 = Parameter(Type::PlainPrimitive(), 0);
1130 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 1130 Node* call =
1131 UndefinedConstant(), p0, p1, context, 1131 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(), p0,
1132 frame_state, effect, control); 1132 p1, context, frame_state, effect, control);
1133 Reduction r = Reduce(call); 1133 Reduction r = Reduce(call);
1134 1134
1135 ASSERT_TRUE(r.Changed()); 1135 ASSERT_TRUE(r.Changed());
1136 EXPECT_THAT(r.replacement(), IsNumberPow(IsPlainPrimitiveToNumber(p0), 1136 EXPECT_THAT(r.replacement(), IsNumberPow(IsPlainPrimitiveToNumber(p0),
1137 IsPlainPrimitiveToNumber(p1))); 1137 IsPlainPrimitiveToNumber(p1)));
1138 } 1138 }
1139 1139
1140 // ----------------------------------------------------------------------------- 1140 // -----------------------------------------------------------------------------
1141 // Math.sign 1141 // Math.sign
1142 1142
1143 TEST_F(JSBuiltinReducerTest, MathSignWithNumber) { 1143 TEST_F(JSBuiltinReducerTest, MathSignWithNumber) {
1144 Node* function = MathFunction("sign"); 1144 Node* function = MathFunction("sign");
1145 1145
1146 Node* effect = graph()->start(); 1146 Node* effect = graph()->start();
1147 Node* control = graph()->start(); 1147 Node* control = graph()->start();
1148 Node* context = UndefinedConstant(); 1148 Node* context = UndefinedConstant();
1149 Node* frame_state = graph()->start(); 1149 Node* frame_state = graph()->start();
1150 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1150 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1151 Node* p0 = Parameter(t0, 0); 1151 Node* p0 = Parameter(t0, 0);
1152 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1152 Node* call =
1153 UndefinedConstant(), p0, context, frame_state, 1153 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1154 effect, control); 1154 p0, context, frame_state, effect, control);
1155 Reduction r = Reduce(call); 1155 Reduction r = Reduce(call);
1156 1156
1157 ASSERT_TRUE(r.Changed()); 1157 ASSERT_TRUE(r.Changed());
1158 EXPECT_THAT(r.replacement(), IsNumberSign(p0)); 1158 EXPECT_THAT(r.replacement(), IsNumberSign(p0));
1159 } 1159 }
1160 } 1160 }
1161 1161
1162 TEST_F(JSBuiltinReducerTest, MathSignWithPlainPrimitive) { 1162 TEST_F(JSBuiltinReducerTest, MathSignWithPlainPrimitive) {
1163 Node* function = MathFunction("sign"); 1163 Node* function = MathFunction("sign");
1164 1164
1165 Node* effect = graph()->start(); 1165 Node* effect = graph()->start();
1166 Node* control = graph()->start(); 1166 Node* control = graph()->start();
1167 Node* context = UndefinedConstant(); 1167 Node* context = UndefinedConstant();
1168 Node* frame_state = graph()->start(); 1168 Node* frame_state = graph()->start();
1169 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1169 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1170 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1170 Node* call =
1171 UndefinedConstant(), p0, context, frame_state, 1171 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1172 effect, control); 1172 context, frame_state, effect, control);
1173 Reduction r = Reduce(call); 1173 Reduction r = Reduce(call);
1174 1174
1175 ASSERT_TRUE(r.Changed()); 1175 ASSERT_TRUE(r.Changed());
1176 EXPECT_THAT(r.replacement(), IsNumberSign(IsPlainPrimitiveToNumber(p0))); 1176 EXPECT_THAT(r.replacement(), IsNumberSign(IsPlainPrimitiveToNumber(p0)));
1177 } 1177 }
1178 1178
1179 // ----------------------------------------------------------------------------- 1179 // -----------------------------------------------------------------------------
1180 // Math.sin 1180 // Math.sin
1181 1181
1182 TEST_F(JSBuiltinReducerTest, MathSinWithNumber) { 1182 TEST_F(JSBuiltinReducerTest, MathSinWithNumber) {
1183 Node* function = MathFunction("sin"); 1183 Node* function = MathFunction("sin");
1184 1184
1185 Node* effect = graph()->start(); 1185 Node* effect = graph()->start();
1186 Node* control = graph()->start(); 1186 Node* control = graph()->start();
1187 Node* context = UndefinedConstant(); 1187 Node* context = UndefinedConstant();
1188 Node* frame_state = graph()->start(); 1188 Node* frame_state = graph()->start();
1189 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1189 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1190 Node* p0 = Parameter(t0, 0); 1190 Node* p0 = Parameter(t0, 0);
1191 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1191 Node* call =
1192 UndefinedConstant(), p0, context, frame_state, 1192 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1193 effect, control); 1193 p0, context, frame_state, effect, control);
1194 Reduction r = Reduce(call); 1194 Reduction r = Reduce(call);
1195 1195
1196 ASSERT_TRUE(r.Changed()); 1196 ASSERT_TRUE(r.Changed());
1197 EXPECT_THAT(r.replacement(), IsNumberSin(p0)); 1197 EXPECT_THAT(r.replacement(), IsNumberSin(p0));
1198 } 1198 }
1199 } 1199 }
1200 1200
1201 TEST_F(JSBuiltinReducerTest, MathSinWithPlainPrimitive) { 1201 TEST_F(JSBuiltinReducerTest, MathSinWithPlainPrimitive) {
1202 Node* function = MathFunction("sin"); 1202 Node* function = MathFunction("sin");
1203 1203
1204 Node* effect = graph()->start(); 1204 Node* effect = graph()->start();
1205 Node* control = graph()->start(); 1205 Node* control = graph()->start();
1206 Node* context = UndefinedConstant(); 1206 Node* context = UndefinedConstant();
1207 Node* frame_state = graph()->start(); 1207 Node* frame_state = graph()->start();
1208 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1208 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1209 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1209 Node* call =
1210 UndefinedConstant(), p0, context, frame_state, 1210 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1211 effect, control); 1211 context, frame_state, effect, control);
1212 Reduction r = Reduce(call); 1212 Reduction r = Reduce(call);
1213 1213
1214 ASSERT_TRUE(r.Changed()); 1214 ASSERT_TRUE(r.Changed());
1215 EXPECT_THAT(r.replacement(), IsNumberSin(IsPlainPrimitiveToNumber(p0))); 1215 EXPECT_THAT(r.replacement(), IsNumberSin(IsPlainPrimitiveToNumber(p0)));
1216 } 1216 }
1217 1217
1218 // ----------------------------------------------------------------------------- 1218 // -----------------------------------------------------------------------------
1219 // Math.sinh 1219 // Math.sinh
1220 1220
1221 TEST_F(JSBuiltinReducerTest, MathSinhWithNumber) { 1221 TEST_F(JSBuiltinReducerTest, MathSinhWithNumber) {
1222 Node* function = MathFunction("sinh"); 1222 Node* function = MathFunction("sinh");
1223 1223
1224 Node* effect = graph()->start(); 1224 Node* effect = graph()->start();
1225 Node* control = graph()->start(); 1225 Node* control = graph()->start();
1226 Node* context = UndefinedConstant(); 1226 Node* context = UndefinedConstant();
1227 Node* frame_state = graph()->start(); 1227 Node* frame_state = graph()->start();
1228 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1228 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1229 Node* p0 = Parameter(t0, 0); 1229 Node* p0 = Parameter(t0, 0);
1230 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1230 Node* call =
1231 UndefinedConstant(), p0, context, frame_state, 1231 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1232 effect, control); 1232 p0, context, frame_state, effect, control);
1233 Reduction r = Reduce(call); 1233 Reduction r = Reduce(call);
1234 1234
1235 ASSERT_TRUE(r.Changed()); 1235 ASSERT_TRUE(r.Changed());
1236 EXPECT_THAT(r.replacement(), IsNumberSinh(p0)); 1236 EXPECT_THAT(r.replacement(), IsNumberSinh(p0));
1237 } 1237 }
1238 } 1238 }
1239 1239
1240 TEST_F(JSBuiltinReducerTest, MathSinhWithPlainPrimitive) { 1240 TEST_F(JSBuiltinReducerTest, MathSinhWithPlainPrimitive) {
1241 Node* function = MathFunction("sinh"); 1241 Node* function = MathFunction("sinh");
1242 1242
1243 Node* effect = graph()->start(); 1243 Node* effect = graph()->start();
1244 Node* control = graph()->start(); 1244 Node* control = graph()->start();
1245 Node* context = UndefinedConstant(); 1245 Node* context = UndefinedConstant();
1246 Node* frame_state = graph()->start(); 1246 Node* frame_state = graph()->start();
1247 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1247 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1248 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1248 Node* call =
1249 UndefinedConstant(), p0, context, frame_state, 1249 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1250 effect, control); 1250 context, frame_state, effect, control);
1251 Reduction r = Reduce(call); 1251 Reduction r = Reduce(call);
1252 1252
1253 ASSERT_TRUE(r.Changed()); 1253 ASSERT_TRUE(r.Changed());
1254 EXPECT_THAT(r.replacement(), IsNumberSinh(IsPlainPrimitiveToNumber(p0))); 1254 EXPECT_THAT(r.replacement(), IsNumberSinh(IsPlainPrimitiveToNumber(p0)));
1255 } 1255 }
1256 1256
1257 // ----------------------------------------------------------------------------- 1257 // -----------------------------------------------------------------------------
1258 // Math.sqrt 1258 // Math.sqrt
1259 1259
1260 TEST_F(JSBuiltinReducerTest, MathSqrtWithNumber) { 1260 TEST_F(JSBuiltinReducerTest, MathSqrtWithNumber) {
1261 Node* function = MathFunction("sqrt"); 1261 Node* function = MathFunction("sqrt");
1262 1262
1263 Node* effect = graph()->start(); 1263 Node* effect = graph()->start();
1264 Node* control = graph()->start(); 1264 Node* control = graph()->start();
1265 Node* context = UndefinedConstant(); 1265 Node* context = UndefinedConstant();
1266 Node* frame_state = graph()->start(); 1266 Node* frame_state = graph()->start();
1267 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1267 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1268 Node* p0 = Parameter(t0, 0); 1268 Node* p0 = Parameter(t0, 0);
1269 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1269 Node* call =
1270 UndefinedConstant(), p0, context, frame_state, 1270 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1271 effect, control); 1271 p0, context, frame_state, effect, control);
1272 Reduction r = Reduce(call); 1272 Reduction r = Reduce(call);
1273 1273
1274 ASSERT_TRUE(r.Changed()); 1274 ASSERT_TRUE(r.Changed());
1275 EXPECT_THAT(r.replacement(), IsNumberSqrt(p0)); 1275 EXPECT_THAT(r.replacement(), IsNumberSqrt(p0));
1276 } 1276 }
1277 } 1277 }
1278 1278
1279 TEST_F(JSBuiltinReducerTest, MathSqrtWithPlainPrimitive) { 1279 TEST_F(JSBuiltinReducerTest, MathSqrtWithPlainPrimitive) {
1280 Node* function = MathFunction("sqrt"); 1280 Node* function = MathFunction("sqrt");
1281 1281
1282 Node* effect = graph()->start(); 1282 Node* effect = graph()->start();
1283 Node* control = graph()->start(); 1283 Node* control = graph()->start();
1284 Node* context = UndefinedConstant(); 1284 Node* context = UndefinedConstant();
1285 Node* frame_state = graph()->start(); 1285 Node* frame_state = graph()->start();
1286 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1286 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1287 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1287 Node* call =
1288 UndefinedConstant(), p0, context, frame_state, 1288 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1289 effect, control); 1289 context, frame_state, effect, control);
1290 Reduction r = Reduce(call); 1290 Reduction r = Reduce(call);
1291 1291
1292 ASSERT_TRUE(r.Changed()); 1292 ASSERT_TRUE(r.Changed());
1293 EXPECT_THAT(r.replacement(), IsNumberSqrt(IsPlainPrimitiveToNumber(p0))); 1293 EXPECT_THAT(r.replacement(), IsNumberSqrt(IsPlainPrimitiveToNumber(p0)));
1294 } 1294 }
1295 1295
1296 // ----------------------------------------------------------------------------- 1296 // -----------------------------------------------------------------------------
1297 // Math.tan 1297 // Math.tan
1298 1298
1299 TEST_F(JSBuiltinReducerTest, MathTanWithNumber) { 1299 TEST_F(JSBuiltinReducerTest, MathTanWithNumber) {
1300 Node* function = MathFunction("tan"); 1300 Node* function = MathFunction("tan");
1301 1301
1302 Node* effect = graph()->start(); 1302 Node* effect = graph()->start();
1303 Node* control = graph()->start(); 1303 Node* control = graph()->start();
1304 Node* context = UndefinedConstant(); 1304 Node* context = UndefinedConstant();
1305 Node* frame_state = graph()->start(); 1305 Node* frame_state = graph()->start();
1306 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1306 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1307 Node* p0 = Parameter(t0, 0); 1307 Node* p0 = Parameter(t0, 0);
1308 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1308 Node* call =
1309 UndefinedConstant(), p0, context, frame_state, 1309 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1310 effect, control); 1310 p0, context, frame_state, effect, control);
1311 Reduction r = Reduce(call); 1311 Reduction r = Reduce(call);
1312 1312
1313 ASSERT_TRUE(r.Changed()); 1313 ASSERT_TRUE(r.Changed());
1314 EXPECT_THAT(r.replacement(), IsNumberTan(p0)); 1314 EXPECT_THAT(r.replacement(), IsNumberTan(p0));
1315 } 1315 }
1316 } 1316 }
1317 1317
1318 TEST_F(JSBuiltinReducerTest, MathTanWithPlainPrimitive) { 1318 TEST_F(JSBuiltinReducerTest, MathTanWithPlainPrimitive) {
1319 Node* function = MathFunction("tan"); 1319 Node* function = MathFunction("tan");
1320 1320
1321 Node* effect = graph()->start(); 1321 Node* effect = graph()->start();
1322 Node* control = graph()->start(); 1322 Node* control = graph()->start();
1323 Node* context = UndefinedConstant(); 1323 Node* context = UndefinedConstant();
1324 Node* frame_state = graph()->start(); 1324 Node* frame_state = graph()->start();
1325 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1325 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1326 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1326 Node* call =
1327 UndefinedConstant(), p0, context, frame_state, 1327 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1328 effect, control); 1328 context, frame_state, effect, control);
1329 Reduction r = Reduce(call); 1329 Reduction r = Reduce(call);
1330 1330
1331 ASSERT_TRUE(r.Changed()); 1331 ASSERT_TRUE(r.Changed());
1332 EXPECT_THAT(r.replacement(), IsNumberTan(IsPlainPrimitiveToNumber(p0))); 1332 EXPECT_THAT(r.replacement(), IsNumberTan(IsPlainPrimitiveToNumber(p0)));
1333 } 1333 }
1334 1334
1335 // ----------------------------------------------------------------------------- 1335 // -----------------------------------------------------------------------------
1336 // Math.tanh 1336 // Math.tanh
1337 1337
1338 TEST_F(JSBuiltinReducerTest, MathTanhWithNumber) { 1338 TEST_F(JSBuiltinReducerTest, MathTanhWithNumber) {
1339 Node* function = MathFunction("tanh"); 1339 Node* function = MathFunction("tanh");
1340 1340
1341 Node* effect = graph()->start(); 1341 Node* effect = graph()->start();
1342 Node* control = graph()->start(); 1342 Node* control = graph()->start();
1343 Node* context = UndefinedConstant(); 1343 Node* context = UndefinedConstant();
1344 Node* frame_state = graph()->start(); 1344 Node* frame_state = graph()->start();
1345 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1345 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1346 Node* p0 = Parameter(t0, 0); 1346 Node* p0 = Parameter(t0, 0);
1347 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1347 Node* call =
1348 UndefinedConstant(), p0, context, frame_state, 1348 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1349 effect, control); 1349 p0, context, frame_state, effect, control);
1350 Reduction r = Reduce(call); 1350 Reduction r = Reduce(call);
1351 1351
1352 ASSERT_TRUE(r.Changed()); 1352 ASSERT_TRUE(r.Changed());
1353 EXPECT_THAT(r.replacement(), IsNumberTanh(p0)); 1353 EXPECT_THAT(r.replacement(), IsNumberTanh(p0));
1354 } 1354 }
1355 } 1355 }
1356 1356
1357 TEST_F(JSBuiltinReducerTest, MathTanhWithPlainPrimitive) { 1357 TEST_F(JSBuiltinReducerTest, MathTanhWithPlainPrimitive) {
1358 Node* function = MathFunction("tanh"); 1358 Node* function = MathFunction("tanh");
1359 1359
1360 Node* effect = graph()->start(); 1360 Node* effect = graph()->start();
1361 Node* control = graph()->start(); 1361 Node* control = graph()->start();
1362 Node* context = UndefinedConstant(); 1362 Node* context = UndefinedConstant();
1363 Node* frame_state = graph()->start(); 1363 Node* frame_state = graph()->start();
1364 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1364 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1365 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1365 Node* call =
1366 UndefinedConstant(), p0, context, frame_state, 1366 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1367 effect, control); 1367 context, frame_state, effect, control);
1368 Reduction r = Reduce(call); 1368 Reduction r = Reduce(call);
1369 1369
1370 ASSERT_TRUE(r.Changed()); 1370 ASSERT_TRUE(r.Changed());
1371 EXPECT_THAT(r.replacement(), IsNumberTanh(IsPlainPrimitiveToNumber(p0))); 1371 EXPECT_THAT(r.replacement(), IsNumberTanh(IsPlainPrimitiveToNumber(p0)));
1372 } 1372 }
1373 1373
1374 // ----------------------------------------------------------------------------- 1374 // -----------------------------------------------------------------------------
1375 // Math.trunc 1375 // Math.trunc
1376 1376
1377 TEST_F(JSBuiltinReducerTest, MathTruncWithNumber) { 1377 TEST_F(JSBuiltinReducerTest, MathTruncWithNumber) {
1378 Node* function = MathFunction("trunc"); 1378 Node* function = MathFunction("trunc");
1379 1379
1380 Node* effect = graph()->start(); 1380 Node* effect = graph()->start();
1381 Node* control = graph()->start(); 1381 Node* control = graph()->start();
1382 Node* context = UndefinedConstant(); 1382 Node* context = UndefinedConstant();
1383 Node* frame_state = graph()->start(); 1383 Node* frame_state = graph()->start();
1384 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1384 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1385 Node* p0 = Parameter(t0, 0); 1385 Node* p0 = Parameter(t0, 0);
1386 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1386 Node* call =
1387 UndefinedConstant(), p0, context, frame_state, 1387 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1388 effect, control); 1388 p0, context, frame_state, effect, control);
1389 Reduction r = Reduce(call); 1389 Reduction r = Reduce(call);
1390 1390
1391 ASSERT_TRUE(r.Changed()); 1391 ASSERT_TRUE(r.Changed());
1392 EXPECT_THAT(r.replacement(), IsNumberTrunc(p0)); 1392 EXPECT_THAT(r.replacement(), IsNumberTrunc(p0));
1393 } 1393 }
1394 } 1394 }
1395 1395
1396 TEST_F(JSBuiltinReducerTest, MathTruncWithPlainPrimitive) { 1396 TEST_F(JSBuiltinReducerTest, MathTruncWithPlainPrimitive) {
1397 Node* function = MathFunction("trunc"); 1397 Node* function = MathFunction("trunc");
1398 1398
1399 Node* effect = graph()->start(); 1399 Node* effect = graph()->start();
1400 Node* control = graph()->start(); 1400 Node* control = graph()->start();
1401 Node* context = UndefinedConstant(); 1401 Node* context = UndefinedConstant();
1402 Node* frame_state = graph()->start(); 1402 Node* frame_state = graph()->start();
1403 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1403 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1404 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1404 Node* call =
1405 UndefinedConstant(), p0, context, frame_state, 1405 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1406 effect, control); 1406 context, frame_state, effect, control);
1407 Reduction r = Reduce(call); 1407 Reduction r = Reduce(call);
1408 1408
1409 ASSERT_TRUE(r.Changed()); 1409 ASSERT_TRUE(r.Changed());
1410 EXPECT_THAT(r.replacement(), IsNumberTrunc(IsPlainPrimitiveToNumber(p0))); 1410 EXPECT_THAT(r.replacement(), IsNumberTrunc(IsPlainPrimitiveToNumber(p0)));
1411 } 1411 }
1412 1412
1413 // ----------------------------------------------------------------------------- 1413 // -----------------------------------------------------------------------------
1414 // Number.isFinite 1414 // Number.isFinite
1415 1415
1416 TEST_F(JSBuiltinReducerTest, NumberIsFiniteWithNumber) { 1416 TEST_F(JSBuiltinReducerTest, NumberIsFiniteWithNumber) {
1417 Node* function = NumberFunction("isFinite"); 1417 Node* function = NumberFunction("isFinite");
1418 1418
1419 Node* effect = graph()->start(); 1419 Node* effect = graph()->start();
1420 Node* control = graph()->start(); 1420 Node* control = graph()->start();
1421 Node* context = UndefinedConstant(); 1421 Node* context = UndefinedConstant();
1422 Node* frame_state = graph()->start(); 1422 Node* frame_state = graph()->start();
1423 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1423 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1424 Node* p0 = Parameter(t0, 0); 1424 Node* p0 = Parameter(t0, 0);
1425 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1425 Node* call =
1426 UndefinedConstant(), p0, context, frame_state, 1426 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1427 effect, control); 1427 p0, context, frame_state, effect, control);
1428 Reduction r = Reduce(call); 1428 Reduction r = Reduce(call);
1429 1429
1430 ASSERT_TRUE(r.Changed()); 1430 ASSERT_TRUE(r.Changed());
1431 EXPECT_THAT(r.replacement(), IsNumberEqual(IsNumberSubtract(p0, p0), 1431 EXPECT_THAT(r.replacement(), IsNumberEqual(IsNumberSubtract(p0, p0),
1432 IsNumberSubtract(p0, p0))); 1432 IsNumberSubtract(p0, p0)));
1433 } 1433 }
1434 } 1434 }
1435 1435
1436 // ----------------------------------------------------------------------------- 1436 // -----------------------------------------------------------------------------
1437 // Number.isInteger 1437 // Number.isInteger
1438 1438
1439 TEST_F(JSBuiltinReducerTest, NumberIsIntegerWithNumber) { 1439 TEST_F(JSBuiltinReducerTest, NumberIsIntegerWithNumber) {
1440 Node* function = NumberFunction("isInteger"); 1440 Node* function = NumberFunction("isInteger");
1441 1441
1442 Node* effect = graph()->start(); 1442 Node* effect = graph()->start();
1443 Node* control = graph()->start(); 1443 Node* control = graph()->start();
1444 Node* context = UndefinedConstant(); 1444 Node* context = UndefinedConstant();
1445 Node* frame_state = graph()->start(); 1445 Node* frame_state = graph()->start();
1446 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1446 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1447 Node* p0 = Parameter(t0, 0); 1447 Node* p0 = Parameter(t0, 0);
1448 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1448 Node* call =
1449 UndefinedConstant(), p0, context, frame_state, 1449 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1450 effect, control); 1450 p0, context, frame_state, effect, control);
1451 Reduction r = Reduce(call); 1451 Reduction r = Reduce(call);
1452 1452
1453 ASSERT_TRUE(r.Changed()); 1453 ASSERT_TRUE(r.Changed());
1454 EXPECT_THAT(r.replacement(), 1454 EXPECT_THAT(r.replacement(),
1455 IsNumberEqual(IsNumberSubtract(p0, IsNumberTrunc(p0)), 1455 IsNumberEqual(IsNumberSubtract(p0, IsNumberTrunc(p0)),
1456 IsNumberConstant(0.0))); 1456 IsNumberConstant(0.0)));
1457 } 1457 }
1458 } 1458 }
1459 1459
1460 // ----------------------------------------------------------------------------- 1460 // -----------------------------------------------------------------------------
1461 // Number.isNaN 1461 // Number.isNaN
1462 1462
1463 TEST_F(JSBuiltinReducerTest, NumberIsNaNWithNumber) { 1463 TEST_F(JSBuiltinReducerTest, NumberIsNaNWithNumber) {
1464 Node* function = NumberFunction("isNaN"); 1464 Node* function = NumberFunction("isNaN");
1465 1465
1466 Node* effect = graph()->start(); 1466 Node* effect = graph()->start();
1467 Node* control = graph()->start(); 1467 Node* control = graph()->start();
1468 Node* context = UndefinedConstant(); 1468 Node* context = UndefinedConstant();
1469 Node* frame_state = graph()->start(); 1469 Node* frame_state = graph()->start();
1470 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1470 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1471 Node* p0 = Parameter(t0, 0); 1471 Node* p0 = Parameter(t0, 0);
1472 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1472 Node* call =
1473 UndefinedConstant(), p0, context, frame_state, 1473 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1474 effect, control); 1474 p0, context, frame_state, effect, control);
1475 Reduction r = Reduce(call); 1475 Reduction r = Reduce(call);
1476 1476
1477 ASSERT_TRUE(r.Changed()); 1477 ASSERT_TRUE(r.Changed());
1478 EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0))); 1478 EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0)));
1479 } 1479 }
1480 } 1480 }
1481 1481
1482 // ----------------------------------------------------------------------------- 1482 // -----------------------------------------------------------------------------
1483 // Number.isSafeInteger 1483 // Number.isSafeInteger
1484 1484
1485 TEST_F(JSBuiltinReducerTest, NumberIsSafeIntegerWithIntegral32) { 1485 TEST_F(JSBuiltinReducerTest, NumberIsSafeIntegerWithIntegral32) {
1486 Node* function = NumberFunction("isSafeInteger"); 1486 Node* function = NumberFunction("isSafeInteger");
1487 1487
1488 Node* effect = graph()->start(); 1488 Node* effect = graph()->start();
1489 Node* control = graph()->start(); 1489 Node* control = graph()->start();
1490 Node* context = UndefinedConstant(); 1490 Node* context = UndefinedConstant();
1491 Node* frame_state = graph()->start(); 1491 Node* frame_state = graph()->start();
1492 TRACED_FOREACH(Type*, t0, kIntegral32Types) { 1492 TRACED_FOREACH(Type*, t0, kIntegral32Types) {
1493 Node* p0 = Parameter(t0, 0); 1493 Node* p0 = Parameter(t0, 0);
1494 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1494 Node* call =
1495 UndefinedConstant(), p0, context, frame_state, 1495 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1496 effect, control); 1496 p0, context, frame_state, effect, control);
1497 Reduction r = Reduce(call); 1497 Reduction r = Reduce(call);
1498 1498
1499 ASSERT_TRUE(r.Changed()); 1499 ASSERT_TRUE(r.Changed());
1500 EXPECT_THAT(r.replacement(), IsTrueConstant()); 1500 EXPECT_THAT(r.replacement(), IsTrueConstant());
1501 } 1501 }
1502 } 1502 }
1503 1503
1504 // ----------------------------------------------------------------------------- 1504 // -----------------------------------------------------------------------------
1505 // Number.parseInt 1505 // Number.parseInt
1506 1506
1507 TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32) { 1507 TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32) {
1508 Node* function = NumberFunction("parseInt"); 1508 Node* function = NumberFunction("parseInt");
1509 1509
1510 Node* effect = graph()->start(); 1510 Node* effect = graph()->start();
1511 Node* control = graph()->start(); 1511 Node* control = graph()->start();
1512 Node* context = UndefinedConstant(); 1512 Node* context = UndefinedConstant();
1513 Node* frame_state = graph()->start(); 1513 Node* frame_state = graph()->start();
1514 TRACED_FOREACH(Type*, t0, kIntegral32Types) { 1514 TRACED_FOREACH(Type*, t0, kIntegral32Types) {
1515 Node* p0 = Parameter(t0, 0); 1515 Node* p0 = Parameter(t0, 0);
1516 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1516 Node* call =
1517 UndefinedConstant(), p0, context, frame_state, 1517 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1518 effect, control); 1518 p0, context, frame_state, effect, control);
1519 Reduction r = Reduce(call); 1519 Reduction r = Reduce(call);
1520 1520
1521 ASSERT_TRUE(r.Changed()); 1521 ASSERT_TRUE(r.Changed());
1522 EXPECT_EQ(p0, r.replacement()); 1522 EXPECT_EQ(p0, r.replacement());
1523 } 1523 }
1524 } 1524 }
1525 1525
1526 TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32AndUndefined) { 1526 TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32AndUndefined) {
1527 Node* function = NumberFunction("parseInt"); 1527 Node* function = NumberFunction("parseInt");
1528 1528
1529 Node* effect = graph()->start(); 1529 Node* effect = graph()->start();
1530 Node* control = graph()->start(); 1530 Node* control = graph()->start();
1531 Node* context = UndefinedConstant(); 1531 Node* context = UndefinedConstant();
1532 Node* frame_state = graph()->start(); 1532 Node* frame_state = graph()->start();
1533 TRACED_FOREACH(Type*, t0, kIntegral32Types) { 1533 TRACED_FOREACH(Type*, t0, kIntegral32Types) {
1534 Node* p0 = Parameter(t0, 0); 1534 Node* p0 = Parameter(t0, 0);
1535 Node* p1 = Parameter(Type::Undefined(), 1); 1535 Node* p1 = Parameter(Type::Undefined(), 1);
1536 Node* call = graph()->NewNode(javascript()->CallFunction(4), function, 1536 Node* call =
1537 UndefinedConstant(), p0, p1, context, 1537 graph()->NewNode(javascript()->Call(4), function, UndefinedConstant(),
1538 frame_state, effect, control); 1538 p0, p1, context, frame_state, effect, control);
1539 Reduction r = Reduce(call); 1539 Reduction r = Reduce(call);
1540 1540
1541 ASSERT_TRUE(r.Changed()); 1541 ASSERT_TRUE(r.Changed());
1542 EXPECT_EQ(p0, r.replacement()); 1542 EXPECT_EQ(p0, r.replacement());
1543 } 1543 }
1544 } 1544 }
1545 1545
1546 // ----------------------------------------------------------------------------- 1546 // -----------------------------------------------------------------------------
1547 // String.fromCharCode 1547 // String.fromCharCode
1548 1548
1549 TEST_F(JSBuiltinReducerTest, StringFromCharCodeWithNumber) { 1549 TEST_F(JSBuiltinReducerTest, StringFromCharCodeWithNumber) {
1550 Node* function = StringFunction("fromCharCode"); 1550 Node* function = StringFunction("fromCharCode");
1551 1551
1552 Node* effect = graph()->start(); 1552 Node* effect = graph()->start();
1553 Node* control = graph()->start(); 1553 Node* control = graph()->start();
1554 Node* context = UndefinedConstant(); 1554 Node* context = UndefinedConstant();
1555 Node* frame_state = graph()->start(); 1555 Node* frame_state = graph()->start();
1556 TRACED_FOREACH(Type*, t0, kNumberTypes) { 1556 TRACED_FOREACH(Type*, t0, kNumberTypes) {
1557 Node* p0 = Parameter(t0, 0); 1557 Node* p0 = Parameter(t0, 0);
1558 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1558 Node* call =
1559 UndefinedConstant(), p0, context, frame_state, 1559 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(),
1560 effect, control); 1560 p0, context, frame_state, effect, control);
1561 Reduction r = Reduce(call); 1561 Reduction r = Reduce(call);
1562 1562
1563 ASSERT_TRUE(r.Changed()); 1563 ASSERT_TRUE(r.Changed());
1564 EXPECT_THAT(r.replacement(), IsStringFromCharCode(p0)); 1564 EXPECT_THAT(r.replacement(), IsStringFromCharCode(p0));
1565 } 1565 }
1566 } 1566 }
1567 1567
1568 TEST_F(JSBuiltinReducerTest, StringFromCharCodeWithPlainPrimitive) { 1568 TEST_F(JSBuiltinReducerTest, StringFromCharCodeWithPlainPrimitive) {
1569 Node* function = StringFunction("fromCharCode"); 1569 Node* function = StringFunction("fromCharCode");
1570 1570
1571 Node* effect = graph()->start(); 1571 Node* effect = graph()->start();
1572 Node* control = graph()->start(); 1572 Node* control = graph()->start();
1573 Node* context = UndefinedConstant(); 1573 Node* context = UndefinedConstant();
1574 Node* frame_state = graph()->start(); 1574 Node* frame_state = graph()->start();
1575 Node* p0 = Parameter(Type::PlainPrimitive(), 0); 1575 Node* p0 = Parameter(Type::PlainPrimitive(), 0);
1576 Node* call = graph()->NewNode(javascript()->CallFunction(3), function, 1576 Node* call =
1577 UndefinedConstant(), p0, context, frame_state, 1577 graph()->NewNode(javascript()->Call(3), function, UndefinedConstant(), p0,
1578 effect, control); 1578 context, frame_state, effect, control);
1579 Reduction r = Reduce(call); 1579 Reduction r = Reduce(call);
1580 1580
1581 ASSERT_TRUE(r.Changed()); 1581 ASSERT_TRUE(r.Changed());
1582 EXPECT_THAT(r.replacement(), 1582 EXPECT_THAT(r.replacement(),
1583 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0))); 1583 IsStringFromCharCode(IsPlainPrimitiveToNumber(p0)));
1584 } 1584 }
1585 1585
1586 } // namespace compiler 1586 } // namespace compiler
1587 } // namespace internal 1587 } // namespace internal
1588 } // namespace v8 1588 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698