Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tests/compiler/dart2js/dead_bailout_target_test.dart

Issue 14404004: Throw NoSuchMethod or ArgumentError instead of generating a bailout, when we know the next instruct… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"; 8 import "package:expect/expect.dart";
9 import 'compiler_helper.dart'; 9 import 'compiler_helper.dart';
10 10
11 String TEST = r''' 11 String TEST = r'''
12 main() { 12 main() {
13 foo(1); 13 foo(1);
14 foo([]); 14 foo([]);
15 } 15 }
16 16
17 class A {
18 operator -() => this;
19 }
20
17 foo(a) { 21 foo(a) {
22 new A(); // Force having another operator-
18 // Make the method recursive to always enable bailouts 23 // Make the method recursive to always enable bailouts
19 // and force a list instantiation. 24 // and force a list instantiation.
20 foo([]); 25 foo([]);
21 // Force bailout on [a]. 26 // Force bailout on [a].
22 for (int i = 0; i < 100; i++) a[0] = 42; 27 for (int i = 0; i < 100; i++) a[0] = 42;
23 // Force bailout on [:a.length:]. 28 // Force bailout on [:a.length:].
24 for (int i = 0; i < 200; i++) a[0] = -a.length; 29 for (int i = 0; i < 200; i++) a[0] = -a.length;
25 } 30 }
26 '''; 31 ''';
27 32
(...skipping 27 matching lines...) Expand all
55 60
56 // Check that the bailout method has a case 2 for the state, which 61 // Check that the bailout method has a case 2 for the state, which
57 // is the second bailout in foo. 62 // is the second bailout in foo.
58 RegExp state = new RegExp('case 2:[ \n]+state0 = 0;'); 63 RegExp state = new RegExp('case 2:[ \n]+state0 = 0;');
59 checkNumberOfMatches(state.allMatches(generated).iterator, 1); 64 checkNumberOfMatches(state.allMatches(generated).iterator, 1);
60 65
61 // Finally, make sure that the reason foo does not contain 66 // Finally, make sure that the reason foo does not contain
62 // 'getInterceptor' is not because the compiler renamed it. 67 // 'getInterceptor' is not because the compiler renamed it.
63 Expect.isTrue(generated.contains('getInterceptor')); 68 Expect.isTrue(generated.contains('getInterceptor'));
64 } 69 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698