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

Side by Side Diff: src/heap/mark-compact.cc

Issue 2459903003: [Tracing] Use TracingCategoryObserver in gc statistics (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/tracing/tracing-category-observer.cc » ('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 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"
28 #include "src/utils-inl.h" 29 #include "src/utils-inl.h"
29 #include "src/v8.h" 30 #include "src/v8.h"
30 31
31 namespace v8 { 32 namespace v8 {
32 namespace internal { 33 namespace internal {
33 34
34 35
35 const char* Marking::kWhiteBitPattern = "00"; 36 const char* Marking::kWhiteBitPattern = "00";
36 const char* Marking::kBlackBitPattern = "11"; 37 const char* Marking::kBlackBitPattern = "11";
37 const char* Marking::kGreyBitPattern = "10"; 38 const char* Marking::kGreyBitPattern = "10";
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 while (space_it.has_next()) { 2230 while (space_it.has_next()) {
2230 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator()); 2231 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator());
2231 ObjectIterator* obj_it = it.get(); 2232 ObjectIterator* obj_it = it.get();
2232 while ((obj = obj_it->Next()) != nullptr) { 2233 while ((obj = obj_it->Next()) != nullptr) {
2233 visitor->Visit(obj); 2234 visitor->Visit(obj);
2234 } 2235 }
2235 } 2236 }
2236 } 2237 }
2237 2238
2238 void MarkCompactCollector::RecordObjectStats() { 2239 void MarkCompactCollector::RecordObjectStats() {
2239 if (FLAG_track_gc_object_stats) { 2240 if (V8_UNLIKELY(FLAG_gc_stats)) {
2241 heap()->CreateObjectStats();
2240 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, 2242 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_,
2241 heap()->dead_object_stats_); 2243 heap()->dead_object_stats_);
2242 VisitAllObjects(&visitor); 2244 VisitAllObjects(&visitor);
2243 std::stringstream live, dead; 2245 if (V8_UNLIKELY(FLAG_gc_stats &
2244 heap()->live_object_stats_->Dump(live); 2246 v8::tracing::TracingCategoryObserver::ENABLED_BY_TRACING)) {
2245 heap()->dead_object_stats_->Dump(dead); 2247 std::stringstream live, dead;
2246 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats"), 2248 heap()->live_object_stats_->Dump(live);
2247 "V8.GC_Objects_Stats", TRACE_EVENT_SCOPE_THREAD, 2249 heap()->dead_object_stats_->Dump(dead);
2248 "live", TRACE_STR_COPY(live.str().c_str()), "dead", 2250 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("v8.gc_stats"),
2249 TRACE_STR_COPY(dead.str().c_str())); 2251 "V8.GC_Objects_Stats", TRACE_EVENT_SCOPE_THREAD,
2252 "live", TRACE_STR_COPY(live.str().c_str()), "dead",
2253 TRACE_STR_COPY(dead.str().c_str()));
2254 }
2250 if (FLAG_trace_gc_object_stats) { 2255 if (FLAG_trace_gc_object_stats) {
2251 heap()->live_object_stats_->PrintJSON("live"); 2256 heap()->live_object_stats_->PrintJSON("live");
2252 heap()->dead_object_stats_->PrintJSON("dead"); 2257 heap()->dead_object_stats_->PrintJSON("dead");
2253 } 2258 }
2254 heap()->live_object_stats_->CheckpointObjectStats(); 2259 heap()->live_object_stats_->CheckpointObjectStats();
2255 heap()->dead_object_stats_->ClearObjectStats(); 2260 heap()->dead_object_stats_->ClearObjectStats();
2256 } 2261 }
2257 } 2262 }
2258 2263
2259 void MarkCompactCollector::MarkLiveObjects() { 2264 void MarkCompactCollector::MarkLiveObjects() {
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
3917 // The target is always in old space, we don't have to record the slot in 3922 // The target is always in old space, we don't have to record the slot in
3918 // the old-to-new remembered set. 3923 // the old-to-new remembered set.
3919 DCHECK(!heap()->InNewSpace(target)); 3924 DCHECK(!heap()->InNewSpace(target));
3920 RecordRelocSlot(host, &rinfo, target); 3925 RecordRelocSlot(host, &rinfo, target);
3921 } 3926 }
3922 } 3927 }
3923 } 3928 }
3924 3929
3925 } // namespace internal 3930 } // namespace internal
3926 } // namespace v8 3931 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/tracing/tracing-category-observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698