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

Unified Diff: tests/standalone/int_array_test.dart

Issue 11967012: Optimized loads/stores for scalar list: Uint8Clamped, Int8, Int16, Uint16. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/int_array_test.dart
===================================================================
--- tests/standalone/int_array_test.dart (revision 17135)
+++ tests/standalone/int_array_test.dart (working copy)
@@ -9,6 +9,50 @@
import 'dart:scalarlist';
+void testInt16() {
+ Int16List intArray = new Int16List(4);
+ intArray[0] = 0;
+ intArray[1] = -1;
+ intArray[2] = -2;
+ intArray[3] = -3;
+ for (int i = 0; i < intArray.length; i++) {
+ intArray[i]++;
+ }
+ var x = intArray[0];
+ var y = intArray[1];
+ var z = intArray[2];
+ var w = intArray[3];
+ Expect.equals(1, x);
+ Expect.equals(0, y);
+ Expect.equals(-1, z);
+ Expect.equals(-2, w);
+ var t = y + 1;
+ intArray[0] = t;
+ Expect.equals(t, intArray[0]);
+}
+
+void testUint16() {
+ Uint16List intArray = new Uint16List(4);
+ intArray[0] = 0;
+ intArray[1] = 1;
+ intArray[2] = 2;
+ intArray[3] = 3;
+ for (int i = 0; i < intArray.length; i++) {
+ intArray[i]--;
+ }
+ var x = intArray[0];
+ var y = intArray[1];
+ var z = intArray[2];
+ var w = intArray[3];
+ Expect.equals(65535, x);
+ Expect.equals(0, y);
+ Expect.equals(1, z);
+ Expect.equals(2, w);
+ var t = y + 1;
+ intArray[0] = t;
+ Expect.equals(t, intArray[0]);
+}
+
void testInt32ToSmi() {
Int32List intArray;
@@ -75,7 +119,6 @@
var y = intArray[1];
var z = intArray[2];
var w = intArray[3];
- print(w);
Expect.equals(4611686018427387903, x);
Expect.equals(18446744073709551615, y);
Expect.equals(4611686018427387904, z);
@@ -85,8 +128,9 @@
main() {
testUint64ToSmi();
- return;
for (int i = 0; i < 2000; i++) {
+ testInt16();
+ testUint16();
testInt32ToSmi();
testUint32ToSmi();
testInt64ToSmi();
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698