| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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=--optimization-counter-threshold=5 | 4 // VMOptions=--optimization-counter-threshold=5 --no-background-compilation |
| 5 // Test correct OSR (issue 16151). | 5 // Test correct OSR (issue 16151). |
| 6 | 6 |
| 7 import "dart:collection"; | 7 import "dart:collection"; |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 List create([int length]) { | 10 List create([int length]) { |
| 11 return new MyList(length); | 11 return new MyList(length); |
| 12 } | 12 } |
| 13 | 13 |
| 14 main() { | 14 main() { |
| 15 test(create); | 15 test(create); |
| 16 } | 16 } |
| 17 | 17 |
| 18 | 18 |
| 19 class MyList<E> extends ListBase<E> { | 19 class MyList<E> extends ListBase<E> { |
| 20 List<E> _list; | 20 List<E> _list; |
| 21 | 21 |
| 22 MyList([int length]): _list = (length==null ? new List() : new List(length)); | 22 MyList([int length]): _list = (length==null ? new List() : new List(length)); |
| 23 | 23 |
| 24 E operator [](int index) => _list[index]; | 24 E operator [](int index) => _list[index]; |
| 25 | 25 |
| 26 void operator []=(int index, E value) { | 26 void operator []=(int index, E value) { |
| 27 _list[index]=value; | 27 _list[index]=value; |
| 28 } | 28 } |
| 29 | 29 |
| 30 int get length => _list.length; | 30 int get length => _list.length; |
| 31 | 31 |
| 32 void set length(int newLength) { | 32 void set length(int newLength) { |
| 33 _list.length=newLength; | 33 _list.length=newLength; |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 test(List create([int length])) { | 38 test(List create([int length])) { |
| 39 sort_A01_t02_test(create); | 39 sort_A01_t02_test(create); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // From library co19 sort_A01_t02. | 42 // From library co19 sort_A01_t02. |
| 43 | 43 |
| 44 sort_A01_t02_test(List create([int length])) { | 44 sort_A01_t02_test(List create([int length])) { |
| 45 int c(var a, var b) { | 45 int c(var a, var b) { |
| 46 return a < b ? -1 : (a == b ? 0 : 1); | 46 return a < b ? -1 : (a == b ? 0 : 1); |
| 47 } | 47 } |
| 48 | 48 |
| 49 int maxlen = 7; | 49 int maxlen = 7; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 swap(0, n-1); | 87 swap(0, n-1); |
| 88 } else { | 88 } else { |
| 89 swap(i, n-1); | 89 swap(i, n-1); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } //void permute | 93 } //void permute |
| 94 permute(length); | 94 permute(length); |
| 95 } //for i in 0..length | 95 } //for i in 0..length |
| 96 } // test | 96 } // test |
| OLD | NEW |