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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 uword stack_pointer, | 273 uword stack_pointer, |
274 uword frame_pointer, | 274 uword frame_pointer, |
275 const Object& exception_object, | 275 const Object& exception_object, |
276 const Object& stacktrace_object) { | 276 const Object& stacktrace_object) { |
277 // The no_gc StackResource is unwound through the tear down of | 277 // The no_gc StackResource is unwound through the tear down of |
278 // stack resources below. | 278 // stack resources below. |
279 NoGCScope no_gc; | 279 NoGCScope no_gc; |
280 RawObject* raw_exception = exception_object.raw(); | 280 RawObject* raw_exception = exception_object.raw(); |
281 RawObject* raw_stacktrace = stacktrace_object.raw(); | 281 RawObject* raw_stacktrace = stacktrace_object.raw(); |
282 | 282 |
283 // The following operation is part of the 'epilogue' of the CallToRuntime, | |
284 // CallBootstrapCFunction, and CallNativeCFunction stubs. In the case of an | |
285 // exception, we skip the epilogues and must set the correct state here. | |
286 // The other operations performed as part of the 'epilogue' are handled | |
287 // by the simulator's Longjmp or the JumpToExceptionHandler stub. | |
288 isolate->set_top_context(Context::null()); | |
289 | |
290 #if defined(USING_SIMULATOR) | 283 #if defined(USING_SIMULATOR) |
291 // Unwinding of the C++ frames and destroying of their stack resources is done | 284 // Unwinding of the C++ frames and destroying of their stack resources is done |
292 // by the simulator, because the target stack_pointer is a simulated stack | 285 // by the simulator, because the target stack_pointer is a simulated stack |
293 // pointer and not the C++ stack pointer. | 286 // pointer and not the C++ stack pointer. |
294 | 287 |
295 // Continue simulating at the given pc in the given frame after setting up the | 288 // Continue simulating at the given pc in the given frame after setting up the |
296 // exception object in the kExceptionObjectReg register and the stacktrace | 289 // exception object in the kExceptionObjectReg register and the stacktrace |
297 // object (may be raw null) in the kStackTraceObjectReg register. | 290 // object (may be raw null) in the kStackTraceObjectReg register. |
298 | 291 |
299 Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer, | 292 Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer, |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 | 771 |
779 // Throw JavascriptCompatibilityError exception. | 772 // Throw JavascriptCompatibilityError exception. |
780 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { | 773 void Exceptions::ThrowJavascriptCompatibilityError(const char* msg) { |
781 const Array& exc_args = Array::Handle(Array::New(1)); | 774 const Array& exc_args = Array::Handle(Array::New(1)); |
782 const String& msg_str = String::Handle(String::New(msg)); | 775 const String& msg_str = String::Handle(String::New(msg)); |
783 exc_args.SetAt(0, msg_str); | 776 exc_args.SetAt(0, msg_str); |
784 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); | 777 Exceptions::ThrowByType(Exceptions::kJavascriptCompatibilityError, exc_args); |
785 } | 778 } |
786 | 779 |
787 } // namespace dart | 780 } // namespace dart |
OLD | NEW |