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

Unified Diff: vm/dart_api_state.h

Issue 11879005: Added code to trace zone and handles creation/deletion under flags (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | vm/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/dart_api_state.h
===================================================================
--- vm/dart_api_state.h (revision 16932)
+++ vm/dart_api_state.h (working copy)
@@ -21,6 +21,9 @@
namespace dart {
+DECLARE_DEBUG_FLAG(bool, trace_zones);
+DECLARE_DEBUG_FLAG(bool, trace_handles);
+
// Implementation of Zone support for very fast allocation of small chunks
// of memory. The chunks cannot be deallocated individually, but instead
// zones support deallocating all chunks in one fast operation when the
@@ -35,6 +38,13 @@
if (isolate != NULL) {
isolate->set_current_zone(&zone_);
}
+#ifdef DEBUG
+ if (FLAG_trace_zones) {
+ OS::PrintErr("*** Starting a new Api zone 0x%"Px"(0x%"Px")\n",
+ reinterpret_cast<intptr_t>(this),
+ reinterpret_cast<intptr_t>(&zone_));
+ }
+#endif
}
// Delete all memory associated with the zone.
@@ -43,6 +53,13 @@
if (isolate != NULL && isolate->current_zone() == &zone_) {
isolate->set_current_zone(zone_.previous_);
}
+#ifdef DEBUG
+ if (FLAG_trace_zones) {
+ OS::PrintErr("*** Deleting Api zone 0x%"Px"(0x%"Px")\n",
+ reinterpret_cast<intptr_t>(this),
+ reinterpret_cast<intptr_t>(&zone_));
+ }
+#endif
}
// Allocates an array sized to hold 'len' elements of type
@@ -220,8 +237,25 @@
public:
LocalHandles() : Handles<kLocalHandleSizeInWords,
kLocalHandlesPerChunk,
- kOffsetOfRawPtrInLocalHandle>() { }
- ~LocalHandles() { }
+ kOffsetOfRawPtrInLocalHandle>() {
+#ifdef DEBUG
+ if (FLAG_trace_handles) {
+ OS::PrintErr("*** Starting a new Local handle block 0x%"Px"\n",
+ reinterpret_cast<intptr_t>(this));
+ }
+#endif
+ }
+ ~LocalHandles() {
+#ifdef DEBUG
+ if (FLAG_trace_handles) {
+ OS::PrintErr("*** Handle Counts for 0x(%"Px"):Scoped = %d\n",
+ reinterpret_cast<intptr_t>(this),
+ CountHandles());
+ OS::PrintErr("*** Deleting Local handle block 0x%"Px"\n",
+ reinterpret_cast<intptr_t>(this));
+ }
+#endif
+ }
// Visit all object pointers stored in the various handles.
@@ -265,9 +299,25 @@
PersistentHandles() : Handles<kPersistentHandleSizeInWords,
kPersistentHandlesPerChunk,
kOffsetOfRawPtrInPersistentHandle>(),
- free_list_(NULL) { }
+ free_list_(NULL) {
+#ifdef DEBUG
+ if (FLAG_trace_handles) {
+ OS::PrintErr("*** Starting a new Persistent handle block 0x%"Px"\n",
+ reinterpret_cast<intptr_t>(this));
+ }
+#endif
+ }
~PersistentHandles() {
free_list_ = NULL;
+#ifdef DEBUG
+ if (FLAG_trace_handles) {
+ OS::PrintErr("*** Handle Counts for 0x(%"Px"):Scoped = %d\n",
+ reinterpret_cast<intptr_t>(this),
+ CountHandles());
+ OS::PrintErr("*** Deleting Persistent handle block 0x%"Px"\n",
+ reinterpret_cast<intptr_t>(this));
+ }
+#endif
}
// Accessors.
« no previous file with comments | « no previous file | vm/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698