OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // VMOptions=--optimization_counter_threshold=10 --no-background-compilation | 5 // VMOptions=--optimization_counter_threshold=10 --no-background-compilation |
6 | 6 |
7 // This test tries to verify that we produce the correct stack trace when | 7 // This test tries to verify that we produce the correct stack trace when |
8 // throwing exceptions even when functions are inlined. | 8 // throwing exceptions even when functions are inlined. |
9 // The test invokes a bunch of functions and then does a throw. There is a | 9 // The test invokes a bunch of functions and then does a throw. There is a |
10 // catch at the outer function which uses the stack trace produced to return | 10 // catch at the outer function which uses the stack trace produced to return |
(...skipping 10 matching lines...) Expand all Loading... |
21 try { | 21 try { |
22 for (var i = 0; i <= 50; i++) { | 22 for (var i = 0; i <= 50; i++) { |
23 func2(i * k); | 23 func2(i * k); |
24 } | 24 } |
25 return ""; | 25 return ""; |
26 } catch (e, stacktrace) { | 26 } catch (e, stacktrace) { |
27 var result = e + "\n" + stacktrace.toString(); | 27 var result = e + "\n" + stacktrace.toString(); |
28 return result; | 28 return result; |
29 } | 29 } |
30 } | 30 } |
| 31 |
31 int func2(var i) { | 32 int func2(var i) { |
32 var result = 0; | 33 var result = 0; |
33 for (var k = 0; k <= 10; k++) { | 34 for (var k = 0; k <= 10; k++) { |
34 result += func3(i + k); | 35 result += func3(i + k); |
35 } | 36 } |
36 return result; | 37 return result; |
37 } | 38 } |
| 39 |
38 int func3(var i) { | 40 int func3(var i) { |
39 var result = 0; | 41 var result = 0; |
40 for (var l = 0; l <= 1; l++) { | 42 for (var l = 0; l <= 1; l++) { |
41 result += func4(i + l); | 43 result += func4(i + l); |
42 } | 44 } |
43 return result; | 45 return result; |
44 } | 46 } |
| 47 |
45 int func4(var i) { | 48 int func4(var i) { |
46 var result = 0; | 49 var result = 0; |
47 for (var j = 0; j <= 10; j++) { | 50 for (var j = 0; j <= 10; j++) { |
48 result += func5(i + j); | 51 result += func5(i + j); |
49 } | 52 } |
50 return result; | 53 return result; |
51 } | 54 } |
| 55 |
52 int func5(var i) { | 56 int func5(var i) { |
53 if (i >= 520) throw "show me inlined functions"; | 57 if (i >= 520) throw "show me inlined functions"; |
54 return i; | 58 return i; |
55 } | 59 } |
56 } | 60 } |
57 | 61 |
58 expectHasSubstring(String string, String substring) { | 62 expectHasSubstring(String string, String substring) { |
59 if (!string.contains(substring)) { | 63 if (!string.contains(substring)) { |
60 var sb = new StringBuffer(); | 64 var sb = new StringBuffer(); |
61 sb.writeln("Expect string:"); | 65 sb.writeln("Expect string:"); |
(...skipping 16 matching lines...) Expand all Loading... |
78 for (var i = 0; i <= 10; i++) { | 82 for (var i = 0; i <= 10; i++) { |
79 result = x.func1(i); | 83 result = x.func1(i); |
80 } | 84 } |
81 expectHasSubstring(result, "show me inlined functions"); | 85 expectHasSubstring(result, "show me inlined functions"); |
82 expectHasSubstring(result, "Test.func1"); | 86 expectHasSubstring(result, "Test.func1"); |
83 expectHasSubstring(result, "Test.func2"); | 87 expectHasSubstring(result, "Test.func2"); |
84 expectHasSubstring(result, "Test.func3"); | 88 expectHasSubstring(result, "Test.func3"); |
85 expectHasSubstring(result, "Test.func4"); | 89 expectHasSubstring(result, "Test.func4"); |
86 expectHasSubstring(result, "Test.func5"); | 90 expectHasSubstring(result, "Test.func5"); |
87 } | 91 } |
OLD | NEW |