Revert "Revert "Add JIT""

Added missing EntryPointToCodePointer.

This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399.

Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk
index 8e4b46b..41c8da6 100644
--- a/test/Android.run-test.mk
+++ b/test/Android.run-test.mk
@@ -84,6 +84,9 @@
 ifeq ($(ART_TEST_INTERPRETER),true)
   COMPILER_TYPES += interpreter
 endif
+ifeq ($(ART_TEST_JIT),true)
+  COMPILER_TYPES += jit
+endif
 ifeq ($(ART_TEST_OPTIMIZING),true)
   COMPILER_TYPES += optimizing
 endif
@@ -497,7 +500,12 @@
         test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEFAULT_RULES
         run_test_options += --quick
       else
-        $$(error found $(4) expected $(COMPILER_TYPES))
+        ifeq ($(4),jit)
+          test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEFAULT_RULES
+          run_test_options += --jit
+        else
+          $$(error found $(4) expected $(COMPILER_TYPES))
+        endif
       endif
     endif
   endif
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index f64756b..ee40ee8 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -26,6 +26,7 @@
 HAVE_IMAGE="y"
 HOST="n"
 INTERPRETER="n"
+JIT="n"
 INVOKE_WITH=""
 ISA=x86
 LIBRARY_DIRECTORY="lib"
@@ -127,6 +128,9 @@
     elif [ "x$1" = "x--interpreter" ]; then
         INTERPRETER="y"
         shift
+    elif [ "x$1" = "x--jit" ]; then
+        JIT="y"
+        shift
     elif [ "x$1" = "x--jvm" ]; then
         USE_JVM="y"
         shift
@@ -260,6 +264,16 @@
     fi
 fi
 
+if [ "$JIT" = "y" ]; then
+    INT_OPTS="-Xjit"
+    if [ "$VERIFY" = "y" ] ; then
+      COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=interpret-only"
+    else
+      COMPILE_FLAGS="${COMPILE_FLAGS} --compiler-filter=verify-none"
+      DEX_VERIFY="${DEX_VERIFY} -Xverify:none"
+    fi
+fi
+
 JNI_OPTS="-Xjnigreflimit:512 -Xcheck:jni"
 
 if [ "$RELOCATE" = "y" ]; then
diff --git a/test/run-all-tests b/test/run-all-tests
index 318a0de..d0b3cf9 100755
--- a/test/run-all-tests
+++ b/test/run-all-tests
@@ -53,6 +53,9 @@
     elif [ "x$1" = "x--interpreter" ]; then
         run_args="${run_args} --interpreter"
         shift
+    elif [ "x$1" = "x--jit" ]; then
+        run_args="${run_args} --jit"
+        shift
     elif [ "x$1" = "x--no-verify" ]; then
         run_args="${run_args} --no-verify"
         shift
@@ -126,7 +129,7 @@
         echo "  $prog [options]  Run all tests with the given options."
         echo "  Options are all passed to run-test; refer to that for " \
              "further documentation:"
-        echo "    --debug --dev --host --interpreter --jvm --no-optimize"
+        echo "    --debug --dev --host --interpreter --jit --jvm --no-optimize"
         echo "    --no-verify -O --update --valgrind --zygote --64 --relocate"
         echo "    --prebuild --always-clean --gcstress --gcverify --trace"
         echo "    --no-patchoat --no-dex2oat"
diff --git a/test/run-test b/test/run-test
index 8c47663..8bc4151 100755
--- a/test/run-test
+++ b/test/run-test
@@ -193,6 +193,9 @@
         run_args="${run_args} --interpreter"
         image_suffix="-interpreter"
         shift
+    elif [ "x$1" = "x--jit" ]; then
+        run_args="${run_args} --jit"
+        shift
     elif [ "x$1" = "x--optimizing" ]; then
         run_args="${run_args} -Xcompiler-option --compiler-backend=Optimizing"
         image_suffix="-optimizing"
@@ -430,6 +433,7 @@
         echo "    --gdb                 Run under gdb; incompatible with some tests."
         echo "    --build-only          Build test files only (off by default)."
         echo "    --interpreter         Enable interpreter only mode (off by default)."
+        echo "    --jit                 Enable jit (off by default)."
         echo "    --optimizing          Enable optimizing compiler (off by default)."
         echo "    --quick               Use Quick compiler (default)."
         echo "    --no-verify           Turn off verification (on by default)."