OLD | NEW |
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/utils/random-number-generator.h" | 10 #include "src/base/utils/random-number-generator.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 void SamplingHeapProfiler::SampleObject(Address soon_object, size_t size) { | 93 void SamplingHeapProfiler::SampleObject(Address soon_object, size_t size) { |
94 DisallowHeapAllocation no_allocation; | 94 DisallowHeapAllocation no_allocation; |
95 | 95 |
96 HandleScope scope(isolate_); | 96 HandleScope scope(isolate_); |
97 HeapObject* heap_object = HeapObject::FromAddress(soon_object); | 97 HeapObject* heap_object = HeapObject::FromAddress(soon_object); |
98 Handle<Object> obj(heap_object, isolate_); | 98 Handle<Object> obj(heap_object, isolate_); |
99 | 99 |
100 // Mark the new block as FreeSpace to make sure the heap is iterable while we | 100 // Mark the new block as FreeSpace to make sure the heap is iterable while we |
101 // are taking the sample. | 101 // are taking the sample. |
102 heap()->CreateFillerObjectAt(soon_object, static_cast<int>(size)); | 102 heap()->CreateFillerObjectAt(soon_object, static_cast<int>(size), |
| 103 ClearRecordedSlots::kNo); |
103 | 104 |
104 Local<v8::Value> loc = v8::Utils::ToLocal(obj); | 105 Local<v8::Value> loc = v8::Utils::ToLocal(obj); |
105 | 106 |
106 AllocationNode* node = AddStack(); | 107 AllocationNode* node = AddStack(); |
107 node->allocations_[size]++; | 108 node->allocations_[size]++; |
108 Sample* sample = new Sample(size, node, loc, this); | 109 Sample* sample = new Sample(size, node, loc, this); |
109 samples_.insert(sample); | 110 samples_.insert(sample); |
110 sample->global.SetWeak(sample, OnWeakCallback, WeakCallbackType::kParameter); | 111 sample->global.SetWeak(sample, OnWeakCallback, WeakCallbackType::kParameter); |
111 } | 112 } |
112 | 113 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 auto profile = new v8::internal::AllocationProfile(); | 246 auto profile = new v8::internal::AllocationProfile(); |
246 | 247 |
247 TranslateAllocationNode(profile, &profile_root_, scripts); | 248 TranslateAllocationNode(profile, &profile_root_, scripts); |
248 | 249 |
249 return profile; | 250 return profile; |
250 } | 251 } |
251 | 252 |
252 | 253 |
253 } // namespace internal | 254 } // namespace internal |
254 } // namespace v8 | 255 } // namespace v8 |
OLD | NEW |