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

Unified Diff: src/heap/spaces.h

Issue 2371133002: [heap] Make committed counters on space size_t (Closed)
Patch Set: rebase Created 4 years, 3 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 | « src/heap/heap.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.h
diff --git a/src/heap/spaces.h b/src/heap/spaces.h
index 99dd378bbe0b2b2af5c097278b14dade084ed669..09d4d020f6577dcadf0a980573c557dca5f062ab 100644
--- a/src/heap/spaces.h
+++ b/src/heap/spaces.h
@@ -918,9 +918,9 @@ class Space : public Malloced {
// Return the total amount committed memory for this space, i.e., allocatable
// memory and page headers.
- virtual intptr_t CommittedMemory() { return committed_; }
+ virtual size_t CommittedMemory() { return committed_; }
- virtual intptr_t MaximumCommittedMemory() { return max_committed_; }
+ virtual size_t MaximumCommittedMemory() { return max_committed_; }
// Returns allocated size.
virtual intptr_t Size() = 0;
@@ -945,18 +945,17 @@ class Space : public Malloced {
virtual std::unique_ptr<ObjectIterator> GetObjectIterator() = 0;
- void AccountCommitted(intptr_t bytes) {
- DCHECK_GE(bytes, 0);
+ void AccountCommitted(size_t bytes) {
+ DCHECK_GE(committed_ + bytes, committed_);
committed_ += bytes;
if (committed_ > max_committed_) {
max_committed_ = committed_;
}
}
- void AccountUncommitted(intptr_t bytes) {
- DCHECK_GE(bytes, 0);
+ void AccountUncommitted(size_t bytes) {
+ DCHECK_GE(committed_, committed_ - bytes);
committed_ -= bytes;
- DCHECK_GE(committed_, 0);
}
#ifdef DEBUG
@@ -973,8 +972,8 @@ class Space : public Malloced {
Executability executable_;
// Keeps track of committed memory in a space.
- intptr_t committed_;
- intptr_t max_committed_;
+ size_t committed_;
+ size_t max_committed_;
DISALLOW_COPY_AND_ASSIGN(Space);
};
@@ -2461,11 +2460,6 @@ class NewSpace : public Space {
static_cast<intptr_t>(fragmentation_in_intermediate_generation_);
}
- // The same, but returning an int. We have to have the one that returns
- // intptr_t because it is inherited, but if we know we are dealing with the
- // new space, which can't get as big as the other spaces then this is useful:
- int SizeAsInt() { return static_cast<int>(Size()); }
-
// Return the allocatable capacity of a semispace.
intptr_t Capacity() {
SLOW_DCHECK(to_space_.current_capacity() == from_space_.current_capacity());
@@ -2482,11 +2476,11 @@ class NewSpace : public Space {
// Committed memory for NewSpace is the committed memory of both semi-spaces
// combined.
- intptr_t CommittedMemory() override {
+ size_t CommittedMemory() override {
return from_space_.CommittedMemory() + to_space_.CommittedMemory();
}
- intptr_t MaximumCommittedMemory() override {
+ size_t MaximumCommittedMemory() override {
return from_space_.MaximumCommittedMemory() +
to_space_.MaximumCommittedMemory();
}
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698