Chromium Code Reviews| Index: vm/exceptions.cc |
| =================================================================== |
| --- vm/exceptions.cc (revision 10127) |
| +++ vm/exceptions.cc (working copy) |
| @@ -27,13 +27,21 @@ |
| static bool FindExceptionHandler(uword* handler_pc, |
| uword* handler_sp, |
| uword* handler_fp, |
| - GrowableArray<uword>* stack_frame_pcs) { |
| + GrowableArray<uword>* stack_frame_pcs, |
| + const GrowableObjectArray& func_list, |
| + const GrowableObjectArray& code_list) { |
|
Ivan Posva
2012/08/03 20:49:53
How about this:
FindExceptionHandler(...
const
|
| StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); |
| StackFrame* frame = frames.NextFrame(); |
| ASSERT(frame != NULL); |
| + Function& func = Function::Handle(); |
| + Code& code = Code::Handle(); |
| while (!frame->IsEntryFrame()) { |
| if (frame->IsDartFrame()) { |
| stack_frame_pcs->Add(frame->pc()); |
| + func = frame->LookupDartFunction(); |
| + code = frame->LookupDartCode(); |
| + func_list.Add(func); |
| + code_list.Add(code); |
| if (frame->FindExceptionHandler(handler_pc)) { |
| *handler_sp = frame->sp(); |
| *handler_fp = frame->fp(); |
| @@ -136,20 +144,26 @@ |
| uword handler_sp = 0; |
| uword handler_fp = 0; |
| GrowableArray<uword> stack_frame_pcs; |
| + const GrowableObjectArray& func_list = |
| + GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| + const GrowableObjectArray& code_list = |
| + GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| bool handler_exists = FindExceptionHandler(&handler_pc, |
| &handler_sp, |
| &handler_fp, |
| - &stack_frame_pcs); |
| + &stack_frame_pcs, |
| + func_list, |
| + code_list); |
| // TODO(5411263): At some point we can optimize by figuring out if a |
| // stack trace is needed based on whether the catch code specifies a |
| // stack trace object or there is a rethrow in the catch clause. |
| Stacktrace& stacktrace = Stacktrace::Handle(); |
| if (!stack_frame_pcs.is_empty()) { |
| if (existing_stacktrace.IsNull()) { |
| - stacktrace = Stacktrace::New(stack_frame_pcs); |
| + stacktrace = Stacktrace::New(stack_frame_pcs, func_list, code_list); |
| } else { |
| stacktrace ^= existing_stacktrace.raw(); |
| - stacktrace.Append(stack_frame_pcs); |
| + stacktrace.Append(stack_frame_pcs, func_list, code_list); |
| } |
| } else { |
| stacktrace ^= existing_stacktrace.raw(); |