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

Side by Side Diff: src/heap.cc

Issue 3454035: Revert attempt to make heap size 32/64 clean. This change needs to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 Object* Heap::roots_[Heap::kRootListLength]; 56 Object* Heap::roots_[Heap::kRootListLength];
57 57
58 NewSpace Heap::new_space_; 58 NewSpace Heap::new_space_;
59 OldSpace* Heap::old_pointer_space_ = NULL; 59 OldSpace* Heap::old_pointer_space_ = NULL;
60 OldSpace* Heap::old_data_space_ = NULL; 60 OldSpace* Heap::old_data_space_ = NULL;
61 OldSpace* Heap::code_space_ = NULL; 61 OldSpace* Heap::code_space_ = NULL;
62 MapSpace* Heap::map_space_ = NULL; 62 MapSpace* Heap::map_space_ = NULL;
63 CellSpace* Heap::cell_space_ = NULL; 63 CellSpace* Heap::cell_space_ = NULL;
64 LargeObjectSpace* Heap::lo_space_ = NULL; 64 LargeObjectSpace* Heap::lo_space_ = NULL;
65 65
66 intptr_t Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit; 66 int Heap::old_gen_promotion_limit_ = kMinimumPromotionLimit;
67 intptr_t Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit; 67 int Heap::old_gen_allocation_limit_ = kMinimumAllocationLimit;
68 68
69 int Heap::old_gen_exhausted_ = false; 69 int Heap::old_gen_exhausted_ = false;
70 70
71 int Heap::amount_of_external_allocated_memory_ = 0; 71 int Heap::amount_of_external_allocated_memory_ = 0;
72 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0; 72 int Heap::amount_of_external_allocated_memory_at_last_global_gc_ = 0;
73 73
74 // semispace_size_ should be a power of 2 and old_generation_size_ should be 74 // semispace_size_ should be a power of 2 and old_generation_size_ should be
75 // a multiple of Page::kPageSize. 75 // a multiple of Page::kPageSize.
76 #if defined(ANDROID) 76 #if defined(ANDROID)
77 int Heap::max_semispace_size_ = 2*MB; 77 int Heap::max_semispace_size_ = 2*MB;
78 intptr_t Heap::max_old_generation_size_ = 192*MB; 78 int Heap::max_old_generation_size_ = 192*MB;
79 int Heap::initial_semispace_size_ = 128*KB; 79 int Heap::initial_semispace_size_ = 128*KB;
80 intptr_t Heap::code_range_size_ = 0; 80 size_t Heap::code_range_size_ = 0;
81 #elif defined(V8_TARGET_ARCH_X64) 81 #elif defined(V8_TARGET_ARCH_X64)
82 int Heap::max_semispace_size_ = 16*MB; 82 int Heap::max_semispace_size_ = 16*MB;
83 intptr_t Heap::max_old_generation_size_ = 1*GB; 83 int Heap::max_old_generation_size_ = 1*GB;
84 int Heap::initial_semispace_size_ = 1*MB; 84 int Heap::initial_semispace_size_ = 1*MB;
85 intptr_t Heap::code_range_size_ = 512*MB; 85 size_t Heap::code_range_size_ = 512*MB;
86 #else 86 #else
87 int Heap::max_semispace_size_ = 8*MB; 87 int Heap::max_semispace_size_ = 8*MB;
88 intptr_t Heap::max_old_generation_size_ = 512*MB; 88 int Heap::max_old_generation_size_ = 512*MB;
89 int Heap::initial_semispace_size_ = 512*KB; 89 int Heap::initial_semispace_size_ = 512*KB;
90 intptr_t Heap::code_range_size_ = 0; 90 size_t Heap::code_range_size_ = 0;
91 #endif 91 #endif
92 92
93 // The snapshot semispace size will be the default semispace size if 93 // The snapshot semispace size will be the default semispace size if
94 // snapshotting is used and will be the requested semispace size as 94 // snapshotting is used and will be the requested semispace size as
95 // set up by ConfigureHeap otherwise. 95 // set up by ConfigureHeap otherwise.
96 int Heap::reserved_semispace_size_ = Heap::max_semispace_size_; 96 int Heap::reserved_semispace_size_ = Heap::max_semispace_size_;
97 97
98 List<Heap::GCPrologueCallbackPair> Heap::gc_prologue_callbacks_; 98 List<Heap::GCPrologueCallbackPair> Heap::gc_prologue_callbacks_;
99 List<Heap::GCEpilogueCallbackPair> Heap::gc_epilogue_callbacks_; 99 List<Heap::GCEpilogueCallbackPair> Heap::gc_epilogue_callbacks_;
100 100
101 GCCallback Heap::global_gc_prologue_callback_ = NULL; 101 GCCallback Heap::global_gc_prologue_callback_ = NULL;
102 GCCallback Heap::global_gc_epilogue_callback_ = NULL; 102 GCCallback Heap::global_gc_epilogue_callback_ = NULL;
103 HeapObjectCallback Heap::gc_safe_size_of_old_object_ = NULL; 103 HeapObjectCallback Heap::gc_safe_size_of_old_object_ = NULL;
104 104
105 // Variables set based on semispace_size_ and old_generation_size_ in 105 // Variables set based on semispace_size_ and old_generation_size_ in
106 // ConfigureHeap. 106 // ConfigureHeap.
107 107
108 // Will be 4 * reserved_semispace_size_ to ensure that young 108 // Will be 4 * reserved_semispace_size_ to ensure that young
109 // generation can be aligned to its size. 109 // generation can be aligned to its size.
110 int Heap::survived_since_last_expansion_ = 0; 110 int Heap::survived_since_last_expansion_ = 0;
111 intptr_t Heap::external_allocation_limit_ = 0; 111 int Heap::external_allocation_limit_ = 0;
112 112
113 Heap::HeapState Heap::gc_state_ = NOT_IN_GC; 113 Heap::HeapState Heap::gc_state_ = NOT_IN_GC;
114 114
115 int Heap::mc_count_ = 0; 115 int Heap::mc_count_ = 0;
116 int Heap::ms_count_ = 0; 116 int Heap::ms_count_ = 0;
117 int Heap::gc_count_ = 0; 117 int Heap::gc_count_ = 0;
118 118
119 GCTracer* Heap::tracer_ = NULL; 119 GCTracer* Heap::tracer_ = NULL;
120 120
121 int Heap::unflattened_strings_length_ = 0; 121 int Heap::unflattened_strings_length_ = 0;
122 122
123 int Heap::always_allocate_scope_depth_ = 0; 123 int Heap::always_allocate_scope_depth_ = 0;
124 int Heap::linear_allocation_scope_depth_ = 0; 124 int Heap::linear_allocation_scope_depth_ = 0;
125 int Heap::contexts_disposed_ = 0; 125 int Heap::contexts_disposed_ = 0;
126 126
127 int Heap::young_survivors_after_last_gc_ = 0; 127 int Heap::young_survivors_after_last_gc_ = 0;
128 int Heap::high_survival_rate_period_length_ = 0; 128 int Heap::high_survival_rate_period_length_ = 0;
129 double Heap::survival_rate_ = 0; 129 double Heap::survival_rate_ = 0;
130 Heap::SurvivalRateTrend Heap::previous_survival_rate_trend_ = Heap::STABLE; 130 Heap::SurvivalRateTrend Heap::previous_survival_rate_trend_ = Heap::STABLE;
131 Heap::SurvivalRateTrend Heap::survival_rate_trend_ = Heap::STABLE; 131 Heap::SurvivalRateTrend Heap::survival_rate_trend_ = Heap::STABLE;
132 132
133 #ifdef DEBUG 133 #ifdef DEBUG
134 bool Heap::allocation_allowed_ = true; 134 bool Heap::allocation_allowed_ = true;
135 135
136 int Heap::allocation_timeout_ = 0; 136 int Heap::allocation_timeout_ = 0;
137 bool Heap::disallow_allocation_failure_ = false; 137 bool Heap::disallow_allocation_failure_ = false;
138 #endif // DEBUG 138 #endif // DEBUG
139 139
140 intptr_t GCTracer::alive_after_last_gc_ = 0; 140 int GCTracer::alive_after_last_gc_ = 0;
141 double GCTracer::last_gc_end_timestamp_ = 0.0; 141 double GCTracer::last_gc_end_timestamp_ = 0.0;
142 int GCTracer::max_gc_pause_ = 0; 142 int GCTracer::max_gc_pause_ = 0;
143 intptr_t GCTracer::max_alive_after_gc_ = 0; 143 int GCTracer::max_alive_after_gc_ = 0;
144 int GCTracer::min_in_mutator_ = kMaxInt; 144 int GCTracer::min_in_mutator_ = kMaxInt;
145 145
146 int Heap::Capacity() { 146 int Heap::Capacity() {
147 if (!HasBeenSetup()) return 0; 147 if (!HasBeenSetup()) return 0;
148 148
149 return new_space_.Capacity() + 149 return new_space_.Capacity() +
150 old_pointer_space_->Capacity() + 150 old_pointer_space_->Capacity() +
151 old_data_space_->Capacity() + 151 old_data_space_->Capacity() +
152 code_space_->Capacity() + 152 code_space_->Capacity() +
153 map_space_->Capacity() + 153 map_space_->Capacity() +
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 new_space_.ReportStatistics(); 282 new_space_.ReportStatistics();
283 new_space_.ClearHistograms(); 283 new_space_.ClearHistograms();
284 } 284 }
285 #endif 285 #endif
286 } 286 }
287 287
288 288
289 #if defined(ENABLE_LOGGING_AND_PROFILING) 289 #if defined(ENABLE_LOGGING_AND_PROFILING)
290 void Heap::PrintShortHeapStatistics() { 290 void Heap::PrintShortHeapStatistics() {
291 if (!FLAG_trace_gc_verbose) return; 291 if (!FLAG_trace_gc_verbose) return;
292 PrintF("Memory allocator, used: %8" V8_PTR_PREFIX "d" 292 PrintF("Memory allocator, used: %8d, available: %8d\n",
293 ", available: %8" V8_PTR_PREFIX "d\n",
294 MemoryAllocator::Size(), 293 MemoryAllocator::Size(),
295 MemoryAllocator::Available()); 294 MemoryAllocator::Available());
296 PrintF("New space, used: %8" V8_PTR_PREFIX "d" 295 PrintF("New space, used: %8d, available: %8d\n",
297 ", available: %8" V8_PTR_PREFIX "d\n",
298 Heap::new_space_.Size(), 296 Heap::new_space_.Size(),
299 new_space_.Available()); 297 new_space_.Available());
300 PrintF("Old pointers, used: %8" V8_PTR_PREFIX "d" 298 PrintF("Old pointers, used: %8d, available: %8d, waste: %8d\n",
301 ", available: %8" V8_PTR_PREFIX "d"
302 ", waste: %8" V8_PTR_PREFIX "d\n",
303 old_pointer_space_->Size(), 299 old_pointer_space_->Size(),
304 old_pointer_space_->Available(), 300 old_pointer_space_->Available(),
305 old_pointer_space_->Waste()); 301 old_pointer_space_->Waste());
306 PrintF("Old data space, used: %8" V8_PTR_PREFIX "d" 302 PrintF("Old data space, used: %8d, available: %8d, waste: %8d\n",
307 ", available: %8" V8_PTR_PREFIX "d"
308 ", waste: %8" V8_PTR_PREFIX "d\n",
309 old_data_space_->Size(), 303 old_data_space_->Size(),
310 old_data_space_->Available(), 304 old_data_space_->Available(),
311 old_data_space_->Waste()); 305 old_data_space_->Waste());
312 PrintF("Code space, used: %8" V8_PTR_PREFIX "d" 306 PrintF("Code space, used: %8d, available: %8d, waste: %8d\n",
313 ", available: %8" V8_PTR_PREFIX "d"
314 ", waste: %8" V8_PTR_PREFIX "d\n",
315 code_space_->Size(), 307 code_space_->Size(),
316 code_space_->Available(), 308 code_space_->Available(),
317 code_space_->Waste()); 309 code_space_->Waste());
318 PrintF("Map space, used: %8" V8_PTR_PREFIX "d" 310 PrintF("Map space, used: %8d, available: %8d, waste: %8d\n",
319 ", available: %8" V8_PTR_PREFIX "d"
320 ", waste: %8" V8_PTR_PREFIX "d\n",
321 map_space_->Size(), 311 map_space_->Size(),
322 map_space_->Available(), 312 map_space_->Available(),
323 map_space_->Waste()); 313 map_space_->Waste());
324 PrintF("Cell space, used: %8" V8_PTR_PREFIX "d" 314 PrintF("Cell space, used: %8d, available: %8d, waste: %8d\n",
325 ", available: %8" V8_PTR_PREFIX "d"
326 ", waste: %8" V8_PTR_PREFIX "d\n",
327 cell_space_->Size(), 315 cell_space_->Size(),
328 cell_space_->Available(), 316 cell_space_->Available(),
329 cell_space_->Waste()); 317 cell_space_->Waste());
330 PrintF("Large object space, used: %8" V8_PTR_PREFIX "d" 318 PrintF("Large object space, used: %8d, avaialble: %8d\n",
331 ", available: %8" V8_PTR_PREFIX "d\n",
332 lo_space_->Size(), 319 lo_space_->Size(),
333 lo_space_->Available()); 320 lo_space_->Available());
334 } 321 }
335 #endif 322 #endif
336 323
337 324
338 // TODO(1238405): Combine the infrastructure for --heap-stats and 325 // TODO(1238405): Combine the infrastructure for --heap-stats and
339 // --log-gc to avoid the complicated preprocessor and flag testing. 326 // --log-gc to avoid the complicated preprocessor and flag testing.
340 void Heap::ReportStatisticsAfterGC() { 327 void Heap::ReportStatisticsAfterGC() {
341 // Similar to the before GC, we use some complicated logic to ensure that 328 // Similar to the before GC, we use some complicated logic to ensure that
(...skipping 28 matching lines...) Expand all
370 } 357 }
371 358
372 if (FLAG_gc_verbose) Print(); 359 if (FLAG_gc_verbose) Print();
373 #endif 360 #endif
374 361
375 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) 362 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
376 ReportStatisticsBeforeGC(); 363 ReportStatisticsBeforeGC();
377 #endif 364 #endif
378 } 365 }
379 366
380 intptr_t Heap::SizeOfObjects() { 367 int Heap::SizeOfObjects() {
381 intptr_t total = 0; 368 int total = 0;
382 AllSpaces spaces; 369 AllSpaces spaces;
383 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { 370 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
384 total += space->Size(); 371 total += space->Size();
385 } 372 }
386 return total; 373 return total;
387 } 374 }
388 375
389 void Heap::GarbageCollectionEpilogue() { 376 void Heap::GarbageCollectionEpilogue() {
390 #ifdef DEBUG 377 #ifdef DEBUG
391 allow_allocation(true); 378 allow_allocation(true);
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 old_pointer_space_->FlushTopPageWatermark(); 955 old_pointer_space_->FlushTopPageWatermark();
969 map_space_->FlushTopPageWatermark(); 956 map_space_->FlushTopPageWatermark();
970 957
971 // Implements Cheney's copying algorithm 958 // Implements Cheney's copying algorithm
972 LOG(ResourceEvent("scavenge", "begin")); 959 LOG(ResourceEvent("scavenge", "begin"));
973 960
974 // Clear descriptor cache. 961 // Clear descriptor cache.
975 DescriptorLookupCache::Clear(); 962 DescriptorLookupCache::Clear();
976 963
977 // Used for updating survived_since_last_expansion_ at function end. 964 // Used for updating survived_since_last_expansion_ at function end.
978 intptr_t survived_watermark = PromotedSpaceSize(); 965 int survived_watermark = PromotedSpaceSize();
979 966
980 CheckNewSpaceExpansionCriteria(); 967 CheckNewSpaceExpansionCriteria();
981 968
982 // Flip the semispaces. After flipping, to space is empty, from space has 969 // Flip the semispaces. After flipping, to space is empty, from space has
983 // live objects. 970 // live objects.
984 new_space_.Flip(); 971 new_space_.Flip();
985 new_space_.ResetAllocationInfo(); 972 new_space_.ResetAllocationInfo();
986 973
987 // We need to sweep newly copied objects which can be either in the 974 // We need to sweep newly copied objects which can be either in the
988 // to space or promoted to the old generation. For to-space 975 // to space or promoted to the old generation. For to-space
(...skipping 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after
3502 3489
3503 3490
3504 // This function expects that NewSpace's allocated objects histogram is 3491 // This function expects that NewSpace's allocated objects histogram is
3505 // populated (via a call to CollectStatistics or else as a side effect of a 3492 // populated (via a call to CollectStatistics or else as a side effect of a
3506 // just-completed scavenge collection). 3493 // just-completed scavenge collection).
3507 void Heap::ReportHeapStatistics(const char* title) { 3494 void Heap::ReportHeapStatistics(const char* title) {
3508 USE(title); 3495 USE(title);
3509 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", 3496 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n",
3510 title, gc_count_); 3497 title, gc_count_);
3511 PrintF("mark-compact GC : %d\n", mc_count_); 3498 PrintF("mark-compact GC : %d\n", mc_count_);
3512 PrintF("old_gen_promotion_limit_ %" V8_PTR_PREFIX "d\n", 3499 PrintF("old_gen_promotion_limit_ %d\n", old_gen_promotion_limit_);
3513 old_gen_promotion_limit_); 3500 PrintF("old_gen_allocation_limit_ %d\n", old_gen_allocation_limit_);
3514 PrintF("old_gen_allocation_limit_ %" V8_PTR_PREFIX "d\n",
3515 old_gen_allocation_limit_);
3516 3501
3517 PrintF("\n"); 3502 PrintF("\n");
3518 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles()); 3503 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles());
3519 GlobalHandles::PrintStats(); 3504 GlobalHandles::PrintStats();
3520 PrintF("\n"); 3505 PrintF("\n");
3521 3506
3522 PrintF("Heap statistics : "); 3507 PrintF("Heap statistics : ");
3523 MemoryAllocator::ReportStatistics(); 3508 MemoryAllocator::ReportStatistics();
3524 PrintF("To space : "); 3509 PrintF("To space : ");
3525 new_space_.ReportStatistics(); 3510 new_space_.ReportStatistics();
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 4062
4078 // The old generation is paged. 4063 // The old generation is paged.
4079 max_old_generation_size_ = RoundUp(max_old_generation_size_, Page::kPageSize); 4064 max_old_generation_size_ = RoundUp(max_old_generation_size_, Page::kPageSize);
4080 4065
4081 heap_configured = true; 4066 heap_configured = true;
4082 return true; 4067 return true;
4083 } 4068 }
4084 4069
4085 4070
4086 bool Heap::ConfigureHeapDefault() { 4071 bool Heap::ConfigureHeapDefault() {
4087 return ConfigureHeap( 4072 return ConfigureHeap(FLAG_max_new_space_size / 2, FLAG_max_old_space_size);
4088 FLAG_max_new_space_size * (KB / 2), FLAG_max_old_space_size * MB);
4089 } 4073 }
4090 4074
4091 4075
4092 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) { 4076 void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
4093 *stats->start_marker = HeapStats::kStartMarker; 4077 *stats->start_marker = HeapStats::kStartMarker;
4094 *stats->end_marker = HeapStats::kEndMarker; 4078 *stats->end_marker = HeapStats::kEndMarker;
4095 *stats->new_space_size = new_space_.Size(); 4079 *stats->new_space_size = new_space_.Size();
4096 *stats->new_space_capacity = new_space_.Capacity(); 4080 *stats->new_space_capacity = new_space_.Capacity();
4097 *stats->old_pointer_space_size = old_pointer_space_->Size(); 4081 *stats->old_pointer_space_size = old_pointer_space_->Size();
4098 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity(); 4082 *stats->old_pointer_space_capacity = old_pointer_space_->Capacity();
(...skipping 21 matching lines...) Expand all
4120 if (FreeListNode::IsFreeListNode(obj)) continue; 4104 if (FreeListNode::IsFreeListNode(obj)) continue;
4121 InstanceType type = obj->map()->instance_type(); 4105 InstanceType type = obj->map()->instance_type();
4122 ASSERT(0 <= type && type <= LAST_TYPE); 4106 ASSERT(0 <= type && type <= LAST_TYPE);
4123 stats->objects_per_type[type]++; 4107 stats->objects_per_type[type]++;
4124 stats->size_per_type[type] += obj->Size(); 4108 stats->size_per_type[type] += obj->Size();
4125 } 4109 }
4126 } 4110 }
4127 } 4111 }
4128 4112
4129 4113
4130 intptr_t Heap::PromotedSpaceSize() { 4114 int Heap::PromotedSpaceSize() {
4131 return old_pointer_space_->Size() 4115 return old_pointer_space_->Size()
4132 + old_data_space_->Size() 4116 + old_data_space_->Size()
4133 + code_space_->Size() 4117 + code_space_->Size()
4134 + map_space_->Size() 4118 + map_space_->Size()
4135 + cell_space_->Size() 4119 + cell_space_->Size()
4136 + lo_space_->Size(); 4120 + lo_space_->Size();
4137 } 4121 }
4138 4122
4139 4123
4140 int Heap::PromotedExternalMemorySize() { 4124 int Heap::PromotedExternalMemorySize() {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
4266 4250
4267 4251
4268 void Heap::TearDown() { 4252 void Heap::TearDown() {
4269 if (FLAG_print_cumulative_gc_stat) { 4253 if (FLAG_print_cumulative_gc_stat) {
4270 PrintF("\n\n"); 4254 PrintF("\n\n");
4271 PrintF("gc_count=%d ", gc_count_); 4255 PrintF("gc_count=%d ", gc_count_);
4272 PrintF("mark_sweep_count=%d ", ms_count_); 4256 PrintF("mark_sweep_count=%d ", ms_count_);
4273 PrintF("mark_compact_count=%d ", mc_count_); 4257 PrintF("mark_compact_count=%d ", mc_count_);
4274 PrintF("max_gc_pause=%d ", GCTracer::get_max_gc_pause()); 4258 PrintF("max_gc_pause=%d ", GCTracer::get_max_gc_pause());
4275 PrintF("min_in_mutator=%d ", GCTracer::get_min_in_mutator()); 4259 PrintF("min_in_mutator=%d ", GCTracer::get_min_in_mutator());
4276 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", 4260 PrintF("max_alive_after_gc=%d ", GCTracer::get_max_alive_after_gc());
4277 GCTracer::get_max_alive_after_gc());
4278 PrintF("\n\n"); 4261 PrintF("\n\n");
4279 } 4262 }
4280 4263
4281 GlobalHandles::TearDown(); 4264 GlobalHandles::TearDown();
4282 4265
4283 ExternalStringTable::TearDown(); 4266 ExternalStringTable::TearDown();
4284 4267
4285 new_space_.TearDown(); 4268 new_space_.TearDown();
4286 4269
4287 if (old_pointer_space_ != NULL) { 4270 if (old_pointer_space_ != NULL) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4393 UNREACHABLE(); 4376 UNREACHABLE();
4394 } 4377 }
4395 4378
4396 4379
4397 #ifdef DEBUG 4380 #ifdef DEBUG
4398 4381
4399 class PrintHandleVisitor: public ObjectVisitor { 4382 class PrintHandleVisitor: public ObjectVisitor {
4400 public: 4383 public:
4401 void VisitPointers(Object** start, Object** end) { 4384 void VisitPointers(Object** start, Object** end) {
4402 for (Object** p = start; p < end; p++) 4385 for (Object** p = start; p < end; p++)
4403 PrintF(" handle %p to %p\n", 4386 PrintF(" handle %p to %p\n", p, *p);
4404 reinterpret_cast<void*>(p),
4405 reinterpret_cast<void*>(*p));
4406 } 4387 }
4407 }; 4388 };
4408 4389
4409 void Heap::PrintHandles() { 4390 void Heap::PrintHandles() {
4410 PrintF("Handles:\n"); 4391 PrintF("Handles:\n");
4411 PrintHandleVisitor v; 4392 PrintHandleVisitor v;
4412 HandleScopeImplementer::Iterate(&v); 4393 HandleScopeImplementer::Iterate(&v);
4413 } 4394 }
4414 4395
4415 #endif 4396 #endif
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
4748 void Heap::TracePathToGlobal() { 4729 void Heap::TracePathToGlobal() {
4749 search_target = NULL; 4730 search_target = NULL;
4750 search_for_any_global = true; 4731 search_for_any_global = true;
4751 4732
4752 MarkRootVisitor root_visitor; 4733 MarkRootVisitor root_visitor;
4753 IterateRoots(&root_visitor, VISIT_ONLY_STRONG); 4734 IterateRoots(&root_visitor, VISIT_ONLY_STRONG);
4754 } 4735 }
4755 #endif 4736 #endif
4756 4737
4757 4738
4758 static intptr_t CountTotalHolesSize() { 4739 static int CountTotalHolesSize() {
4759 intptr_t holes_size = 0; 4740 int holes_size = 0;
4760 OldSpaces spaces; 4741 OldSpaces spaces;
4761 for (OldSpace* space = spaces.next(); 4742 for (OldSpace* space = spaces.next();
4762 space != NULL; 4743 space != NULL;
4763 space = spaces.next()) { 4744 space = spaces.next()) {
4764 holes_size += space->Waste() + space->AvailableFree(); 4745 holes_size += space->Waste() + space->AvailableFree();
4765 } 4746 }
4766 return holes_size; 4747 return holes_size;
4767 } 4748 }
4768 4749
4769 4750
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
4847 UNREACHABLE(); 4828 UNREACHABLE();
4848 } 4829 }
4849 PrintF(" "); 4830 PrintF(" ");
4850 4831
4851 PrintF("external=%d ", static_cast<int>(scopes_[Scope::EXTERNAL])); 4832 PrintF("external=%d ", static_cast<int>(scopes_[Scope::EXTERNAL]));
4852 PrintF("mark=%d ", static_cast<int>(scopes_[Scope::MC_MARK])); 4833 PrintF("mark=%d ", static_cast<int>(scopes_[Scope::MC_MARK]));
4853 PrintF("sweep=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP])); 4834 PrintF("sweep=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP]));
4854 PrintF("sweepns=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP_NEWSPACE])); 4835 PrintF("sweepns=%d ", static_cast<int>(scopes_[Scope::MC_SWEEP_NEWSPACE]));
4855 PrintF("compact=%d ", static_cast<int>(scopes_[Scope::MC_COMPACT])); 4836 PrintF("compact=%d ", static_cast<int>(scopes_[Scope::MC_COMPACT]));
4856 4837
4857 PrintF("total_size_before=%" V8_PTR_PREFIX "d ", start_size_); 4838 PrintF("total_size_before=%d ", start_size_);
4858 PrintF("total_size_after=%" V8_PTR_PREFIX "d ", Heap::SizeOfObjects()); 4839 PrintF("total_size_after=%d ", Heap::SizeOfObjects());
4859 PrintF("holes_size_before=%" V8_PTR_PREFIX "d ", 4840 PrintF("holes_size_before=%d ", in_free_list_or_wasted_before_gc_);
4860 in_free_list_or_wasted_before_gc_); 4841 PrintF("holes_size_after=%d ", CountTotalHolesSize());
4861 PrintF("holes_size_after=%" V8_PTR_PREFIX "d ", CountTotalHolesSize());
4862 4842
4863 PrintF("allocated=%" V8_PTR_PREFIX "d ", allocated_since_last_gc_); 4843 PrintF("allocated=%d ", allocated_since_last_gc_);
4864 PrintF("promoted=%" V8_PTR_PREFIX "d ", promoted_objects_size_); 4844 PrintF("promoted=%d ", promoted_objects_size_);
4865 4845
4866 PrintF("\n"); 4846 PrintF("\n");
4867 } 4847 }
4868 4848
4869 #if defined(ENABLE_LOGGING_AND_PROFILING) 4849 #if defined(ENABLE_LOGGING_AND_PROFILING)
4870 Heap::PrintShortHeapStatistics(); 4850 Heap::PrintShortHeapStatistics();
4871 #endif 4851 #endif
4872 } 4852 }
4873 4853
4874 4854
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4996 void ExternalStringTable::TearDown() { 4976 void ExternalStringTable::TearDown() {
4997 new_space_strings_.Free(); 4977 new_space_strings_.Free();
4998 old_space_strings_.Free(); 4978 old_space_strings_.Free();
4999 } 4979 }
5000 4980
5001 4981
5002 List<Object*> ExternalStringTable::new_space_strings_; 4982 List<Object*> ExternalStringTable::new_space_strings_;
5003 List<Object*> ExternalStringTable::old_space_strings_; 4983 List<Object*> ExternalStringTable::old_space_strings_;
5004 4984
5005 } } // namespace v8::internal 4985 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698