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

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

Issue 2644903003: 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
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 "vm/dart.h" 5 #include "vm/dart.h"
6 6
7 #include "vm/become.h" 7 #include "vm/become.h"
8 #include "vm/clustered_snapshot.h" 8 #include "vm/clustered_snapshot.h"
9 #include "vm/code_observers.h" 9 #include "vm/code_observers.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
11 #include "vm/dart_api_state.h" 11 #include "vm/dart_api_state.h"
12 #include "vm/dart_entry.h" 12 #include "vm/dart_entry.h"
13 #include "vm/debugger.h" 13 #include "vm/debugger.h"
14 #include "vm/flags.h" 14 #include "vm/flags.h"
15 #include "vm/freelist.h" 15 #include "vm/freelist.h"
16 #include "vm/handles.h" 16 #include "vm/handles.h"
17 #include "vm/heap.h" 17 #include "vm/heap.h"
18 #include "vm/isolate.h" 18 #include "vm/isolate.h"
19 #include "vm/kernel_isolate.h" 19 #include "vm/kernel_isolate.h"
20 #include "vm/malloc_hooks.h"
20 #include "vm/message_handler.h" 21 #include "vm/message_handler.h"
21 #include "vm/metrics.h" 22 #include "vm/metrics.h"
22 #include "vm/object.h" 23 #include "vm/object.h"
23 #include "vm/object_store.h" 24 #include "vm/object_store.h"
24 #include "vm/object_id_ring.h" 25 #include "vm/object_id_ring.h"
25 #include "vm/port.h" 26 #include "vm/port.h"
26 #include "vm/profiler.h" 27 #include "vm/profiler.h"
27 #include "vm/service_isolate.h" 28 #include "vm/service_isolate.h"
28 #include "vm/simulator.h" 29 #include "vm/simulator.h"
29 #include "vm/snapshot.h" 30 #include "vm/snapshot.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 FLAG_verify_gc_contains = true; 148 FLAG_verify_gc_contains = true;
148 } 149 }
149 #endif 150 #endif
150 set_thread_exit_callback(thread_exit); 151 set_thread_exit_callback(thread_exit);
151 SetFileCallbacks(file_open, file_read, file_write, file_close); 152 SetFileCallbacks(file_open, file_read, file_write, file_close);
152 set_entropy_source_callback(entropy_source); 153 set_entropy_source_callback(entropy_source);
153 OS::InitOnce(); 154 OS::InitOnce();
154 start_time_micros_ = OS::GetCurrentMonotonicMicros(); 155 start_time_micros_ = OS::GetCurrentMonotonicMicros();
155 VirtualMemory::InitOnce(); 156 VirtualMemory::InitOnce();
156 OSThread::InitOnce(); 157 OSThread::InitOnce();
158 MallocHooks::InitOnce();
157 if (FLAG_support_timeline) { 159 if (FLAG_support_timeline) {
158 Timeline::InitOnce(); 160 Timeline::InitOnce();
159 } 161 }
160 NOT_IN_PRODUCT( 162 NOT_IN_PRODUCT(
161 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce")); 163 TimelineDurationScope tds(Timeline::GetVMStream(), "Dart::InitOnce"));
162 Isolate::InitOnce(); 164 Isolate::InitOnce();
163 PortMap::InitOnce(); 165 PortMap::InitOnce();
164 FreeListElement::InitOnce(); 166 FreeListElement::InitOnce();
165 ForwardingCorpse::InitOnce(); 167 ForwardingCorpse::InitOnce();
166 Api::InitOnce(); 168 Api::InitOnce();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (FLAG_support_timeline) { 486 if (FLAG_support_timeline) {
485 if (FLAG_trace_shutdown) { 487 if (FLAG_trace_shutdown) {
486 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n", 488 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n",
487 UptimeMillis()); 489 UptimeMillis());
488 } 490 }
489 Timeline::Shutdown(); 491 Timeline::Shutdown();
490 } 492 }
491 if (FLAG_trace_shutdown) { 493 if (FLAG_trace_shutdown) {
492 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis()); 494 OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis());
493 } 495 }
494 496 MallocHooks::TearDown();
495 return NULL; 497 return NULL;
496 } 498 }
497 499
498 500
499 Isolate* Dart::CreateIsolate(const char* name_prefix, 501 Isolate* Dart::CreateIsolate(const char* name_prefix,
500 const Dart_IsolateFlags& api_flags) { 502 const Dart_IsolateFlags& api_flags) {
501 // Create a new isolate. 503 // Create a new isolate.
502 Isolate* isolate = Isolate::Init(name_prefix, api_flags); 504 Isolate* isolate = Isolate::Init(name_prefix, api_flags);
503 return isolate; 505 return isolate;
504 } 506 }
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 return predefined_handles_->handles_.IsValidScopedHandle(address); 751 return predefined_handles_->handles_.IsValidScopedHandle(address);
750 } 752 }
751 753
752 754
753 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 755 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
754 ASSERT(predefined_handles_ != NULL); 756 ASSERT(predefined_handles_ != NULL);
755 return predefined_handles_->api_handles_.IsValidHandle(handle); 757 return predefined_handles_->api_handles_.IsValidHandle(handle);
756 } 758 }
757 759
758 } // namespace dart 760 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698