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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 // TODO(16615): Validate isolate parameter. | 1457 // TODO(16615): Validate isolate parameter. |
1458 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1458 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
1459 if (iso->HasMutatorThread()) { | 1459 if (iso->HasMutatorThread()) { |
1460 FATAL("Multiple mutators within one isolate is not supported."); | 1460 FATAL("Multiple mutators within one isolate is not supported."); |
1461 } | 1461 } |
1462 Thread::EnsureInit(); | 1462 Thread::EnsureInit(); |
1463 Thread::EnterIsolate(iso); | 1463 Thread::EnterIsolate(iso); |
1464 } | 1464 } |
1465 | 1465 |
1466 | 1466 |
1467 DART_EXPORT void Dart_ThreadDisableProfiling() { | 1467 DART_EXPORT void Dart_IsolateBlocked() { |
1468 Thread* T = Thread::Current(); | 1468 Isolate* isolate = Isolate::Current(); |
1469 if (T == NULL) { | 1469 CHECK_ISOLATE(isolate); |
| 1470 IsolateProfilerData* profiler_data = isolate->profiler_data(); |
| 1471 if (profiler_data == NULL) { |
1470 return; | 1472 return; |
1471 } | 1473 } |
1472 T->DisableThreadInterrupts(); | 1474 profiler_data->Block(); |
1473 } | 1475 } |
1474 | 1476 |
1475 | 1477 |
1476 DART_EXPORT void Dart_ThreadEnableProfiling() { | 1478 DART_EXPORT void Dart_IsolateUnblocked() { |
1477 Thread* T = Thread::Current(); | 1479 Isolate* isolate = Isolate::Current(); |
1478 if (T == NULL) { | 1480 CHECK_ISOLATE(isolate); |
| 1481 IsolateProfilerData* profiler_data = isolate->profiler_data(); |
| 1482 if (profiler_data == NULL) { |
1479 return; | 1483 return; |
1480 } | 1484 } |
1481 T->EnableThreadInterrupts(); | 1485 profiler_data->Unblock(); |
1482 } | 1486 } |
1483 | 1487 |
1484 | 1488 |
1485 DART_EXPORT void Dart_ExitIsolate() { | 1489 DART_EXPORT void Dart_ExitIsolate() { |
1486 CHECK_ISOLATE(Isolate::Current()); | 1490 CHECK_ISOLATE(Isolate::Current()); |
1487 Thread::ExitIsolate(); | 1491 Thread::ExitIsolate(); |
1488 } | 1492 } |
1489 | 1493 |
1490 | 1494 |
1491 // TODO(iposva): Remove this API and instead expose the underlying flags. | 1495 // TODO(iposva): Remove this API and instead expose the underlying flags. |
(...skipping 4591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6083 ApiReallocate); | 6087 ApiReallocate); |
6084 writer.WriteFullSnapshot(); | 6088 writer.WriteFullSnapshot(); |
6085 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6089 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
6086 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6090 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
6087 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 6091 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
6088 | 6092 |
6089 return Api::Success(); | 6093 return Api::Success(); |
6090 } | 6094 } |
6091 | 6095 |
6092 } // namespace dart | 6096 } // namespace dart |
OLD | NEW |