OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1443 DART_EXPORT void Dart_SetPausedOnExit(bool paused) { | 1443 DART_EXPORT void Dart_SetPausedOnExit(bool paused) { |
1444 Isolate* isolate = Isolate::Current(); | 1444 Isolate* isolate = Isolate::Current(); |
1445 CHECK_ISOLATE(isolate); | 1445 CHECK_ISOLATE(isolate); |
1446 NoSafepointScope no_safepoint_scope; | 1446 NoSafepointScope no_safepoint_scope; |
1447 if (isolate->message_handler()->is_paused_on_exit() != paused) { | 1447 if (isolate->message_handler()->is_paused_on_exit() != paused) { |
1448 isolate->message_handler()->PausedOnExit(paused); | 1448 isolate->message_handler()->PausedOnExit(paused); |
1449 } | 1449 } |
1450 } | 1450 } |
1451 | 1451 |
1452 | 1452 |
1453 DART_EXPORT void Dart_SetStickyError(Dart_Handle error) { | |
1454 Thread* thread = Thread::Current(); | |
1455 Isolate* isolate = thread->isolate(); | |
1456 CHECK_ISOLATE(isolate); | |
siva
2016/08/08 17:53:45
Probably better to create a scope here as we will
Cutch
2016/08/08 19:14:30
Done.
| |
1457 NoSafepointScope no_safepoint_scope; | |
1458 if (isolate->sticky_error() != Error::null()) { | |
1459 FATAL1("%s expects there to be no sticky error.", CURRENT_FUNC); | |
1460 } | |
1461 if (!Dart_IsUnhandledExceptionError(error)) { | |
1462 FATAL1("%s expects the error to be an unhandled exception error.", | |
1463 CURRENT_FUNC); | |
1464 } | |
1465 isolate->SetStickyError( | |
1466 Api::UnwrapErrorHandle(thread->zone(), error).raw()); | |
siva
2016/08/08 17:53:45
you could use Z here instead of thread->zone() to
Cutch
2016/08/08 19:14:30
Done.
| |
1467 } | |
1468 | |
1469 | |
1470 DART_EXPORT bool Dart_HasStickyError() { | |
1471 Isolate* isolate = Isolate::Current(); | |
1472 CHECK_ISOLATE(isolate); | |
1473 NoSafepointScope no_safepoint_scope; | |
1474 return isolate->sticky_error() != Error::null(); | |
1475 } | |
1476 | |
1477 | |
1453 DART_EXPORT void Dart_ExitIsolate() { | 1478 DART_EXPORT void Dart_ExitIsolate() { |
1454 Thread* T = Thread::Current(); | 1479 Thread* T = Thread::Current(); |
1455 CHECK_ISOLATE(T->isolate()); | 1480 CHECK_ISOLATE(T->isolate()); |
1456 // The Thread structure is disassociated from the isolate, we do the | 1481 // The Thread structure is disassociated from the isolate, we do the |
1457 // safepoint transition explicity here instead of using the TransitionXXX | 1482 // safepoint transition explicity here instead of using the TransitionXXX |
1458 // scope objects as the original transition happened outside this scope in | 1483 // scope objects as the original transition happened outside this scope in |
1459 // Dart_EnterIsolate/Dart_CreateIsolate. | 1484 // Dart_EnterIsolate/Dart_CreateIsolate. |
1460 ASSERT(T->execution_state() == Thread::kThreadInNative); | 1485 ASSERT(T->execution_state() == Thread::kThreadInNative); |
1461 T->ExitSafepoint(); | 1486 T->ExitSafepoint(); |
1462 T->set_execution_state(Thread::kThreadInVM); | 1487 T->set_execution_state(Thread::kThreadInVM); |
(...skipping 5099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6562 | 6587 |
6563 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6588 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
6564 #if defined(DART_PRECOMPILED_RUNTIME) | 6589 #if defined(DART_PRECOMPILED_RUNTIME) |
6565 return true; | 6590 return true; |
6566 #else | 6591 #else |
6567 return false; | 6592 return false; |
6568 #endif | 6593 #endif |
6569 } | 6594 } |
6570 | 6595 |
6571 } // namespace dart | 6596 } // namespace dart |
OLD | NEW |