summaryrefslogtreecommitdiffstats
path: root/src/spaces.cc
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-02-03 11:58:03 +0000
committerLeon Clarke <leonclarke@google.com>2010-02-03 11:58:03 +0000
commit4515c472dc3e5ed2448a564600976759e569a0a8 (patch)
tree67d539a5e9fa0e72e2490426693bf73d1e36173f /src/spaces.cc
parentd91b9f7d46489a9ee00f9cb415630299c76a502b (diff)
downloadandroid_external_v8-4515c472dc3e5ed2448a564600976759e569a0a8.tar.gz
android_external_v8-4515c472dc3e5ed2448a564600976759e569a0a8.tar.bz2
android_external_v8-4515c472dc3e5ed2448a564600976759e569a0a8.zip
Update v8 to bleeding_edge revision 3784
Diffstat (limited to 'src/spaces.cc')
-rw-r--r--src/spaces.cc29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/spaces.cc b/src/spaces.cc
index 28509003..2c495d85 100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -357,12 +357,18 @@ void* MemoryAllocator::AllocateRawMemory(const size_t requested,
}
int alloced = static_cast<int>(*allocated);
size_ += alloced;
+#ifdef DEBUG
+ ZapBlock(reinterpret_cast<Address>(mem), alloced);
+#endif
Counters::memory_allocated.Increment(alloced);
return mem;
}
void MemoryAllocator::FreeRawMemory(void* mem, size_t length) {
+#ifdef DEBUG
+ ZapBlock(reinterpret_cast<Address>(mem), length);
+#endif
if (CodeRange::contains(static_cast<Address>(mem))) {
CodeRange::FreeRawMemory(mem, length);
} else {
@@ -446,6 +452,9 @@ Page* MemoryAllocator::CommitPages(Address start, size_t size,
if (!initial_chunk_->Commit(start, size, owner->executable() == EXECUTABLE)) {
return Page::FromAddress(NULL);
}
+#ifdef DEBUG
+ ZapBlock(start, size);
+#endif
Counters::memory_allocated.Increment(static_cast<int>(size));
// So long as we correctly overestimated the number of chunks we should not
@@ -467,10 +476,14 @@ bool MemoryAllocator::CommitBlock(Address start,
ASSERT(InInitialChunk(start + size - 1));
if (!initial_chunk_->Commit(start, size, executable)) return false;
+#ifdef DEBUG
+ ZapBlock(start, size);
+#endif
Counters::memory_allocated.Increment(static_cast<int>(size));
return true;
}
+
bool MemoryAllocator::UncommitBlock(Address start, size_t size) {
ASSERT(start != NULL);
ASSERT(size > 0);
@@ -483,6 +496,14 @@ bool MemoryAllocator::UncommitBlock(Address start, size_t size) {
return true;
}
+
+void MemoryAllocator::ZapBlock(Address start, size_t size) {
+ for (size_t s = 0; s + kPointerSize <= size; s += kPointerSize) {
+ Memory::Address_at(start + s) = kZapValue;
+ }
+}
+
+
Page* MemoryAllocator::InitializePagesInChunk(int chunk_id, int pages_in_chunk,
PagedSpace* owner) {
ASSERT(IsValidChunk(chunk_id));
@@ -1599,9 +1620,7 @@ void OldSpaceFreeList::RebuildSizeList() {
int OldSpaceFreeList::Free(Address start, int size_in_bytes) {
#ifdef DEBUG
- for (int i = 0; i < size_in_bytes; i += kPointerSize) {
- Memory::Address_at(start + i) = kZapValue;
- }
+ MemoryAllocator::ZapBlock(start, size_in_bytes);
#endif
FreeListNode* node = FreeListNode::FromAddress(start);
node->set_size(size_in_bytes);
@@ -1733,9 +1752,7 @@ void FixedSizeFreeList::Reset() {
void FixedSizeFreeList::Free(Address start) {
#ifdef DEBUG
- for (int i = 0; i < object_size_; i += kPointerSize) {
- Memory::Address_at(start + i) = kZapValue;
- }
+ MemoryAllocator::ZapBlock(start, object_size_);
#endif
// We only use the freelists with mark-sweep.
ASSERT(!MarkCompactCollector::IsCompacting());