| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "vm/stack_frame.h" | 5 #include "vm/stack_frame.h" |
| 6 | 6 |
| 7 #include "platform/memory_sanitizer.h" | 7 #include "platform/memory_sanitizer.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/deopt_instructions.h" | 9 #include "vm/deopt_instructions.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 ASSERT(reinterpret_cast<RawObject*>(pc_marker)->GetClassId() == kCodeCid || | 200 ASSERT(reinterpret_cast<RawObject*>(pc_marker)->GetClassId() == kCodeCid || |
| 201 reinterpret_cast<RawObject*>(pc_marker) == Object::null()); | 201 reinterpret_cast<RawObject*>(pc_marker) == Object::null()); |
| 202 return reinterpret_cast<RawCode*>(pc_marker); | 202 return reinterpret_cast<RawCode*>(pc_marker); |
| 203 } | 203 } |
| 204 | 204 |
| 205 | 205 |
| 206 bool StackFrame::FindExceptionHandler(Thread* thread, | 206 bool StackFrame::FindExceptionHandler(Thread* thread, |
| 207 uword* handler_pc, | 207 uword* handler_pc, |
| 208 bool* needs_stacktrace, | 208 bool* needs_stacktrace, |
| 209 bool* has_catch_all) const { | 209 bool* has_catch_all) const { |
| 210 Isolate* isolate = thread->isolate(); | 210 REUSABLE_CODE_HANDLESCOPE(thread); |
| 211 REUSABLE_CODE_HANDLESCOPE(isolate); | |
| 212 Code& code = reused_code_handle.Handle(); | 211 Code& code = reused_code_handle.Handle(); |
| 213 code = LookupDartCode(); | 212 code = LookupDartCode(); |
| 214 if (code.IsNull()) { | 213 if (code.IsNull()) { |
| 215 return false; // Stub frames do not have exception handlers. | 214 return false; // Stub frames do not have exception handlers. |
| 216 } | 215 } |
| 217 uword pc_offset = pc() - code.EntryPoint(); | 216 uword pc_offset = pc() - code.EntryPoint(); |
| 218 | 217 |
| 219 REUSABLE_EXCEPTION_HANDLERS_HANDLESCOPE(isolate); | 218 REUSABLE_EXCEPTION_HANDLERS_HANDLESCOPE(thread); |
| 220 ExceptionHandlers& handlers = reused_exception_handlers_handle.Handle(); | 219 ExceptionHandlers& handlers = reused_exception_handlers_handle.Handle(); |
| 221 handlers = code.exception_handlers(); | 220 handlers = code.exception_handlers(); |
| 222 if (handlers.num_entries() == 0) { | 221 if (handlers.num_entries() == 0) { |
| 223 return false; | 222 return false; |
| 224 } | 223 } |
| 225 | 224 |
| 226 // Find pc descriptor for the current pc. | 225 // Find pc descriptor for the current pc. |
| 227 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(isolate); | 226 REUSABLE_PC_DESCRIPTORS_HANDLESCOPE(thread); |
| 228 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle(); | 227 PcDescriptors& descriptors = reused_pc_descriptors_handle.Handle(); |
| 229 descriptors = code.pc_descriptors(); | 228 descriptors = code.pc_descriptors(); |
| 230 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); | 229 PcDescriptors::Iterator iter(descriptors, RawPcDescriptors::kAnyKind); |
| 231 while (iter.MoveNext()) { | 230 while (iter.MoveNext()) { |
| 232 const intptr_t current_try_index = iter.TryIndex(); | 231 const intptr_t current_try_index = iter.TryIndex(); |
| 233 if ((iter.PcOffset() == pc_offset) && (current_try_index != -1)) { | 232 if ((iter.PcOffset() == pc_offset) && (current_try_index != -1)) { |
| 234 RawExceptionHandlers::HandlerInfo handler_info; | 233 RawExceptionHandlers::HandlerInfo handler_info; |
| 235 handlers.GetHandlerInfo(current_try_index, &handler_info); | 234 handlers.GetHandlerInfo(current_try_index, &handler_info); |
| 236 *handler_pc = code.EntryPoint() + handler_info.handler_pc_offset; | 235 *handler_pc = code.EntryPoint() + handler_info.handler_pc_offset; |
| 237 *needs_stacktrace = handler_info.needs_stacktrace; | 236 *needs_stacktrace = handler_info.needs_stacktrace; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { | 496 if (deopt_instr->kind() == DeoptInstr::kCallerFp) { |
| 498 return (index - num_materializations_); | 497 return (index - num_materializations_); |
| 499 } | 498 } |
| 500 } | 499 } |
| 501 UNREACHABLE(); | 500 UNREACHABLE(); |
| 502 return 0; | 501 return 0; |
| 503 } | 502 } |
| 504 | 503 |
| 505 | 504 |
| 506 } // namespace dart | 505 } // namespace dart |
| OLD | NEW |