ART: Fix old warnings

Fix Wconstant-conversion warnings.

Partially reverts commit df53be273509dd43725870fb20a2c7d71f7fbfd3.

Bug: 28149048
Bug: 29823425
Test: m
Test: m test-art-host
Change-Id: Ib377150690c0f2c2142e4b91f2144e2bcaa020ef
diff --git a/build/Android.bp b/build/Android.bp
index 6d35deb..c5ff486 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -59,9 +59,6 @@
         "-Wunreachable-code-break",
         "-Wunreachable-code-return",
 
-        // Bug: http://b/29823425  Disable -Wconstant-conversion for Clang update to r271374
-        "-Wno-constant-conversion",
-
         // Enable thread annotations for std::mutex, etc.
         "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
     ],
diff --git a/compiler/utils/arm/assembler_thumb2.cc b/compiler/utils/arm/assembler_thumb2.cc
index d7096b3..abc36c6 100644
--- a/compiler/utils/arm/assembler_thumb2.cc
+++ b/compiler/utils/arm/assembler_thumb2.cc
@@ -324,7 +324,7 @@
 
 inline int16_t Thumb2Assembler::BEncoding16(int32_t offset, Condition cond) {
   DCHECK_ALIGNED(offset, 2);
-  int16_t encoding = B15 | B14;
+  int16_t encoding = static_cast<int16_t>(B15 | B14);
   if (cond != AL) {
     DCHECK(IsInt<9>(offset));
     encoding |= B12 |  (static_cast<int32_t>(cond) << 8) | ((offset >> 1) & 0xff);
diff --git a/compiler/utils/mips/assembler_mips_test.cc b/compiler/utils/mips/assembler_mips_test.cc
index c24e1b1..0917530 100644
--- a/compiler/utils/mips/assembler_mips_test.cc
+++ b/compiler/utils/mips/assembler_mips_test.cc
@@ -2851,7 +2851,7 @@
   // Account for 5 extra instructions: ori, addu, lw, jalr, addiu.
   uint32_t offset_forward = (kAdduCount1 + 5) * sizeof(uint32_t);
   // Account for 5 extra instructions: subu, addiu, sw, nal, lui.
-  uint32_t offset_back = -(kAdduCount1 + 5) * sizeof(uint32_t);
+  uint32_t offset_back = static_cast<uint32_t>(-(kAdduCount1 + 5) * sizeof(uint32_t));
 
   std::ostringstream oss;
   oss <<
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index a224986..21780a1 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -17,6 +17,8 @@
 #ifndef ART_RUNTIME_STACK_MAP_H_
 #define ART_RUNTIME_STACK_MAP_H_
 
+#include <limits>
+
 #include "arch/code_offset.h"
 #include "base/bit_vector.h"
 #include "base/bit_utils.h"
@@ -1259,7 +1261,10 @@
 
 // Most of the fields are encoded as ULEB128 to save space.
 struct CodeInfoEncoding {
-  static constexpr uint32_t kInvalidSize = static_cast<size_t>(-1);
+  using SizeType = uint32_t;
+
+  static constexpr SizeType kInvalidSize = std::numeric_limits<SizeType>::max();
+
   // Byte sized tables go first to avoid unnecessary alignment bits.
   ByteSizedTable dex_register_map;
   ByteSizedTable location_catalog;
@@ -1285,7 +1290,7 @@
       inline_info = BitEncodingTable<InlineInfoEncoding>();
     }
     cache_header_size =
-        dchecked_integral_cast<uint32_t>(ptr - reinterpret_cast<const uint8_t*>(data));
+        dchecked_integral_cast<SizeType>(ptr - reinterpret_cast<const uint8_t*>(data));
     ComputeTableOffsets();
   }
 
@@ -1332,9 +1337,9 @@
  private:
   // Computed fields (not serialized).
   // Header size in bytes, cached to avoid needing to re-decoding the encoding in HeaderSize.
-  uint32_t cache_header_size = kInvalidSize;
+  SizeType cache_header_size = kInvalidSize;
   // Non header size in bytes, cached to avoid needing to re-decoding the encoding in NonHeaderSize.
-  uint32_t cache_non_header_size = kInvalidSize;
+  SizeType cache_non_header_size = kInvalidSize;
 };
 
 /**