| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 268 |
| 269 // Is there enough space left in OLD to guarantee that a scavenge can | 269 // Is there enough space left in OLD to guarantee that a scavenge can |
| 270 // succeed? | 270 // succeed? |
| 271 // | 271 // |
| 272 // Note that MemoryAllocator->MaxAvailable() undercounts the memory available | 272 // Note that MemoryAllocator->MaxAvailable() undercounts the memory available |
| 273 // for object promotion. It counts only the bytes that the memory | 273 // for object promotion. It counts only the bytes that the memory |
| 274 // allocator has not yet allocated from the OS and assigned to any space, | 274 // allocator has not yet allocated from the OS and assigned to any space, |
| 275 // and does not count available bytes already in the old space or code | 275 // and does not count available bytes already in the old space or code |
| 276 // space. Undercounting is safe---we may get an unrequested full GC when | 276 // space. Undercounting is safe---we may get an unrequested full GC when |
| 277 // a scavenge would have succeeded. | 277 // a scavenge would have succeeded. |
| 278 if (memory_allocator()->MaxAvailable() <= new_space_->Size()) { | 278 if (static_cast<intptr_t>(memory_allocator()->MaxAvailable()) <= |
| 279 new_space_->Size()) { |
| 279 isolate_->counters() | 280 isolate_->counters() |
| 280 ->gc_compactor_caused_by_oldspace_exhaustion() | 281 ->gc_compactor_caused_by_oldspace_exhaustion() |
| 281 ->Increment(); | 282 ->Increment(); |
| 282 *reason = "scavenge might not succeed"; | 283 *reason = "scavenge might not succeed"; |
| 283 return MARK_COMPACTOR; | 284 return MARK_COMPACTOR; |
| 284 } | 285 } |
| 285 | 286 |
| 286 // Default | 287 // Default |
| 287 *reason = NULL; | 288 *reason = NULL; |
| 288 return SCAVENGER; | 289 return SCAVENGER; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 308 new_space_->CollectStatistics(); | 309 new_space_->CollectStatistics(); |
| 309 new_space_->ReportStatistics(); | 310 new_space_->ReportStatistics(); |
| 310 new_space_->ClearHistograms(); | 311 new_space_->ClearHistograms(); |
| 311 } | 312 } |
| 312 #endif // DEBUG | 313 #endif // DEBUG |
| 313 } | 314 } |
| 314 | 315 |
| 315 | 316 |
| 316 void Heap::PrintShortHeapStatistics() { | 317 void Heap::PrintShortHeapStatistics() { |
| 317 if (!FLAG_trace_gc_verbose) return; | 318 if (!FLAG_trace_gc_verbose) return; |
| 318 PrintIsolate(isolate_, "Memory allocator, used: %6" V8PRIdPTR | 319 PrintIsolate(isolate_, |
| 319 " KB, available: %6" V8PRIdPTR " KB\n", | 320 "Memory allocator, used: %6zu KB," |
| 321 " available: %6zu KB\n", |
| 320 memory_allocator()->Size() / KB, | 322 memory_allocator()->Size() / KB, |
| 321 memory_allocator()->Available() / KB); | 323 memory_allocator()->Available() / KB); |
| 322 PrintIsolate(isolate_, "New space, used: %6" V8PRIdPTR | 324 PrintIsolate(isolate_, "New space, used: %6" V8PRIdPTR |
| 323 " KB" | 325 " KB" |
| 324 ", available: %6" V8PRIdPTR | 326 ", available: %6" V8PRIdPTR |
| 325 " KB" | 327 " KB" |
| 326 ", committed: %6zu KB\n", | 328 ", committed: %6zu KB\n", |
| 327 new_space_->Size() / KB, new_space_->Available() / KB, | 329 new_space_->Size() / KB, new_space_->Available() / KB, |
| 328 new_space_->CommittedMemory() / KB); | 330 new_space_->CommittedMemory() / KB); |
| 329 PrintIsolate(isolate_, "Old space, used: %6" V8PRIdPTR | 331 PrintIsolate(isolate_, "Old space, used: %6" V8PRIdPTR |
| (...skipping 6198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6528 } | 6530 } |
| 6529 | 6531 |
| 6530 | 6532 |
| 6531 // static | 6533 // static |
| 6532 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6534 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6533 return StaticVisitorBase::GetVisitorId(map); | 6535 return StaticVisitorBase::GetVisitorId(map); |
| 6534 } | 6536 } |
| 6535 | 6537 |
| 6536 } // namespace internal | 6538 } // namespace internal |
| 6537 } // namespace v8 | 6539 } // namespace v8 |
| OLD | NEW |