OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/tick-sample.h" | 5 #include "src/profiler/tick-sample.h" |
6 | 6 |
7 #include "include/v8-profiler.h" | 7 #include "include/v8-profiler.h" |
| 8 #include "src/counters.h" |
8 #include "src/frames-inl.h" | 9 #include "src/frames-inl.h" |
9 #include "src/msan.h" | 10 #include "src/msan.h" |
10 #include "src/simulator.h" | 11 #include "src/simulator.h" |
11 #include "src/vm-state-inl.h" | 12 #include "src/vm-state-inl.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace { | 15 namespace { |
15 | 16 |
16 bool IsSamePage(i::byte* ptr1, i::byte* ptr2) { | 17 bool IsSamePage(i::byte* ptr1, i::byte* ptr2) { |
17 const uint32_t kPageSize = 4096; | 18 const uint32_t kPageSize = 4096; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // e.g. it is used as a general purpose register in the function. | 231 // e.g. it is used as a general purpose register in the function. |
231 // Bailout. | 232 // Bailout. |
232 if (it.done()) return false; | 233 if (it.done()) return false; |
233 | 234 |
234 size_t i = 0; | 235 size_t i = 0; |
235 if (record_c_entry_frame == kIncludeCEntryFrame && | 236 if (record_c_entry_frame == kIncludeCEntryFrame && |
236 (it.top_frame_type() == internal::StackFrame::EXIT || | 237 (it.top_frame_type() == internal::StackFrame::EXIT || |
237 it.top_frame_type() == internal::StackFrame::BUILTIN_EXIT)) { | 238 it.top_frame_type() == internal::StackFrame::BUILTIN_EXIT)) { |
238 frames[i++] = isolate->c_function(); | 239 frames[i++] = isolate->c_function(); |
239 } | 240 } |
| 241 i::RuntimeCallTimer* timer = |
| 242 isolate->counters()->runtime_call_stats()->current_timer(); |
240 for (; !it.done() && i < frames_limit; it.Advance()) { | 243 for (; !it.done() && i < frames_limit; it.Advance()) { |
| 244 while (timer && reinterpret_cast<i::Address>(timer) < it.frame()->fp() && |
| 245 i < frames_limit) { |
| 246 frames[i++] = reinterpret_cast<i::Address>(timer->counter()); |
| 247 timer = timer->parent(); |
| 248 } |
| 249 if (i == frames_limit) break; |
241 if (!it.frame()->is_interpreted()) { | 250 if (!it.frame()->is_interpreted()) { |
242 frames[i++] = it.frame()->pc(); | 251 frames[i++] = it.frame()->pc(); |
243 continue; | 252 continue; |
244 } | 253 } |
245 // For interpreted frames use the bytecode array pointer as the pc. | 254 // For interpreted frames use the bytecode array pointer as the pc. |
246 i::InterpretedFrame* frame = static_cast<i::InterpretedFrame*>(it.frame()); | 255 i::InterpretedFrame* frame = static_cast<i::InterpretedFrame*>(it.frame()); |
247 // Since the sampler can interrupt execution at any point the | 256 // Since the sampler can interrupt execution at any point the |
248 // bytecode_array might be garbage, so don't dereference it. | 257 // bytecode_array might be garbage, so don't dereference it. |
249 i::Address bytecode_array = | 258 i::Address bytecode_array = |
250 reinterpret_cast<i::Address>(frame->GetBytecodeArray()) - | 259 reinterpret_cast<i::Address>(frame->GetBytecodeArray()) - |
(...skipping 12 matching lines...) Expand all Loading... |
263 bool use_simulator_reg_state) { | 272 bool use_simulator_reg_state) { |
264 v8::TickSample::Init(reinterpret_cast<v8::Isolate*>(isolate), state, | 273 v8::TickSample::Init(reinterpret_cast<v8::Isolate*>(isolate), state, |
265 record_c_entry_frame, update_stats, | 274 record_c_entry_frame, update_stats, |
266 use_simulator_reg_state); | 275 use_simulator_reg_state); |
267 if (pc == nullptr) return; | 276 if (pc == nullptr) return; |
268 timestamp = base::TimeTicks::HighResolutionNow(); | 277 timestamp = base::TimeTicks::HighResolutionNow(); |
269 } | 278 } |
270 | 279 |
271 } // namespace internal | 280 } // namespace internal |
272 } // namespace v8 | 281 } // namespace v8 |
OLD | NEW |