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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 AllocationNode* child = | 148 AllocationNode* child = |
149 new AllocationNode(parent, name, script_id, start_position); | 149 new AllocationNode(parent, name, script_id, start_position); |
150 parent->children_.push_back(child); | 150 parent->children_.push_back(child); |
151 return child; | 151 return child; |
152 } | 152 } |
153 | 153 |
154 SamplingHeapProfiler::AllocationNode* SamplingHeapProfiler::AddStack() { | 154 SamplingHeapProfiler::AllocationNode* SamplingHeapProfiler::AddStack() { |
155 AllocationNode* node = &profile_root_; | 155 AllocationNode* node = &profile_root_; |
156 | 156 |
157 std::vector<SharedFunctionInfo*> stack; | 157 std::vector<SharedFunctionInfo*> stack; |
158 StackTraceFrameIterator it(isolate_); | 158 JavaScriptFrameIterator it(isolate_); |
159 int frames_captured = 0; | 159 int frames_captured = 0; |
160 while (!it.done() && frames_captured < stack_depth_) { | 160 while (!it.done() && frames_captured < stack_depth_) { |
161 StandardFrame* frame = it.frame(); | 161 JavaScriptFrame* frame = it.frame(); |
162 SharedFunctionInfo* shared = frame->function()->shared(); | 162 SharedFunctionInfo* shared = frame->function()->shared(); |
163 stack.push_back(shared); | 163 stack.push_back(shared); |
164 | 164 |
165 frames_captured++; | 165 frames_captured++; |
166 it.Advance(); | 166 it.Advance(); |
167 } | 167 } |
168 | 168 |
169 if (frames_captured == 0) { | 169 if (frames_captured == 0) { |
170 const char* name = nullptr; | 170 const char* name = nullptr; |
171 switch (isolate_->current_vm_state()) { | 171 switch (isolate_->current_vm_state()) { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 273 } |
274 } | 274 } |
275 auto profile = new v8::internal::AllocationProfile(); | 275 auto profile = new v8::internal::AllocationProfile(); |
276 TranslateAllocationNode(profile, &profile_root_, scripts); | 276 TranslateAllocationNode(profile, &profile_root_, scripts); |
277 return profile; | 277 return profile; |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 } // namespace internal | 281 } // namespace internal |
282 } // namespace v8 | 282 } // namespace v8 |
OLD | NEW |