OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 // VMOptions=--deoptimization_counter_threshold=1000 | |
5 | |
6 // Library tag to be able to run in html test framework. | |
7 library float32x4_unbox_regress_test; | |
8 | |
9 import 'package:expect/expect.dart'; | |
10 import 'dart:typeddata'; | |
11 | |
12 testListStore(array, index, value) { | |
13 array[index] = value; | |
14 } | |
15 | |
16 void testListStoreDeopt() { | |
17 var list; | |
18 var value = new Float32x4(1.0, 2.0, 3.0, 4.0); | |
19 var smi = 12; | |
20 list = new Float32x4List(8); | |
21 for (int i = 0; i < 3000; i++) { | |
22 testListStore(list, 0, value); | |
23 } | |
24 | |
25 try { | |
26 // Without a proper check for SMI in the Float32x4 unbox instruction | |
27 // this might trigger a crash. | |
28 testListStore(list, 0, smi); | |
29 } catch (_) { } | |
30 } | |
31 | |
32 testAdd(a, b) { | |
33 var c = a + b; | |
34 Expect.equals(3.0, c.x); | |
35 Expect.equals(5.0, c.y); | |
36 Expect.equals(7.0, c.z); | |
37 Expect.equals(9.0, c.w); | |
38 } | |
39 | |
40 void testAddDeopt() { | |
41 var a = new Float32x4(1.0, 2.0, 3.0, 4.0); | |
42 var b = new Float32x4(2.0, 3.0, 4.0, 5.0); | |
43 var smi = 12; | |
44 for (int i = 0; i < 3000; i++) { | |
45 testAdd(a, b); | |
46 } | |
47 | |
48 try { | |
49 testAdd(a, smi); | |
50 } catch (_) {} | |
51 } | |
52 | |
53 main() { | |
54 testListStoreDeopt(); | |
55 testAddDeopt(); | |
56 } | |
OLD | NEW |