Revert "Add additional checks for ArtMethod::GetOatQuickMethodHeader"

This reverts commit bbbcea9ec41513a439283a6d7ad9798d7c4faa83.

Reason for revert: https://android-build.googleplex.com/builds/submitted/8490058/aosp_x86-eng/latest/view/logs/build_error.log

Change-Id: Ibca5761f7893d1c8e81dc6f67b2a2b513675f4cc
diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc
index 4471b93..495398b 100644
--- a/compiler/exception_test.cc
+++ b/compiler/exception_test.cc
@@ -187,16 +187,14 @@
     fake_stack.push_back(0);
   }
 
-  OatQuickMethodHeader* header = OatQuickMethodHeader::FromEntryPoint(
-      method_g_->GetEntryPointFromQuickCompiledCode());
-  fake_stack.push_back(header->ToNativeQuickPc(
+  fake_stack.push_back(method_g_->GetOatQuickMethodHeader(0)->ToNativeQuickPc(
       method_g_, kDexPc, /* is_for_catch_handler= */ false));  // return pc
 
   // Create/push fake 16byte stack frame for method g
   fake_stack.push_back(reinterpret_cast<uintptr_t>(method_g_));
   fake_stack.push_back(0);
   fake_stack.push_back(0);
-  fake_stack.push_back(header->ToNativeQuickPc(
+  fake_stack.push_back(method_g_->GetOatQuickMethodHeader(0)->ToNativeQuickPc(
       method_g_, kDexPc, /* is_for_catch_handler= */ false));  // return pc
 
   // Create/push fake 16byte stack frame for method f
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 6ae7c43..f6f8b5f 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -551,12 +551,6 @@
     return nullptr;
   }
 
-  // We should not reach here with a pc of 0. pc can be 0 for downcalls when walking the stack.
-  // For native methods this case is handled by the caller by checking the quick frame tag. See
-  // StackVisitor::WalkStack for more details. For non-native methods pc can be 0 only for runtime
-  // methods or proxy invoke handlers which are handled earlier.
-  DCHECK(pc != 0);
-
   // Check whether the current entry point contains this pc.
   if (!class_linker->IsQuickGenericJniStub(existing_entry_point) &&
       !class_linker->IsQuickResolutionStub(existing_entry_point) &&
@@ -598,17 +592,21 @@
   OatFile::OatMethod oat_method =
       FindOatMethodFor(this, class_linker->GetImagePointerSize(), &found);
   if (!found) {
-    CHECK(IsNative());
-    // We are running the GenericJNI stub. The entrypoint may point
-    // to different entrypoints or to a JIT-compiled JNI stub.
-    DCHECK(class_linker->IsQuickGenericJniStub(existing_entry_point) ||
-           class_linker->IsQuickResolutionStub(existing_entry_point) ||
-           existing_entry_point == GetQuickInstrumentationEntryPoint() ||
-           (jit != nullptr && jit->GetCodeCache()->ContainsPc(existing_entry_point)))
-        << " entrypoint: " << existing_entry_point
-        << " size: " << OatQuickMethodHeader::FromEntryPoint(existing_entry_point)->GetCodeSize()
-        << " pc: " << reinterpret_cast<const void*>(pc);
-    return nullptr;
+    if (IsNative()) {
+      // We are running the GenericJNI stub. The entrypoint may point
+      // to different entrypoints or to a JIT-compiled JNI stub.
+      DCHECK(class_linker->IsQuickGenericJniStub(existing_entry_point) ||
+             class_linker->IsQuickResolutionStub(existing_entry_point) ||
+             existing_entry_point == GetQuickInstrumentationEntryPoint() ||
+             (jit != nullptr && jit->GetCodeCache()->ContainsPc(existing_entry_point)))
+          << " entrypoint: " << existing_entry_point
+          << " size: " << OatQuickMethodHeader::FromEntryPoint(existing_entry_point)->GetCodeSize()
+          << " pc: " << reinterpret_cast<const void*>(pc);
+      return nullptr;
+    }
+    // Only for unit tests.
+    // TODO(ngeoffray): Update these tests to pass the right pc?
+    return OatQuickMethodHeader::FromEntryPoint(existing_entry_point);
   }
   const void* oat_entry_point = oat_method.GetQuickCode();
   if (oat_entry_point == nullptr || class_linker->IsQuickGenericJniStub(oat_entry_point)) {
@@ -617,6 +615,12 @@
   }
 
   OatQuickMethodHeader* method_header = OatQuickMethodHeader::FromEntryPoint(oat_entry_point);
+  if (pc == 0) {
+    // This is a downcall, it can only happen for a native method.
+    DCHECK(IsNative());
+    return method_header;
+  }
+
   DCHECK(method_header->Contains(pc))
       << PrettyMethod()
       << " " << std::hex << pc << " " << oat_entry_point