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

Unified Diff: runtime/vm/zone.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/thread_test.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/zone.h
diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h
index d73398bfe40588de5cf144578152612e4e6889bc..349168194824eb62a1f3f17d9a0baf53ece3bded 100644
--- a/runtime/vm/zone.h
+++ b/runtime/vm/zone.h
@@ -64,10 +64,10 @@ class Zone {
// Compute the total size of this zone. This includes wasted space that is
// due to internal fragmentation in the segments.
- intptr_t SizeInBytes() const;
+ uintptr_t SizeInBytes() const;
// Computes the amount of space used in the zone.
- intptr_t CapacityInBytes() const;
+ uintptr_t CapacityInBytes() const;
// Structure for managing handles allocation.
VMHandles* handles() { return &handles_; }
@@ -76,10 +76,6 @@ class Zone {
Zone* previous() const { return previous_; }
-#ifndef PRODUCT
- void PrintJSON(JSONStream* stream) const;
-#endif
-
private:
Zone();
~Zone(); // Delete all memory associated with the zone.
@@ -180,7 +176,7 @@ class StackZone : public StackResource {
// Compute the total size of this zone. This includes wasted space that is
// due to internal fragmentation in the segments.
- intptr_t SizeInBytes() const { return zone_.SizeInBytes(); }
+ uintptr_t SizeInBytes() const { return zone_.SizeInBytes(); }
// Computes the used space in the zone.
intptr_t CapacityInBytes() const { return zone_.CapacityInBytes(); }
@@ -200,7 +196,6 @@ class StackZone : public StackResource {
inline uword Zone::AllocUnsafe(intptr_t size) {
ASSERT(size >= 0);
-
// Round up the requested size to fit the alignment.
if (size > (kIntptrMax - kAlignment)) {
FATAL1("Zone::Alloc: 'size' is too large: size=%" Pd "", size);
@@ -252,6 +247,7 @@ inline ElementType* Zone::Realloc(ElementType* old_data,
reinterpret_cast<uword>(old_data) + (new_len * kElementSize);
// ...and there is sufficient space.
if (new_end <= limit_) {
+ ASSERT(new_len >= old_len);
position_ = Utils::RoundUp(new_end, kAlignment);
return old_data;
}
« no previous file with comments | « runtime/vm/thread_test.cc ('k') | runtime/vm/zone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698