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

Unified Diff: runtime/vm/exceptions.cc

Issue 2376843002: Pass new pool pointer to the JumpToException stub instead of reloading in through the frame's Code … (Closed)
Patch Set: Created 4 years, 3 months 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 | « no previous file | runtime/vm/simulator_arm.h » ('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 7c9d71dccbb5327f3db5be3086ee36e0ccd85f13..f2ae49cb747e871029b61b305b3de0b6d4ae1481 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -144,6 +144,7 @@ static bool FindExceptionHandler(Thread* thread,
uword* handler_pc,
uword* handler_sp,
uword* handler_fp,
+ uword* handler_pp,
bool* needs_stacktrace) {
StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
StackFrame* frame = frames.NextFrame();
@@ -152,6 +153,7 @@ static bool FindExceptionHandler(Thread* thread,
*needs_stacktrace = false;
bool is_catch_all = false;
uword temp_handler_pc = kUwordMax;
+ uword saved_pp = 0;
Florian Schneider 2016/09/27 22:21:08 ObjectPool& saved_pp = ObjectPool::Handle();
while (!frame->IsEntryFrame()) {
if (frame->IsDartFrame()) {
if (frame->FindExceptionHandler(thread,
@@ -163,12 +165,16 @@ static bool FindExceptionHandler(Thread* thread,
*handler_pc = temp_handler_pc;
*handler_sp = frame->sp();
*handler_fp = frame->fp();
+ *handler_pp = saved_pp;
}
if (*needs_stacktrace || is_catch_all) {
return true;
}
}
} // if frame->IsDartFrame
+#if !defined(TARGET_ARCH_IA32) && !defined(TARGET_ARCH_DBC)
+ saved_pp = frame->saved_caller_pp();
+#endif
frame = frames.NextFrame();
ASSERT(frame != NULL);
} // while !frame->IsEntryFrame
@@ -177,6 +183,7 @@ static bool FindExceptionHandler(Thread* thread,
*handler_pc = frame->pc();
*handler_sp = frame->sp();
*handler_fp = frame->fp();
+ *handler_pp = saved_pp;
}
// No catch-all encountered, needs stacktrace.
*needs_stacktrace = true;
@@ -186,7 +193,8 @@ static bool FindExceptionHandler(Thread* thread,
static void FindErrorHandler(uword* handler_pc,
uword* handler_sp,
- uword* handler_fp) {
+ uword* handler_fp,
+ uword* handler_pp) {
// TODO(turnidge): Is there a faster way to get the next entry frame?
StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
StackFrame* frame = frames.NextFrame();
@@ -199,6 +207,7 @@ static void FindErrorHandler(uword* handler_pc,
*handler_pc = frame->pc();
*handler_sp = frame->sp();
*handler_fp = frame->fp();
+ *handler_pp = 0;
}
@@ -206,6 +215,7 @@ static void JumpToExceptionHandler(Thread* thread,
uword program_counter,
uword stack_pointer,
uword frame_pointer,
+ uword pool_pointer,
Florian Schneider 2016/09/27 22:21:08 Pass const ObjectPool& pool_pointer like we pass t
const Object& exception_object,
const Object& stacktrace_object) {
// The no_gc StackResource is unwound through the tear down of
@@ -224,7 +234,8 @@ static void JumpToExceptionHandler(Thread* thread,
// object (may be raw null) in the kStackTraceObjectReg register.
Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer,
- raw_exception, raw_stacktrace, thread);
+ pool_pointer, raw_exception, raw_stacktrace,
+ thread);
#else
// Prepare for unwinding frames by destroying all the stack resources
// in the previous frames.
@@ -234,7 +245,7 @@ static void JumpToExceptionHandler(Thread* thread,
// 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*);
+ Thread*, uword);
Florian Schneider 2016/09/27 22:21:08 Can you make the pool pointer argument RawObject*?
ExcpHandler func = reinterpret_cast<ExcpHandler>(
StubCode::JumpToExceptionHandler_entry()->EntryPoint());
@@ -244,7 +255,7 @@ static void JumpToExceptionHandler(Thread* thread,
stack_pointer - current_sp);
func(program_counter, stack_pointer, frame_pointer,
- raw_exception, raw_stacktrace, thread);
+ raw_exception, raw_stacktrace, thread, pool_pointer);
#endif
UNREACHABLE();
}
@@ -317,6 +328,7 @@ static void ThrowExceptionHelper(Thread* thread,
uword handler_pc = 0;
uword handler_sp = 0;
uword handler_fp = 0;
+ uword handler_pp = 0;
Instance& stacktrace = Instance::Handle(zone);
bool handler_exists = false;
bool handler_needs_stacktrace = false;
@@ -327,6 +339,7 @@ static void ThrowExceptionHelper(Thread* thread,
&handler_pc,
&handler_sp,
&handler_fp,
+ &handler_pp,
&handler_needs_stacktrace);
if (handler_pc == 0) {
// No Dart frame.
@@ -352,6 +365,7 @@ static void ThrowExceptionHelper(Thread* thread,
&handler_pc,
&handler_sp,
&handler_fp,
+ &handler_pp,
&handler_needs_stacktrace);
if (!existing_stacktrace.IsNull()) {
// If we have an existing stack trace then this better be a rethrow. The
@@ -389,6 +403,7 @@ static void ThrowExceptionHelper(Thread* thread,
handler_pc,
handler_sp,
handler_fp,
+ handler_pp,
exception,
stacktrace);
} else {
@@ -406,6 +421,7 @@ static void ThrowExceptionHelper(Thread* thread,
handler_pc,
handler_sp,
handler_fp,
+ handler_pp,
unhandled_exception,
stacktrace);
}
@@ -589,9 +605,11 @@ void Exceptions::PropagateError(const Error& error) {
uword handler_pc = 0;
uword handler_sp = 0;
uword handler_fp = 0;
- FindErrorHandler(&handler_pc, &handler_sp, &handler_fp);
- JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp, error,
- Stacktrace::Handle(zone)); // Null stacktrace.
+ uword handler_pp = 0;
+ const Stacktrace& stacktrace = Stacktrace::Handle(zone); // null
+ FindErrorHandler(&handler_pc, &handler_sp, &handler_fp, &handler_pp);
+ JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp,
+ handler_pp, error, stacktrace);
}
UNREACHABLE();
}
« no previous file with comments | « no previous file | runtime/vm/simulator_arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698