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

Unified Diff: tests/language/vm/string_polymorphic_test.dart

Issue 161853002: Enable polymorphic inlining of StringBase [] and StringBase codeUnitAt (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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: tests/language/vm/string_polymorphic_test.dart
diff --git a/tests/language/vm/string_polymorphic_test.dart b/tests/language/vm/string_polymorphic_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e71d074557a35ac3cf6cc50b32f2d275826c0560
--- /dev/null
+++ b/tests/language/vm/string_polymorphic_test.dart
@@ -0,0 +1,33 @@
+// 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.
+// Tests that the VM does not crash on weird corner cases of class Math.
+// VMOptions=--optimization_counter_threshold=10
+
+import 'package:expect/expect.dart';
+
+test1(String a, String b) {
+ return a == b;
+}
+
+var LEN = 500;
+
+var ITER = 10000000 / LEN;
Florian Schneider 2014/02/17 11:56:12 The iteration count can probably be lower if you a
Cutch 2014/02/18 17:00:30 Done.
+
+measure(fn, a, b) {
+ for (var i = 0; i < ITER; i++) {
+ Expect.equals(true, fn(a, b));
+ }
+}
+
+main() {
+ var n = LEN;
+ StringBuffer s = new StringBuffer();
+ for (var i=0; i < n; ++i) s.write("A");
+ String t = s.toString();
+ String u = s.toString();
+ String v = s.toString() + "\u1234";
+ String w = s.toString() + "\u1234";
+ for (var i=0; i<10; i++) measure(test1, t, u);
+ for (var i=0; i<10; i++) measure(test1, v, w);
+}

Powered by Google App Engine
This is Rietveld 408576698