Compiler_LLVM doesn't use reference map.

Also, for runtime_support_llvm, we fix the throw_exception_from_code bug.

Compiler LLVM haven't done the write barrier, so we need to scan image space.

Change-Id: I2be8b5fb1cf2a677d90f568480e58c10b315f42d
diff --git a/src/compiler_llvm/runtime_support_llvm.cc b/src/compiler_llvm/runtime_support_llvm.cc
index ccc8639..6ad80f8 100644
--- a/src/compiler_llvm/runtime_support_llvm.cc
+++ b/src/compiler_llvm/runtime_support_llvm.cc
@@ -128,7 +128,11 @@
 
 void art_throw_exception_from_code(Object* exception) {
   Thread* thread = Thread::Current();
-  thread->SetException(static_cast<Throwable*>(exception));
+  if (exception == NULL) {
+    thread->ThrowNewException("Ljava/lang/NullPointerException;", "throw with null exception");
+  } else {
+    thread->SetException(static_cast<Throwable*>(exception));
+  }
 }
 
 int32_t art_find_catch_block_from_code(Method* current_method, int32_t dex_pc) {
diff --git a/src/mark_sweep.cc b/src/mark_sweep.cc
index 381c7f0..1553dd8 100644
--- a/src/mark_sweep.cc
+++ b/src/mark_sweep.cc
@@ -139,6 +139,7 @@
   void* arg = reinterpret_cast<void*>(this);
   const std::vector<Space*>& spaces = heap_->GetSpaces();
   for (size_t i = 0; i < spaces.size(); ++i) {
+#if !defined(ART_USE_LLVM_COMPILER)
 #ifndef NDEBUG
     uintptr_t begin = reinterpret_cast<uintptr_t>(spaces[i]->Begin());
     uintptr_t end = reinterpret_cast<uintptr_t>(spaces[i]->End());
@@ -154,6 +155,12 @@
       mark_bitmap_->ScanWalk(begin, end, &MarkSweep::ScanBitmapCallback, arg);
     }
 #endif
+#else
+    // TODO: Implement card marking.
+    uintptr_t begin = reinterpret_cast<uintptr_t>(spaces[i]->Begin());
+    uintptr_t end = reinterpret_cast<uintptr_t>(spaces[i]->End());
+    mark_bitmap_->ScanWalk(begin, end, &MarkSweep::ScanBitmapCallback, arg);
+#endif
   }
   finger_ = reinterpret_cast<Object*>(~0);
   // TODO: tune the frequency of emptying the mark stack
diff --git a/src/thread.cc b/src/thread.cc
index 64f618c..846aa39 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -482,6 +482,7 @@
     }
     const int kMaxRepetition = 3;
     Method* m = frame.GetMethod();
+#if !defined(ART_USE_LLVM_COMPILER)
     Class* c = m->GetDeclaringClass();
     ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
     const DexCache* dex_cache = c->GetDexCache();
@@ -490,6 +491,10 @@
       const DexFile& dex_file = class_linker->FindDexFile(dex_cache);
       line_number = dex_file.GetLineNumFromPC(m, m->ToDexPC(pc));
     }
+#else
+    // Compiler_LLVM stores line_number in the ShadowFrame, and passes it to visitor.
+    int line_number = static_cast<int>(pc);
+#endif
     if (line_number == last_line_number && last_method == m) {
       repetition_count++;
     } else {
@@ -1705,12 +1710,14 @@
   SirtVisitRoots(visitor, arg);
   ShadowFrameVisitRoots(visitor, arg);
 
+#if !defined(ART_USE_LLVM_COMPILER)
   // Cheat and steal the long jump context. Assume that we are not doing a GC during exception
   // delivery.
   Context* context = GetLongJumpContext();
   // Visit roots on this thread's stack
   ReferenceMapVisitor mapper(context, visitor, arg);
   WalkStack(&mapper);
+#endif
 }
 
 #if VERIFY_OBJECT_ENABLED
@@ -1719,9 +1726,11 @@
 }
 
 void Thread::VerifyStack() {
+#if !defined(ART_USE_LLVM_COMPILER)
   UniquePtr<Context> context(Context::Create());
   ReferenceMapVisitor mapper(context.get(), VerifyObject, NULL);
   WalkStack(&mapper);
+#endif
 }
 #endif