Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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_V8_PROFILER_H_ | 5 #ifndef V8_V8_PROFILER_H_ |
| 6 #define V8_V8_PROFILER_H_ | 6 #define V8_V8_PROFILER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "v8.h" // NOLINT(build/include) | 9 #include "v8.h" // NOLINT(build/include) |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 // samples don't care. | 53 // samples don't care. |
| 54 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; | 54 enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; |
| 55 | 55 |
| 56 TickSample() | 56 TickSample() |
| 57 : state(OTHER), | 57 : state(OTHER), |
| 58 pc(nullptr), | 58 pc(nullptr), |
| 59 external_callback_entry(nullptr), | 59 external_callback_entry(nullptr), |
| 60 frames_count(0), | 60 frames_count(0), |
| 61 has_external_callback(false), | 61 has_external_callback(false), |
| 62 update_stats(true) {} | 62 update_stats(true) {} |
| 63 | |
| 64 /** | |
| 65 * Initialize a tick sample from the isolate. | |
| 66 * \param isolate The currect isolate. | |
|
alph
2016/08/08 21:36:57
typo. Perhaps just "The isolate" would be fine.
lpy
2016/08/09 18:31:43
Done.
| |
| 67 * \param state Execution state. | |
| 68 * \param record_c_entry_frame Include or skip the runtime function. | |
| 69 * \param update_stats Whether update the sample to the aggregated stats. | |
| 70 * \param update_state If set to true, V8 will update the register state | |
| 71 when running on simulator. Default value is true, | |
| 72 unless the register state is absolutely correct, | |
| 73 otherwise don't use it. | |
| 74 */ | |
| 63 void Init(Isolate* isolate, const v8::RegisterState& state, | 75 void Init(Isolate* isolate, const v8::RegisterState& state, |
| 64 RecordCEntryFrame record_c_entry_frame, bool update_stats); | 76 RecordCEntryFrame record_c_entry_frame, bool update_stats, |
| 65 static bool GetStackSample(Isolate* isolate, const v8::RegisterState& state, | 77 bool update_state = true); |
|
alph
2016/08/08 21:36:57
How does it update the state if it's declared cons
lpy
2016/08/09 18:31:43
My question is where we want to propagate the upda
| |
| 78 /** | |
| 79 * Get a call stack sample from the isolate. | |
| 80 * \param isolate The currect isolate. | |
| 81 * \param state Register state. | |
| 82 * \param record_c_entry_frame Include or skip the runtime function. | |
| 83 * \param frames Caller allocated buffer to store stack frames. | |
| 84 * \param frames_limit Maximum number of frames to capture. The buffer must | |
| 85 * be large enough to hold the number of frames. | |
| 86 * \param sample_info The sample info is filled up by the function | |
| 87 * provides number of actual captured stack frames and | |
| 88 * the current VM state. | |
| 89 * \param update_state If set to true, V8 will update the given register state | |
| 90 when running on simulator. Default value is true, | |
| 91 unless the register state is absolutely correct, | |
| 92 otherwise don't use it. | |
| 93 * \note GetStackSample should only be called when the JS thread is paused or | |
| 94 * interrupted. Otherwise the behavior is undefined. | |
|
alph
2016/08/08 21:36:57
Could you please also note that the function is th
lpy
2016/08/09 18:31:43
Done.
| |
| 95 */ | |
| 96 static bool GetStackSample(Isolate* isolate, v8::RegisterState& state, | |
|
alph
2016/08/08 21:36:57
if state is an in-out parameter now, it should be
lpy
2016/08/09 18:31:43
Done.
| |
| 66 RecordCEntryFrame record_c_entry_frame, | 97 RecordCEntryFrame record_c_entry_frame, |
| 67 void** frames, size_t frames_limit, | 98 void** frames, size_t frames_limit, |
| 68 v8::SampleInfo* sample_info); | 99 v8::SampleInfo* sample_info, |
| 100 bool update_state = true); | |
| 69 StateTag state; // The state of the VM. | 101 StateTag state; // The state of the VM. |
| 70 void* pc; // Instruction pointer. | 102 void* pc; // Instruction pointer. |
| 71 union { | 103 union { |
| 72 void* tos; // Top stack value (*sp). | 104 void* tos; // Top stack value (*sp). |
| 73 void* external_callback_entry; | 105 void* external_callback_entry; |
| 74 }; | 106 }; |
| 75 static const unsigned kMaxFramesCountLog2 = 8; | 107 static const unsigned kMaxFramesCountLog2 = 8; |
| 76 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; | 108 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; |
| 77 void* stack[kMaxFramesCount]; // Call stack. | 109 void* stack[kMaxFramesCount]; // Call stack. |
| 78 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. | 110 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 uint32_t index; // Index of the time interval that was changed. | 857 uint32_t index; // Index of the time interval that was changed. |
| 826 uint32_t count; // New value of count field for the interval with this index. | 858 uint32_t count; // New value of count field for the interval with this index. |
| 827 uint32_t size; // New value of size field for the interval with this index. | 859 uint32_t size; // New value of size field for the interval with this index. |
| 828 }; | 860 }; |
| 829 | 861 |
| 830 | 862 |
| 831 } // namespace v8 | 863 } // namespace v8 |
| 832 | 864 |
| 833 | 865 |
| 834 #endif // V8_V8_PROFILER_H_ | 866 #endif // V8_V8_PROFILER_H_ |
| OLD | NEW |