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

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

Issue 2625613002: Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmall… (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « runtime/platform/assert.h ('k') | runtime/vm/malloc_hooks.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
11 #include "vm/class_finalizer.h" 11 #include "vm/class_finalizer.h"
12 #include "vm/clustered_snapshot.h" 12 #include "vm/clustered_snapshot.h"
13 #include "vm/compiler.h" 13 #include "vm/compiler.h"
14 #include "vm/dart.h" 14 #include "vm/dart.h"
15 #include "vm/dart_api_impl.h" 15 #include "vm/dart_api_impl.h"
16 #include "vm/dart_api_message.h" 16 #include "vm/dart_api_message.h"
17 #include "vm/dart_api_state.h" 17 #include "vm/dart_api_state.h"
18 #include "vm/dart_entry.h" 18 #include "vm/dart_entry.h"
19 #include "vm/debugger.h" 19 #include "vm/debugger.h"
20 #if !defined(DART_PRECOMPILED_RUNTIME) 20 #if !defined(DART_PRECOMPILED_RUNTIME)
21 #include "vm/kernel_reader.h" 21 #include "vm/kernel_reader.h"
22 #endif 22 #endif
23 #include "vm/exceptions.h" 23 #include "vm/exceptions.h"
24 #include "vm/flags.h" 24 #include "vm/flags.h"
25 #include "vm/growable_array.h" 25 #include "vm/growable_array.h"
26 #include "vm/lockers.h" 26 #include "vm/lockers.h"
27 #include "vm/isolate_reload.h" 27 #include "vm/isolate_reload.h"
28 #include "vm/kernel_isolate.h" 28 #include "vm/kernel_isolate.h"
29 #include "vm/malloc_hooks.h"
29 #include "vm/message.h" 30 #include "vm/message.h"
30 #include "vm/message_handler.h" 31 #include "vm/message_handler.h"
31 #include "vm/native_entry.h" 32 #include "vm/native_entry.h"
32 #include "vm/object.h" 33 #include "vm/object.h"
33 #include "vm/object_store.h" 34 #include "vm/object_store.h"
34 #include "vm/os_thread.h" 35 #include "vm/os_thread.h"
35 #include "vm/os.h" 36 #include "vm/os.h"
36 #include "vm/port.h" 37 #include "vm/port.h"
37 #include "vm/precompiler.h" 38 #include "vm/precompiler.h"
38 #include "vm/profiler.h" 39 #include "vm/profiler.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 "Dart_Initialize: " 1166 "Dart_Initialize: "
1166 "Dart_InitializeParams is null."); 1167 "Dart_InitializeParams is null.");
1167 } 1168 }
1168 1169
1169 if (params->version != DART_INITIALIZE_PARAMS_CURRENT_VERSION) { 1170 if (params->version != DART_INITIALIZE_PARAMS_CURRENT_VERSION) {
1170 return strdup( 1171 return strdup(
1171 "Dart_Initialize: " 1172 "Dart_Initialize: "
1172 "Invalid Dart_InitializeParams version."); 1173 "Invalid Dart_InitializeParams version.");
1173 } 1174 }
1174 1175
1176 MallocHooks::Init();
1177
1175 return Dart::InitOnce(params->vm_isolate_snapshot, 1178 return Dart::InitOnce(params->vm_isolate_snapshot,
1176 params->instructions_snapshot, params->data_snapshot, 1179 params->instructions_snapshot, params->data_snapshot,
1177 params->create, params->shutdown, params->thread_exit, 1180 params->create, params->shutdown, params->thread_exit,
1178 params->file_open, params->file_read, 1181 params->file_open, params->file_read,
1179 params->file_write, params->file_close, 1182 params->file_write, params->file_close,
1180 params->entropy_source, params->get_service_assets); 1183 params->entropy_source, params->get_service_assets);
1181 } 1184 }
1182 1185
1183 1186
1184 DART_EXPORT char* Dart_Cleanup() { 1187 DART_EXPORT char* Dart_Cleanup() {
1185 CHECK_NO_ISOLATE(Isolate::Current()); 1188 CHECK_NO_ISOLATE(Isolate::Current());
1186 const char* err_msg = Dart::Cleanup(); 1189 const char* err_msg = Dart::Cleanup();
1190 MallocHooks::TearDown();
1187 if (err_msg != NULL) { 1191 if (err_msg != NULL) {
1188 return strdup(err_msg); 1192 return strdup(err_msg);
1189 } 1193 }
1190 return NULL; 1194 return NULL;
1191 } 1195 }
1192 1196
1193 1197
1194 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) { 1198 DART_EXPORT bool Dart_SetVMFlags(int argc, const char** argv) {
1195 return Flags::ProcessCommandLineFlags(argc, argv); 1199 return Flags::ProcessCommandLineFlags(argc, argv);
1196 } 1200 }
(...skipping 5618 matching lines...) Expand 10 before | Expand all | Expand 10 after
6815 } 6819 }
6816 6820
6817 6821
6818 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6822 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6819 #ifndef PRODUCT 6823 #ifndef PRODUCT
6820 Profiler::DumpStackTrace(context); 6824 Profiler::DumpStackTrace(context);
6821 #endif 6825 #endif
6822 } 6826 }
6823 6827
6824 } // namespace dart 6828 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/assert.h ('k') | runtime/vm/malloc_hooks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698