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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return child; | 136 return child; |
137 } | 137 } |
138 | 138 |
139 SamplingHeapProfiler::AllocationNode* SamplingHeapProfiler::AddStack() { | 139 SamplingHeapProfiler::AllocationNode* SamplingHeapProfiler::AddStack() { |
140 AllocationNode* node = &profile_root_; | 140 AllocationNode* node = &profile_root_; |
141 | 141 |
142 std::vector<SharedFunctionInfo*> stack; | 142 std::vector<SharedFunctionInfo*> stack; |
143 StackTraceFrameIterator it(isolate_); | 143 StackTraceFrameIterator it(isolate_); |
144 int frames_captured = 0; | 144 int frames_captured = 0; |
145 while (!it.done() && frames_captured < stack_depth_) { | 145 while (!it.done() && frames_captured < stack_depth_) { |
146 JavaScriptFrame* frame = it.frame(); | 146 StandardFrame* frame = it.frame(); |
147 SharedFunctionInfo* shared = frame->function()->shared(); | 147 SharedFunctionInfo* shared = frame->function()->shared(); |
148 stack.push_back(shared); | 148 stack.push_back(shared); |
149 | 149 |
150 frames_captured++; | 150 frames_captured++; |
151 it.Advance(); | 151 it.Advance(); |
152 } | 152 } |
153 | 153 |
154 if (frames_captured == 0) { | 154 if (frames_captured == 0) { |
155 const char* name = nullptr; | 155 const char* name = nullptr; |
156 switch (isolate_->current_vm_state()) { | 156 switch (isolate_->current_vm_state()) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 auto profile = new v8::internal::AllocationProfile(); | 255 auto profile = new v8::internal::AllocationProfile(); |
256 | 256 |
257 TranslateAllocationNode(profile, &profile_root_, scripts); | 257 TranslateAllocationNode(profile, &profile_root_, scripts); |
258 | 258 |
259 return profile; | 259 return profile; |
260 } | 260 } |
261 | 261 |
262 | 262 |
263 } // namespace internal | 263 } // namespace internal |
264 } // namespace v8 | 264 } // namespace v8 |
OLD | NEW |