| 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 #include "vm/exceptions.h" | 6 #include "vm/exceptions.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/runtime_entry.h" | 8 #include "vm/runtime_entry.h" |
| 9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // Scan the stack until we hit the first function in the _AssertionError | 14 // Scan the stack until we hit the first function in the _AssertionError |
| 15 // class. We then return the next frame's script taking inlining into account. | 15 // class. We then return the next frame's script taking inlining into account. |
| 16 static RawScript* FindScript(DartFrameIterator* iterator) { | 16 static RawScript* FindScript(DartFrameIterator* iterator) { |
| 17 if (FLAG_precompiled_runtime) { |
| 18 // The precompiled runtime faces two issues in recovering the correct |
| 19 // assertion text. First, the precompiled runtime does not include |
| 20 // the inlining meta-data so we cannot walk the inline-aware stack trace. |
| 21 // Second, the script text itself is missing so whatever script is returned |
| 22 // from here will be missing the assertion expression text. |
| 23 iterator->NextFrame(); // Skip _AssertionError._checkAssertion frame |
| 24 return Exceptions::GetCallerScript(iterator); |
| 25 } |
| 17 StackFrame* stack_frame = iterator->NextFrame(); | 26 StackFrame* stack_frame = iterator->NextFrame(); |
| 18 Code& code = Code::Handle(); | 27 Code& code = Code::Handle(); |
| 19 Function& func = Function::Handle(); | 28 Function& func = Function::Handle(); |
| 20 const Class& assert_error_class = Class::Handle( | 29 const Class& assert_error_class = Class::Handle( |
| 21 Library::LookupCoreClass(Symbols::AssertionError())); | 30 Library::LookupCoreClass(Symbols::AssertionError())); |
| 22 ASSERT(!assert_error_class.IsNull()); | 31 ASSERT(!assert_error_class.IsNull()); |
| 23 bool hit_assertion_error = false; | 32 bool hit_assertion_error = false; |
| 24 while (stack_frame != NULL) { | 33 while (stack_frame != NULL) { |
| 25 code ^= stack_frame->LookupDartCode(); | 34 code ^= stack_frame->LookupDartCode(); |
| 26 if (code.is_optimized()) { | 35 if (code.is_optimized()) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 177 |
| 169 // Rethrow an error with a stacktrace. | 178 // Rethrow an error with a stacktrace. |
| 170 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { | 179 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { |
| 171 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); | 180 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); |
| 172 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); | 181 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); |
| 173 Exceptions::ReThrow(thread, error, stacktrace); | 182 Exceptions::ReThrow(thread, error, stacktrace); |
| 174 return Object::null(); | 183 return Object::null(); |
| 175 } | 184 } |
| 176 | 185 |
| 177 } // namespace dart | 186 } // namespace dart |
| OLD | NEW |