Fix unhandled allocation failure

Add check in AllocateData before attempting to translate address.

Adds hints that allocation failures are unlikely.

Bug: 140523064
Test: TH
Change-Id: I905557ce64f0a1aab7df4673859463ca27792f2b
diff --git a/runtime/jit/jit_memory_region.cc b/runtime/jit/jit_memory_region.cc
index 3faf2ad..12e5d54 100644
--- a/runtime/jit/jit_memory_region.cc
+++ b/runtime/jit/jit_memory_region.cc
@@ -367,7 +367,7 @@
   DCHECK_GT(total_size, header_size);
   uint8_t* w_memory = reinterpret_cast<uint8_t*>(
       mspace_memalign(exec_mspace_, alignment, total_size));
-  if (w_memory == nullptr) {
+  if (UNLIKELY(w_memory == nullptr)) {
     return nullptr;
   }
   uint8_t* x_memory = GetExecutableAddress(w_memory);
@@ -478,6 +478,9 @@
 
 const uint8_t* JitMemoryRegion::AllocateData(size_t data_size) {
   void* result = mspace_malloc(data_mspace_, data_size);
+  if (UNLIKELY(result == nullptr)) {
+    return nullptr;
+  }
   used_memory_for_data_ += mspace_usable_size(result);
   return reinterpret_cast<uint8_t*>(GetNonWritableDataAddress(result));
 }