OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // VMOptions=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import 'dart:developer'; | 6 import 'dart:developer'; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 try { | 25 try { |
26 for (int i = 0; i < x; i++) { | 26 for (int i = 0; i < x; i++) { |
27 sum += x; | 27 sum += x; |
28 } | 28 } |
29 } catch (e) { | 29 } catch (e) { |
30 print("caught $e"); | 30 print("caught $e"); |
31 } | 31 } |
32 if (global >= 100) { | 32 if (global >= 100) { |
33 debugger(); | 33 debugger(); |
34 } | 34 } |
35 global = global + 1; // Line A | 35 global = global + 1; // Line A |
36 return sum; | 36 return sum; |
37 } | 37 } |
38 | 38 |
39 @alwaysInline | 39 @alwaysInline |
40 b2(x) => b3(x); // Line B | 40 b2(x) => b3(x); // Line B |
41 | 41 |
42 @alwaysInline | 42 @alwaysInline |
43 b1(x) => b2(x); // Line C | 43 b1(x) => b2(x); // Line C |
44 | 44 |
45 test() { | 45 test() { |
46 while (true) { | 46 while (true) { |
47 b1(10000); // Line D | 47 b1(10000); // Line D |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 var tests = [ | 51 var tests = [ |
52 hasStoppedAtBreakpoint, | 52 hasStoppedAtBreakpoint, |
53 stoppedAtLine(LINE_A), | 53 stoppedAtLine(LINE_A), |
54 | |
55 (Isolate isolate) async { | 54 (Isolate isolate) async { |
56 // We are at our breakpoint with global=100. | 55 // We are at our breakpoint with global=100. |
57 var result = await isolate.rootLibrary.evaluate('global'); | 56 var result = await isolate.rootLibrary.evaluate('global'); |
58 print('global is $result'); | 57 print('global is $result'); |
59 expect(result.type, equals('Instance')); | 58 expect(result.type, equals('Instance')); |
60 expect(result.valueAsString, equals('100')); | 59 expect(result.valueAsString, equals('100')); |
61 | 60 |
62 // Rewind the top stack frame. | 61 // Rewind the top stack frame. |
63 bool caughtException; | 62 bool caughtException; |
64 try { | 63 try { |
65 result = await isolate.rewind(1); | 64 result = await isolate.rewind(1); |
66 expect(false, isTrue, reason:'Unreachable'); | 65 expect(false, isTrue, reason: 'Unreachable'); |
67 } on ServerRpcException catch(e) { | 66 } on ServerRpcException catch (e) { |
68 caughtException = true; | 67 caughtException = true; |
69 expect(e.code, equals(ServerRpcException.kCannotResume)); | 68 expect(e.code, equals(ServerRpcException.kCannotResume)); |
70 expect(e.message, | 69 expect( |
71 startsWith('Cannot rewind to frame 1 due to conflicting compiler ' | 70 e.message, |
72 'optimizations. Run the vm with --no-prune-dead-locals ' | 71 startsWith('Cannot rewind to frame 1 due to conflicting compiler ' |
73 'to disallow these optimizations. Next valid rewind ' | 72 'optimizations. Run the vm with --no-prune-dead-locals ' |
74 'frame is ')); | 73 'to disallow these optimizations. Next valid rewind ' |
| 74 'frame is ')); |
75 } | 75 } |
76 expect(caughtException, isTrue); | 76 expect(caughtException, isTrue); |
77 }, | 77 }, |
78 ]; | 78 ]; |
79 | 79 |
80 | 80 main(args) => runIsolateTests(args, tests, testeeConcurrent: test, extraArgs: [ |
81 main(args) => runIsolateTests(args, tests, testeeConcurrent: test, | 81 '--trace-rewind', |
82 extraArgs: | 82 '--prune-dead-locals', |
83 ['--trace-rewind', | 83 '--enable-inlining-annotations', |
84 '--prune-dead-locals', | 84 '--no-background-compilation', |
85 '--enable-inlining-annotations', | 85 '--optimization-counter-threshold=10' |
86 '--no-background-compilation', | 86 ]); |
87 '--optimization-counter-threshold=10']); | |
OLD | NEW |