Fix braino in single frame deopt.

handler_method_header_ is actually the OatQuickMethodHeader
of the caller of the method that is deoptimizing (as we will
resume at its call site). We should use the OatQuickMethodHeader
of the method that is deoptimizing and pass it to the code cache
to invalidate the method.

Change-Id: I2b61a96b8415e9477e3ac902c54a314aeb0811a0
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index dd384c7..2dfa860 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -290,13 +290,18 @@
         stacked_shadow_frame_pushed_(false),
         single_frame_deopt_(single_frame),
         single_frame_done_(false),
-        single_frame_deopt_method_(nullptr) {
+        single_frame_deopt_method_(nullptr),
+        single_frame_deopt_quick_method_header_(nullptr) {
   }
 
   ArtMethod* GetSingleFrameDeoptMethod() const {
     return single_frame_deopt_method_;
   }
 
+  const OatQuickMethodHeader* GetSingleFrameDeoptQuickMethodHeader() const {
+    return single_frame_deopt_quick_method_header_;
+  }
+
   bool VisitFrame() OVERRIDE SHARED_REQUIRES(Locks::mutator_lock_) {
     exception_handler_->SetHandlerFrameDepth(GetFrameDepth());
     ArtMethod* method = GetMethod();
@@ -368,6 +373,7 @@
         exception_handler_->SetHandlerQuickArg0(reinterpret_cast<uintptr_t>(method));
         single_frame_done_ = true;
         single_frame_deopt_method_ = method;
+        single_frame_deopt_quick_method_header_ = GetCurrentOatQuickMethodHeader();
       }
       return true;
     }
@@ -603,6 +609,7 @@
   const bool single_frame_deopt_;
   bool single_frame_done_;
   ArtMethod* single_frame_deopt_method_;
+  const OatQuickMethodHeader* single_frame_deopt_quick_method_header_;
 
   DISALLOW_COPY_AND_ASSIGN(DeoptimizeStackVisitor);
 };
@@ -636,7 +643,7 @@
   DCHECK(deopt_method != nullptr);
   if (Runtime::Current()->UseJit()) {
     Runtime::Current()->GetJit()->GetCodeCache()->InvalidateCompiledCodeFor(
-        deopt_method, handler_method_header_);
+        deopt_method, visitor.GetSingleFrameDeoptQuickMethodHeader());
   } else {
     // Transfer the code to interpreter.
     Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(