Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index d5d1128e49affbfb251df6c441f1dbc41e01eb70..cb7455918b345f9daabdf459e12ea375bbfe498d 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -331,46 +331,61 @@ void Heap::PrintShortHeapStatistics() { |
isolate_->memory_allocator()->Available() / KB); |
PrintPID("New space, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
new_space_.Size() / KB, |
new_space_.Available() / KB, |
- new_space_.CommittedMemory() / KB); |
+ new_space_.CommittedMemory() / KB, |
+ new_space_.bottom()); |
mvstanton1
2012/10/11 12:22:45
oops, should not have checked in this debugging co
|
PrintPID("Old pointers, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
old_pointer_space_->SizeOfObjects() / KB, |
old_pointer_space_->Available() / KB, |
- old_pointer_space_->CommittedMemory() / KB); |
+ old_pointer_space_->CommittedMemory() / KB, |
+ reinterpret_cast<void *>( |
+ old_pointer_space_->FirstPage()->address())); |
PrintPID("Old data space, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
old_data_space_->SizeOfObjects() / KB, |
old_data_space_->Available() / KB, |
- old_data_space_->CommittedMemory() / KB); |
+ old_data_space_->CommittedMemory() / KB, |
+ reinterpret_cast<void *>(old_data_space_->FirstPage()->address())); |
PrintPID("Code space, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
code_space_->SizeOfObjects() / KB, |
code_space_->Available() / KB, |
- code_space_->CommittedMemory() / KB); |
+ code_space_->CommittedMemory() / KB, |
+ reinterpret_cast<void *>(code_space_->FirstPage()->address())); |
PrintPID("Map space, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
map_space_->SizeOfObjects() / KB, |
map_space_->Available() / KB, |
- map_space_->CommittedMemory() / KB); |
+ map_space_->CommittedMemory() / KB, |
+ reinterpret_cast<void *>(map_space_->FirstPage()->address())); |
PrintPID("Cell space, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
cell_space_->SizeOfObjects() / KB, |
cell_space_->Available() / KB, |
- cell_space_->CommittedMemory() / KB); |
+ cell_space_->CommittedMemory() / KB, |
+ reinterpret_cast<void *>(cell_space_->FirstPage()->address())); |
PrintPID("Large object space, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
- ", committed: %6" V8_PTR_PREFIX "d KB\n", |
+ ", committed: %6" V8_PTR_PREFIX "d KB" |
+ ", %p\n", |
lo_space_->SizeOfObjects() / KB, |
lo_space_->Available() / KB, |
- lo_space_->CommittedMemory() / KB); |
+ lo_space_->CommittedMemory() / KB, |
+ reinterpret_cast<void *>(lo_space_->first_page()->address())); |
PrintPID("All spaces, used: %6" V8_PTR_PREFIX "d KB" |
", available: %6" V8_PTR_PREFIX "d KB" |
", committed: %6" V8_PTR_PREFIX "d KB\n", |
@@ -404,14 +419,15 @@ void Heap::GarbageCollectionPrologue() { |
ClearJSFunctionResultCaches(); |
gc_count_++; |
unflattened_strings_length_ = 0; |
-#ifdef DEBUG |
- ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
- allow_allocation(false); |
if (FLAG_verify_heap) { |
Verify(); |
} |
+#ifdef DEBUG |
+ ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); |
+ allow_allocation(false); |
+ |
if (FLAG_gc_verbose) Print(); |
#endif // DEBUG |
@@ -447,14 +463,25 @@ void Heap::RepairFreeListsAfterBoot() { |
void Heap::GarbageCollectionEpilogue() { |
store_buffer()->GCEpilogue(); |
LiveObjectList::GCEpilogue(); |
+ |
#ifdef DEBUG |
allow_allocation(true); |
Michael Starzinger
2012/10/11 12:42:46
Neither the zapping nor the verification should do
mvstanton1
2012/10/12 08:40:50
Done.
|
- ZapFromSpace(); |
+#endif |
+ |
+ // In release mode, we only zap the from space under heap verification. |
+#ifndef DEBUG |
+ if (FLAG_verify_heap) { |
+#endif |
+ ZapFromSpace(); |
+#ifndef DEBUG |
+ } |
+#endif |
if (FLAG_verify_heap) { |
Verify(); |
} |
+#ifdef DEBUG |
if (FLAG_print_global_handles) isolate_->global_handles()->Print(); |
if (FLAG_print_handles) PrintHandles(); |
if (FLAG_gc_verbose) Print(); |
@@ -651,7 +678,6 @@ void Heap::PerformScavenge() { |
} |
-#ifdef DEBUG |
// Helper class for verifying the symbol table. |
class SymbolTableVerifier : public ObjectVisitor { |
public: |
@@ -660,19 +686,16 @@ class SymbolTableVerifier : public ObjectVisitor { |
for (Object** p = start; p < end; p++) { |
if ((*p)->IsHeapObject()) { |
// Check that the symbol is actually a symbol. |
- ASSERT((*p)->IsTheHole() || (*p)->IsUndefined() || (*p)->IsSymbol()); |
+ CHECK((*p)->IsTheHole() || (*p)->IsUndefined() || (*p)->IsSymbol()); |
} |
} |
} |
}; |
-#endif // DEBUG |
static void VerifySymbolTable() { |
-#ifdef DEBUG |
SymbolTableVerifier verifier; |
HEAP->symbol_table()->IterateElements(&verifier); |
-#endif // DEBUG |
} |
@@ -1044,7 +1067,6 @@ class ScavengeVisitor: public ObjectVisitor { |
}; |
-#ifdef DEBUG |
// Visitor class to verify pointers in code or data space do not point into |
// new space. |
class VerifyNonPointerSpacePointersVisitor: public ObjectVisitor { |
@@ -1052,7 +1074,7 @@ class VerifyNonPointerSpacePointersVisitor: public ObjectVisitor { |
void VisitPointers(Object** start, Object**end) { |
for (Object** current = start; current < end; current++) { |
if ((*current)->IsHeapObject()) { |
- ASSERT(!HEAP->InNewSpace(HeapObject::cast(*current))); |
+ CHECK(!HEAP->InNewSpace(HeapObject::cast(*current))); |
} |
} |
} |
@@ -1077,7 +1099,6 @@ static void VerifyNonPointerSpacePointers() { |
object->Iterate(&v); |
} |
} |
-#endif |
void Heap::CheckNewSpaceExpansionCriteria() { |
@@ -1216,9 +1237,8 @@ class ScavengeWeakObjectRetainer : public WeakObjectRetainer { |
void Heap::Scavenge() { |
RelocationLock relocation_lock(this); |
-#ifdef DEBUG |
+ |
if (FLAG_verify_heap) VerifyNonPointerSpacePointers(); |
-#endif |
gc_state_ = SCAVENGE; |
@@ -4597,14 +4617,12 @@ MaybeObject* Heap::AllocateRawAsciiString(int length, PretenureFlag pretenure) { |
String::cast(result)->set_hash_field(String::kEmptyHashField); |
ASSERT_EQ(size, HeapObject::cast(result)->Size()); |
-#ifdef DEBUG |
if (FLAG_verify_heap) { |
// Initialize string's content to ensure ASCII-ness (character range 0-127) |
// as required when verifying the heap. |
char* dest = SeqAsciiString::cast(result)->GetChars(); |
memset(dest, 0x0F, length * kCharSize); |
} |
-#endif // DEBUG |
return result; |
} |
@@ -4689,9 +4707,14 @@ MaybeObject* Heap::AllocateRawFixedArray(int length) { |
if (always_allocate()) return AllocateFixedArray(length, TENURED); |
// Allocate the raw data for a fixed array. |
int size = FixedArray::SizeFor(length); |
- return size <= kMaxObjectSizeInNewSpace |
- ? new_space_.AllocateRaw(size) |
- : lo_space_->AllocateRaw(size, NOT_EXECUTABLE); |
+ MaybeObject* retptr; |
mvstanton1
2012/10/11 12:22:45
I think this was debugging, I will revert this blo
|
+ if (size <= kMaxObjectSizeInNewSpace) { |
+ retptr = new_space_.AllocateRaw(size); |
+ } else { |
+ retptr = lo_space_->AllocateRaw(size, NOT_EXECUTABLE); |
+ } |
+ |
+ return retptr; |
} |
@@ -5394,9 +5417,8 @@ bool Heap::InSpace(Address addr, AllocationSpace space) { |
} |
-#ifdef DEBUG |
void Heap::Verify() { |
- ASSERT(HasBeenSetUp()); |
+ CHECK(HasBeenSetUp()); |
store_buffer()->Verify(); |
@@ -5416,10 +5438,6 @@ void Heap::Verify() { |
lo_space_->Verify(); |
} |
- |
-#endif // DEBUG |
- |
- |
MaybeObject* Heap::LookupSymbol(Vector<const char> string) { |
Object* symbol = NULL; |
Object* new_table; |
@@ -5509,8 +5527,6 @@ bool Heap::LookupSymbolIfExists(String* string, String** symbol) { |
return symbol_table()->LookupSymbolIfExists(string, symbol); |
} |
- |
-#ifdef DEBUG |
void Heap::ZapFromSpace() { |
NewSpacePageIterator it(new_space_.FromSpaceStart(), |
new_space_.FromSpaceEnd()); |
@@ -5523,7 +5539,6 @@ void Heap::ZapFromSpace() { |
} |
} |
} |
-#endif // DEBUG |
void Heap::IterateAndMarkPointersToFromSpace(Address start, |
@@ -6260,11 +6275,10 @@ void Heap::SetStackLimits() { |
void Heap::TearDown() { |
-#ifdef DEBUG |
if (FLAG_verify_heap) { |
Verify(); |
} |
-#endif |
+ |
if (FLAG_print_cumulative_gc_stat) { |
PrintF("\n\n"); |
PrintF("gc_count=%d ", gc_count_); |