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

Side by Side Diff: tests/standalone/typed_data_test.dart

Issue 308513005: Intrinsify [] for ExternalUint8 and Uint8 typed data. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 // Dart test program for testing typed data. 5 // Dart test program for testing typed data.
6 6
7 // VMOptions=--optimization_counter_threshold=10 7 // VMOptions=--optimization_counter_threshold=10
8 8
9 // Library tag to be able to run in html test framework. 9 // Library tag to be able to run in html test framework.
10 library TypedDataTest; 10 library TypedDataTest;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 typed_data[3] = 127; 53 typed_data[3] = 127;
54 Expect.equals(127, typed_data[3]); 54 Expect.equals(127, typed_data[3]);
55 // This should eventually throw. 55 // This should eventually throw.
56 typed_data[0] = 128; 56 typed_data[0] = 128;
57 typed_data[4] = -129; 57 typed_data[4] = -129;
58 if (check_throws) { 58 if (check_throws) {
59 Expect.throws(() { 59 Expect.throws(() {
60 typed_data[1] = 1.2; 60 typed_data[1] = 1.2;
61 }); 61 });
62 } 62 }
63 Expect.throws(() => typed_data[-1]);
64 Expect.throws(() => typed_data[100]);
zra 2014/05/30 18:11:00 Is the non-smi index path followed somewhere?
srdjan 2014/05/30 19:23:12 Done.
63 } 65 }
64 66
65 void testUnsignedTypedDataRange(bool check_throws) { 67 void testUnsignedTypedDataRange(bool check_throws) {
66 Uint8List typed_data; 68 Uint8List typed_data;
67 typed_data = new Uint8List(10); 69 typed_data = new Uint8List(10);
68 70
69 typed_data[1] = 255; 71 typed_data[1] = 255;
70 Expect.equals(255, typed_data[1]); 72 Expect.equals(255, typed_data[1]);
71 typed_data[1] = 0; 73 typed_data[1] = 0;
72 Expect.equals(0, typed_data[1]); 74 Expect.equals(0, typed_data[1]);
73 75
74 for (int i = 0; i < typed_data.length; i++) { 76 for (int i = 0; i < typed_data.length; i++) {
75 typed_data[i] = i; 77 typed_data[i] = i;
76 } 78 }
77 for (int i = 0; i < typed_data.length; i++) { 79 for (int i = 0; i < typed_data.length; i++) {
78 Expect.equals(i, typed_data[i]); 80 Expect.equals(i, typed_data[i]);
79 } 81 }
80 82
81 // These should eventually throw. 83 // These should eventually throw.
82 typed_data[1] = 256; 84 typed_data[1] = 256;
83 typed_data[1] = -1; 85 typed_data[1] = -1;
84 typed_data[2] = -129; 86 typed_data[2] = -129;
85 if (check_throws) { 87 if (check_throws) {
86 Expect.throws(() { 88 Expect.throws(() {
87 typed_data[1] = 1.2; 89 typed_data[1] = 1.2;
88 }); 90 });
89 } 91 }
92 Expect.throws(() => typed_data[-1]);
93 Expect.throws(() => typed_data[100]);
90 } 94 }
91 95
92 void testClampedUnsignedTypedDataRangeHelper(Uint8ClampedList typed_data, 96 void testClampedUnsignedTypedDataRangeHelper(Uint8ClampedList typed_data,
93 bool check_throws) { 97 bool check_throws) {
94 Uint8ClampedList typed_data; 98 Uint8ClampedList typed_data;
95 typed_data = new Uint8ClampedList(10); 99 typed_data = new Uint8ClampedList(10);
96 100
97 typed_data[1] = 255; 101 typed_data[1] = 255;
98 Expect.equals(255, typed_data[1]); 102 Expect.equals(255, typed_data[1]);
99 typed_data[1] = 0; 103 typed_data[1] = 0;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 testSetAtIndex(float64list, 1.4260258159703532e-105, true); 409 testSetAtIndex(float64list, 1.4260258159703532e-105, true);
406 testGetAtIndex(float64list, 1.4260258159703532e-105); 410 testGetAtIndex(float64list, 1.4260258159703532e-105);
407 } 411 }
408 testTypedDataRange(true); 412 testTypedDataRange(true);
409 testUnsignedTypedDataRange(true); 413 testUnsignedTypedDataRange(true);
410 testViewCreation(); 414 testViewCreation();
411 testWhere(); 415 testWhere();
412 testCreationFromList(); 416 testCreationFromList();
413 } 417 }
414 418
OLDNEW
« runtime/vm/intrinsifier_mips.cc ('K') | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698