Revert attempt to make heap size 32/64 clean. This change needs to
be done from Windows where the compiler is stricter about truncating changes. Review URL: http://codereview.chromium.org/3454035 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5545 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d6313dbbb7
commit
2d0c23bc82
@ -294,7 +294,7 @@ void Debugger::Debug() {
|
|||||||
} else if (GetVFPSingleValue(arg1, &svalue)) {
|
} else if (GetVFPSingleValue(arg1, &svalue)) {
|
||||||
PrintF("%s: %f \n", arg1, svalue);
|
PrintF("%s: %f \n", arg1, svalue);
|
||||||
} else if (GetVFPDoubleValue(arg1, &dvalue)) {
|
} else if (GetVFPDoubleValue(arg1, &dvalue)) {
|
||||||
PrintF("%s: %f \n", arg1, dvalue);
|
PrintF("%s: %lf \n", arg1, dvalue);
|
||||||
} else {
|
} else {
|
||||||
PrintF("%s unrecognized\n", arg1);
|
PrintF("%s unrecognized\n", arg1);
|
||||||
}
|
}
|
||||||
@ -349,8 +349,7 @@ void Debugger::Debug() {
|
|||||||
end = cur + words;
|
end = cur + words;
|
||||||
|
|
||||||
while (cur < end) {
|
while (cur < end) {
|
||||||
PrintF(" 0x%08x: 0x%08x %10d\n",
|
PrintF(" 0x%08x: 0x%08x %10d\n", cur, *cur, *cur);
|
||||||
reinterpret_cast<intptr_t>(cur), *cur, *cur);
|
|
||||||
cur++;
|
cur++;
|
||||||
}
|
}
|
||||||
} else if (strcmp(cmd, "disasm") == 0) {
|
} else if (strcmp(cmd, "disasm") == 0) {
|
||||||
@ -383,8 +382,7 @@ void Debugger::Debug() {
|
|||||||
|
|
||||||
while (cur < end) {
|
while (cur < end) {
|
||||||
dasm.InstructionDecode(buffer, cur);
|
dasm.InstructionDecode(buffer, cur);
|
||||||
PrintF(" 0x%08x %s\n",
|
PrintF(" 0x%08x %s\n", cur, buffer.start());
|
||||||
reinterpret_cast<intptr_t>(cur), buffer.start());
|
|
||||||
cur += Instr::kInstrSize;
|
cur += Instr::kInstrSize;
|
||||||
}
|
}
|
||||||
} else if (strcmp(cmd, "gdb") == 0) {
|
} else if (strcmp(cmd, "gdb") == 0) {
|
||||||
@ -1063,7 +1061,7 @@ uintptr_t Simulator::StackLimit() const {
|
|||||||
// Unsupported instructions use Format to print an error and stop execution.
|
// Unsupported instructions use Format to print an error and stop execution.
|
||||||
void Simulator::Format(Instr* instr, const char* format) {
|
void Simulator::Format(Instr* instr, const char* format) {
|
||||||
PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n",
|
PrintF("Simulator found unsupported instruction:\n 0x%08x: %s\n",
|
||||||
reinterpret_cast<intptr_t>(instr), format);
|
instr, format);
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2652,7 +2650,7 @@ void Simulator::InstructionDecode(Instr* instr) {
|
|||||||
v8::internal::EmbeddedVector<char, 256> buffer;
|
v8::internal::EmbeddedVector<char, 256> buffer;
|
||||||
dasm.InstructionDecode(buffer,
|
dasm.InstructionDecode(buffer,
|
||||||
reinterpret_cast<byte*>(instr));
|
reinterpret_cast<byte*>(instr));
|
||||||
PrintF(" 0x%08x %s\n", reinterpret_cast<intptr_t>(instr), buffer.start());
|
PrintF(" 0x%08x %s\n", instr, buffer.start());
|
||||||
}
|
}
|
||||||
if (instr->ConditionField() == special_condition) {
|
if (instr->ConditionField() == special_condition) {
|
||||||
DecodeUnconditional(instr);
|
DecodeUnconditional(instr);
|
||||||
|
@ -465,7 +465,7 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
|
|||||||
void RelocInfo::Print() {
|
void RelocInfo::Print() {
|
||||||
PrintF("%p %s", pc_, RelocModeName(rmode_));
|
PrintF("%p %s", pc_, RelocModeName(rmode_));
|
||||||
if (IsComment(rmode_)) {
|
if (IsComment(rmode_)) {
|
||||||
PrintF(" (%s)", reinterpret_cast<char*>(data_));
|
PrintF(" (%s)", data_);
|
||||||
} else if (rmode_ == EMBEDDED_OBJECT) {
|
} else if (rmode_ == EMBEDDED_OBJECT) {
|
||||||
PrintF(" (");
|
PrintF(" (");
|
||||||
target_object()->ShortPrint();
|
target_object()->ShortPrint();
|
||||||
@ -479,7 +479,7 @@ void RelocInfo::Print() {
|
|||||||
Code* code = Code::GetCodeFromTargetAddress(target_address());
|
Code* code = Code::GetCodeFromTargetAddress(target_address());
|
||||||
PrintF(" (%s) (%p)", Code::Kind2String(code->kind()), target_address());
|
PrintF(" (%s) (%p)", Code::Kind2String(code->kind()), target_address());
|
||||||
} else if (IsPosition(rmode_)) {
|
} else if (IsPosition(rmode_)) {
|
||||||
PrintF(" (%" V8_PTR_PREFIX "d)", data());
|
PrintF(" (%d)", data());
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintF("\n");
|
PrintF("\n");
|
||||||
|
@ -90,7 +90,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (FLAG_trace_contexts) {
|
if (FLAG_trace_contexts) {
|
||||||
PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
|
PrintF(" - looking in context %p", *context);
|
||||||
if (context->IsGlobalContext()) PrintF(" (global context)");
|
if (context->IsGlobalContext()) PrintF(" (global context)");
|
||||||
PrintF("\n");
|
PrintF("\n");
|
||||||
}
|
}
|
||||||
@ -110,8 +110,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
|
|||||||
if (*attributes != ABSENT) {
|
if (*attributes != ABSENT) {
|
||||||
// property found
|
// property found
|
||||||
if (FLAG_trace_contexts) {
|
if (FLAG_trace_contexts) {
|
||||||
PrintF("=> found property in context object %p\n",
|
PrintF("=> found property in context object %p\n", *extension);
|
||||||
reinterpret_cast<void*>(*extension));
|
|
||||||
}
|
}
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ void BitVector::Print() {
|
|||||||
if (Contains(i)) {
|
if (Contains(i)) {
|
||||||
if (!first) PrintF(",");
|
if (!first) PrintF(",");
|
||||||
first = false;
|
first = false;
|
||||||
PrintF("%d", i);
|
PrintF("%d");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PrintF("}");
|
PrintF("}");
|
||||||
|
@ -44,10 +44,7 @@ namespace internal {
|
|||||||
void Disassembler::Dump(FILE* f, byte* begin, byte* end) {
|
void Disassembler::Dump(FILE* f, byte* begin, byte* end) {
|
||||||
for (byte* pc = begin; pc < end; pc++) {
|
for (byte* pc = begin; pc < end; pc++) {
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n",
|
PrintF("%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n", pc, pc - begin, *pc);
|
||||||
reinterpret_cast<intptr_t>(pc),
|
|
||||||
pc - begin,
|
|
||||||
*pc);
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(f, "%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n",
|
fprintf(f, "%" V8PRIxPTR " %4" V8PRIdPTR " %02x\n",
|
||||||
reinterpret_cast<uintptr_t>(pc), pc - begin, *pc);
|
reinterpret_cast<uintptr_t>(pc), pc - begin, *pc);
|
||||||
|
@ -179,8 +179,8 @@ DEFINE_bool(always_inline_smi_code, false,
|
|||||||
"always inline smi code in non-opt code")
|
"always inline smi code in non-opt code")
|
||||||
|
|
||||||
// heap.cc
|
// heap.cc
|
||||||
DEFINE_int(max_new_space_size, 0, "max size of the new generation (in kBytes)")
|
DEFINE_int(max_new_space_size, 0, "max size of the new generation")
|
||||||
DEFINE_int(max_old_space_size, 0, "max size of the old generation (in Mbytes)")
|
DEFINE_int(max_old_space_size, 0, "max size of the old generation")
|
||||||
DEFINE_bool(gc_global, false, "always perform global GCs")
|
DEFINE_bool(gc_global, false, "always perform global GCs")
|
||||||
DEFINE_int(gc_interval, -1, "garbage collect after <n> allocations")
|
DEFINE_int(gc_interval, -1, "garbage collect after <n> allocations")
|
||||||
DEFINE_bool(trace_gc, false,
|
DEFINE_bool(trace_gc, false,
|
||||||
|
@ -486,7 +486,7 @@ void GlobalHandles::PrintStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrintF("Global Handle Statistics:\n");
|
PrintF("Global Handle Statistics:\n");
|
||||||
PrintF(" allocated memory = %" V8_PTR_PREFIX "dB\n", sizeof(Node) * total);
|
PrintF(" allocated memory = %dB\n", sizeof(Node) * total);
|
||||||
PrintF(" # weak = %d\n", weak);
|
PrintF(" # weak = %d\n", weak);
|
||||||
PrintF(" # pending = %d\n", pending);
|
PrintF(" # pending = %d\n", pending);
|
||||||
PrintF(" # near_death = %d\n", near_death);
|
PrintF(" # near_death = %d\n", near_death);
|
||||||
@ -497,10 +497,8 @@ void GlobalHandles::PrintStats() {
|
|||||||
void GlobalHandles::Print() {
|
void GlobalHandles::Print() {
|
||||||
PrintF("Global handles:\n");
|
PrintF("Global handles:\n");
|
||||||
for (Node* current = head_; current != NULL; current = current->next()) {
|
for (Node* current = head_; current != NULL; current = current->next()) {
|
||||||
PrintF(" handle %p to %p (weak=%d)\n",
|
PrintF(" handle %p to %p (weak=%d)\n", current->handle().location(),
|
||||||
reinterpret_cast<void*>(current->handle().location()),
|
*current->handle(), current->state_ == Node::WEAK);
|
||||||
reinterpret_cast<void*>(*current->handle()),
|
|
||||||
current->state_ == Node::WEAK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ namespace v8 {
|
|||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
void Heap::UpdateOldSpaceLimits() {
|
void Heap::UpdateOldSpaceLimits() {
|
||||||
intptr_t old_gen_size = PromotedSpaceSize();
|
int old_gen_size = PromotedSpaceSize();
|
||||||
old_gen_promotion_limit_ =
|
old_gen_promotion_limit_ =
|
||||||
old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3);
|
old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3);
|
||||||
old_gen_allocation_limit_ =
|
old_gen_allocation_limit_ =
|
||||||
|
92
src/heap.cc
92
src/heap.cc
@ -63,8 +63,8 @@ MapSpace* Heap::map_space_ = NULL;
|
|||||||
CellSpace* Heap::cell_space_ = NULL;
|
CellSpace* Heap::cell_space_ = NULL;
|
||||||
LargeObjectSpace* Heap::lo_space_ = NULL;
|
LargeObjectSpace* Heap::lo_space_ = NULL;
|
||||||
|
|
||||||
intptr_t Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit;
|
int Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit;
|
||||||
intptr_t Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit;
|
int Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit;
|
||||||
|
|
||||||
int Heap::old_gen_exhausted_ = false;
|
int Heap::old_gen_exhausted_ = false;
|
||||||
|
|
||||||
@ -75,19 +75,19 @@ int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0;
|
|||||||
// a multiple of Page::kPageSize.
|
// a multiple of Page::kPageSize.
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
int Heap::max_semispace_size_ = 2*MB;
|
int Heap::max_semispace_size_ = 2*MB;
|
||||||
intptr_t Heap::max_old_generation_size_ = 192*MB;
|
int Heap::max_old_generation_size_ = 192*MB;
|
||||||
int Heap::initial_semispace_size_ = 128*KB;
|
int Heap::initial_semispace_size_ = 128*KB;
|
||||||
intptr_t Heap::code_range_size_ = 0;
|
size_t Heap::code_range_size_ = 0;
|
||||||
#elif defined(V8_TARGET_ARCH_X64)
|
#elif defined(V8_TARGET_ARCH_X64)
|
||||||
int Heap::max_semispace_size_ = 16*MB;
|
int Heap::max_semispace_size_ = 16*MB;
|
||||||
intptr_t Heap::max_old_generation_size_ = 1*GB;
|
int Heap::max_old_generation_size_ = 1*GB;
|
||||||
int Heap::initial_semispace_size_ = 1*MB;
|
int Heap::initial_semispace_size_ = 1*MB;
|
||||||
intptr_t Heap::code_range_size_ = 512*MB;
|
size_t Heap::code_range_size_ = 512*MB;
|
||||||
#else
|
#else
|
||||||
int Heap::max_semispace_size_ = 8*MB;
|
int Heap::max_semispace_size_ = 8*MB;
|
||||||
intptr_t Heap::max_old_generation_size_ = 512*MB;
|
int Heap::max_old_generation_size_ = 512*MB;
|
||||||
int Heap::initial_semispace_size_ = 512*KB;
|
int Heap::initial_semispace_size_ = 512*KB;
|
||||||
intptr_t Heap::code_range_size_ = 0;
|
size_t Heap::code_range_size_ = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The snapshot semispace size will be the default semispace size if
|
// The snapshot semispace size will be the default semispace size if
|
||||||
@ -108,7 +108,7 @@ HeapObjectCallback Heap::gc_safe_size_of_old_object_ = NULL;
|
|||||||
// Will be 4 * reserved_semispace_size_ to ensure that young
|
// Will be 4 * reserved_semispace_size_ to ensure that young
|
||||||
// generation can be aligned to its size.
|
// generation can be aligned to its size.
|
||||||
int Heap::survived_since_last_expansion_ = 0;
|
int Heap::survived_since_last_expansion_ = 0;
|
||||||
intptr_t Heap::external_allocation_limit_ = 0;
|
int Heap::external_allocation_limit_ = 0;
|
||||||
|
|
||||||
Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
|
Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
|
||||||
|
|
||||||
@ -137,10 +137,10 @@ int Heap::allocation_timeout_ = 0;
|
|||||||
bool Heap::disallow_allocation_failure_ = false;
|
bool Heap::disallow_allocation_failure_ = false;
|
||||||
#endif // DEBUG
|
#endif // DEBUG
|
||||||
|
|
||||||
intptr_t GCTracer::alive_after_last_gc_ = 0;
|
int GCTracer::alive_after_last_gc_ = 0;
|
||||||
double GCTracer::last_gc_end_timestamp_ = 0.0;
|
double GCTracer::last_gc_end_timestamp_ = 0.0;
|
||||||
int GCTracer::max_gc_pause_ = 0;
|
int GCTracer::max_gc_pause_ = 0;
|
||||||
intptr_t GCTracer::max_alive_after_gc_ = 0;
|
int GCTracer::max_alive_after_gc_ = 0;
|
||||||
int GCTracer::min_in_mutator_ = kMaxInt;
|
int GCTracer::min_in_mutator_ = kMaxInt;
|
||||||
|
|
||||||
int Heap::Capacity() {
|
int Heap::Capacity() {
|
||||||
@ -289,46 +289,33 @@ void Heap::ReportStatisticsBeforeGC() {
|
|||||||
#if defined(ENABLE_LOGGING_AND_PROFILING)
|
#if defined(ENABLE_LOGGING_AND_PROFILING)
|
||||||
void Heap::PrintShortHeapStatistics() {
|
void Heap::PrintShortHeapStatistics() {
|
||||||
if (!FLAG_trace_gc_verbose) return;
|
if (!FLAG_trace_gc_verbose) return;
|
||||||
PrintF("Memory allocator, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Memory allocator, used: %8d, available: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
MemoryAllocator::Size(),
|
MemoryAllocator::Size(),
|
||||||
MemoryAllocator::Available());
|
MemoryAllocator::Available());
|
||||||
PrintF("New space, used: %8" V8_PTR_PREFIX "d"
|
PrintF("New space, used: %8d, available: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
Heap::new_space_.Size(),
|
Heap::new_space_.Size(),
|
||||||
new_space_.Available());
|
new_space_.Available());
|
||||||
PrintF("Old pointers, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Old pointers, used: %8d, available: %8d, waste: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d"
|
|
||||||
", waste: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
old_pointer_space_->Size(),
|
old_pointer_space_->Size(),
|
||||||
old_pointer_space_->Available(),
|
old_pointer_space_->Available(),
|
||||||
old_pointer_space_->Waste());
|
old_pointer_space_->Waste());
|
||||||
PrintF("Old data space, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Old data space, used: %8d, available: %8d, waste: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d"
|
|
||||||
", waste: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
old_data_space_->Size(),
|
old_data_space_->Size(),
|
||||||
old_data_space_->Available(),
|
old_data_space_->Available(),
|
||||||
old_data_space_->Waste());
|
old_data_space_->Waste());
|
||||||
PrintF("Code space, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Code space, used: %8d, available: %8d, waste: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d"
|
|
||||||
", waste: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
code_space_->Size(),
|
code_space_->Size(),
|
||||||
code_space_->Available(),
|
code_space_->Available(),
|
||||||
code_space_->Waste());
|
code_space_->Waste());
|
||||||
PrintF("Map space, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Map space, used: %8d, available: %8d, waste: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d"
|
|
||||||
", waste: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
map_space_->Size(),
|
map_space_->Size(),
|
||||||
map_space_->Available(),
|
map_space_->Available(),
|
||||||
map_space_->Waste());
|
map_space_->Waste());
|
||||||
PrintF("Cell space, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Cell space, used: %8d, available: %8d, waste: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d"
|
|
||||||
", waste: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
cell_space_->Size(),
|
cell_space_->Size(),
|
||||||
cell_space_->Available(),
|
cell_space_->Available(),
|
||||||
cell_space_->Waste());
|
cell_space_->Waste());
|
||||||
PrintF("Large object space, used: %8" V8_PTR_PREFIX "d"
|
PrintF("Large object space, used: %8d, avaialble: %8d\n",
|
||||||
", available: %8" V8_PTR_PREFIX "d\n",
|
|
||||||
lo_space_->Size(),
|
lo_space_->Size(),
|
||||||
lo_space_->Available());
|
lo_space_->Available());
|
||||||
}
|
}
|
||||||
@ -377,8 +364,8 @@ void Heap::GarbageCollectionPrologue() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
intptr_t Heap::SizeOfObjects() {
|
int Heap::SizeOfObjects() {
|
||||||
intptr_t total = 0;
|
int total = 0;
|
||||||
AllSpaces spaces;
|
AllSpaces spaces;
|
||||||
for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
|
for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
|
||||||
total += space->Size();
|
total += space->Size();
|
||||||
@ -975,7 +962,7 @@ void Heap::Scavenge() {
|
|||||||
DescriptorLookupCache::Clear();
|
DescriptorLookupCache::Clear();
|
||||||
|
|
||||||
// Used for updating survived_since_last_expansion_ at function end.
|
// Used for updating survived_since_last_expansion_ at function end.
|
||||||
intptr_t survived_watermark = PromotedSpaceSize();
|
int survived_watermark = PromotedSpaceSize();
|
||||||
|
|
||||||
CheckNewSpaceExpansionCriteria();
|
CheckNewSpaceExpansionCriteria();
|
||||||
|
|
||||||
@ -3509,10 +3496,8 @@ void Heap::ReportHeapStatistics(const char* title) {
|
|||||||
PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n",
|
PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n",
|
||||||
title, gc_count_);
|
title, gc_count_);
|
||||||
PrintF("mark-compact GC : %d\n", mc_count_);
|
PrintF("mark-compact GC : %d\n", mc_count_);
|
||||||
PrintF("old_gen_promotion_limit_ %" V8_PTR_PREFIX "d\n",
|
PrintF("old_gen_promotion_limit_ %d\n", old_gen_promotion_limit_);
|
||||||
old_gen_promotion_limit_);
|
PrintF("old_gen_allocation_limit_ %d\n", old_gen_allocation_limit_);
|
||||||
PrintF("old_gen_allocation_limit_ %" V8_PTR_PREFIX "d\n",
|
|
||||||
old_gen_allocation_limit_);
|
|
||||||
|
|
||||||
PrintF("\n");
|
PrintF("\n");
|
||||||
PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles());
|
PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles());
|
||||||
@ -4084,8 +4069,7 @@ bool Heap::ConfigureHeap(int max_semispace_size, int max_old_gen_size) {
|
|||||||
|
|
||||||
|
|
||||||
bool Heap::ConfigureHeapDefault() {
|
bool Heap::ConfigureHeapDefault() {
|
||||||
return ConfigureHeap(
|
return ConfigureHeap(FLAG_max_new_space_size / 2, FLAG_max_old_space_size);
|
||||||
FLAG_max_new_space_size * (KB / 2), FLAG_max_old_space_size * MB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4127,7 +4111,7 @@ void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
intptr_t Heap::PromotedSpaceSize() {
|
int Heap::PromotedSpaceSize() {
|
||||||
return old_pointer_space_->Size()
|
return old_pointer_space_->Size()
|
||||||
+ old_data_space_->Size()
|
+ old_data_space_->Size()
|
||||||
+ code_space_->Size()
|
+ code_space_->Size()
|
||||||
@ -4273,8 +4257,7 @@ void Heap::TearDown() {
|
|||||||
PrintF("mark_compact_count=%d ", mc_count_);
|
PrintF("mark_compact_count=%d ", mc_count_);
|
||||||
PrintF("max_gc_pause=%d ", GCTracer::get_max_gc_pause());
|
PrintF("max_gc_pause=%d ", GCTracer::get_max_gc_pause());
|
||||||
PrintF("min_in_mutator=%d ", GCTracer::get_min_in_mutator());
|
PrintF("min_in_mutator=%d ", GCTracer::get_min_in_mutator());
|
||||||
PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ",
|
PrintF("max_alive_after_gc=%d ", GCTracer::get_max_alive_after_gc());
|
||||||
GCTracer::get_max_alive_after_gc());
|
|
||||||
PrintF("\n\n");
|
PrintF("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4400,9 +4383,7 @@ class PrintHandleVisitor: public ObjectVisitor {
|
|||||||
public:
|
public:
|
||||||
void VisitPointers(Object** start, Object** end) {
|
void VisitPointers(Object** start, Object** end) {
|
||||||
for (Object** p = start; p < end; p++)
|
for (Object** p = start; p < end; p++)
|
||||||
PrintF(" handle %p to %p\n",
|
PrintF(" handle %p to %p\n", p, *p);
|
||||||
reinterpret_cast<void*>(p),
|
|
||||||
reinterpret_cast<void*>(*p));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4755,8 +4736,8 @@ void Heap::TracePathToGlobal() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static intptr_t CountTotalHolesSize() {
|
static int CountTotalHolesSize() {
|
||||||
intptr_t holes_size = 0;
|
int holes_size = 0;
|
||||||
OldSpaces spaces;
|
OldSpaces spaces;
|
||||||
for (OldSpace* space = spaces.next();
|
for (OldSpace* space = spaces.next();
|
||||||
space != NULL;
|
space != NULL;
|
||||||
@ -4854,14 +4835,13 @@ GCTracer::~GCTracer() {
|
|||||||
PrintF("sweepns=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP_NEWSPACE]));
|
PrintF("sweepns=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP_NEWSPACE]));
|
||||||
PrintF("compact=%d ", static_cast<int>(scopes_[Scope::MC_COMPACT]));
|
PrintF("compact=%d ", static_cast<int>(scopes_[Scope::MC_COMPACT]));
|
||||||
|
|
||||||
PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_size_);
|
PrintF("total_size_before=%d ", start_size_);
|
||||||
PrintF("total_size_after=%" V8_PTR_PREFIX "d ", Heap::SizeOfObjects());
|
PrintF("total_size_after=%d ", Heap::SizeOfObjects());
|
||||||
PrintF("holes_size_before=%" V8_PTR_PREFIX "d ",
|
PrintF("holes_size_before=%d ", in_free_list_or_wasted_before_gc_);
|
||||||
in_free_list_or_wasted_before_gc_);
|
PrintF("holes_size_after=%d ", CountTotalHolesSize());
|
||||||
PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize());
|
|
||||||
|
|
||||||
PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_);
|
PrintF("allocated=%d ", allocated_since_last_gc_);
|
||||||
PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_);
|
PrintF("promoted=%d ", promoted_objects_size_);
|
||||||
|
|
||||||
PrintF("\n");
|
PrintF("\n");
|
||||||
}
|
}
|
||||||
|
36
src/heap.h
36
src/heap.h
@ -245,13 +245,13 @@ class Heap : public AllStatic {
|
|||||||
// semi space. The young generation consists of two semi spaces and
|
// semi space. The young generation consists of two semi spaces and
|
||||||
// we reserve twice the amount needed for those in order to ensure
|
// we reserve twice the amount needed for those in order to ensure
|
||||||
// that new space can be aligned to its size.
|
// that new space can be aligned to its size.
|
||||||
static intptr_t MaxReserved() {
|
static int MaxReserved() {
|
||||||
return 4 * reserved_semispace_size_ + max_old_generation_size_;
|
return 4 * reserved_semispace_size_ + max_old_generation_size_;
|
||||||
}
|
}
|
||||||
static int MaxSemiSpaceSize() { return max_semispace_size_; }
|
static int MaxSemiSpaceSize() { return max_semispace_size_; }
|
||||||
static int ReservedSemiSpaceSize() { return reserved_semispace_size_; }
|
static int ReservedSemiSpaceSize() { return reserved_semispace_size_; }
|
||||||
static int InitialSemiSpaceSize() { return initial_semispace_size_; }
|
static int InitialSemiSpaceSize() { return initial_semispace_size_; }
|
||||||
static intptr_t MaxOldGenerationSize() { return max_old_generation_size_; }
|
static int MaxOldGenerationSize() { return max_old_generation_size_; }
|
||||||
|
|
||||||
// Returns the capacity of the heap in bytes w/o growing. Heap grows when
|
// Returns the capacity of the heap in bytes w/o growing. Heap grows when
|
||||||
// more spaces are needed until it reaches the limit.
|
// more spaces are needed until it reaches the limit.
|
||||||
@ -269,7 +269,7 @@ class Heap : public AllStatic {
|
|||||||
static inline int MaxObjectSizeInPagedSpace();
|
static inline int MaxObjectSizeInPagedSpace();
|
||||||
|
|
||||||
// Returns of size of all objects residing in the heap.
|
// Returns of size of all objects residing in the heap.
|
||||||
static intptr_t SizeOfObjects();
|
static int SizeOfObjects();
|
||||||
|
|
||||||
// Return the starting address and a mask for the new space. And-masking an
|
// Return the starting address and a mask for the new space. And-masking an
|
||||||
// address with the mask will result in the start address of the new space
|
// address with the mask will result in the start address of the new space
|
||||||
@ -1069,8 +1069,8 @@ class Heap : public AllStatic {
|
|||||||
static int reserved_semispace_size_;
|
static int reserved_semispace_size_;
|
||||||
static int max_semispace_size_;
|
static int max_semispace_size_;
|
||||||
static int initial_semispace_size_;
|
static int initial_semispace_size_;
|
||||||
static intptr_t max_old_generation_size_;
|
static int max_old_generation_size_;
|
||||||
static intptr_t code_range_size_;
|
static size_t code_range_size_;
|
||||||
|
|
||||||
// For keeping track of how much data has survived
|
// For keeping track of how much data has survived
|
||||||
// scavenge since last new space expansion.
|
// scavenge since last new space expansion.
|
||||||
@ -1098,7 +1098,7 @@ class Heap : public AllStatic {
|
|||||||
static HeapState gc_state_;
|
static HeapState gc_state_;
|
||||||
|
|
||||||
// Returns the size of object residing in non new spaces.
|
// Returns the size of object residing in non new spaces.
|
||||||
static intptr_t PromotedSpaceSize();
|
static int PromotedSpaceSize();
|
||||||
|
|
||||||
// Returns the amount of external memory registered since last global gc.
|
// Returns the amount of external memory registered since last global gc.
|
||||||
static int PromotedExternalMemorySize();
|
static int PromotedExternalMemorySize();
|
||||||
@ -1133,16 +1133,16 @@ class Heap : public AllStatic {
|
|||||||
// Limit that triggers a global GC on the next (normally caused) GC. This
|
// Limit that triggers a global GC on the next (normally caused) GC. This
|
||||||
// is checked when we have already decided to do a GC to help determine
|
// is checked when we have already decided to do a GC to help determine
|
||||||
// which collector to invoke.
|
// which collector to invoke.
|
||||||
static intptr_t old_gen_promotion_limit_;
|
static int old_gen_promotion_limit_;
|
||||||
|
|
||||||
// Limit that triggers a global GC as soon as is reasonable. This is
|
// Limit that triggers a global GC as soon as is reasonable. This is
|
||||||
// checked before expanding a paged space in the old generation and on
|
// checked before expanding a paged space in the old generation and on
|
||||||
// every allocation in large object space.
|
// every allocation in large object space.
|
||||||
static intptr_t old_gen_allocation_limit_;
|
static int old_gen_allocation_limit_;
|
||||||
|
|
||||||
// Limit on the amount of externally allocated memory allowed
|
// Limit on the amount of externally allocated memory allowed
|
||||||
// between global GCs. If reached a global GC is forced.
|
// between global GCs. If reached a global GC is forced.
|
||||||
static intptr_t external_allocation_limit_;
|
static int external_allocation_limit_;
|
||||||
|
|
||||||
// The amount of external memory registered through the API kept alive
|
// The amount of external memory registered through the API kept alive
|
||||||
// by global handles
|
// by global handles
|
||||||
@ -1231,8 +1231,8 @@ class Heap : public AllStatic {
|
|||||||
GCTracer* tracer,
|
GCTracer* tracer,
|
||||||
CollectionPolicy collectionPolicy);
|
CollectionPolicy collectionPolicy);
|
||||||
|
|
||||||
static const intptr_t kMinimumPromotionLimit = 2 * MB;
|
static const int kMinimumPromotionLimit = 2 * MB;
|
||||||
static const intptr_t kMinimumAllocationLimit = 8 * MB;
|
static const int kMinimumAllocationLimit = 8 * MB;
|
||||||
|
|
||||||
inline static void UpdateOldSpaceLimits();
|
inline static void UpdateOldSpaceLimits();
|
||||||
|
|
||||||
@ -1837,7 +1837,7 @@ class GCTracer BASE_EMBEDDED {
|
|||||||
static int get_max_gc_pause() { return max_gc_pause_; }
|
static int get_max_gc_pause() { return max_gc_pause_; }
|
||||||
|
|
||||||
// Returns maximum size of objects alive after GC.
|
// Returns maximum size of objects alive after GC.
|
||||||
static intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; }
|
static int get_max_alive_after_gc() { return max_alive_after_gc_; }
|
||||||
|
|
||||||
// Returns minimal interval between two subsequent collections.
|
// Returns minimal interval between two subsequent collections.
|
||||||
static int get_min_in_mutator() { return min_in_mutator_; }
|
static int get_min_in_mutator() { return min_in_mutator_; }
|
||||||
@ -1852,7 +1852,7 @@ class GCTracer BASE_EMBEDDED {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double start_time_; // Timestamp set in the constructor.
|
double start_time_; // Timestamp set in the constructor.
|
||||||
intptr_t start_size_; // Size of objects in heap set in constructor.
|
int start_size_; // Size of objects in heap set in constructor.
|
||||||
GarbageCollector collector_; // Type of collector.
|
GarbageCollector collector_; // Type of collector.
|
||||||
|
|
||||||
// A count (including this one, eg, the first collection is 1) of the
|
// A count (including this one, eg, the first collection is 1) of the
|
||||||
@ -1884,30 +1884,30 @@ class GCTracer BASE_EMBEDDED {
|
|||||||
|
|
||||||
// Total amount of space either wasted or contained in one of free lists
|
// Total amount of space either wasted or contained in one of free lists
|
||||||
// before the current GC.
|
// before the current GC.
|
||||||
intptr_t in_free_list_or_wasted_before_gc_;
|
int in_free_list_or_wasted_before_gc_;
|
||||||
|
|
||||||
// Difference between space used in the heap at the beginning of the current
|
// Difference between space used in the heap at the beginning of the current
|
||||||
// collection and the end of the previous collection.
|
// collection and the end of the previous collection.
|
||||||
intptr_t allocated_since_last_gc_;
|
int allocated_since_last_gc_;
|
||||||
|
|
||||||
// Amount of time spent in mutator that is time elapsed between end of the
|
// Amount of time spent in mutator that is time elapsed between end of the
|
||||||
// previous collection and the beginning of the current one.
|
// previous collection and the beginning of the current one.
|
||||||
double spent_in_mutator_;
|
double spent_in_mutator_;
|
||||||
|
|
||||||
// Size of objects promoted during the current collection.
|
// Size of objects promoted during the current collection.
|
||||||
intptr_t promoted_objects_size_;
|
int promoted_objects_size_;
|
||||||
|
|
||||||
// Maximum GC pause.
|
// Maximum GC pause.
|
||||||
static int max_gc_pause_;
|
static int max_gc_pause_;
|
||||||
|
|
||||||
// Maximum size of objects alive after GC.
|
// Maximum size of objects alive after GC.
|
||||||
static intptr_t max_alive_after_gc_;
|
static int max_alive_after_gc_;
|
||||||
|
|
||||||
// Minimal interval between two subsequent collections.
|
// Minimal interval between two subsequent collections.
|
||||||
static int min_in_mutator_;
|
static int min_in_mutator_;
|
||||||
|
|
||||||
// Size of objects alive after last GC.
|
// Size of objects alive after last GC.
|
||||||
static intptr_t alive_after_last_gc_;
|
static int alive_after_last_gc_;
|
||||||
|
|
||||||
static double last_gc_end_timestamp_;
|
static double last_gc_end_timestamp_;
|
||||||
};
|
};
|
||||||
|
@ -1005,12 +1005,11 @@ void Logger::HeapSampleBeginEvent(const char* space, const char* kind) {
|
|||||||
|
|
||||||
|
|
||||||
void Logger::HeapSampleStats(const char* space, const char* kind,
|
void Logger::HeapSampleStats(const char* space, const char* kind,
|
||||||
intptr_t capacity, intptr_t used) {
|
int capacity, int used) {
|
||||||
#ifdef ENABLE_LOGGING_AND_PROFILING
|
#ifdef ENABLE_LOGGING_AND_PROFILING
|
||||||
if (!Log::IsEnabled() || !FLAG_log_gc) return;
|
if (!Log::IsEnabled() || !FLAG_log_gc) return;
|
||||||
LogMessageBuilder msg;
|
LogMessageBuilder msg;
|
||||||
msg.Append("heap-sample-stats,\"%s\",\"%s\","
|
msg.Append("heap-sample-stats,\"%s\",\"%s\",%d,%d\n",
|
||||||
"%" V8_PTR_PREFIX "d,%" V8_PTR_PREFIX "d\n",
|
|
||||||
space, kind, capacity, used);
|
space, kind, capacity, used);
|
||||||
msg.WriteToLogFile();
|
msg.WriteToLogFile();
|
||||||
#endif
|
#endif
|
||||||
|
@ -237,7 +237,7 @@ class Logger {
|
|||||||
static void HeapSampleJSProducerEvent(const char* constructor,
|
static void HeapSampleJSProducerEvent(const char* constructor,
|
||||||
Address* stack);
|
Address* stack);
|
||||||
static void HeapSampleStats(const char* space, const char* kind,
|
static void HeapSampleStats(const char* space, const char* kind,
|
||||||
intptr_t capacity, intptr_t used);
|
int capacity, int used);
|
||||||
|
|
||||||
static void SharedLibraryEvent(const char* library_path,
|
static void SharedLibraryEvent(const char* library_path,
|
||||||
uintptr_t start,
|
uintptr_t start,
|
||||||
|
@ -2008,10 +2008,8 @@ class MapCompact {
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (FLAG_gc_verbose) {
|
if (FLAG_gc_verbose) {
|
||||||
PrintF("update %p : %p -> %p\n",
|
PrintF("update %p : %p -> %p\n", obj->address(),
|
||||||
obj->address(),
|
map, new_map);
|
||||||
reinterpret_cast<void*>(map),
|
|
||||||
reinterpret_cast<void*>(new_map));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ void Failure::FailureVerify() {
|
|||||||
|
|
||||||
|
|
||||||
void HeapObject::PrintHeader(const char* id) {
|
void HeapObject::PrintHeader(const char* id) {
|
||||||
PrintF("%p: [%s]\n", reinterpret_cast<void*>(this), id);
|
PrintF("%p: [%s]\n", this, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -522,9 +522,9 @@ void JSObject::PrintElements() {
|
|||||||
|
|
||||||
|
|
||||||
void JSObject::JSObjectPrint() {
|
void JSObject::JSObjectPrint() {
|
||||||
PrintF("%p: [JSObject]\n", reinterpret_cast<void*>(this));
|
PrintF("%p: [JSObject]\n", this);
|
||||||
PrintF(" - map = %p\n", reinterpret_cast<void*>(map()));
|
PrintF(" - map = %p\n", map());
|
||||||
PrintF(" - prototype = %p\n", reinterpret_cast<void*>(GetPrototype()));
|
PrintF(" - prototype = %p\n", GetPrototype());
|
||||||
PrintF(" {\n");
|
PrintF(" {\n");
|
||||||
PrintProperties();
|
PrintProperties();
|
||||||
PrintElements();
|
PrintElements();
|
||||||
@ -744,7 +744,7 @@ void String::StringVerify() {
|
|||||||
|
|
||||||
void JSFunction::JSFunctionPrint() {
|
void JSFunction::JSFunctionPrint() {
|
||||||
HeapObject::PrintHeader("Function");
|
HeapObject::PrintHeader("Function");
|
||||||
PrintF(" - map = 0x%p\n", reinterpret_cast<void*>(map()));
|
PrintF(" - map = 0x%p\n", map());
|
||||||
PrintF(" - initial_map = ");
|
PrintF(" - initial_map = ");
|
||||||
if (has_initial_map()) {
|
if (has_initial_map()) {
|
||||||
initial_map()->ShortPrint();
|
initial_map()->ShortPrint();
|
||||||
@ -1224,9 +1224,9 @@ void BreakPointInfo::BreakPointInfoVerify() {
|
|||||||
|
|
||||||
void BreakPointInfo::BreakPointInfoPrint() {
|
void BreakPointInfo::BreakPointInfoPrint() {
|
||||||
HeapObject::PrintHeader("BreakPointInfo");
|
HeapObject::PrintHeader("BreakPointInfo");
|
||||||
PrintF("\n - code_position: %d", code_position()->value());
|
PrintF("\n - code_position: %d", code_position());
|
||||||
PrintF("\n - source_position: %d", source_position()->value());
|
PrintF("\n - source_position: %d", source_position());
|
||||||
PrintF("\n - statement_position: %d", statement_position()->value());
|
PrintF("\n - statement_position: %d", statement_position());
|
||||||
PrintF("\n - break_point_objects: ");
|
PrintF("\n - break_point_objects: ");
|
||||||
break_point_objects()->ShortPrint();
|
break_point_objects()->ShortPrint();
|
||||||
}
|
}
|
||||||
|
@ -47,15 +47,8 @@ RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is used for printing out debugging information. It makes an integer
|
|
||||||
// that is closely related to the address of an object.
|
|
||||||
static int IntForLabel(Label* label) {
|
|
||||||
return static_cast<int>(reinterpret_cast<intptr_t>(label));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::Bind(Label* label) {
|
void RegExpMacroAssemblerTracer::Bind(Label* label) {
|
||||||
PrintF("label[%08x]: (Bind)\n", IntForLabel(label));
|
PrintF("label[%08x]: (Bind)\n", label, label);
|
||||||
assembler_->Bind(label);
|
assembler_->Bind(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +60,7 @@ void RegExpMacroAssemblerTracer::AdvanceCurrentPosition(int by) {
|
|||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) {
|
void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) {
|
||||||
PrintF(" CheckGreedyLoop(label[%08x]);\n\n", IntForLabel(label));
|
PrintF(" CheckGreedyLoop(label[%08x]);\n\n", label);
|
||||||
assembler_->CheckGreedyLoop(label);
|
assembler_->CheckGreedyLoop(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,13 +84,14 @@ void RegExpMacroAssemblerTracer::Backtrack() {
|
|||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::GoTo(Label* label) {
|
void RegExpMacroAssemblerTracer::GoTo(Label* label) {
|
||||||
PrintF(" GoTo(label[%08x]);\n\n", IntForLabel(label));
|
PrintF(" GoTo(label[%08x]);\n\n", label);
|
||||||
assembler_->GoTo(label);
|
assembler_->GoTo(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::PushBacktrack(Label* label) {
|
void RegExpMacroAssemblerTracer::PushBacktrack(Label* label) {
|
||||||
PrintF(" PushBacktrack(label[%08x]);\n", IntForLabel(label));
|
PrintF(" PushBacktrack(label[%08x]);\n",
|
||||||
|
label);
|
||||||
assembler_->PushBacktrack(label);
|
assembler_->PushBacktrack(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +176,7 @@ void RegExpMacroAssemblerTracer::LoadCurrentCharacter(int cp_offset,
|
|||||||
const char* check_msg = check_bounds ? "" : " (unchecked)";
|
const char* check_msg = check_bounds ? "" : " (unchecked)";
|
||||||
PrintF(" LoadCurrentCharacter(cp_offset=%d, label[%08x]%s (%d chars));\n",
|
PrintF(" LoadCurrentCharacter(cp_offset=%d, label[%08x]%s (%d chars));\n",
|
||||||
cp_offset,
|
cp_offset,
|
||||||
IntForLabel(on_end_of_input),
|
on_end_of_input,
|
||||||
check_msg,
|
check_msg,
|
||||||
characters);
|
characters);
|
||||||
assembler_->LoadCurrentCharacter(cp_offset,
|
assembler_->LoadCurrentCharacter(cp_offset,
|
||||||
@ -193,43 +187,39 @@ void RegExpMacroAssemblerTracer::LoadCurrentCharacter(int cp_offset,
|
|||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckCharacterLT(uc16 limit, Label* on_less) {
|
void RegExpMacroAssemblerTracer::CheckCharacterLT(uc16 limit, Label* on_less) {
|
||||||
PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n",
|
PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n", limit, on_less);
|
||||||
limit, IntForLabel(on_less));
|
|
||||||
assembler_->CheckCharacterLT(limit, on_less);
|
assembler_->CheckCharacterLT(limit, on_less);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckCharacterGT(uc16 limit,
|
void RegExpMacroAssemblerTracer::CheckCharacterGT(uc16 limit,
|
||||||
Label* on_greater) {
|
Label* on_greater) {
|
||||||
PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n",
|
PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n", limit, on_greater);
|
||||||
limit, IntForLabel(on_greater));
|
|
||||||
assembler_->CheckCharacterGT(limit, on_greater);
|
assembler_->CheckCharacterGT(limit, on_greater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckCharacter(uint32_t c, Label* on_equal) {
|
void RegExpMacroAssemblerTracer::CheckCharacter(uint32_t c, Label* on_equal) {
|
||||||
PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n",
|
PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n", c, on_equal);
|
||||||
c, IntForLabel(on_equal));
|
|
||||||
assembler_->CheckCharacter(c, on_equal);
|
assembler_->CheckCharacter(c, on_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckAtStart(Label* on_at_start) {
|
void RegExpMacroAssemblerTracer::CheckAtStart(Label* on_at_start) {
|
||||||
PrintF(" CheckAtStart(label[%08x]);\n", IntForLabel(on_at_start));
|
PrintF(" CheckAtStart(label[%08x]);\n", on_at_start);
|
||||||
assembler_->CheckAtStart(on_at_start);
|
assembler_->CheckAtStart(on_at_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckNotAtStart(Label* on_not_at_start) {
|
void RegExpMacroAssemblerTracer::CheckNotAtStart(Label* on_not_at_start) {
|
||||||
PrintF(" CheckNotAtStart(label[%08x]);\n", IntForLabel(on_not_at_start));
|
PrintF(" CheckNotAtStart(label[%08x]);\n", on_not_at_start);
|
||||||
assembler_->CheckNotAtStart(on_not_at_start);
|
assembler_->CheckNotAtStart(on_not_at_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RegExpMacroAssemblerTracer::CheckNotCharacter(uint32_t c,
|
void RegExpMacroAssemblerTracer::CheckNotCharacter(uint32_t c,
|
||||||
Label* on_not_equal) {
|
Label* on_not_equal) {
|
||||||
PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n",
|
PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n", c, on_not_equal);
|
||||||
c, IntForLabel(on_not_equal));
|
|
||||||
assembler_->CheckNotCharacter(c, on_not_equal);
|
assembler_->CheckNotCharacter(c, on_not_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +231,7 @@ void RegExpMacroAssemblerTracer::CheckCharacterAfterAnd(
|
|||||||
PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
|
PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
|
||||||
c,
|
c,
|
||||||
mask,
|
mask,
|
||||||
IntForLabel(on_equal));
|
on_equal);
|
||||||
assembler_->CheckCharacterAfterAnd(c, mask, on_equal);
|
assembler_->CheckCharacterAfterAnd(c, mask, on_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,7 +243,7 @@ void RegExpMacroAssemblerTracer::CheckNotCharacterAfterAnd(
|
|||||||
PrintF(" CheckNotCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
|
PrintF(" CheckNotCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
|
||||||
c,
|
c,
|
||||||
mask,
|
mask,
|
||||||
IntForLabel(on_not_equal));
|
on_not_equal);
|
||||||
assembler_->CheckNotCharacterAfterAnd(c, mask, on_not_equal);
|
assembler_->CheckNotCharacterAfterAnd(c, mask, on_not_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +258,7 @@ void RegExpMacroAssemblerTracer::CheckNotCharacterAfterMinusAnd(
|
|||||||
c,
|
c,
|
||||||
minus,
|
minus,
|
||||||
mask,
|
mask,
|
||||||
IntForLabel(on_not_equal));
|
on_not_equal);
|
||||||
assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal);
|
assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +266,7 @@ void RegExpMacroAssemblerTracer::CheckNotCharacterAfterMinusAnd(
|
|||||||
void RegExpMacroAssemblerTracer::CheckNotBackReference(int start_reg,
|
void RegExpMacroAssemblerTracer::CheckNotBackReference(int start_reg,
|
||||||
Label* on_no_match) {
|
Label* on_no_match) {
|
||||||
PrintF(" CheckNotBackReference(register=%d, label[%08x]);\n", start_reg,
|
PrintF(" CheckNotBackReference(register=%d, label[%08x]);\n", start_reg,
|
||||||
IntForLabel(on_no_match));
|
on_no_match);
|
||||||
assembler_->CheckNotBackReference(start_reg, on_no_match);
|
assembler_->CheckNotBackReference(start_reg, on_no_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +275,7 @@ void RegExpMacroAssemblerTracer::CheckNotBackReferenceIgnoreCase(
|
|||||||
int start_reg,
|
int start_reg,
|
||||||
Label* on_no_match) {
|
Label* on_no_match) {
|
||||||
PrintF(" CheckNotBackReferenceIgnoreCase(register=%d, label[%08x]);\n",
|
PrintF(" CheckNotBackReferenceIgnoreCase(register=%d, label[%08x]);\n",
|
||||||
start_reg, IntForLabel(on_no_match));
|
start_reg, on_no_match);
|
||||||
assembler_->CheckNotBackReferenceIgnoreCase(start_reg, on_no_match);
|
assembler_->CheckNotBackReferenceIgnoreCase(start_reg, on_no_match);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +286,7 @@ void RegExpMacroAssemblerTracer::CheckNotRegistersEqual(int reg1,
|
|||||||
PrintF(" CheckNotRegistersEqual(reg1=%d, reg2=%d, label[%08x]);\n",
|
PrintF(" CheckNotRegistersEqual(reg1=%d, reg2=%d, label[%08x]);\n",
|
||||||
reg1,
|
reg1,
|
||||||
reg2,
|
reg2,
|
||||||
IntForLabel(on_not_equal));
|
on_not_equal);
|
||||||
assembler_->CheckNotRegistersEqual(reg1, reg2, on_not_equal);
|
assembler_->CheckNotRegistersEqual(reg1, reg2, on_not_equal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,8 +300,7 @@ void RegExpMacroAssemblerTracer::CheckCharacters(Vector<const uc16> str,
|
|||||||
for (int i = 0; i < str.length(); i++) {
|
for (int i = 0; i < str.length(); i++) {
|
||||||
PrintF("u%04x", str[i]);
|
PrintF("u%04x", str[i]);
|
||||||
}
|
}
|
||||||
PrintF("\", cp_offset=%d, label[%08x])\n",
|
PrintF("\", cp_offset=%d, label[%08x])\n", cp_offset, on_failure);
|
||||||
cp_offset, IntForLabel(on_failure));
|
|
||||||
assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string);
|
assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +312,7 @@ bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass(
|
|||||||
on_no_match);
|
on_no_match);
|
||||||
PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n",
|
PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n",
|
||||||
type,
|
type,
|
||||||
IntForLabel(on_no_match),
|
on_no_match,
|
||||||
supported ? "true" : "false");
|
supported ? "true" : "false");
|
||||||
return supported;
|
return supported;
|
||||||
}
|
}
|
||||||
@ -332,7 +321,7 @@ bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass(
|
|||||||
void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index,
|
void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index,
|
||||||
int comparand, Label* if_lt) {
|
int comparand, Label* if_lt) {
|
||||||
PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n",
|
PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n",
|
||||||
register_index, comparand, IntForLabel(if_lt));
|
register_index, comparand, if_lt);
|
||||||
assembler_->IfRegisterLT(register_index, comparand, if_lt);
|
assembler_->IfRegisterLT(register_index, comparand, if_lt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +329,7 @@ void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index,
|
|||||||
void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index,
|
void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index,
|
||||||
Label* if_eq) {
|
Label* if_eq) {
|
||||||
PrintF(" IfRegisterEqPos(register=%d, label[%08x]);\n",
|
PrintF(" IfRegisterEqPos(register=%d, label[%08x]);\n",
|
||||||
register_index, IntForLabel(if_eq));
|
register_index, if_eq);
|
||||||
assembler_->IfRegisterEqPos(register_index, if_eq);
|
assembler_->IfRegisterEqPos(register_index, if_eq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +337,7 @@ void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index,
|
|||||||
void RegExpMacroAssemblerTracer::IfRegisterGE(int register_index,
|
void RegExpMacroAssemblerTracer::IfRegisterGE(int register_index,
|
||||||
int comparand, Label* if_ge) {
|
int comparand, Label* if_ge) {
|
||||||
PrintF(" IfRegisterGE(register=%d, number=%d, label[%08x]);\n",
|
PrintF(" IfRegisterGE(register=%d, number=%d, label[%08x]);\n",
|
||||||
register_index, comparand, IntForLabel(if_ge));
|
register_index, comparand, if_ge);
|
||||||
assembler_->IfRegisterGE(register_index, comparand, if_ge);
|
assembler_->IfRegisterGE(register_index, comparand, if_ge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6801,7 +6801,7 @@ static void PrintObject(Object* obj) {
|
|||||||
} else if (obj->IsFalse()) {
|
} else if (obj->IsFalse()) {
|
||||||
PrintF("<false>");
|
PrintF("<false>");
|
||||||
} else {
|
} else {
|
||||||
PrintF("%p", reinterpret_cast<void*>(obj));
|
PrintF("%p", obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,9 +270,9 @@ void CodeRange::TearDown() {
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// MemoryAllocator
|
// MemoryAllocator
|
||||||
//
|
//
|
||||||
intptr_t MemoryAllocator::capacity_ = 0;
|
int MemoryAllocator::capacity_ = 0;
|
||||||
intptr_t MemoryAllocator::size_ = 0;
|
int MemoryAllocator::size_ = 0;
|
||||||
intptr_t MemoryAllocator::size_executable_ = 0;
|
int MemoryAllocator::size_executable_ = 0;
|
||||||
|
|
||||||
List<MemoryAllocator::MemoryAllocationCallbackRegistration>
|
List<MemoryAllocator::MemoryAllocationCallbackRegistration>
|
||||||
MemoryAllocator::memory_allocation_callbacks_;
|
MemoryAllocator::memory_allocation_callbacks_;
|
||||||
@ -302,7 +302,7 @@ int MemoryAllocator::Pop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MemoryAllocator::Setup(intptr_t capacity) {
|
bool MemoryAllocator::Setup(int capacity) {
|
||||||
capacity_ = RoundUp(capacity, Page::kPageSize);
|
capacity_ = RoundUp(capacity, Page::kPageSize);
|
||||||
|
|
||||||
// Over-estimate the size of chunks_ array. It assumes the expansion of old
|
// Over-estimate the size of chunks_ array. It assumes the expansion of old
|
||||||
@ -691,9 +691,7 @@ Page* MemoryAllocator::FindLastPageInSameChunk(Page* p) {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void MemoryAllocator::ReportStatistics() {
|
void MemoryAllocator::ReportStatistics() {
|
||||||
float pct = static_cast<float>(capacity_ - size_) / capacity_;
|
float pct = static_cast<float>(capacity_ - size_) / capacity_;
|
||||||
PrintF(" capacity: %" V8_PTR_PREFIX "d"
|
PrintF(" capacity: %d, used: %d, available: %%%d\n\n",
|
||||||
", used: %" V8_PTR_PREFIX "d"
|
|
||||||
", available: %%%d\n\n",
|
|
||||||
capacity_, size_, static_cast<int>(pct*100));
|
capacity_, size_, static_cast<int>(pct*100));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -771,7 +769,7 @@ Page* MemoryAllocator::RelinkPagesInChunk(int chunk_id,
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// PagedSpace implementation
|
// PagedSpace implementation
|
||||||
|
|
||||||
PagedSpace::PagedSpace(intptr_t max_capacity,
|
PagedSpace::PagedSpace(int max_capacity,
|
||||||
AllocationSpace id,
|
AllocationSpace id,
|
||||||
Executability executable)
|
Executability executable)
|
||||||
: Space(id, executable) {
|
: Space(id, executable) {
|
||||||
@ -1645,8 +1643,7 @@ void NewSpace::ReportStatistics() {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (FLAG_heap_stats) {
|
if (FLAG_heap_stats) {
|
||||||
float pct = static_cast<float>(Available()) / Capacity();
|
float pct = static_cast<float>(Available()) / Capacity();
|
||||||
PrintF(" capacity: %" V8_PTR_PREFIX "d"
|
PrintF(" capacity: %d, available: %d, %%%d\n",
|
||||||
", available: %" V8_PTR_PREFIX "d, %%%d\n",
|
|
||||||
Capacity(), Available(), static_cast<int>(pct*100));
|
Capacity(), Available(), static_cast<int>(pct*100));
|
||||||
PrintF("\n Object Histogram:\n");
|
PrintF("\n Object Histogram:\n");
|
||||||
for (int i = 0; i <= LAST_TYPE; i++) {
|
for (int i = 0; i <= LAST_TYPE; i++) {
|
||||||
@ -2405,9 +2402,7 @@ void PagedSpace::CollectCodeStatistics() {
|
|||||||
|
|
||||||
void OldSpace::ReportStatistics() {
|
void OldSpace::ReportStatistics() {
|
||||||
int pct = Available() * 100 / Capacity();
|
int pct = Available() * 100 / Capacity();
|
||||||
PrintF(" capacity: %" V8_PTR_PREFIX "d"
|
PrintF(" capacity: %d, waste: %d, available: %d, %%%d\n",
|
||||||
", waste: %" V8_PTR_PREFIX "d"
|
|
||||||
", available: %" V8_PTR_PREFIX "d, %%%d\n",
|
|
||||||
Capacity(), Waste(), Available(), pct);
|
Capacity(), Waste(), Available(), pct);
|
||||||
|
|
||||||
ClearHistograms();
|
ClearHistograms();
|
||||||
@ -2564,9 +2559,7 @@ void FixedSpace::DeallocateBlock(Address start,
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void FixedSpace::ReportStatistics() {
|
void FixedSpace::ReportStatistics() {
|
||||||
int pct = Available() * 100 / Capacity();
|
int pct = Available() * 100 / Capacity();
|
||||||
PrintF(" capacity: %" V8_PTR_PREFIX "d"
|
PrintF(" capacity: %d, waste: %d, available: %d, %%%d\n",
|
||||||
", waste: %" V8_PTR_PREFIX "d"
|
|
||||||
", available: %" V8_PTR_PREFIX "d, %%%d\n",
|
|
||||||
Capacity(), Waste(), Available(), pct);
|
Capacity(), Waste(), Available(), pct);
|
||||||
|
|
||||||
ClearHistograms();
|
ClearHistograms();
|
||||||
@ -3018,7 +3011,7 @@ void LargeObjectSpace::Print() {
|
|||||||
|
|
||||||
|
|
||||||
void LargeObjectSpace::ReportStatistics() {
|
void LargeObjectSpace::ReportStatistics() {
|
||||||
PrintF(" size: %" V8_PTR_PREFIX "d\n", size_);
|
PrintF(" size: %d\n", size_);
|
||||||
int num_objects = 0;
|
int num_objects = 0;
|
||||||
ClearHistograms();
|
ClearHistograms();
|
||||||
LargeObjectIterator it(this);
|
LargeObjectIterator it(this);
|
||||||
|
82
src/spaces.h
82
src/spaces.h
@ -371,7 +371,7 @@ class Space : public Malloced {
|
|||||||
// Identity used in error reporting.
|
// Identity used in error reporting.
|
||||||
AllocationSpace identity() { return id_; }
|
AllocationSpace identity() { return id_; }
|
||||||
|
|
||||||
virtual intptr_t Size() = 0;
|
virtual int Size() = 0;
|
||||||
|
|
||||||
#ifdef ENABLE_HEAP_PROTECTION
|
#ifdef ENABLE_HEAP_PROTECTION
|
||||||
// Protect/unprotect the space by marking it read-only/writable.
|
// Protect/unprotect the space by marking it read-only/writable.
|
||||||
@ -491,7 +491,7 @@ class MemoryAllocator : public AllStatic {
|
|||||||
public:
|
public:
|
||||||
// Initializes its internal bookkeeping structures.
|
// Initializes its internal bookkeeping structures.
|
||||||
// Max capacity of the total space.
|
// Max capacity of the total space.
|
||||||
static bool Setup(intptr_t max_capacity);
|
static bool Setup(int max_capacity);
|
||||||
|
|
||||||
// Deletes valid chunks.
|
// Deletes valid chunks.
|
||||||
static void TearDown();
|
static void TearDown();
|
||||||
@ -582,18 +582,16 @@ class MemoryAllocator : public AllStatic {
|
|||||||
MemoryAllocationCallback callback);
|
MemoryAllocationCallback callback);
|
||||||
|
|
||||||
// Returns the maximum available bytes of heaps.
|
// Returns the maximum available bytes of heaps.
|
||||||
static intptr_t Available() {
|
static int Available() { return capacity_ < size_ ? 0 : capacity_ - size_; }
|
||||||
return capacity_ < size_ ? 0 : capacity_ - size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns allocated spaces in bytes.
|
// Returns allocated spaces in bytes.
|
||||||
static intptr_t Size() { return size_; }
|
static int Size() { return size_; }
|
||||||
|
|
||||||
// Returns allocated executable spaces in bytes.
|
// Returns allocated executable spaces in bytes.
|
||||||
static intptr_t SizeExecutable() { return size_executable_; }
|
static int SizeExecutable() { return size_executable_; }
|
||||||
|
|
||||||
// Returns maximum available bytes that the old space can have.
|
// Returns maximum available bytes that the old space can have.
|
||||||
static intptr_t MaxAvailable() {
|
static int MaxAvailable() {
|
||||||
return (Available() / Page::kPageSize) * Page::kObjectAreaSize;
|
return (Available() / Page::kPageSize) * Page::kObjectAreaSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,12 +649,12 @@ class MemoryAllocator : public AllStatic {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Maximum space size in bytes.
|
// Maximum space size in bytes.
|
||||||
static intptr_t capacity_;
|
static int capacity_;
|
||||||
|
|
||||||
// Allocated space size in bytes.
|
// Allocated space size in bytes.
|
||||||
static intptr_t size_;
|
static int size_;
|
||||||
// Allocated executable space size in bytes.
|
// Allocated executable space size in bytes.
|
||||||
static intptr_t size_executable_;
|
static int size_executable_;
|
||||||
|
|
||||||
struct MemoryAllocationCallbackRegistration {
|
struct MemoryAllocationCallbackRegistration {
|
||||||
MemoryAllocationCallbackRegistration(MemoryAllocationCallback callback,
|
MemoryAllocationCallbackRegistration(MemoryAllocationCallback callback,
|
||||||
@ -929,10 +927,10 @@ class AllocationStats BASE_EMBEDDED {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accessors for the allocation statistics.
|
// Accessors for the allocation statistics.
|
||||||
intptr_t Capacity() { return capacity_; }
|
int Capacity() { return capacity_; }
|
||||||
intptr_t Available() { return available_; }
|
int Available() { return available_; }
|
||||||
intptr_t Size() { return size_; }
|
int Size() { return size_; }
|
||||||
intptr_t Waste() { return waste_; }
|
int Waste() { return waste_; }
|
||||||
|
|
||||||
// Grow the space by adding available bytes.
|
// Grow the space by adding available bytes.
|
||||||
void ExpandSpace(int size_in_bytes) {
|
void ExpandSpace(int size_in_bytes) {
|
||||||
@ -953,7 +951,7 @@ class AllocationStats BASE_EMBEDDED {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Free allocated bytes, making them available (size -> available).
|
// Free allocated bytes, making them available (size -> available).
|
||||||
void DeallocateBytes(intptr_t size_in_bytes) {
|
void DeallocateBytes(int size_in_bytes) {
|
||||||
size_ -= size_in_bytes;
|
size_ -= size_in_bytes;
|
||||||
available_ += size_in_bytes;
|
available_ += size_in_bytes;
|
||||||
}
|
}
|
||||||
@ -972,19 +970,17 @@ class AllocationStats BASE_EMBEDDED {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
intptr_t capacity_;
|
int capacity_;
|
||||||
intptr_t available_;
|
int available_;
|
||||||
intptr_t size_;
|
int size_;
|
||||||
intptr_t waste_;
|
int waste_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class PagedSpace : public Space {
|
class PagedSpace : public Space {
|
||||||
public:
|
public:
|
||||||
// Creates a space with a maximum capacity, and an id.
|
// Creates a space with a maximum capacity, and an id.
|
||||||
PagedSpace(intptr_t max_capacity,
|
PagedSpace(int max_capacity, AllocationSpace id, Executability executable);
|
||||||
AllocationSpace id,
|
|
||||||
Executability executable);
|
|
||||||
|
|
||||||
virtual ~PagedSpace() {}
|
virtual ~PagedSpace() {}
|
||||||
|
|
||||||
@ -1035,21 +1031,21 @@ class PagedSpace : public Space {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Current capacity without growing (Size() + Available() + Waste()).
|
// Current capacity without growing (Size() + Available() + Waste()).
|
||||||
intptr_t Capacity() { return accounting_stats_.Capacity(); }
|
int Capacity() { return accounting_stats_.Capacity(); }
|
||||||
|
|
||||||
// Total amount of memory committed for this space. For paged
|
// Total amount of memory committed for this space. For paged
|
||||||
// spaces this equals the capacity.
|
// spaces this equals the capacity.
|
||||||
intptr_t CommittedMemory() { return Capacity(); }
|
int CommittedMemory() { return Capacity(); }
|
||||||
|
|
||||||
// Available bytes without growing.
|
// Available bytes without growing.
|
||||||
intptr_t Available() { return accounting_stats_.Available(); }
|
int Available() { return accounting_stats_.Available(); }
|
||||||
|
|
||||||
// Allocated bytes in this space.
|
// Allocated bytes in this space.
|
||||||
virtual intptr_t Size() { return accounting_stats_.Size(); }
|
virtual int Size() { return accounting_stats_.Size(); }
|
||||||
|
|
||||||
// Wasted bytes due to fragmentation and not recoverable until the
|
// Wasted bytes due to fragmentation and not recoverable until the
|
||||||
// next GC of this space.
|
// next GC of this space.
|
||||||
intptr_t Waste() { return accounting_stats_.Waste(); }
|
int Waste() { return accounting_stats_.Waste(); }
|
||||||
|
|
||||||
// Returns the address of the first object in this space.
|
// Returns the address of the first object in this space.
|
||||||
Address bottom() { return first_page_->ObjectAreaStart(); }
|
Address bottom() { return first_page_->ObjectAreaStart(); }
|
||||||
@ -1332,7 +1328,7 @@ class SemiSpace : public Space {
|
|||||||
|
|
||||||
// If we don't have these here then SemiSpace will be abstract. However
|
// If we don't have these here then SemiSpace will be abstract. However
|
||||||
// they should never be called.
|
// they should never be called.
|
||||||
virtual intptr_t Size() {
|
virtual int Size() {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1358,7 +1354,7 @@ class SemiSpace : public Space {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Returns the current capacity of the semi space.
|
// Returns the current capacity of the semi space.
|
||||||
intptr_t Capacity() { return capacity_; }
|
int Capacity() { return capacity_; }
|
||||||
|
|
||||||
// Returns the maximum capacity of the semi space.
|
// Returns the maximum capacity of the semi space.
|
||||||
int MaximumCapacity() { return maximum_capacity_; }
|
int MaximumCapacity() { return maximum_capacity_; }
|
||||||
@ -1475,22 +1471,22 @@ class NewSpace : public Space {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return the allocated bytes in the active semispace.
|
// Return the allocated bytes in the active semispace.
|
||||||
virtual intptr_t Size() { return static_cast<int>(top() - bottom()); }
|
virtual int Size() { return static_cast<int>(top() - bottom()); }
|
||||||
|
|
||||||
// Return the current capacity of a semispace.
|
// Return the current capacity of a semispace.
|
||||||
intptr_t Capacity() {
|
int Capacity() {
|
||||||
ASSERT(to_space_.Capacity() == from_space_.Capacity());
|
ASSERT(to_space_.Capacity() == from_space_.Capacity());
|
||||||
return to_space_.Capacity();
|
return to_space_.Capacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the total amount of memory committed for new space.
|
// Return the total amount of memory committed for new space.
|
||||||
intptr_t CommittedMemory() {
|
int CommittedMemory() {
|
||||||
if (from_space_.is_committed()) return 2 * Capacity();
|
if (from_space_.is_committed()) return 2 * Capacity();
|
||||||
return Capacity();
|
return Capacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the available bytes without growing in the active semispace.
|
// Return the available bytes without growing in the active semispace.
|
||||||
intptr_t Available() { return Capacity() - Size(); }
|
int Available() { return Capacity() - Size(); }
|
||||||
|
|
||||||
// Return the maximum capacity of a semispace.
|
// Return the maximum capacity of a semispace.
|
||||||
int MaximumCapacity() {
|
int MaximumCapacity() {
|
||||||
@ -1499,7 +1495,7 @@ class NewSpace : public Space {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the initial capacity of a semispace.
|
// Returns the initial capacity of a semispace.
|
||||||
intptr_t InitialCapacity() {
|
int InitialCapacity() {
|
||||||
ASSERT(to_space_.InitialCapacity() == from_space_.InitialCapacity());
|
ASSERT(to_space_.InitialCapacity() == from_space_.InitialCapacity());
|
||||||
return to_space_.InitialCapacity();
|
return to_space_.InitialCapacity();
|
||||||
}
|
}
|
||||||
@ -1685,7 +1681,7 @@ class OldSpaceFreeList BASE_EMBEDDED {
|
|||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
// Return the number of bytes available on the free list.
|
// Return the number of bytes available on the free list.
|
||||||
intptr_t available() { return available_; }
|
int available() { return available_; }
|
||||||
|
|
||||||
// Place a node on the free list. The block of size 'size_in_bytes'
|
// Place a node on the free list. The block of size 'size_in_bytes'
|
||||||
// starting at 'start' is placed on the free list. The return value is the
|
// starting at 'start' is placed on the free list. The return value is the
|
||||||
@ -1787,7 +1783,7 @@ class FixedSizeFreeList BASE_EMBEDDED {
|
|||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
// Return the number of bytes available on the free list.
|
// Return the number of bytes available on the free list.
|
||||||
intptr_t available() { return available_; }
|
int available() { return available_; }
|
||||||
|
|
||||||
// Place a node on the free list. The block starting at 'start' (assumed to
|
// Place a node on the free list. The block starting at 'start' (assumed to
|
||||||
// have size object_size_) is placed on the free list. Bookkeeping
|
// have size object_size_) is placed on the free list. Bookkeeping
|
||||||
@ -1801,7 +1797,7 @@ class FixedSizeFreeList BASE_EMBEDDED {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Available bytes on the free list.
|
// Available bytes on the free list.
|
||||||
intptr_t available_;
|
int available_;
|
||||||
|
|
||||||
// The head of the free list.
|
// The head of the free list.
|
||||||
Address head_;
|
Address head_;
|
||||||
@ -1836,7 +1832,7 @@ class OldSpace : public PagedSpace {
|
|||||||
|
|
||||||
// The bytes available on the free list (ie, not above the linear allocation
|
// The bytes available on the free list (ie, not above the linear allocation
|
||||||
// pointer).
|
// pointer).
|
||||||
intptr_t AvailableFree() { return free_list_.available(); }
|
int AvailableFree() { return free_list_.available(); }
|
||||||
|
|
||||||
// The limit of allocation for a page in this space.
|
// The limit of allocation for a page in this space.
|
||||||
virtual Address PageAllocationLimit(Page* page) {
|
virtual Address PageAllocationLimit(Page* page) {
|
||||||
@ -2133,7 +2129,7 @@ class LargeObjectChunk {
|
|||||||
|
|
||||||
// Given a chunk size, returns the object size it can accommodate. Used by
|
// Given a chunk size, returns the object size it can accommodate. Used by
|
||||||
// LargeObjectSpace::Available.
|
// LargeObjectSpace::Available.
|
||||||
static intptr_t ObjectSizeFor(intptr_t chunk_size) {
|
static int ObjectSizeFor(int chunk_size) {
|
||||||
if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0;
|
if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0;
|
||||||
return chunk_size - Page::kPageSize - Page::kObjectStartOffset;
|
return chunk_size - Page::kPageSize - Page::kObjectStartOffset;
|
||||||
}
|
}
|
||||||
@ -2169,11 +2165,11 @@ class LargeObjectSpace : public Space {
|
|||||||
Object* AllocateRawFixedArray(int size_in_bytes);
|
Object* AllocateRawFixedArray(int size_in_bytes);
|
||||||
|
|
||||||
// Available bytes for objects in this space.
|
// Available bytes for objects in this space.
|
||||||
intptr_t Available() {
|
int Available() {
|
||||||
return LargeObjectChunk::ObjectSizeFor(MemoryAllocator::Available());
|
return LargeObjectChunk::ObjectSizeFor(MemoryAllocator::Available());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual intptr_t Size() {
|
virtual int Size() {
|
||||||
return size_;
|
return size_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2227,7 +2223,7 @@ class LargeObjectSpace : public Space {
|
|||||||
private:
|
private:
|
||||||
// The head of the linked list of large object chunks.
|
// The head of the linked list of large object chunks.
|
||||||
LargeObjectChunk* first_chunk_;
|
LargeObjectChunk* first_chunk_;
|
||||||
intptr_t size_; // allocated bytes
|
int size_; // allocated bytes
|
||||||
int page_count_; // number of chunks
|
int page_count_; // number of chunks
|
||||||
|
|
||||||
|
|
||||||
|
20
src/utils.h
20
src/utils.h
@ -222,21 +222,11 @@ uint32_t ComputeIntegerHash(uint32_t key);
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// I/O support.
|
// I/O support.
|
||||||
|
|
||||||
#if __GNUC__ >= 4
|
// Our version of printf(). Avoids compilation errors that we get
|
||||||
// On gcc we can ask the compiler to check the types of %d-style format
|
// with standard printf when attempting to print pointers, etc.
|
||||||
// specifiers and their associated arguments. TODO(erikcorry) fix this
|
// (the errors are due to the extra compilation flags, which we
|
||||||
// so it works on MacOSX.
|
// want elsewhere).
|
||||||
#if defined(__MACH__) && defined(__APPLE__)
|
void PrintF(const char* format, ...);
|
||||||
#define PRINTF_CHECKING
|
|
||||||
#else // MacOsX.
|
|
||||||
#define PRINTF_CHECKING __attribute__ ((format (printf, 1, 2)))
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define PRINTF_CHECKING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Our version of printf().
|
|
||||||
void PRINTF_CHECKING PrintF(const char* format, ...);
|
|
||||||
|
|
||||||
// Our version of fflush.
|
// Our version of fflush.
|
||||||
void Flush();
|
void Flush();
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --max-new-space-size=256
|
// Flags: --max-new-space-size=262144
|
||||||
|
|
||||||
|
|
||||||
// Check that a mod where the stub code hits a failure in heap number
|
// Check that a mod where the stub code hits a failure in heap number
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --max-new-space-size=256
|
// Flags: --max-new-space-size=262144
|
||||||
|
|
||||||
function zero() {
|
function zero() {
|
||||||
var x = 0.5;
|
var x = 0.5;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// Flags: --max-new-space-size=256
|
// Flags: --max-new-space-size=262144
|
||||||
|
|
||||||
function zero() {
|
function zero() {
|
||||||
var x = 0.5;
|
var x = 0.5;
|
||||||
|
Loading…
Reference in New Issue
Block a user