OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 // Flags: --allow-natives-syntax --harmony-tailcalls | 5 // Flags: --allow-natives-syntax --harmony-tailcalls |
6 | 6 |
7 | 7 |
8 Error.prepareStackTrace = (error,stack) => { | 8 Error.prepareStackTrace = (error,stack) => { |
9 error.strace = stack; | 9 error.strace = stack; |
10 return error.message + "\n at " + stack.join("\n at "); | 10 return error.message + "\n at " + stack.join("\n at "); |
11 } | 11 } |
12 | 12 |
| 13 var verbose = typeof(arguments) !== "undefined" && arguments.indexOf("-v") >= 0; |
13 | 14 |
14 function checkStackTrace(expected) { | 15 function checkStackTrace(expected) { |
15 var e = new Error(); | 16 var e = new Error(); |
16 e.stack; // prepare stack trace | 17 e.stack; // prepare stack trace |
17 var stack = e.strace; | 18 var stack = e.strace; |
18 assertEquals("checkStackTrace", stack[0].getFunctionName()); | 19 assertEquals("checkStackTrace", stack[0].getFunctionName()); |
19 for (var i = 0; i < expected.length; i++) { | 20 for (var i = 0; i < expected.length; i++) { |
20 assertEquals(expected[i].name, stack[i + 1].getFunctionName()); | 21 assertEquals(expected[i].name, stack[i + 1].getFunctionName()); |
21 } | 22 } |
22 } | 23 } |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 ` %OptimizeFunctionOnNextCall(test);`, | 334 ` %OptimizeFunctionOnNextCall(test);`, |
334 ` test();`, | 335 ` test();`, |
335 ` assertEquals(${1 + cfg.test_warmup_count}, counter);`, | 336 ` assertEquals(${1 + cfg.test_warmup_count}, counter);`, |
336 `})();`, | 337 `})();`, |
337 ``, | 338 ``, |
338 ]; | 339 ]; |
339 var source = lines.join("\n"); | 340 var source = lines.join("\n"); |
340 return source; | 341 return source; |
341 } | 342 } |
342 | 343 |
343 var f_args_variants = ["", "1", "1, 2"]; | 344 var f_args_variants = [/*"", "1",*/ "1, 2"]; |
344 var g_args_variants = ["", "10", "10, 20"]; | 345 var g_args_variants = [/*"", "10",*/ "10, 20"]; |
345 var f_inlinable_variants = [true, false]; | 346 var f_inlinable_variants = [true, false]; |
346 var g_inlinable_variants = [true, false]; | 347 var g_inlinable_variants = [true, false]; |
347 // This is to avoid bailing out because of referencing new.target. | 348 // This is to avoid bailing out because of referencing new.target. |
348 var check_new_target_variants = [true, false]; | 349 var check_new_target_variants = [/*true,*/ false]; |
349 var deopt_mode_variants = ["none", "f", "g", "test"]; | 350 var deopt_mode_variants = ["none", "f", "g", "test"]; |
350 var f_variants = [ | 351 var f_variants = [ |
351 f_cfg_sloppy, | 352 f_cfg_sloppy, |
352 f_cfg_strict, | 353 f_cfg_strict, |
353 f_cfg_bound, | 354 f_cfg_bound, |
354 f_cfg_proxy, | 355 f_cfg_proxy, |
355 f_cfg_possibly_eval, | 356 // f_cfg_possibly_eval, |
356 ]; | 357 ]; |
357 var g_variants = [ | 358 var g_variants = [ |
358 g_cfg_normal, | 359 g_cfg_normal, |
359 g_cfg_reflect_apply, | 360 // g_cfg_reflect_apply, |
360 g_cfg_function_apply, | 361 g_cfg_function_apply, |
361 g_cfg_function_apply_arguments_object, | 362 // g_cfg_function_apply_arguments_object, |
362 g_cfg_function_call, | 363 g_cfg_function_call, |
363 ]; | 364 ]; |
364 var test_warmup_counts = [0, 1, 2]; | 365 var test_warmup_counts = [0, 1, 2]; |
365 | 366 |
366 var iter = 0; | 367 var iter = 0; |
367 var tests_executed = 0; | 368 var tests_executed = 0; |
368 if (shard !== undefined) { | 369 if (verbose && shard !== undefined) { |
369 // print("Running shard #" + shard); | 370 print("Running shard #" + shard); |
370 } | 371 } |
371 f_variants.forEach((f_cfg) => { | 372 f_variants.forEach((f_cfg) => { |
372 check_new_target_variants.forEach((check_new_target) => { | 373 check_new_target_variants.forEach((check_new_target) => { |
373 deopt_mode_variants.forEach((deopt_mode) => { | 374 deopt_mode_variants.forEach((deopt_mode) => { |
374 g_variants.forEach((g_cfg) => { | 375 g_variants.forEach((g_cfg) => { |
375 f_args_variants.forEach((f_args) => { | 376 f_args_variants.forEach((f_args) => { |
376 g_args_variants.forEach((g_args) => { | 377 g_args_variants.forEach((g_args) => { |
377 f_inlinable_variants.forEach((f_inlinable) => { | 378 f_inlinable_variants.forEach((f_inlinable) => { |
378 g_inlinable_variants.forEach((g_inlinable) => { | 379 g_inlinable_variants.forEach((g_inlinable) => { |
379 test_warmup_counts.forEach((test_warmup_count) => { | 380 test_warmup_counts.forEach((test_warmup_count) => { |
380 if (shard !== undefined && (iter++) % SHARDS_COUNT != shard)
{ | 381 if (shard !== undefined && (iter++) % SHARDS_COUNT != shard)
{ |
381 // print("skipping..."); | 382 if (verbose) { |
| 383 print("skipping..."); |
| 384 } |
382 return; | 385 return; |
383 } | 386 } |
384 tests_executed++; | 387 tests_executed++; |
385 var cfg = { | 388 var cfg = { |
386 f_source_template: f_cfg.source_template, | 389 f_source_template: f_cfg.source_template, |
387 f_inlinable, | 390 f_inlinable, |
388 f_args, | 391 f_args, |
389 f_name: f_cfg.func_name, | 392 f_name: f_cfg.func_name, |
390 f_receiver: g_cfg.receiver, | 393 f_receiver: g_cfg.receiver, |
391 g_source_template: g_cfg.source_template, | 394 g_source_template: g_cfg.source_template, |
392 g_inlinable, | 395 g_inlinable, |
393 g_args, | 396 g_args, |
394 test_warmup_count, | 397 test_warmup_count, |
395 check_new_target, | 398 check_new_target, |
396 deopt_mode, | 399 deopt_mode, |
397 }; | 400 }; |
398 var source = test_template(cfg); | 401 var source = test_template(cfg); |
399 // print("===================="); | 402 if (verbose) { |
400 // print(source); | 403 // print("===================="); |
| 404 // print(source); |
| 405 } |
401 eval(source); | 406 eval(source); |
402 }); | 407 }); |
403 }); | 408 }); |
404 }); | 409 }); |
405 }); | 410 }); |
406 }); | 411 }); |
407 }); | 412 }); |
408 }); | 413 }); |
409 }); | 414 }); |
410 }); | 415 }); |
411 // print("Number of tests executed: " + tests_executed); | 416 if (verbose) { |
| 417 print("Number of tests executed: " + tests_executed); |
| 418 } |
412 } | 419 } |
413 | 420 |
414 // Uncomment to run all the tests at once or use shard runners. | 421 // Uncomment to run all the tests at once or use shard runners. |
415 //run_tests(); | 422 //run_tests(); |
OLD | NEW |