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

Unified Diff: src/spaces.h

Issue 7970009: Merged from GC branch to bleeding_edge (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated test expectations. More passes, but not all. Created 9 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/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index b302568540fbc0c5d5b417878d3e509b2e10da37..c649b04e385da4dd58cc8fc7ba94246f9b7f9e46 100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -452,12 +452,27 @@ class MemoryChunk {
// Manage live byte count (count of bytes known to be live,
// because they are marked black).
void ResetLiveBytes() {
+ if (FLAG_trace_live_byte_count) {
+ PrintF("ResetLiveBytes:%p:%x->0\n",
+ static_cast<void*>(this), live_byte_count_);
+ }
live_byte_count_ = 0;
}
void IncrementLiveBytes(int by) {
+ ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_);
+ if (FLAG_trace_live_byte_count) {
+ printf("UpdateLiveBytes:%p:%x%c=%x->%x\n",
+ static_cast<void*>(this), live_byte_count_,
+ ((by < 0) ? '-' : '+'), ((by < 0) ? -by : by),
+ live_byte_count_ + by);
+ }
live_byte_count_ += by;
+ ASSERT_LE(static_cast<unsigned>(live_byte_count_), size_);
+ }
+ int LiveBytes() {
+ ASSERT(static_cast<unsigned>(live_byte_count_) <= size_);
+ return live_byte_count_;
}
- int LiveBytes() { return live_byte_count_; }
static void IncrementLiveBytes(Address address, int by) {
MemoryChunk::FromAddress(address)->IncrementLiveBytes(by);
}
@@ -467,10 +482,11 @@ class MemoryChunk {
static const intptr_t kAlignmentMask = kAlignment - 1;
+ static const intptr_t kSizeOffset = kPointerSize + kPointerSize;
+
static const intptr_t kLiveBytesOffset =
- kPointerSize + kPointerSize + kPointerSize + kPointerSize +
- kPointerSize + kPointerSize + kPointerSize + kPointerSize +
- kIntSize;
+ kSizeOffset + kPointerSize + kPointerSize + kPointerSize +
+ kPointerSize + kPointerSize + kPointerSize + kIntSize;
static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize;
@@ -700,6 +716,10 @@ class Page : public MemoryChunk {
void ClearSweptPrecisely() { ClearFlag(WAS_SWEPT_PRECISELY); }
void ClearSweptConservatively() { ClearFlag(WAS_SWEPT_CONSERVATIVELY); }
+#ifdef DEBUG
+ void Print();
+#endif // DEBUG
+
friend class MemoryAllocator;
};
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698