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 // TODO(v8:4698), TODO(ishell): support these cases. | 6 // TODO(v8:4698), TODO(ishell): support these cases. |
7 // Flags: --turbo --nostress-opt | 7 // Flags: --turbo --nostress-opt |
8 | 8 |
9 | 9 |
10 Error.prepareStackTrace = (error,stack) => { | 10 Error.prepareStackTrace = (error,stack) => { |
(...skipping 21 matching lines...) Expand all Loading... |
32 } | 32 } |
33 return line; | 33 return line; |
34 })(); | 34 })(); |
35 | 35 |
36 | 36 |
37 function ident_source(source, ident) { | 37 function ident_source(source, ident) { |
38 ident = " ".repeat(ident); | 38 ident = " ".repeat(ident); |
39 return ident + source.replace(/\n/gi, "\n" + ident); | 39 return ident + source.replace(/\n/gi, "\n" + ident); |
40 } | 40 } |
41 | 41 |
| 42 var SHARDS_COUNT = 10; |
42 | 43 |
43 function run_tests() { | 44 function run_tests(shard) { |
44 function inlinable_comment(inlinable) { | 45 function inlinable_comment(inlinable) { |
45 return inlinable ? CAN_INLINE_COMMENT : DONT_INLINE_COMMENT; | 46 return inlinable ? CAN_INLINE_COMMENT : DONT_INLINE_COMMENT; |
46 } | 47 } |
47 | 48 |
48 // Check arguments manually to avoid bailing out with reason "bad value | 49 // Check arguments manually to avoid bailing out with reason "bad value |
49 // context for arguments value". | 50 // context for arguments value". |
50 function check_arguments_template(expected_name) { | 51 function check_arguments_template(expected_name) { |
51 var lines = [ | 52 var lines = [ |
52 ` assertEquals_(${expected_name}.length, arguments.length);`, | 53 ` assertEquals_(${expected_name}.length, arguments.length);`, |
53 ` for (var i = 0; i < ${expected_name}.length; i++) {`, | 54 ` for (var i = 0; i < ${expected_name}.length; i++) {`, |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 f_cfg_possibly_eval, | 319 f_cfg_possibly_eval, |
319 ]; | 320 ]; |
320 var g_variants = [ | 321 var g_variants = [ |
321 g_cfg_normal, | 322 g_cfg_normal, |
322 g_cfg_function_call, | 323 g_cfg_function_call, |
323 g_cfg_function_apply, | 324 g_cfg_function_apply, |
324 g_cfg_function_apply_arguments_object, | 325 g_cfg_function_apply_arguments_object, |
325 ]; | 326 ]; |
326 var test_warmup_counts = [0, 1, 2]; | 327 var test_warmup_counts = [0, 1, 2]; |
327 | 328 |
| 329 var iter = 0; |
| 330 if (shard !== undefined) { |
| 331 print("Running shard #" + shard); |
| 332 } |
328 f_variants.forEach((f_cfg) => { | 333 f_variants.forEach((f_cfg) => { |
329 g_variants.forEach((g_cfg) => { | 334 g_variants.forEach((g_cfg) => { |
330 f_args_variants.forEach((f_args) => { | 335 f_args_variants.forEach((f_args) => { |
331 g_args_variants.forEach((g_args) => { | 336 g_args_variants.forEach((g_args) => { |
332 f_inlinable_variants.forEach((f_inlinable) => { | 337 f_inlinable_variants.forEach((f_inlinable) => { |
333 g_inlinable_variants.forEach((g_inlinable) => { | 338 g_inlinable_variants.forEach((g_inlinable) => { |
334 test_warmup_counts.forEach((test_warmup_count) => { | 339 test_warmup_counts.forEach((test_warmup_count) => { |
| 340 if (shard !== undefined && (iter++) % SHARDS_COUNT != shard) { |
| 341 print("skipping..."); |
| 342 return; |
| 343 } |
335 var cfg = { | 344 var cfg = { |
336 f_source_template: f_cfg.source_template, | 345 f_source_template: f_cfg.source_template, |
337 f_inlinable, | 346 f_inlinable, |
338 f_args, | 347 f_args, |
339 f_name: f_cfg.func_name, | 348 f_name: f_cfg.func_name, |
340 f_receiver: g_cfg.receiver, | 349 f_receiver: g_cfg.receiver, |
341 g_source_template: g_cfg.source_template, | 350 g_source_template: g_cfg.source_template, |
342 g_inlinable, | 351 g_inlinable, |
343 g_args, | 352 g_args, |
344 test_warmup_count, | 353 test_warmup_count, |
345 }; | 354 }; |
346 var source = test_template(cfg); | 355 var source = test_template(cfg); |
347 print("===================="); | 356 print("===================="); |
348 print(source); | 357 print(source); |
349 eval(source); | 358 eval(source); |
350 }); | 359 }); |
351 }); | 360 }); |
352 }); | 361 }); |
353 }); | 362 }); |
354 }); | 363 }); |
355 }); | 364 }); |
356 }); | 365 }); |
357 } | 366 } |
358 | 367 |
359 run_tests(); | 368 // Uncomment to run all the tests at once or use shard runners. |
| 369 //run_tests(); |
OLD | NEW |