| 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 // Tests that the VM does not crash on weird corner cases of class Math. | 4 // Tests that the VM does not crash on weird corner cases of class Math. |
| 5 // VMOptions=--optimization_counter_threshold=10 | 5 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 | 8 |
| 9 test1(String a, String b) { | 9 test1(String a, String b) { |
| 10 return a == b; | 10 return a == b; |
| 11 } | 11 } |
| 12 | 12 |
| 13 var LEN = 500; | 13 var LEN = 500; |
| 14 | 14 |
| 15 var ITER = 100000 / LEN; | 15 var ITER = 100000 / LEN; |
| 16 | 16 |
| 17 measure(fn, a, b) { | 17 measure(fn, a, b) { |
| 18 for (var i = 0; i < ITER; i++) { | 18 for (var i = 0; i < ITER; i++) { |
| 19 Expect.equals(true, fn(a, b)); | 19 Expect.equals(true, fn(a, b)); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 main() { | 23 main() { |
| 24 var n = LEN; | 24 var n = LEN; |
| 25 StringBuffer s = new StringBuffer(); | 25 StringBuffer s = new StringBuffer(); |
| 26 for (var i=0; i < n; ++i) s.write("A"); | 26 for (var i=0; i < n; ++i) s.write("A"); |
| 27 String t = s.toString(); | 27 String t = s.toString(); |
| 28 String u = s.toString(); | 28 String u = s.toString(); |
| 29 String v = s.toString() + "\u1234"; | 29 String v = s.toString() + "\u1234"; |
| 30 String w = s.toString() + "\u1234"; | 30 String w = s.toString() + "\u1234"; |
| 31 for (var i=0; i<10; i++) measure(test1, t, u); | 31 for (var i=0; i<10; i++) measure(test1, t, u); |
| 32 for (var i=0; i<10; i++) measure(test1, v, w); | 32 for (var i=0; i<10; i++) measure(test1, v, w); |
| 33 } | 33 } |
| OLD | NEW |