| 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 #ifndef V8_PROFILER_TICK_SAMPLE_H_ | 5 #ifndef V8_PROFILER_TICK_SAMPLE_H_ |
| 6 #define V8_PROFILER_TICK_SAMPLE_H_ | 6 #define V8_PROFILER_TICK_SAMPLE_H_ |
| 7 | 7 |
| 8 #include "include/v8.h" | 8 #include "include/v8.h" |
| 9 | 9 |
| 10 #include "src/base/platform/time.h" | 10 #include "src/base/platform/time.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // include the runtime function we're calling. Externally exposed tick | 29 // include the runtime function we're calling. Externally exposed tick |
| 30 // samples don't care. | 30 // samples don't care. |
| 31 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; | 31 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; |
| 32 | 32 |
| 33 TickSample() | 33 TickSample() |
| 34 : state(OTHER), | 34 : state(OTHER), |
| 35 pc(NULL), | 35 pc(NULL), |
| 36 external_callback_entry(NULL), | 36 external_callback_entry(NULL), |
| 37 frames_count(0), | 37 frames_count(0), |
| 38 has_external_callback(false), | 38 has_external_callback(false), |
| 39 update_stats(true), | 39 update_stats(true) {} |
| 40 top_frame_type(StackFrame::NONE) {} | |
| 41 void Init(Isolate* isolate, const v8::RegisterState& state, | 40 void Init(Isolate* isolate, const v8::RegisterState& state, |
| 42 RecordCEntryFrame record_c_entry_frame, bool update_stats); | 41 RecordCEntryFrame record_c_entry_frame, bool update_stats); |
| 43 static void GetStackSample(Isolate* isolate, const v8::RegisterState& state, | 42 static bool GetStackSample(Isolate* isolate, const v8::RegisterState& state, |
| 44 RecordCEntryFrame record_c_entry_frame, | 43 RecordCEntryFrame record_c_entry_frame, |
| 45 void** frames, size_t frames_limit, | 44 void** frames, size_t frames_limit, |
| 46 v8::SampleInfo* sample_info); | 45 v8::SampleInfo* sample_info); |
| 47 StateTag state; // The state of the VM. | 46 StateTag state; // The state of the VM. |
| 48 Address pc; // Instruction pointer. | 47 Address pc; // Instruction pointer. |
| 49 union { | 48 union { |
| 50 Address tos; // Top stack value (*sp). | 49 Address tos; // Top stack value (*sp). |
| 51 Address external_callback_entry; | 50 Address external_callback_entry; |
| 52 }; | 51 }; |
| 53 static const unsigned kMaxFramesCountLog2 = 8; | 52 static const unsigned kMaxFramesCountLog2 = 8; |
| 54 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; | 53 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; |
| 55 Address stack[kMaxFramesCount]; // Call stack. | 54 Address stack[kMaxFramesCount]; // Call stack. |
| 56 base::TimeTicks timestamp; | 55 base::TimeTicks timestamp; |
| 57 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. | 56 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. |
| 58 bool has_external_callback : 1; | 57 bool has_external_callback : 1; |
| 59 bool update_stats : 1; // Whether the sample should update aggregated stats. | 58 bool update_stats : 1; // Whether the sample should update aggregated stats. |
| 60 StackFrame::Type top_frame_type : 5; | |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 | 61 |
| 64 #if defined(USE_SIMULATOR) | 62 #if defined(USE_SIMULATOR) |
| 65 class SimulatorHelper { | 63 class SimulatorHelper { |
| 66 public: | 64 public: |
| 67 // Returns true if register values were successfully retrieved | 65 // Returns true if register values were successfully retrieved |
| 68 // from the simulator, otherwise returns false. | 66 // from the simulator, otherwise returns false. |
| 69 static bool FillRegisters(Isolate* isolate, v8::RegisterState* state); | 67 static bool FillRegisters(Isolate* isolate, v8::RegisterState* state); |
| 70 }; | 68 }; |
| 71 #endif // USE_SIMULATOR | 69 #endif // USE_SIMULATOR |
| 72 | 70 |
| 73 } // namespace internal | 71 } // namespace internal |
| 74 } // namespace v8 | 72 } // namespace v8 |
| 75 | 73 |
| 76 #endif // V8_PROFILER_TICK_SAMPLE_H_ | 74 #endif // V8_PROFILER_TICK_SAMPLE_H_ |
| OLD | NEW |