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

Unified Diff: test/codegen/lib/typed_data/int64_list_load_store_test.dart

Issue 1673863002: Infra for running lib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Reformat Created 4 years, 10 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
Index: test/codegen/lib/typed_data/int64_list_load_store_test.dart
diff --git a/test/codegen/lib/typed_data/int64_list_load_store_test.dart b/test/codegen/lib/typed_data/int64_list_load_store_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6dd09c67f0fbb40a57fc488fc103ac100af76e88
--- /dev/null
+++ b/test/codegen/lib/typed_data/int64_list_load_store_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--optimization-counter-threshold=10
+
+// Test that the compiler's load elimination phase sees interfering writes to
+// the array's buffer.
+
+import "dart:typed_data";
+import 'package:expect/expect.dart';
+
+void testStoreLoad(l, z) {
+ l[0] = 9223372036854775807;
+ l[1] = 9223372036854775806;
+ l[2] = l[0];
+ l[3] = z;
+ Expect.equals(l[0], 9223372036854775807);
+ Expect.equals(l[1], 9223372036854775806);
+ Expect.isTrue(l[1] < l[0]);
+ Expect.equals(l[2], l[0]);
+ Expect.equals(l[3], z);
+}
+
+main() {
+ var l = new Int64List(4);
+ var zGood = 9223372036854775807;
+ var zBad = false;
+ for (var i = 0; i < 40; i++) {
+ testStoreLoad(l, zGood);
+ }
+ // Deopt.
+ try {
+ testStoreLoad(l, zBad);
+ } catch (_) { }
+ for (var i = 0; i < 40; i++) {
+ testStoreLoad(l, zGood);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698