More robust 652-deopt-intrinsic.

The deoptimization check was flakey, as deoptimizations could
happen in other threads or prior to executing the loop method.

So instead, just ensure the method that used to deoptimize never
moves to being interpreted.

Test: 652-deopt-intrinsic
Change-Id: I035d87014b9d233fdaa40736501b7aac38a74f89
diff --git a/test/652-deopt-intrinsic/src/Main.java b/test/652-deopt-intrinsic/src/Main.java
index a82580c..8c583c0 100644
--- a/test/652-deopt-intrinsic/src/Main.java
+++ b/test/652-deopt-intrinsic/src/Main.java
@@ -27,16 +27,22 @@
     for (int i = 0; i < 5000; i++) {
       $noinline$doCall("foo");
       $noinline$doCall(m);
-      if (numberOfDeoptimizations() != 0) {
-        throw new Error("Unexpected deoptimizations");
-      }
     }
   }
 
   public static boolean $noinline$doCall(Object foo) {
-    return foo.equals(Main.class);
+    boolean isCompiledAtEntry = !isInterpreted();
+    boolean result = foo.equals(Main.class);
+
+    // Test that the 'equals' above did not lead to a deoptimization.
+    if (isCompiledAtEntry) {
+      if (isInterpreted()) {
+        throw new Error("Unexpected deoptimization");
+      }
+    }
+    return result;
   }
 
-  public static native int numberOfDeoptimizations();
+  public static native boolean isInterpreted();
   public static native void ensureJitCompiled(Class<?> cls, String methodName);
 }