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

Unified Diff: runtime/vm/thread.h

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/service.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread.h
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index d9f227b83f32b56057992677cc834648582aaeb8..7e8553c9adb5607361395658cab6d3703cfdf860 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -14,7 +14,6 @@
#include "vm/os_thread.h"
#include "vm/store_buffer.h"
#include "vm/runtime_entry_list.h"
-
namespace dart {
class AbstractType;
@@ -266,21 +265,23 @@ class Thread : public BaseThread {
bool ZoneIsOwnedByThread(Zone* zone) const;
- void IncrementMemoryUsage(uintptr_t value) {
- current_thread_memory_ += value;
- if (current_thread_memory_ > memory_high_watermark_) {
- memory_high_watermark_ = current_thread_memory_;
+ void IncrementMemoryCapacity(uintptr_t value) {
+ current_zone_capacity_ += value;
+ if (current_zone_capacity_ > zone_high_watermark_) {
+ zone_high_watermark_ = current_zone_capacity_;
}
}
- void DecrementMemoryUsage(uintptr_t value) {
- ASSERT(current_thread_memory_ >= value);
- current_thread_memory_ -= value;
+ void DecrementMemoryCapacity(uintptr_t value) {
+ ASSERT(current_zone_capacity_ >= value);
+ current_zone_capacity_ -= value;
}
- uintptr_t memory_high_watermark() const { return memory_high_watermark_; }
+ uintptr_t current_zone_capacity() { return current_zone_capacity_; }
+
+ uintptr_t zone_high_watermark() const { return zone_high_watermark_; }
- void ResetHighWatermark() { memory_high_watermark_ = current_thread_memory_; }
+ void ResetHighWatermark() { zone_high_watermark_ = current_zone_capacity_; }
// The reusable api local scope for this thread.
ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; }
@@ -717,8 +718,8 @@ class Thread : public BaseThread {
OSThread* os_thread_;
Monitor* thread_lock_;
Zone* zone_;
- uintptr_t current_thread_memory_;
- uintptr_t memory_high_watermark_;
+ uintptr_t current_zone_capacity_;
+ uintptr_t zone_high_watermark_;
ApiLocalScope* api_reusable_scope_;
ApiLocalScope* api_top_scope_;
StackResource* top_resource_;
@@ -803,7 +804,6 @@ class Thread : public BaseThread {
friend class Simulator;
friend class StackZone;
friend class ThreadRegistry;
-
DISALLOW_COPY_AND_ASSIGN(Thread);
};
« no previous file with comments | « runtime/vm/service.cc ('k') | runtime/vm/thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698