| 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/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 const Array& code_array = | 303 const Array& code_array = |
| 304 Array::Handle(isolate, Array::MakeArray(frame_builder.code_list())); | 304 Array::Handle(isolate, Array::MakeArray(frame_builder.code_list())); |
| 305 const Array& pc_offset_array = | 305 const Array& pc_offset_array = |
| 306 Array::Handle(isolate, | 306 Array::Handle(isolate, |
| 307 Array::MakeArray(frame_builder.pc_offset_list())); | 307 Array::MakeArray(frame_builder.pc_offset_list())); |
| 308 if (existing_stacktrace.IsNull()) { | 308 if (existing_stacktrace.IsNull()) { |
| 309 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array); | 309 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array); |
| 310 } else { | 310 } else { |
| 311 stacktrace ^= existing_stacktrace.raw(); | 311 stacktrace ^= existing_stacktrace.raw(); |
| 312 stacktrace.Append(func_array, code_array, pc_offset_array); | 312 stacktrace.Append(func_array, code_array, pc_offset_array); |
| 313 // Since we are re throwing and appending to the existing stack trace |
| 314 // we clear out the catch trace collected in the existing stack trace |
| 315 // as that trace will not be valid anymore. |
| 316 stacktrace.SetCatchStacktrace(Object::empty_array(), |
| 317 Object::empty_array(), |
| 318 Object::empty_array()); |
| 313 } | 319 } |
| 314 } else { | 320 } else { |
| 315 stacktrace ^= existing_stacktrace.raw(); | 321 stacktrace ^= existing_stacktrace.raw(); |
| 322 // Since we are re throwing and appending to the existing stack trace |
| 323 // we clear out the catch trace collected in the existing stack trace |
| 324 // as that trace will not be valid anymore. |
| 325 stacktrace.SetCatchStacktrace(Object::empty_array(), |
| 326 Object::empty_array(), |
| 327 Object::empty_array()); |
| 316 } | 328 } |
| 317 } | 329 } |
| 318 // We expect to find a handler_pc, if the exception is unhandled | 330 // We expect to find a handler_pc, if the exception is unhandled |
| 319 // then we expect to at least have the dart entry frame on the | 331 // then we expect to at least have the dart entry frame on the |
| 320 // stack as Exceptions::Throw should happen only after a dart | 332 // stack as Exceptions::Throw should happen only after a dart |
| 321 // invocation has been done. | 333 // invocation has been done. |
| 322 ASSERT(handler_pc != 0); | 334 ASSERT(handler_pc != 0); |
| 323 | 335 |
| 324 if (FLAG_print_stacktrace_at_throw) { | 336 if (FLAG_print_stacktrace_at_throw) { |
| 325 OS::Print("Exception '%s' thrown:\n", exception.ToCString()); | 337 OS::Print("Exception '%s' thrown:\n", exception.ToCString()); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 break; | 601 break; |
| 590 } | 602 } |
| 591 | 603 |
| 592 return DartLibraryCalls::ExceptionCreate(library, | 604 return DartLibraryCalls::ExceptionCreate(library, |
| 593 *class_name, | 605 *class_name, |
| 594 *constructor_name, | 606 *constructor_name, |
| 595 arguments); | 607 arguments); |
| 596 } | 608 } |
| 597 | 609 |
| 598 } // namespace dart | 610 } // namespace dart |
| OLD | NEW |