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 var verbose = typeof(arguments) !== "undefined" && arguments.indexOf("-v") >= 0; |
14 | 14 |
15 function checkStackTrace(expected) { | 15 function checkStackTrace(expected) { |
16 var e = new Error(); | 16 var e = new Error(); |
17 e.stack; // prepare stack trace | 17 e.stack; // prepare stack trace |
18 var stack = e.strace; | 18 var stack = e.strace; |
19 assertEquals("checkStackTrace", stack[0].getFunctionName()); | 19 assertEquals("checkStackTrace", stack[0].getFunctionName()); |
20 for (var i = 0; i < expected.length; i++) { | 20 for (var i = 0; i < expected.length; i++) { |
21 assertEquals(expected[i].name, stack[i + 1].getFunctionName()); | 21 assertEquals(expected[i].name, stack[i + 1].getFunctionName()); |
22 } | 22 } |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 var CAN_INLINE_COMMENT = "// Let it be inlined."; | 26 var CAN_INLINE_COMMENT = "// Let it be inlined."; |
27 var DONT_INLINE_COMMENT = (function() { | 27 var DONT_INLINE_COMMENT = (function() { |
28 var line = "1"; | 28 var line = "// Don't inline. Don't inline. Don't inline. Don't inline."; |
29 for (var i = 0; i < 200; ++i) { | 29 for (var i = 0; i < 4; i++) { |
30 line += "," + i; | 30 line += "\n " + line; |
31 } | 31 } |
32 line += ";\n"; | |
33 return line; | 32 return line; |
34 })(); | 33 })(); |
35 | 34 |
36 | 35 |
37 function ident_source(source, ident) { | 36 function ident_source(source, ident) { |
38 ident = " ".repeat(ident); | 37 ident = " ".repeat(ident); |
39 return ident + source.replace(/\n/gi, "\n" + ident); | 38 return ident + source.replace(/\n/gi, "\n" + ident); |
40 } | 39 } |
41 | 40 |
42 var SHARDS_COUNT = 10; | 41 var SHARDS_COUNT = 10; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 }); | 413 }); |
415 }); | 414 }); |
416 }); | 415 }); |
417 if (verbose) { | 416 if (verbose) { |
418 print("Number of tests executed: " + tests_executed); | 417 print("Number of tests executed: " + tests_executed); |
419 } | 418 } |
420 } | 419 } |
421 | 420 |
422 // 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. |
423 //run_tests(); | 422 //run_tests(); |
OLD | NEW |