Revert^2 "Cleanup the code to determine instrumentation level"

This reverts commit cb8f8c12872d36304dbac80fbd08d8400a757fe5.

Reason for revert: Reland commit 21ef5a80704da06bdb2945be1c735ca86e8f1860 with fixes

Fixes:
In JITed code when we compare a bool variable
(instrumentation_stubs_installed_) we should use cmpb and not cmpw. This
wasn't caught earlier because the next three variables are bool which
are related to instrumentation are false when instrumentation is disabled.

Test: testrunner.py --host --redefine-stress -t 421-large-frame,
testrunner.py --host --redefine-stress -t 545-tracing-and-jit

Change-Id: Iba363fb62d0cb41bcbc86af202eae73a833ba267
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index fe97c7f..2cf2571 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -1159,7 +1159,7 @@
   uint64_t address = reinterpret_cast64<uint64_t>(Runtime::Current()->GetInstrumentation());
   int offset = instrumentation::Instrumentation::NeedsEntryExitHooksOffset().Int32Value();
   __ Mov(temp, address + offset);
-  __ Ldrh(value, MemOperand(temp, 0));
+  __ Ldrb(value, MemOperand(temp, 0));
   __ Cbnz(value, slow_path->GetEntryLabel());
   __ Bind(slow_path->GetExitLabel());
 }
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index b58ef12..62c285d 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -2154,7 +2154,7 @@
   int offset = instrumentation::Instrumentation::NeedsEntryExitHooksOffset().Int32Value();
   uint32_t address = reinterpret_cast32<uint32_t>(Runtime::Current()->GetInstrumentation());
   __ Mov(temp, address + offset);
-  __ Ldrh(temp, MemOperand(temp, 0));
+  __ Ldrb(temp, MemOperand(temp, 0));
   __ CompareAndBranchIfNonZero(temp, slow_path->GetEntryLabel());
   __ Bind(slow_path->GetExitLabel());
 }
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index b5677e5..11c15d6 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -1166,8 +1166,8 @@
 
   uint64_t address = reinterpret_cast64<uint64_t>(Runtime::Current()->GetInstrumentation());
   int offset = instrumentation::Instrumentation::NeedsEntryExitHooksOffset().Int32Value();
-  __ cmpw(Address::Absolute(address + offset), Immediate(0));
-  __ j(kEqual, slow_path->GetEntryLabel());
+  __ cmpb(Address::Absolute(address + offset), Immediate(0));
+  __ j(kNotEqual, slow_path->GetEntryLabel());
   __ Bind(slow_path->GetExitLabel());
 }
 
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index a2faa43..6deb035 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -1534,7 +1534,7 @@
   uint64_t address = reinterpret_cast64<uint64_t>(Runtime::Current()->GetInstrumentation());
   int offset = instrumentation::Instrumentation::NeedsEntryExitHooksOffset().Int32Value();
   __ movq(CpuRegister(TMP), Immediate(address + offset));
-  __ cmpw(Address(CpuRegister(TMP), 0), Immediate(0));
+  __ cmpb(Address(CpuRegister(TMP), 0), Immediate(0));
   __ j(kNotEqual, slow_path->GetEntryLabel());
   __ Bind(slow_path->GetExitLabel());
 }