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

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

Powered by Google App Engine
This is Rietveld 408576698