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 "platform/address_sanitizer.h" | 7 #include "platform/address_sanitizer.h" |
8 | 8 |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 } else { | 402 } else { |
403 // Get stacktrace field of class Error. This is needed to determine whether | 403 // Get stacktrace field of class Error. This is needed to determine whether |
404 // we have a subclass of Error which carries around its stack trace. | 404 // we have a subclass of Error which carries around its stack trace. |
405 const Field& stacktrace_field = | 405 const Field& stacktrace_field = |
406 Field::Handle(zone, LookupStacktraceField(exception)); | 406 Field::Handle(zone, LookupStacktraceField(exception)); |
407 | 407 |
408 // Find the exception handler and determine if the handler needs a | 408 // Find the exception handler and determine if the handler needs a |
409 // stacktrace. | 409 // stacktrace. |
410 handler_exists = | 410 handler_exists = |
411 FindExceptionHandler(thread, &handler_pc, &handler_sp, &handler_fp, | 411 FindExceptionHandler(thread, &handler_pc, &handler_sp, &handler_fp, |
412 &handler_needs_stacktrace); | 412 &handler_needs_stacktrace); |
kustermann
2016/11/17 11:07:48
Can this FindExceptionHandler() be hoisted out of
Florian Schneider
2016/11/17 18:59:07
Done.
| |
413 if (!existing_stacktrace.IsNull()) { | 413 if (!existing_stacktrace.IsNull()) { |
414 // If we have an existing stack trace then this better be a rethrow. The | 414 // If we have an existing stack trace then this better be a rethrow. The |
415 // reverse is not necessarily true (e.g. Dart_PropagateError can cause | 415 // reverse is not necessarily true (e.g. Dart_PropagateError can cause |
416 // a rethrow being called without an existing stacktrace.) | 416 // a rethrow being called without an existing stacktrace.) |
417 ASSERT(is_rethrow); | 417 ASSERT(is_rethrow); |
418 ASSERT(stacktrace_field.IsNull() || | |
419 (exception.GetField(stacktrace_field) != Object::null())); | |
420 stacktrace = existing_stacktrace.raw(); | 418 stacktrace = existing_stacktrace.raw(); |
kustermann
2016/11/17 11:07:48
This branch doesn't need [stacktrace_field] anymor
Florian Schneider
2016/11/17 18:59:07
Done.
| |
421 } else if (!stacktrace_field.IsNull() || handler_needs_stacktrace) { | 419 } else if (!stacktrace_field.IsNull() || handler_needs_stacktrace) { |
422 // Collect the stacktrace if needed. | 420 // Collect the stacktrace if needed. |
423 ASSERT(existing_stacktrace.IsNull()); | 421 ASSERT(existing_stacktrace.IsNull()); |
424 stacktrace = Exceptions::CurrentStacktrace(); | 422 stacktrace = Exceptions::CurrentStacktrace(); |
425 // If we have an Error object, then set its stackTrace field only if it | 423 // If we have an Error object, then set its stackTrace field only if it |
426 // not yet initialized. | 424 // not yet initialized. |
427 if (!stacktrace_field.IsNull() && | 425 if (!stacktrace_field.IsNull() && |
428 (exception.GetField(stacktrace_field) == Object::null())) { | 426 (exception.GetField(stacktrace_field) == Object::null())) { |
429 exception.SetField(stacktrace_field, stacktrace); | 427 exception.SetField(stacktrace_field, stacktrace); |
430 } | 428 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
788 class_name = &Symbols::_CompileTimeError(); | 786 class_name = &Symbols::_CompileTimeError(); |
789 break; | 787 break; |
790 } | 788 } |
791 | 789 |
792 return DartLibraryCalls::InstanceCreate(library, *class_name, | 790 return DartLibraryCalls::InstanceCreate(library, *class_name, |
793 *constructor_name, arguments); | 791 *constructor_name, arguments); |
794 } | 792 } |
795 | 793 |
796 | 794 |
797 } // namespace dart | 795 } // namespace dart |
OLD | NEW |