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

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

Issue 297183003: Reduce CPU usage when no isolates need to be profiled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
11 #include "vm/class_finalizer.h" 11 #include "vm/class_finalizer.h"
12 #include "vm/compiler.h" 12 #include "vm/compiler.h"
13 #include "vm/dart.h" 13 #include "vm/dart.h"
14 #include "vm/dart_api_impl.h" 14 #include "vm/dart_api_impl.h"
15 #include "vm/dart_api_message.h" 15 #include "vm/dart_api_message.h"
16 #include "vm/dart_api_state.h" 16 #include "vm/dart_api_state.h"
17 #include "vm/dart_entry.h" 17 #include "vm/dart_entry.h"
18 #include "vm/debuginfo.h" 18 #include "vm/debuginfo.h"
19 #include "vm/exceptions.h" 19 #include "vm/exceptions.h"
20 #include "vm/flags.h" 20 #include "vm/flags.h"
21 #include "vm/growable_array.h" 21 #include "vm/growable_array.h"
22 #include "vm/message.h" 22 #include "vm/message.h"
23 #include "vm/message_handler.h" 23 #include "vm/message_handler.h"
24 #include "vm/native_entry.h" 24 #include "vm/native_entry.h"
25 #include "vm/object.h" 25 #include "vm/object.h"
26 #include "vm/object_store.h" 26 #include "vm/object_store.h"
27 #include "vm/port.h" 27 #include "vm/port.h"
28 #include "vm/profiler.h"
28 #include "vm/resolver.h" 29 #include "vm/resolver.h"
29 #include "vm/reusable_handles.h" 30 #include "vm/reusable_handles.h"
30 #include "vm/service.h" 31 #include "vm/service.h"
31 #include "vm/stack_frame.h" 32 #include "vm/stack_frame.h"
32 #include "vm/symbols.h" 33 #include "vm/symbols.h"
33 #include "vm/tags.h" 34 #include "vm/tags.h"
34 #include "vm/timer.h" 35 #include "vm/timer.h"
35 #include "vm/unicode.h" 36 #include "vm/unicode.h"
36 #include "vm/verifier.h" 37 #include "vm/verifier.h"
37 #include "vm/version.h" 38 #include "vm/version.h"
(...skipping 4983 matching lines...) Expand 10 before | Expand all | Expand 10 after
5021 } 5022 }
5022 { 5023 {
5023 NoGCScope no_gc; 5024 NoGCScope no_gc;
5024 RawObject* raw_obj = obj.raw(); 5025 RawObject* raw_obj = obj.raw();
5025 isolate->heap()->SetPeer(raw_obj, peer); 5026 isolate->heap()->SetPeer(raw_obj, peer);
5026 } 5027 }
5027 return Api::Success(); 5028 return Api::Success();
5028 } 5029 }
5029 5030
5030 5031
5032 // --- Profiler support ---
5033
5034 DART_EXPORT void Dart_BlockProfiler() {
5035 Isolate* isolate = Isolate::Current();
5036 CHECK_ISOLATE(isolate);
5037 IsolateProfilerData* profiler_data = isolate->profiler_data();
5038 if (profiler_data == NULL) {
5039 return;
5040 }
5041 profiler_data->Block();
5042 }
5043
5044
5045 DART_EXPORT void Dart_UnblockProfiler() {
5046 Isolate* isolate = Isolate::Current();
5047 CHECK_ISOLATE(isolate);
5048 IsolateProfilerData* profiler_data = isolate->profiler_data();
5049 if (profiler_data == NULL) {
5050 return;
5051 }
5052 profiler_data->Unblock();
5053 }
5054
5055
5031 // --- Service support --- 5056 // --- Service support ---
5032 5057
5033 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { 5058 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) {
5034 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); 5059 return Api::CastIsolate(Service::GetServiceIsolate(callback_data));
5035 } 5060 }
5036 5061
5037 5062
5038 DART_EXPORT bool Dart_IsServiceRunning() { 5063 DART_EXPORT bool Dart_IsServiceRunning() {
5039 return Service::IsRunning(); 5064 return Service::IsRunning();
5040 } 5065 }
5041 5066
5042 5067
5043 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( 5068 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(
5044 const char* name, 5069 const char* name,
5045 Dart_ServiceRequestCallback callback, 5070 Dart_ServiceRequestCallback callback,
5046 void* user_data) { 5071 void* user_data) {
5047 Service::RegisterIsolateEmbedderCallback(name, callback, user_data); 5072 Service::RegisterIsolateEmbedderCallback(name, callback, user_data);
5048 } 5073 }
5049 5074
5050 5075
5051 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5076 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5052 const char* name, 5077 const char* name,
5053 Dart_ServiceRequestCallback callback, 5078 Dart_ServiceRequestCallback callback,
5054 void* user_data) { 5079 void* user_data) {
5055 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5080 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5056 } 5081 }
5057 5082
5058 } // namespace dart 5083 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698