Chromium Code Reviews| Index: runtime/vm/isolate.cc |
| diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc |
| index 8304532470999c81ea515843ad6496c8348db0f3..4e887a8c22501228a0fd94105133ccaa45c1fa2b 100644 |
| --- a/runtime/vm/isolate.cc |
| +++ b/runtime/vm/isolate.cc |
| @@ -776,6 +776,7 @@ Isolate::Isolate(const Dart_IsolateFlags& api_flags) |
| single_step_(false), |
| thread_registry_(new ThreadRegistry()), |
| safepoint_handler_(new SafepointHandler(this)), |
| + memory_high_watermark_(0), |
| message_notify_callback_(NULL), |
| name_(NULL), |
| debugger_name_(NULL), |
| @@ -2103,7 +2104,8 @@ void Isolate::PrintJSON(JSONStream* stream, bool ref) { |
| } |
| } |
| - jsobj.AddProperty("threads", thread_registry_); |
| + jsobj.AddPropertyF("_memoryHighWatermark", "%u", memory_high_watermark_); |
| + jsobj.AddProperty("_threads", thread_registry_); |
| } |
| #endif |
| @@ -2653,6 +2655,8 @@ Thread* Isolate::ScheduleThread(bool is_mutator, bool bypass_safepoint) { |
| thread = thread_registry()->GetFreeThreadLocked(this, is_mutator); |
| ASSERT(thread != NULL); |
| + thread->ResetHighWatermark(); |
| + |
| // Set up other values and set the TLS value. |
| thread->isolate_ = this; |
| ASSERT(heap() != NULL); |
| @@ -2699,6 +2703,7 @@ void Isolate::UnscheduleThread(Thread* thread, |
| // Ensure that the thread reports itself as being at a safepoint. |
| thread->EnterSafepoint(); |
| } |
| + UpdateMemoryHighWatermark(); |
| OSThread* os_thread = thread->os_thread(); |
| ASSERT(os_thread != NULL); |
| os_thread->DisableThreadInterrupts(); |
| @@ -2719,6 +2724,15 @@ void Isolate::UnscheduleThread(Thread* thread, |
| } |
| +void Isolate::UpdateMemoryHighWatermark() { |
| + const uint thread_watermarks_total = |
|
bkonyi
2017/01/04 23:49:52
This is the line that was causing the failure. Cha
zra
2017/01/04 23:53:26
Should this be uintptr_t?
bkonyi
2017/01/05 00:09:02
I'm not certain myself. John had said I should be
bkonyi
2017/01/05 14:36:28
Done.
|
| + thread_registry()->ThreadHighWatermarksTotalLocked(); |
| + if (thread_watermarks_total > memory_high_watermark_) { |
| + memory_high_watermark_ = thread_watermarks_total; |
| + } |
| +} |
| + |
| + |
| static RawInstance* DeserializeObject(Thread* thread, |
| uint8_t* obj_data, |
| intptr_t obj_len) { |