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

Unified Diff: runtime/vm/thread.cc

Issue 2762323002: Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previo… (Closed)
Patch Set: Final change Created 3 years, 9 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 | « runtime/vm/thread.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.cc
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 69a30fd434059dc79c7dd95c6d0eaffd48f2594a..507eebc3e48d0645a9723bdde378221eb2342cfc 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -49,7 +49,6 @@ Thread::~Thread() {
thread_lock_ = NULL;
}
-
#if defined(DEBUG)
#define REUSABLE_HANDLE_SCOPE_INIT(object) \
reusable_##object##_handle_scope_active_(false),
@@ -75,8 +74,8 @@ Thread::Thread(Isolate* isolate)
os_thread_(NULL),
thread_lock_(new Monitor()),
zone_(NULL),
- current_thread_memory_(0),
- memory_high_watermark_(0),
+ current_zone_capacity_(0),
+ zone_high_watermark_(0),
api_reusable_scope_(NULL),
api_top_scope_(NULL),
top_resource_(NULL),
@@ -137,15 +136,15 @@ Thread::Thread(Isolate* isolate)
// This thread should not yet own any zones. If it does, we need to make sure
// we've accounted for any memory it has already allocated.
if (zone_ == NULL) {
- ASSERT(current_thread_memory_ == 0);
+ ASSERT(current_zone_capacity_ == 0);
} else {
Zone* current = zone_;
uintptr_t total_zone_capacity = 0;
while (current != NULL) {
- total_zone_capacity += static_cast<uintptr_t>(current->CapacityInBytes());
+ total_zone_capacity += current->CapacityInBytes();
current = current->previous();
}
- ASSERT(current_thread_memory_ == total_zone_capacity);
+ ASSERT(current_zone_capacity_ == total_zone_capacity);
}
}
@@ -229,7 +228,8 @@ void Thread::PrintJSON(JSONStream* stream) const {
jsobj.AddPropertyF("id", "threads/%" Pd "",
OSThread::ThreadIdToIntPtr(os_thread()->trace_id()));
jsobj.AddProperty("kind", TaskKindToCString(task_kind()));
- jsobj.AddPropertyF("_memoryHighWatermark", "%" Pu "", memory_high_watermark_);
+ jsobj.AddPropertyF("_zoneHighWatermark", "%" Pu "", zone_high_watermark_);
+ jsobj.AddPropertyF("_zoneCapacity", "%" Pu "", current_zone_capacity_);
}
#endif
« no previous file with comments | « runtime/vm/thread.h ('k') | runtime/vm/thread_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698