Index: tests/language/vm/deopt_smi_check_vm_test.dart |
diff --git a/tests/language/vm/deopt_smi_check_vm_test.dart b/tests/language/vm/deopt_smi_check_vm_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c6143029ba9309f61afbb555dca049ecf9a91a0 |
--- /dev/null |
+++ b/tests/language/vm/deopt_smi_check_vm_test.dart |
@@ -0,0 +1,20 @@ |
+// Copyright (c) 2016, 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. |
+// Test deoptimization on a smi check. |
+// VMOptions=--optimization-counter-threshold=10 --no-background-compilation |
+ |
+import 'package:expect/expect.dart'; |
+ |
+hc(a) { |
+ var r = a.hashCode; |
+ return r; |
+} |
+ |
+main() { |
+ for (var i = 0; i < 20; i++) { |
+ Expect.equals((1).hashCode, hc(1)); |
+ } |
+ // Passing double causes deoptimization. |
+ Expect.equals((1.0).hashCode, hc(1.0)); |
+} |