| 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 "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 | 1306 |
| 1307 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { | 1307 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { |
| 1308 CHECK_NO_ISOLATE(Isolate::Current()); | 1308 CHECK_NO_ISOLATE(Isolate::Current()); |
| 1309 // TODO(16615): Validate isolate parameter. | 1309 // TODO(16615): Validate isolate parameter. |
| 1310 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1310 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
| 1311 if (iso->HasMutatorThread()) { | 1311 if (iso->HasMutatorThread()) { |
| 1312 FATAL("Multiple mutators within one isolate is not supported."); | 1312 FATAL("Multiple mutators within one isolate is not supported."); |
| 1313 } | 1313 } |
| 1314 Thread::EnterIsolate(iso); | 1314 if (!Thread::EnterIsolate(iso)) { |
| 1315 FATAL("Unable to Enter Isolate as Dart VM is shutting down"); |
| 1316 } |
| 1315 } | 1317 } |
| 1316 | 1318 |
| 1317 | 1319 |
| 1318 DART_EXPORT void Dart_ThreadDisableProfiling() { | 1320 DART_EXPORT void Dart_ThreadDisableProfiling() { |
| 1319 OSThread* os_thread = OSThread::Current(); | 1321 OSThread* os_thread = OSThread::Current(); |
| 1320 if (os_thread == NULL) { | 1322 if (os_thread == NULL) { |
| 1321 return; | 1323 return; |
| 1322 } | 1324 } |
| 1323 os_thread->DisableThreadInterrupts(); | 1325 os_thread->DisableThreadInterrupts(); |
| 1324 } | 1326 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1520 Thread::ExitIsolate(); | 1522 Thread::ExitIsolate(); |
| 1521 RunLoopData data; | 1523 RunLoopData data; |
| 1522 data.monitor = &monitor; | 1524 data.monitor = &monitor; |
| 1523 data.done = false; | 1525 data.done = false; |
| 1524 I->message_handler()->Run( | 1526 I->message_handler()->Run( |
| 1525 Dart::thread_pool(), | 1527 Dart::thread_pool(), |
| 1526 NULL, RunLoopDone, reinterpret_cast<uword>(&data)); | 1528 NULL, RunLoopDone, reinterpret_cast<uword>(&data)); |
| 1527 while (!data.done) { | 1529 while (!data.done) { |
| 1528 ml.Wait(); | 1530 ml.Wait(); |
| 1529 } | 1531 } |
| 1530 Thread::EnterIsolate(I); | 1532 if (!Thread::EnterIsolate(I)) { |
| 1533 FATAL("Inconsistent state, VM shutting down while in run loop."); |
| 1534 } |
| 1531 } | 1535 } |
| 1532 if (I->object_store()->sticky_error() != Object::null()) { | 1536 if (I->object_store()->sticky_error() != Object::null()) { |
| 1533 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); | 1537 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); |
| 1534 I->object_store()->clear_sticky_error(); | 1538 I->object_store()->clear_sticky_error(); |
| 1535 return error; | 1539 return error; |
| 1536 } | 1540 } |
| 1537 if (FLAG_print_class_table) { | 1541 if (FLAG_print_class_table) { |
| 1538 HANDLESCOPE(T); | 1542 HANDLESCOPE(T); |
| 1539 I->class_table()->Print(); | 1543 I->class_table()->Print(); |
| 1540 } | 1544 } |
| (...skipping 4423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5964 ApiReallocate); | 5968 ApiReallocate); |
| 5965 writer.WriteFullSnapshot(); | 5969 writer.WriteFullSnapshot(); |
| 5966 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 5970 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 5967 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 5971 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 5968 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 5972 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
| 5969 | 5973 |
| 5970 return Api::Success(); | 5974 return Api::Success(); |
| 5971 } | 5975 } |
| 5972 | 5976 |
| 5973 } // namespace dart | 5977 } // namespace dart |
| OLD | NEW |