Pad the page containing ARM code in the JIT code cache to work around a CPU bug.

Bug: 2501147

Verified with seeing the following line in the log. The 4096 number confirms
that the ARM handler code is using a full page.

D/dalvikvm(  369): 21 compilations using 4096 + 1288 bytes

Change-Id: I89e1473ce9a4353f58f740e1c86d358d3fec33b2
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c
index e9b30de..0380e02 100644
--- a/vm/compiler/Compiler.c
+++ b/vm/compiler/Compiler.c
@@ -156,6 +156,14 @@
            (void *) dvmCompilerTemplateStart,
            templateSize);
 
+    /*
+     * Work around a CPU bug by keeping the 32-bit ARM handler code in its own
+     * page.
+     */
+    if (dvmCompilerInstructionSet() == DALVIK_JIT_THUMB2) {
+        templateSize = (templateSize + 4095) & ~4095;
+    }
+
     gDvmJit.templateSize = templateSize;
     gDvmJit.codeCacheByteUsed = templateSize;