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

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

Issue 2459903003: [Tracing] Use TracingCategoryObserver in gc statistics (Closed)
Patch Set: update 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
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 "include/v8-tracing.h"
7 #include "src/base/atomicops.h" 8 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 9 #include "src/base/bits.h"
9 #include "src/base/sys-info.h" 10 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 11 #include "src/code-stubs.h"
11 #include "src/compilation-cache.h" 12 #include "src/compilation-cache.h"
12 #include "src/deoptimizer.h" 13 #include "src/deoptimizer.h"
13 #include "src/execution.h" 14 #include "src/execution.h"
14 #include "src/frames-inl.h" 15 #include "src/frames-inl.h"
15 #include "src/gdb-jit.h" 16 #include "src/gdb-jit.h"
16 #include "src/global-handles.h" 17 #include "src/global-handles.h"
(...skipping 2212 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 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 // The target is always in old space, we don't have to record the slot in 3920 // The target is always in old space, we don't have to record the slot in
3916 // the old-to-new remembered set. 3921 // the old-to-new remembered set.
3917 DCHECK(!heap()->InNewSpace(target)); 3922 DCHECK(!heap()->InNewSpace(target));
3918 RecordRelocSlot(host, &rinfo, target); 3923 RecordRelocSlot(host, &rinfo, target);
3919 } 3924 }
3920 } 3925 }
3921 } 3926 }
3922 3927
3923 } // namespace internal 3928 } // namespace internal
3924 } // namespace v8 3929 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698