| Index: runtime/vm/isolate.cc
|
| ===================================================================
|
| --- runtime/vm/isolate.cc (revision 23906)
|
| +++ 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);
|
| @@ -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 && (Dart::vm_isolate() != NULL)) {
|
| + 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) {
|
| @@ -729,6 +742,13 @@
|
| ASSERT(top_resource() == NULL);
|
| ASSERT((heap_ == NULL) || heap_->Verify());
|
|
|
| + if (FLAG_print_object_histogram) {
|
| + StackZone stack_zone(this);
|
| + HandleScope handle_scope(this);
|
| + 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.
|
|
|