| 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/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 11 #include "src/compilation-cache.h" | 11 #include "src/compilation-cache.h" |
| 12 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
| 13 #include "src/execution.h" | 13 #include "src/execution.h" |
| 14 #include "src/frames-inl.h" | 14 #include "src/frames-inl.h" |
| 15 #include "src/gdb-jit.h" | 15 #include "src/gdb-jit.h" |
| 16 #include "src/global-handles.h" | 16 #include "src/global-handles.h" |
| 17 #include "src/heap/array-buffer-tracker.h" | 17 #include "src/heap/array-buffer-tracker.h" |
| 18 #include "src/heap/gc-tracer.h" | 18 #include "src/heap/gc-tracer.h" |
| 19 #include "src/heap/incremental-marking.h" | 19 #include "src/heap/incremental-marking.h" |
| 20 #include "src/heap/mark-compact-inl.h" | 20 #include "src/heap/mark-compact-inl.h" |
| 21 #include "src/heap/object-stats.h" | 21 #include "src/heap/object-stats.h" |
| 22 #include "src/heap/objects-visiting-inl.h" | 22 #include "src/heap/objects-visiting-inl.h" |
| 23 #include "src/heap/objects-visiting.h" | 23 #include "src/heap/objects-visiting.h" |
| 24 #include "src/heap/page-parallel-job.h" | 24 #include "src/heap/page-parallel-job.h" |
| 25 #include "src/heap/spaces-inl.h" | 25 #include "src/heap/spaces-inl.h" |
| 26 #include "src/ic/ic.h" | 26 #include "src/ic/ic.h" |
| 27 #include "src/ic/stub-cache.h" | 27 #include "src/ic/stub-cache.h" |
| 28 #include "src/tracing/tracing-category-observer.h" | |
| 29 #include "src/utils-inl.h" | 28 #include "src/utils-inl.h" |
| 30 #include "src/v8.h" | 29 #include "src/v8.h" |
| 31 | 30 |
| 32 namespace v8 { | 31 namespace v8 { |
| 33 namespace internal { | 32 namespace internal { |
| 34 | 33 |
| 35 | 34 |
| 36 const char* Marking::kWhiteBitPattern = "00"; | 35 const char* Marking::kWhiteBitPattern = "00"; |
| 37 const char* Marking::kBlackBitPattern = "11"; | 36 const char* Marking::kBlackBitPattern = "11"; |
| 38 const char* Marking::kGreyBitPattern = "10"; | 37 const char* Marking::kGreyBitPattern = "10"; |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 while (space_it.has_next()) { | 2229 while (space_it.has_next()) { |
| 2231 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator()); | 2230 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator()); |
| 2232 ObjectIterator* obj_it = it.get(); | 2231 ObjectIterator* obj_it = it.get(); |
| 2233 while ((obj = obj_it->Next()) != nullptr) { | 2232 while ((obj = obj_it->Next()) != nullptr) { |
| 2234 visitor->Visit(obj); | 2233 visitor->Visit(obj); |
| 2235 } | 2234 } |
| 2236 } | 2235 } |
| 2237 } | 2236 } |
| 2238 | 2237 |
| 2239 void MarkCompactCollector::RecordObjectStats() { | 2238 void MarkCompactCollector::RecordObjectStats() { |
| 2240 if (V8_UNLIKELY(FLAG_gc_stats)) { | 2239 if (FLAG_track_gc_object_stats) { |
| 2241 heap()->CreateObjectStats(); | |
| 2242 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, | 2240 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, |
| 2243 heap()->dead_object_stats_); | 2241 heap()->dead_object_stats_); |
| 2244 VisitAllObjects(&visitor); | 2242 VisitAllObjects(&visitor); |
| 2245 if (V8_UNLIKELY(FLAG_gc_stats & | 2243 std::stringstream live, dead; |
| 2246 v8::tracing::TracingCategoryObserver::ENABLED_BY_TRACING)) { | 2244 heap()->live_object_stats_->Dump(live); |
| 2247 std::stringstream live, dead; | 2245 heap()->dead_object_stats_->Dump(dead); |
| 2248 heap()->live_object_stats_->Dump(live); | 2246 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats"), |
| 2249 heap()->dead_object_stats_->Dump(dead); | 2247 "V8.GC_Objects_Stats", TRACE_EVENT_SCOPE_THREAD, |
| 2250 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats"), | 2248 "live", TRACE_STR_COPY(live.str().c_str()), "dead", |
| 2251 "V8.GC_Objects_Stats", TRACE_EVENT_SCOPE_THREAD, | 2249 TRACE_STR_COPY(dead.str().c_str())); |
| 2252 "live", TRACE_STR_COPY(live.str().c_str()), "dead", | |
| 2253 TRACE_STR_COPY(dead.str().c_str())); | |
| 2254 } | |
| 2255 if (FLAG_trace_gc_object_stats) { | 2250 if (FLAG_trace_gc_object_stats) { |
| 2256 heap()->live_object_stats_->PrintJSON("live"); | 2251 heap()->live_object_stats_->PrintJSON("live"); |
| 2257 heap()->dead_object_stats_->PrintJSON("dead"); | 2252 heap()->dead_object_stats_->PrintJSON("dead"); |
| 2258 } | 2253 } |
| 2259 heap()->live_object_stats_->CheckpointObjectStats(); | 2254 heap()->live_object_stats_->CheckpointObjectStats(); |
| 2260 heap()->dead_object_stats_->ClearObjectStats(); | 2255 heap()->dead_object_stats_->ClearObjectStats(); |
| 2261 } | 2256 } |
| 2262 } | 2257 } |
| 2263 | 2258 |
| 2264 void MarkCompactCollector::MarkLiveObjects() { | 2259 void MarkCompactCollector::MarkLiveObjects() { |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3922 // The target is always in old space, we don't have to record the slot in | 3917 // The target is always in old space, we don't have to record the slot in |
| 3923 // the old-to-new remembered set. | 3918 // the old-to-new remembered set. |
| 3924 DCHECK(!heap()->InNewSpace(target)); | 3919 DCHECK(!heap()->InNewSpace(target)); |
| 3925 RecordRelocSlot(host, &rinfo, target); | 3920 RecordRelocSlot(host, &rinfo, target); |
| 3926 } | 3921 } |
| 3927 } | 3922 } |
| 3928 } | 3923 } |
| 3929 | 3924 |
| 3930 } // namespace internal | 3925 } // namespace internal |
| 3931 } // namespace v8 | 3926 } // namespace v8 |
| OLD | NEW |