Index: runtime/vm/simulator_dbc.cc |
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc |
index ae9eaf87a2d19119aa6a52e5f128fcbaed6b0412..8febf13468918bb2fb8946a1becdc1b78815e38e 100644 |
--- a/runtime/vm/simulator_dbc.cc |
+++ b/runtime/vm/simulator_dbc.cc |
@@ -3691,12 +3691,7 @@ RawObject* Simulator::Call(const Code& code, |
} |
-void Simulator::Longjmp(uword pc, |
- uword sp, |
- uword fp, |
- RawObject* raw_exception, |
- RawObject* raw_stacktrace, |
- Thread* thread) { |
+void Simulator::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) { |
// Walk over all setjmp buffers (simulated --> C++ transitions) |
// and try to find the setjmp associated with the simulated stack pointer. |
SimulatorSetjmpBuffer* buf = last_setjmp_buffer(); |
@@ -3716,12 +3711,22 @@ void Simulator::Longjmp(uword pc, |
// Clear top exit frame. |
thread->set_top_exit_frame_info(0); |
- ASSERT(raw_exception != Object::null()); |
sp_ = reinterpret_cast<RawObject**>(sp); |
fp_ = reinterpret_cast<RawObject**>(fp); |
- pc_ = pc; |
- special_[kExceptionSpecialIndex] = raw_exception; |
- special_[kStacktraceSpecialIndex] = raw_stacktrace; |
+ |
+ if (pc == StubCode::RunExceptionHandler_entry()->EntryPoint()) { |
+ // Instead of executing the RunException stub, we implement its |
+ // behavior here. |
+ RawObject* raw_exception = thread->active_exception(); |
+ RawObject* raw_stacktrace = thread->active_stacktrace(); |
+ ASSERT(raw_exception != Object::null()); |
+ special_[kExceptionSpecialIndex] = raw_exception; |
+ special_[kStacktraceSpecialIndex] = raw_stacktrace; |
+ pc_ = thread->resume_pc(); |
+ } else { |
+ pc_ = pc; |
+ } |
+ |
buf->Longjmp(); |
UNREACHABLE(); |
} |