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

Unified Diff: src/heap/spaces.cc

Issue 1340323002: Revert of [heap] Concurrency support for heap book-keeping info (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index d8280bdffecb363aea98d8df9001580a331dad37..54e7364d0f6463d723e660ec074c4dfd6646da04 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -325,7 +325,7 @@
void MemoryAllocator::TearDown() {
// Check that spaces were torn down before MemoryAllocator.
- DCHECK(size_.Value() == 0);
+ DCHECK(size_ == 0);
// TODO(gc) this will be true again when we fix FreeMemory.
// DCHECK(size_executable_ == 0);
capacity_ = 0;
@@ -350,9 +350,9 @@
LOG(isolate_, DeleteEvent("NewSpace", addr));
DCHECK(reservation->IsReserved());
- const intptr_t size = static_cast<intptr_t>(reservation->size());
- DCHECK(size_.Value() >= size);
- size_.Increment(-size);
+ const size_t size = reservation->size();
+ DCHECK(size_ >= size);
+ size_ -= size;
isolate_->counters()->memory_allocated()->Decrement(static_cast<int>(size));
FreeMemory(reservation, NOT_EXECUTABLE);
}
@@ -395,7 +395,7 @@
base::VirtualMemory reservation(size, alignment);
if (!reservation.IsReserved()) return NULL;
- size_.Increment(static_cast<intptr_t>(reservation.size()));
+ size_ += reservation.size();
Address base =
RoundUp(static_cast<Address>(reservation.address()), alignment);
controller->TakeControl(&reservation);
@@ -493,7 +493,7 @@
chunk->skip_list_ = NULL;
chunk->write_barrier_counter_ = kWriteBarrierCounterGranularity;
chunk->progress_bar_ = 0;
- chunk->high_water_mark_.SetValue(static_cast<intptr_t>(area_start - base));
+ chunk->high_water_mark_ = static_cast<int>(area_start - base);
chunk->set_parallel_sweeping(SWEEPING_DONE);
chunk->mutex_ = NULL;
chunk->available_in_small_free_list_ = 0;
@@ -639,8 +639,7 @@
CodePageGuardSize();
// Check executable memory limit.
- if ((size_executable_.Value() + static_cast<intptr_t>(chunk_size)) >
- capacity_executable_) {
+ if ((size_executable_ + chunk_size) > capacity_executable_) {
LOG(isolate_, StringEvent("MemoryAllocator::AllocateRawMemory",
"V8 Executable Allocation capacity exceeded"));
return NULL;
@@ -664,16 +663,16 @@
DCHECK(
IsAligned(reinterpret_cast<intptr_t>(base), MemoryChunk::kAlignment));
if (base == NULL) return NULL;
- size_.Increment(static_cast<intptr_t>(chunk_size));
+ size_ += chunk_size;
// Update executable memory size.
- size_executable_.Increment(static_cast<intptr_t>(chunk_size));
+ size_executable_ += chunk_size;
} else {
base = AllocateAlignedMemory(chunk_size, commit_size,
MemoryChunk::kAlignment, executable,
&reservation);
if (base == NULL) return NULL;
// Update executable memory size.
- size_executable_.Increment(static_cast<intptr_t>(chunk_size));
+ size_executable_ += reservation.size();
}
if (Heap::ShouldZapGarbage()) {
@@ -760,20 +759,20 @@
isolate_->heap()->RememberUnmappedPage(reinterpret_cast<Address>(chunk),
chunk->IsEvacuationCandidate());
- intptr_t size;
+ size_t size;
base::VirtualMemory* reservation = chunk->reserved_memory();
if (reservation->IsReserved()) {
- size = static_cast<intptr_t>(reservation->size());
+ size = reservation->size();
} else {
- size = static_cast<intptr_t>(chunk->size());
- }
- DCHECK(size_.Value() >= size);
- size_.Increment(-size);
+ size = chunk->size();
+ }
+ DCHECK(size_ >= size);
+ size_ -= size;
isolate_->counters()->memory_allocated()->Decrement(static_cast<int>(size));
if (chunk->executable() == EXECUTABLE) {
- DCHECK(size_executable_.Value() >= size);
- size_executable_.Increment(-size);
+ DCHECK(size_executable_ >= size);
+ size_executable_ -= size;
}
chunk->SetFlag(MemoryChunk::PRE_FREED);
@@ -873,14 +872,13 @@
#ifdef DEBUG
void MemoryAllocator::ReportStatistics() {
- intptr_t size = Size();
- float pct = static_cast<float>(capacity_ - size) / capacity_;
+ float pct = static_cast<float>(capacity_ - size_) / capacity_;
PrintF(" capacity: %" V8_PTR_PREFIX
"d"
", used: %" V8_PTR_PREFIX
"d"
", available: %%%d\n\n",
- capacity_, size, static_cast<int>(pct * 100));
+ capacity_, size_, static_cast<int>(pct * 100));
}
#endif
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698