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) { | |
Florian Schneider
2016/10/31 16:07:05
Add a comment about what the difference with stack
Cutch
2016/10/31 16:13:11
Done.
| |
18 iterator->NextFrame(); // Skip _AssertionError._checkAssertion frame | |
19 return Exceptions::GetCallerScript(iterator); | |
20 } | |
17 StackFrame* stack_frame = iterator->NextFrame(); | 21 StackFrame* stack_frame = iterator->NextFrame(); |
18 Code& code = Code::Handle(); | 22 Code& code = Code::Handle(); |
19 Function& func = Function::Handle(); | 23 Function& func = Function::Handle(); |
20 const Class& assert_error_class = Class::Handle( | 24 const Class& assert_error_class = Class::Handle( |
21 Library::LookupCoreClass(Symbols::AssertionError())); | 25 Library::LookupCoreClass(Symbols::AssertionError())); |
22 ASSERT(!assert_error_class.IsNull()); | 26 ASSERT(!assert_error_class.IsNull()); |
23 bool hit_assertion_error = false; | 27 bool hit_assertion_error = false; |
24 while (stack_frame != NULL) { | 28 while (stack_frame != NULL) { |
25 code ^= stack_frame->LookupDartCode(); | 29 code ^= stack_frame->LookupDartCode(); |
26 if (code.is_optimized()) { | 30 if (code.is_optimized()) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 | 172 |
169 // Rethrow an error with a stacktrace. | 173 // Rethrow an error with a stacktrace. |
170 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { | 174 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { |
171 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); | 175 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); |
172 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); | 176 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); |
173 Exceptions::ReThrow(thread, error, stacktrace); | 177 Exceptions::ReThrow(thread, error, stacktrace); |
174 return Object::null(); | 178 return Object::null(); |
175 } | 179 } |
176 | 180 |
177 } // namespace dart | 181 } // namespace dart |
OLD | NEW |