| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/exceptions.h" | 5 #include "vm/exceptions.h" |
| 6 | 6 |
| 7 #include "vm/cpu.h" | 7 #include "vm/cpu.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 static bool FindExceptionHandler(uword* handler_pc, | 21 static bool FindExceptionHandler(uword* handler_pc, |
| 22 uword* handler_sp, | 22 uword* handler_sp, |
| 23 uword* handler_fp, | 23 uword* handler_fp, |
| 24 GrowableArray<uword>* stack_frame_pcs) { | 24 GrowableArray<uword>* stack_frame_pcs) { |
| 25 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); | 25 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); |
| 26 StackFrame* frame = frames.NextFrame(); | 26 StackFrame* frame = frames.NextFrame(); |
| 27 ASSERT(frame != NULL); | 27 ASSERT(frame != NULL); |
| 28 while (!frame->IsEntryFrame()) { | 28 while (!frame->IsEntryFrame()) { |
| 29 if (frame->IsDartFrame()) { | 29 if (frame->IsDartFrame()) { |
| 30 stack_frame_pcs->Add(frame->pc()); | 30 stack_frame_pcs->Add(frame->pc()); |
| 31 DartFrame* dart_frame = reinterpret_cast<DartFrame*>(frame); | 31 if (frame->FindExceptionHandler(handler_pc)) { |
| 32 if (dart_frame->FindExceptionHandler(handler_pc)) { | |
| 33 *handler_sp = frame->sp(); | 32 *handler_sp = frame->sp(); |
| 34 *handler_fp = frame->fp(); | 33 *handler_fp = frame->fp(); |
| 35 return true; | 34 return true; |
| 36 } | 35 } |
| 37 } | 36 } |
| 38 frame = frames.NextFrame(); | 37 frame = frames.NextFrame(); |
| 39 ASSERT(frame != NULL); | 38 ASSERT(frame != NULL); |
| 40 } | 39 } |
| 41 ASSERT(frame->IsEntryFrame()); | 40 ASSERT(frame->IsEntryFrame()); |
| 42 *handler_pc = frame->pc(); | 41 *handler_pc = frame->pc(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 115 } |
| 117 UNREACHABLE(); | 116 UNREACHABLE(); |
| 118 } | 117 } |
| 119 | 118 |
| 120 | 119 |
| 121 // Static helpers for allocating, initializing, and throwing an error instance. | 120 // Static helpers for allocating, initializing, and throwing an error instance. |
| 122 | 121 |
| 123 // Return the script of the Dart function that called the native entry or the | 122 // Return the script of the Dart function that called the native entry or the |
| 124 // runtime entry. The frame iterator points to the callee. | 123 // runtime entry. The frame iterator points to the callee. |
| 125 RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) { | 124 RawScript* Exceptions::GetCallerScript(DartFrameIterator* iterator) { |
| 126 DartFrame* caller_frame = iterator->NextFrame(); | 125 StackFrame* caller_frame = iterator->NextFrame(); |
| 127 ASSERT(caller_frame != NULL); | 126 ASSERT(caller_frame != NULL); |
| 128 const Function& caller = Function::Handle(caller_frame->LookupDartFunction()); | 127 const Function& caller = Function::Handle(caller_frame->LookupDartFunction()); |
| 129 ASSERT(!caller.IsNull()); | 128 ASSERT(!caller.IsNull()); |
| 130 const Class& caller_class = Class::Handle(caller.owner()); | 129 const Class& caller_class = Class::Handle(caller.owner()); |
| 131 return caller_class.script(); | 130 return caller_class.script(); |
| 132 } | 131 } |
| 133 | 132 |
| 134 | 133 |
| 135 // Allocate a new instance of the given class name. | 134 // Allocate a new instance of the given class name. |
| 136 // TODO(hausner): Rename this NewCoreInstance to call out the fact that | 135 // TODO(hausner): Rename this NewCoreInstance to call out the fact that |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 case kIsolateSpawn: | 351 case kIsolateSpawn: |
| 353 library = Library::IsolateLibrary(); | 352 library = Library::IsolateLibrary(); |
| 354 class_name = String::NewSymbol("IsolateSpawnException"); | 353 class_name = String::NewSymbol("IsolateSpawnException"); |
| 355 break; | 354 break; |
| 356 } | 355 } |
| 357 | 356 |
| 358 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); | 357 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); |
| 359 } | 358 } |
| 360 | 359 |
| 361 } // namespace dart | 360 } // namespace dart |
| OLD | NEW |