Tighten the safe points for code cache resets to happen.

Add a new flag in the Thread struct to track the whereabout of the top frame
in each Java thread. It is not safe to blow away the code cache if any thread
is in the JIT'ed land.
diff --git a/vm/Thread.c b/vm/Thread.c
index 75965d1..e4ee8e3 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -3268,6 +3268,25 @@
 }
 
 /*
+ * Convert ThreadStatus to a string.
+ */
+const char* dvmGetThreadStatusStr(ThreadStatus status)
+{
+    switch (status) {
+    case THREAD_ZOMBIE:         return "ZOMBIE";
+    case THREAD_RUNNING:        return "RUNNABLE";
+    case THREAD_TIMED_WAIT:     return "TIMED_WAIT";
+    case THREAD_MONITOR:        return "MONITOR";
+    case THREAD_WAIT:           return "WAIT";
+    case THREAD_INITIALIZING:   return "INITIALIZING";
+    case THREAD_STARTING:       return "STARTING";
+    case THREAD_NATIVE:         return "NATIVE";
+    case THREAD_VMWAIT:         return "VMWAIT";
+    default:                    return "UNKNOWN";
+    }
+}
+
+/*
  * Print information about the specified thread.
  *
  * Works best when the thread in question is "self" or has been suspended.
@@ -3277,11 +3296,6 @@
 void dvmDumpThreadEx(const DebugOutputTarget* target, Thread* thread,
     bool isRunning)
 {
-    /* tied to ThreadStatus enum */
-    static const char* kStatusNames[] = {
-        "ZOMBIE", "RUNNABLE", "TIMED_WAIT", "MONITOR", "WAIT",
-        "INITIALIZING", "STARTING", "NATIVE", "VMWAIT"
-    };
     Object* threadObj;
     Object* groupObj;
     StringObject* nameStr;
@@ -3333,11 +3347,10 @@
     if (groupName == NULL)
         groupName = strdup("(BOGUS GROUP)");
 
-    assert(thread->status < NELEM(kStatusNames));
     dvmPrintDebugMessage(target,
         "\"%s\"%s prio=%d tid=%d %s\n",
         threadName, isDaemon ? " daemon" : "",
-        priority, thread->threadId, kStatusNames[thread->status]);
+        priority, thread->threadId, dvmGetThreadStatusStr(thread->status));
     dvmPrintDebugMessage(target,
         "  | group=\"%s\" sCount=%d dsCount=%d s=%c obj=%p self=%p\n",
         groupName, thread->suspendCount, thread->dbgSuspendCount,