Jit: MethodTrace + Jit fix

Add checks for debug & trace mode to avoid re-entering Jit'd code.
This is the conversative solution - we'll eventually want the Jit
to integrate support for tracing and debug into Jit'd code.
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index 39b42cd..dfcd88f 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -344,6 +344,7 @@
     gDvmJit.compilerHighWater =
         COMPILER_WORK_QUEUE_SIZE - (COMPILER_WORK_QUEUE_SIZE/4);
     gDvmJit.pProfTable = pJitProfTable;
+    gDvmJit.pProfTableCopy = pJitProfTable;
     dvmUnlockMutex(&gDvmJit.tableLock);
 
     /* Signal running threads to refresh their cached pJitTable pointers */
@@ -511,3 +512,23 @@
             LOGD("Compiler thread has shut down\n");
     }
 }
+
+
+void dvmCompilerStateRefresh()
+{
+    bool jitActive;
+    bool jitActivate;
+
+    dvmLockMutex(&gDvmJit.tableLock);
+    jitActive = gDvmJit.pProfTable != NULL;
+    jitActivate = !(gDvm.debuggerActive || (gDvm.activeProfilers > 0));
+
+    if (jitActivate && !jitActive) {
+        gDvmJit.pProfTable = gDvmJit.pProfTableCopy;
+        dvmUnlockMutex(&gDvmJit.tableLock);
+    } else if (!jitActivate && jitActive) {
+        gDvmJit.pProfTable = NULL;
+        dvmUnlockMutex(&gDvmJit.tableLock);
+        dvmJitUnchainAll();
+    }
+}