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