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

Side by Side Diff: src/profiler/sampling-heap-profiler.cc

Issue 2310143002: [heap] Introduce enum of garbage collection reasons. (Closed)
Patch Set: rebase Created 4 years, 3 months 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/profiler/heap-snapshot-generator.cc ('k') | src/runtime/runtime-debug.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/profiler/sampling-heap-profiler.h" 5 #include "src/profiler/sampling-heap-profiler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <memory> 8 #include <memory>
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/ieee754.h" 10 #include "src/base/ieee754.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 for (auto it : node->children_) { 252 for (auto it : node->children_) {
253 current->children.push_back( 253 current->children.push_back(
254 TranslateAllocationNode(profile, it.second, scripts)); 254 TranslateAllocationNode(profile, it.second, scripts));
255 } 255 }
256 node->pinned_ = false; 256 node->pinned_ = false;
257 return current; 257 return current;
258 } 258 }
259 259
260 v8::AllocationProfile* SamplingHeapProfiler::GetAllocationProfile() { 260 v8::AllocationProfile* SamplingHeapProfiler::GetAllocationProfile() {
261 if (flags_ & v8::HeapProfiler::kSamplingForceGC) { 261 if (flags_ & v8::HeapProfiler::kSamplingForceGC) {
262 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, 262 isolate_->heap()->CollectAllGarbage(
263 "SamplingHeapProfiler"); 263 Heap::kNoGCFlags, GarbageCollectionReason::kSamplingProfiler);
264 } 264 }
265 // To resolve positions to line/column numbers, we will need to look up 265 // To resolve positions to line/column numbers, we will need to look up
266 // scripts. Build a map to allow fast mapping from script id to script. 266 // scripts. Build a map to allow fast mapping from script id to script.
267 std::map<int, Handle<Script>> scripts; 267 std::map<int, Handle<Script>> scripts;
268 { 268 {
269 Script::Iterator iterator(isolate_); 269 Script::Iterator iterator(isolate_);
270 while (Script* script = iterator.Next()) { 270 while (Script* script = iterator.Next()) {
271 scripts[script->id()] = handle(script); 271 scripts[script->id()] = handle(script);
272 } 272 }
273 } 273 }
274 auto profile = new v8::internal::AllocationProfile(); 274 auto profile = new v8::internal::AllocationProfile();
275 TranslateAllocationNode(profile, &profile_root_, scripts); 275 TranslateAllocationNode(profile, &profile_root_, scripts);
276 return profile; 276 return profile;
277 } 277 }
278 278
279 279
280 } // namespace internal 280 } // namespace internal
281 } // namespace v8 281 } // namespace v8
OLDNEW
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698