Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1412733008: Switch profiler from isolates to threads (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 // TODO(16615): Validate isolate parameter. 1456 // TODO(16615): Validate isolate parameter.
1457 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1457 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1458 if (iso->HasMutatorThread()) { 1458 if (iso->HasMutatorThread()) {
1459 FATAL("Multiple mutators within one isolate is not supported."); 1459 FATAL("Multiple mutators within one isolate is not supported.");
1460 } 1460 }
1461 Thread::EnsureInit(); 1461 Thread::EnsureInit();
1462 Thread::EnterIsolate(iso); 1462 Thread::EnterIsolate(iso);
1463 } 1463 }
1464 1464
1465 1465
1466 DART_EXPORT void Dart_IsolateBlocked() { 1466 DART_EXPORT void Dart_ThreadDisableProfiling() {
1467 Isolate* isolate = Isolate::Current(); 1467 Thread* T = Thread::Current();
1468 CHECK_ISOLATE(isolate); 1468 if (T == NULL) {
1469 IsolateProfilerData* profiler_data = isolate->profiler_data();
1470 if (profiler_data == NULL) {
1471 return; 1469 return;
1472 } 1470 }
1473 profiler_data->Block(); 1471 T->DisableThreadInterrupts();
1474 } 1472 }
1475 1473
1476 1474
1477 DART_EXPORT void Dart_IsolateUnblocked() { 1475 DART_EXPORT void Dart_ThreadEnableProfiling() {
1478 Isolate* isolate = Isolate::Current(); 1476 Thread* T = Thread::Current();
1479 CHECK_ISOLATE(isolate); 1477 if (T == NULL) {
1480 IsolateProfilerData* profiler_data = isolate->profiler_data();
1481 if (profiler_data == NULL) {
1482 return; 1478 return;
1483 } 1479 }
1484 profiler_data->Unblock(); 1480 T->EnableThreadInterrupts();
1485 } 1481 }
1486 1482
1487 1483
1488 DART_EXPORT void Dart_ExitIsolate() { 1484 DART_EXPORT void Dart_ExitIsolate() {
1489 CHECK_ISOLATE(Isolate::Current()); 1485 CHECK_ISOLATE(Isolate::Current());
1490 Thread::ExitIsolate(); 1486 Thread::ExitIsolate();
1491 } 1487 }
1492 1488
1493 1489
1494 // TODO(iposva): Remove this API and instead expose the underlying flags. 1490 // TODO(iposva): Remove this API and instead expose the underlying flags.
(...skipping 4577 matching lines...) Expand 10 before | Expand all | Expand 10 after
6072 ApiReallocate); 6068 ApiReallocate);
6073 writer.WriteFullSnapshot(); 6069 writer.WriteFullSnapshot();
6074 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); 6070 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
6075 *isolate_snapshot_size = writer.IsolateSnapshotSize(); 6071 *isolate_snapshot_size = writer.IsolateSnapshotSize();
6076 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); 6072 *instructions_snapshot_size = writer.InstructionsSnapshotSize();
6077 6073
6078 return Api::Success(); 6074 return Api::Success();
6079 } 6075 }
6080 6076
6081 } // namespace dart 6077 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698