Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
| index 31b8c9e147bd5b88ac54da97348e9de717d05e3b..c3f9dbb78836020a112b9f0937a54887393c4e4b 100644 |
| --- a/runtime/vm/isolate.cc |
| +++ b/runtime/vm/isolate.cc |
| @@ -16,6 +16,7 @@ |
| #include "vm/deopt_instructions.h" |
| #include "vm/heap.h" |
| #include "vm/lockers.h" |
| +#include "vm/log.h" |
| #include "vm/message_handler.h" |
| #include "vm/object_id_ring.h" |
| #include "vm/object_store.h" |
| @@ -46,7 +47,7 @@ DEFINE_FLAG(bool, pause_isolates_on_exit, false, |
| DEFINE_FLAG(bool, break_at_isolate_spawn, false, |
| "Insert a one-time breakpoint at the entrypoint for all spawned " |
| "isolates"); |
| - |
| +DEFINE_FLAG(charp, isolate_log_filter, NULL, "Log only named isolate."); |
|
koda
2015/02/09 17:57:29
This is actually a substring filter, so say that.
Cutch
2015/02/09 18:19:39
Done.
|
| // Quick access to the locally defined isolate() method. |
| #define I (isolate()) |
| @@ -475,6 +476,8 @@ Isolate::Isolate() |
| gc_epilogue_callback_(NULL), |
| defer_finalization_count_(0), |
| deopt_context_(NULL), |
| + service_isolate_(false), |
| + log_(new class Log()), |
| stacktrace_(NULL), |
| stack_frame_index_(-1), |
| last_allocationprofile_accumulator_reset_timestamp_(0), |
| @@ -534,6 +537,8 @@ Isolate::Isolate(Isolate* original) |
| gc_epilogue_callback_(NULL), |
| defer_finalization_count_(0), |
| deopt_context_(NULL), |
| + service_isolate_(false), |
| + log_(new class Log()), |
| stacktrace_(NULL), |
| stack_frame_index_(-1), |
| last_allocationprofile_accumulator_reset_timestamp_(0), |
| @@ -571,6 +576,8 @@ Isolate::~Isolate() { |
| message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. |
| ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted. |
| delete spawn_state_; |
| + delete log_; |
| + log_ = NULL; |
| } |
| @@ -695,6 +702,23 @@ void Isolate::BuildName(const char* name_prefix) { |
| } |
| +Log* Isolate::Log() const { |
| + if (FLAG_isolate_log_filter == NULL) { |
| + if (service_isolate_) { |
| + // By default, do not log for the service isolate. |
| + return Log::NoOpLog(); |
| + } |
| + return log_; |
| + } |
| + ASSERT(name_ != NULL); |
| + if (strstr(name_, FLAG_isolate_log_filter) == NULL) { |
| + // Filter does not match, do not log for this isolate. |
| + return Log::NoOpLog(); |
| + } |
| + return log_; |
| +} |
| + |
| + |
| // TODO(5411455): Use flag to override default value and Validate the |
| // stack size by querying OS. |
| uword Isolate::GetSpecifiedStackSize() { |