| 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/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| 11 #include "src/base/once.h" | 11 #include "src/base/once.h" |
| 12 #include "src/base/utils/random-number-generator.h" | 12 #include "src/base/utils/random-number-generator.h" |
| 13 #include "src/bootstrapper.h" | 13 #include "src/bootstrapper.h" |
| 14 #include "src/codegen.h" | 14 #include "src/codegen.h" |
| 15 #include "src/compilation-cache.h" | 15 #include "src/compilation-cache.h" |
| 16 #include "src/conversions.h" | 16 #include "src/conversions.h" |
| 17 #include "src/debug/debug.h" | 17 #include "src/debug/debug.h" |
| 18 #include "src/deoptimizer.h" | 18 #include "src/deoptimizer.h" |
| 19 #include "src/global-handles.h" | 19 #include "src/global-handles.h" |
| 20 #include "src/heap/array-buffer-tracker-inl.h" | 20 #include "src/heap/array-buffer-tracker-inl.h" |
| 21 #include "src/heap/code-stats.h" |
| 21 #include "src/heap/gc-idle-time-handler.h" | 22 #include "src/heap/gc-idle-time-handler.h" |
| 22 #include "src/heap/gc-tracer.h" | 23 #include "src/heap/gc-tracer.h" |
| 23 #include "src/heap/incremental-marking.h" | 24 #include "src/heap/incremental-marking.h" |
| 24 #include "src/heap/mark-compact-inl.h" | 25 #include "src/heap/mark-compact-inl.h" |
| 25 #include "src/heap/mark-compact.h" | 26 #include "src/heap/mark-compact.h" |
| 26 #include "src/heap/memory-reducer.h" | 27 #include "src/heap/memory-reducer.h" |
| 27 #include "src/heap/object-stats.h" | 28 #include "src/heap/object-stats.h" |
| 28 #include "src/heap/objects-visiting-inl.h" | 29 #include "src/heap/objects-visiting-inl.h" |
| 29 #include "src/heap/objects-visiting.h" | 30 #include "src/heap/objects-visiting.h" |
| 30 #include "src/heap/remembered-set.h" | 31 #include "src/heap/remembered-set.h" |
| (...skipping 4429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4460 ExecutionAccess access(isolate()); | 4461 ExecutionAccess access(isolate()); |
| 4461 isolate()->stack_guard()->RequestGC(); | 4462 isolate()->stack_guard()->RequestGC(); |
| 4462 V8::GetCurrentPlatform()->CallOnForegroundThread( | 4463 V8::GetCurrentPlatform()->CallOnForegroundThread( |
| 4463 reinterpret_cast<v8::Isolate*>(isolate()), | 4464 reinterpret_cast<v8::Isolate*>(isolate()), |
| 4464 new MemoryPressureInterruptTask(this)); | 4465 new MemoryPressureInterruptTask(this)); |
| 4465 } | 4466 } |
| 4466 } | 4467 } |
| 4467 } | 4468 } |
| 4468 | 4469 |
| 4469 void Heap::CollectCodeStatistics() { | 4470 void Heap::CollectCodeStatistics() { |
| 4470 PagedSpace::ResetCodeAndMetadataStatistics(isolate()); | 4471 CodeStatistics::ResetCodeAndMetadataStatistics(isolate()); |
| 4471 // We do not look for code in new space, or map space. If code | 4472 // We do not look for code in new space, or map space. If code |
| 4472 // somehow ends up in those spaces, we would miss it here. | 4473 // somehow ends up in those spaces, we would miss it here. |
| 4473 code_space_->CollectCodeStatistics(); | 4474 CodeStatistics::CollectCodeStatistics(code_space_, isolate()); |
| 4474 old_space_->CollectCodeStatistics(); | 4475 CodeStatistics::CollectCodeStatistics(old_space_, isolate()); |
| 4475 lo_space_->CollectCodeStatistics(); | 4476 CodeStatistics::CollectCodeStatistics(lo_space_, isolate()); |
| 4476 } | 4477 } |
| 4477 | 4478 |
| 4478 #ifdef DEBUG | 4479 #ifdef DEBUG |
| 4479 | 4480 |
| 4480 void Heap::Print() { | 4481 void Heap::Print() { |
| 4481 if (!HasBeenSetUp()) return; | 4482 if (!HasBeenSetUp()) return; |
| 4482 isolate()->PrintStack(stdout); | 4483 isolate()->PrintStack(stdout); |
| 4483 AllSpaces spaces(this); | 4484 AllSpaces spaces(this); |
| 4484 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { | 4485 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { |
| 4485 space->Print(); | 4486 space->Print(); |
| 4486 } | 4487 } |
| 4487 } | 4488 } |
| 4488 | 4489 |
| 4489 | 4490 |
| 4490 void Heap::ReportCodeStatistics(const char* title) { | 4491 void Heap::ReportCodeStatistics(const char* title) { |
| 4491 PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title); | 4492 PrintF(">>>>>> Code Stats (%s) >>>>>>\n", title); |
| 4492 CollectCodeStatistics(); | 4493 CollectCodeStatistics(); |
| 4493 PagedSpace::ReportCodeStatistics(isolate()); | 4494 CodeStatistics::ReportCodeStatistics(isolate()); |
| 4494 } | 4495 } |
| 4495 | 4496 |
| 4496 | 4497 |
| 4497 // This function expects that NewSpace's allocated objects histogram is | 4498 // This function expects that NewSpace's allocated objects histogram is |
| 4498 // populated (via a call to CollectStatistics or else as a side effect of a | 4499 // populated (via a call to CollectStatistics or else as a side effect of a |
| 4499 // just-completed scavenge collection). | 4500 // just-completed scavenge collection). |
| 4500 void Heap::ReportHeapStatistics(const char* title) { | 4501 void Heap::ReportHeapStatistics(const char* title) { |
| 4501 USE(title); | 4502 USE(title); |
| 4502 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title, | 4503 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", title, |
| 4503 gc_count_); | 4504 gc_count_); |
| (...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6372 } | 6373 } |
| 6373 | 6374 |
| 6374 | 6375 |
| 6375 // static | 6376 // static |
| 6376 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6377 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6377 return StaticVisitorBase::GetVisitorId(map); | 6378 return StaticVisitorBase::GetVisitorId(map); |
| 6378 } | 6379 } |
| 6379 | 6380 |
| 6380 } // namespace internal | 6381 } // namespace internal |
| 6381 } // namespace v8 | 6382 } // namespace v8 |
| OLD | NEW |