OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // This unit test of dart2js checks that a SSA bailout target | 5 // This unit test of dart2js checks that a SSA bailout target |
6 // instruction gets removed from the graph when it's not used. | 6 // instruction gets removed from the graph when it's not used. |
7 | 7 |
8 import "package:expect/expect.dart"; | |
9 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
10 | 9 |
11 String TEST = r''' | 10 String TEST = r''' |
12 main() { | 11 main() { |
13 foo(1); | 12 foo(1); |
14 foo([]); | 13 foo([]); |
15 } | 14 } |
16 | 15 |
17 foo(a) { | 16 foo(a) { |
18 // Make the method recursive to always enable bailouts | 17 // Make the method recursive to always enable bailouts |
(...skipping 30 matching lines...) Expand all Loading... |
49 | 48 |
50 // Check that the bailout method has a case 2 for the state, which | 49 // Check that the bailout method has a case 2 for the state, which |
51 // is the second bailout in foo. | 50 // is the second bailout in foo. |
52 RegExp state = new RegExp('case 2:[ \n]+state0 = 0;'); | 51 RegExp state = new RegExp('case 2:[ \n]+state0 = 0;'); |
53 checkNumberOfMatches(state.allMatches(generated).iterator, 1); | 52 checkNumberOfMatches(state.allMatches(generated).iterator, 1); |
54 | 53 |
55 // Finally, make sure that the reason foo does not contain | 54 // Finally, make sure that the reason foo does not contain |
56 // 'getInterceptor' is not because the compiler renamed it. | 55 // 'getInterceptor' is not because the compiler renamed it. |
57 Expect.isTrue(generated.contains('getInterceptor')); | 56 Expect.isTrue(generated.contains('getInterceptor')); |
58 } | 57 } |
OLD | NEW |