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

Side by Side Diff: tests/lib/typeddata/float32x4_unbox_regress_test.dart

Issue 14426006: Rename dart:typeddata to dart:typed_data. (Closed) Base URL: https://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
(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 }
OLDNEW
« no previous file with comments | « tests/lib/typeddata/float32x4_test.dart ('k') | tests/standalone/byte_array_view_optimized_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698