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 #ifndef V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 5 #ifndef V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
6 #define V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 6 #define V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 AllocationNode* const owner; | 64 AllocationNode* const owner; |
65 Global<Value> global; | 65 Global<Value> global; |
66 SamplingHeapProfiler* const profiler; | 66 SamplingHeapProfiler* const profiler; |
67 | 67 |
68 private: | 68 private: |
69 DISALLOW_COPY_AND_ASSIGN(Sample); | 69 DISALLOW_COPY_AND_ASSIGN(Sample); |
70 }; | 70 }; |
71 | 71 |
72 class AllocationNode { | 72 class AllocationNode { |
73 public: | 73 public: |
74 AllocationNode(const char* const name, int script_id, | 74 AllocationNode(AllocationNode* parent, const char* name, int script_id, |
75 const int start_position) | 75 int start_position) |
76 : script_id_(script_id), | 76 : parent_(parent), |
| 77 script_id_(script_id), |
77 script_position_(start_position), | 78 script_position_(start_position), |
78 name_(name) {} | 79 name_(name), |
| 80 pinned_(false) {} |
79 ~AllocationNode() { | 81 ~AllocationNode() { |
80 for (auto child : children_) { | 82 for (auto child : children_) { |
81 delete child; | 83 delete child; |
82 } | 84 } |
83 } | 85 } |
84 | 86 |
85 private: | 87 private: |
86 std::map<size_t, unsigned int> allocations_; | 88 std::map<size_t, unsigned int> allocations_; |
87 std::vector<AllocationNode*> children_; | 89 std::vector<AllocationNode*> children_; |
| 90 AllocationNode* const parent_; |
88 const int script_id_; | 91 const int script_id_; |
89 const int script_position_; | 92 const int script_position_; |
90 const char* const name_; | 93 const char* const name_; |
| 94 bool pinned_; |
91 | 95 |
92 friend class SamplingHeapProfiler; | 96 friend class SamplingHeapProfiler; |
93 | 97 |
94 DISALLOW_COPY_AND_ASSIGN(AllocationNode); | 98 DISALLOW_COPY_AND_ASSIGN(AllocationNode); |
95 }; | 99 }; |
96 | 100 |
97 private: | 101 private: |
98 Heap* heap() const { return heap_; } | 102 Heap* heap() const { return heap_; } |
99 | 103 |
100 void SampleObject(Address soon_object, size_t size); | 104 void SampleObject(Address soon_object, size_t size); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 SamplingHeapProfiler* const profiler_; | 161 SamplingHeapProfiler* const profiler_; |
158 Heap* const heap_; | 162 Heap* const heap_; |
159 base::RandomNumberGenerator* const random_; | 163 base::RandomNumberGenerator* const random_; |
160 uint64_t const rate_; | 164 uint64_t const rate_; |
161 }; | 165 }; |
162 | 166 |
163 } // namespace internal | 167 } // namespace internal |
164 } // namespace v8 | 168 } // namespace v8 |
165 | 169 |
166 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 170 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
OLD | NEW |