| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "lib/error.h" | 5 #include "lib/error.h" |
| 6 | 6 |
| 7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 44 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 45 const GrowableObjectArray& pc_offset_list = | 45 const GrowableObjectArray& pc_offset_list = |
| 46 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 46 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 47 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 47 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); |
| 48 StackFrame* frame = frames.NextFrame(); | 48 StackFrame* frame = frames.NextFrame(); |
| 49 ASSERT(frame != NULL); // We expect to find a dart invocation frame. | 49 ASSERT(frame != NULL); // We expect to find a dart invocation frame. |
| 50 Function& func = Function::Handle(); | 50 Function& func = Function::Handle(); |
| 51 Code& code = Code::Handle(); | 51 Code& code = Code::Handle(); |
| 52 Smi& offset = Smi::Handle(); | 52 Smi& offset = Smi::Handle(); |
| 53 bool catch_frame_skipped = false; // Tracks if catch frame has been skipped. | 53 bool catch_frame_skipped = false; // Tracks if catch frame has been skipped. |
| 54 while (!frame->IsEntryFrame()) { | 54 while (frame != NULL) { |
| 55 if (frame->IsDartFrame()) { | 55 if (frame->IsDartFrame()) { |
| 56 code = frame->LookupDartCode(); | 56 code = frame->LookupDartCode(); |
| 57 if (code.is_optimized()) { | 57 if (code.is_optimized()) { |
| 58 // For optimized frames, extract all the inlined functions if any | 58 // For optimized frames, extract all the inlined functions if any |
| 59 // into the stack trace. | 59 // into the stack trace. |
| 60 for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) { | 60 for (InlinedFunctionsIterator it(frame); !it.Done(); it.Advance()) { |
| 61 func = it.function(); | 61 func = it.function(); |
| 62 code = it.code(); | 62 code = it.code(); |
| 63 uword pc = it.pc(); | 63 uword pc = it.pc(); |
| 64 ASSERT(pc != 0); | 64 ASSERT(pc != 0); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 83 catch_frame_skipped = true; | 83 catch_frame_skipped = true; |
| 84 } else { | 84 } else { |
| 85 func_list.Add(func); | 85 func_list.Add(func); |
| 86 code_list.Add(code); | 86 code_list.Add(code); |
| 87 pc_offset_list.Add(offset); | 87 pc_offset_list.Add(offset); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 frame = frames.NextFrame(); | 92 frame = frames.NextFrame(); |
| 93 ASSERT(frame != NULL); | |
| 94 } | 93 } |
| 95 const Array& func_array = Array::Handle(Array::MakeArray(func_list)); | 94 const Array& func_array = Array::Handle(Array::MakeArray(func_list)); |
| 96 const Array& code_array = Array::Handle(Array::MakeArray(code_list)); | 95 const Array& code_array = Array::Handle(Array::MakeArray(code_list)); |
| 97 const Array& pc_offset_array = | 96 const Array& pc_offset_array = |
| 98 Array::Handle(Array::MakeArray(pc_offset_list)); | 97 Array::Handle(Array::MakeArray(pc_offset_list)); |
| 99 trace.SetCatchStacktrace(func_array, code_array, pc_offset_array); | 98 trace.SetCatchStacktrace(func_array, code_array, pc_offset_array); |
| 100 return Object::null(); | 99 return Object::null(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace dart | 102 } // namespace dart |
| OLD | NEW |