Fix 083 run-test by reducing memory usage.

Change-Id: I7dffd5976308f7861d6b594751542afb278ee3ca
diff --git a/src/compiler_llvm/inferred_reg_category_map.cc b/src/compiler_llvm/inferred_reg_category_map.cc
index 528247b..04acd6f 100644
--- a/src/compiler_llvm/inferred_reg_category_map.cc
+++ b/src/compiler_llvm/inferred_reg_category_map.cc
@@ -37,18 +37,22 @@
 
 RegCategory InferredRegCategoryMap::GetRegCategory(uint32_t dex_pc,
                                                    uint16_t reg_idx) const {
-  CHECK_NE(lines_[dex_pc], static_cast<RegCategoryLine*>(NULL));
-  return static_cast<RegCategory>((*lines_[dex_pc])[reg_idx]);
+  if (lines_[dex_pc] == NULL) {
+    return kRegUnknown;
+  }
+  return lines_[dex_pc]->GetRegCategory(reg_idx);
 }
 
 void InferredRegCategoryMap::SetRegCategory(uint32_t dex_pc,
                                             uint16_t reg_idx,
                                             RegCategory cat) {
-  if (lines_[dex_pc] == NULL) {
-    lines_[dex_pc] = new RegCategoryLine(registers_size_, kRegUnknown);
-  }
+  if (cat != kRegUnknown) {
+    if (lines_[dex_pc] == NULL) {
+      lines_[dex_pc] = new RegCategoryLine();
+    }
 
-  (*lines_[dex_pc])[reg_idx] = cat;
+    (*lines_[dex_pc]).SetRegCategory(reg_idx, cat);
+  }
 }
 
 bool InferredRegCategoryMap::
diff --git a/src/compiler_llvm/inferred_reg_category_map.h b/src/compiler_llvm/inferred_reg_category_map.h
index 55d64fe..f056274 100644
--- a/src/compiler_llvm/inferred_reg_category_map.h
+++ b/src/compiler_llvm/inferred_reg_category_map.h
@@ -21,6 +21,7 @@
 
 #include <stdint.h>
 #include <vector>
+#include <map>
 
 namespace art {
 namespace compiler_llvm {
@@ -28,7 +29,35 @@
 
 class InferredRegCategoryMap {
  private:
-  typedef std::vector<uint8_t> RegCategoryLine;
+  class RegCategoryLine {
+   private:
+    // TODO: Use hashmap (unordered_map).
+    typedef std::map<uint16_t, uint8_t> Table;
+    Table reg_category_line_;
+
+   public:
+    RegCategory GetRegCategory(uint16_t reg_idx) const {
+      // TODO: C++0x auto
+      Table::const_iterator result = reg_category_line_.find(reg_idx);
+      if (result == reg_category_line_.end()) {
+        return kRegUnknown;
+      }
+      return static_cast<RegCategory>(result->second);
+    }
+
+    void SetRegCategory(uint16_t reg_idx, RegCategory cat) {
+      if (cat != kRegUnknown) {
+        reg_category_line_[reg_idx] = cat;
+      }
+    }
+
+    bool operator==(RegCategoryLine const& rhs) const {
+      return reg_category_line_ == rhs.reg_category_line_;
+    }
+    bool operator!=(RegCategoryLine const& rhs) const {
+      return reg_category_line_ != rhs.reg_category_line_;
+    }
+  };
 
  public:
   InferredRegCategoryMap(uint32_t insns_size_in_code_units, uint8_t regs_size);
diff --git a/src/dex_verifier.h b/src/dex_verifier.h
index ce6963d..46f9ef2 100644
--- a/src/dex_verifier.h
+++ b/src/dex_verifier.h
@@ -861,12 +861,19 @@
             uint16_t registers_size, DexVerifier* verifier);
 
   RegisterLine* GetLine(size_t idx) {
-    return pc_to_register_line_[idx];
+    Table::iterator result = pc_to_register_line_.find(idx);  // TODO: C++0x auto
+    if (result == pc_to_register_line_.end()) {
+      return NULL;
+    } else {
+      return result->second;
+    }
   }
 
  private:
+  // TODO: Use hashmap (unordered_map).
+  typedef std::map<int32_t, RegisterLine*> Table;
   // Map from a dex pc to the register status associated with it
-  std::map<int32_t, RegisterLine*> pc_to_register_line_;
+  Table pc_to_register_line_;
 
   // Number of registers we track for each instruction. This is equal to the method's declared
   // "registersSize" plus kExtraRegs (2).