Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Unified Diff: runtime/vm/exceptions.cc

Issue 2503653002: JumpToFrame refactor (Closed)
Patch Set: code review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 6e22638d8abea26193a549cef1d2d088fce6f990..e8d6ba0d43cebe58fee46c708b40a594a3b24499 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -210,12 +210,19 @@ static void JumpToExceptionHandler(Thread* thread,
uword frame_pointer,
const Object& exception_object,
const Object& stacktrace_object) {
- // The no_gc StackResource is unwound through the tear down of
- // stack resources below.
- NoSafepointScope no_safepoint;
- RawObject* raw_exception = exception_object.raw();
- RawObject* raw_stacktrace = stacktrace_object.raw();
+ thread->set_active_exception(exception_object);
+ thread->set_active_stacktrace(stacktrace_object);
+ thread->set_resume_pc(program_counter);
+ uword run_exception_pc = StubCode::RunExceptionHandler_entry()->EntryPoint();
+ Exceptions::JumpToFrame(thread, run_exception_pc, stack_pointer,
+ frame_pointer);
+}
+
+void Exceptions::JumpToFrame(Thread* thread,
+ uword program_counter,
+ uword stack_pointer,
+ uword frame_pointer) {
#if !defined(TARGET_ARCH_DBC)
MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
thread->isolate()->pending_deopts();
@@ -284,8 +291,8 @@ static void JumpToExceptionHandler(Thread* thread,
// exception object in the kExceptionObjectReg register and the stacktrace
// object (may be raw null) in the kStackTraceObjectReg register.
- Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer,
- raw_exception, raw_stacktrace, thread);
+ Simulator::Current()->JumpToFrame(program_counter, stack_pointer,
+ frame_pointer, thread);
#else
// Prepare for unwinding frames by destroying all the stack resources
// in the previous frames.
@@ -294,18 +301,16 @@ static void JumpToExceptionHandler(Thread* thread,
// Call a stub to set up the exception object in kExceptionObjectReg,
// to set up the stacktrace object in kStackTraceObjectReg, and to
// continue execution at the given pc in the given frame.
- typedef void (*ExcpHandler)(uword, uword, uword, RawObject*, RawObject*,
- Thread*);
+ typedef void (*ExcpHandler)(uword, uword, uword, Thread*);
ExcpHandler func = reinterpret_cast<ExcpHandler>(
- StubCode::JumpToExceptionHandler_entry()->EntryPoint());
+ StubCode::JumpToFrame_entry()->EntryPoint());
// Unpoison the stack before we tear it down in the generated stub code.
uword current_sp = Thread::GetCurrentStackPointer() - 1024;
ASAN_UNPOISON(reinterpret_cast<void*>(current_sp),
stack_pointer - current_sp);
- func(program_counter, stack_pointer, frame_pointer, raw_exception,
- raw_stacktrace, thread);
+ func(program_counter, stack_pointer, frame_pointer, thread);
#endif
UNREACHABLE();
}
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698