Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| =================================================================== |
| --- runtime/vm/isolate.cc (revision 23899) |
| +++ runtime/vm/isolate.cc (working copy) |
| @@ -14,6 +14,7 @@ |
| #include "vm/dart_entry.h" |
| #include "vm/debugger.h" |
| #include "vm/heap.h" |
| +#include "vm/heap_histogram.h" |
| #include "vm/message_handler.h" |
| #include "vm/object_store.h" |
| #include "vm/parser.h" |
| @@ -34,6 +35,13 @@ |
| "Trace isolate creation and shut down."); |
| DECLARE_FLAG(bool, trace_deoptimization_verbose); |
| + |
| +void Isolate::RegisterClass(const Class& cls) { |
| + class_table()->Register(cls); |
| + if (object_histogram() != NULL) object_histogram()->RegisterClass(cls); |
| +} |
| + |
| + |
| class IsolateMessageHandler : public MessageHandler { |
| public: |
| explicit IsolateMessageHandler(Isolate* isolate); |
| @@ -363,7 +371,7 @@ |
| } |
| -Isolate::Isolate() |
| +Isolate::Isolate(bool is_vm_isolate) |
| : store_buffer_(), |
| message_notify_callback_(NULL), |
| name_(NULL), |
| @@ -400,7 +408,11 @@ |
| deferred_objects_count_(0), |
| deferred_objects_(NULL), |
| stacktrace_(NULL), |
| - stack_frame_index_(-1) { |
| + stack_frame_index_(-1), |
| + object_histogram_(NULL) { |
| + if (FLAG_print_object_histogram && !is_vm_isolate) { |
|
Ivan Posva
2013/06/12 15:18:09
if (FLAG_print_object_histogram && (Dart::vm_isol
bakster
2013/06/12 15:42:42
Seems flaky to me but, I'll change it.
On 2013/06
|
| + object_histogram_ = new ObjectHistogram(this); |
| + } |
| } |
| @@ -418,6 +430,7 @@ |
| mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. |
| delete message_handler_; |
| message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. |
| + delete object_histogram_; |
| } |
| void Isolate::SetCurrent(Isolate* current) { |
| @@ -440,8 +453,8 @@ |
| } |
| -Isolate* Isolate::Init(const char* name_prefix) { |
| - Isolate* result = new Isolate(); |
| +Isolate* Isolate::Init(const char* name_prefix, bool is_vm_isolate) { |
| + Isolate* result = new Isolate(is_vm_isolate); |
| ASSERT(result != NULL); |
| // TODO(5411455): For now just set the recently created isolate as |
| @@ -729,6 +742,12 @@ |
| ASSERT(top_resource() == NULL); |
| ASSERT((heap_ == NULL) || heap_->Verify()); |
| + if (FLAG_print_object_histogram) { |
| + StackZone stack_zone(this); |
|
Ivan Posva
2013/06/12 15:18:09
Please move the HandleScope from within Print here
bakster
2013/06/12 15:42:42
Done.
|
| + heap()->CollectAllGarbage(); |
| + object_histogram()->Print(); |
| + } |
| + |
| // Clean up debugger resources. Shutting down the debugger |
| // requires a handle zone. We must set up a temporary zone because |
| // Isolate::Shutdown is called without a zone. |