Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: include/v8-profiler.h

Issue 2189513002: Move SimulatorHelper into V8 out of profiler clients. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 isolate.
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 use_simulator_reg_state When set to true and V8 is running under a
71 * simulator, the method will use the simulator
72 * register state rather than the one provided
73 * with |state| argument. Otherwise the method
74 * will use provided register |state| as is.
75 */
63 void Init(Isolate* isolate, const v8::RegisterState& state, 76 void Init(Isolate* isolate, const v8::RegisterState& state,
64 RecordCEntryFrame record_c_entry_frame, bool update_stats); 77 RecordCEntryFrame record_c_entry_frame, bool update_stats,
65 static bool GetStackSample(Isolate* isolate, const v8::RegisterState& state, 78 bool use_simulator_reg_state = true);
79 /**
80 * Get a call stack sample from the isolate.
81 * \param isolate The isolate.
82 * \param state Register state.
83 * \param record_c_entry_frame Include or skip the runtime function.
84 * \param frames Caller allocated buffer to store stack frames.
85 * \param frames_limit Maximum number of frames to capture. The buffer must
86 * be large enough to hold the number of frames.
87 * \param sample_info The sample info is filled up by the function
88 * provides number of actual captured stack frames and
89 * the current VM state.
90 * \param use_simulator_reg_state When set to true and V8 is running under a
91 * simulator, the method will use the simulator
92 * register state rather than the one provided
93 * with |state| argument. Otherwise the method
94 * will use provided register |state| as is.
95 * \note GetStackSample is thread and signal safe and should only be called
96 * when the JS thread is paused or interrupted.
97 * Otherwise the behavior is undefined.
98 */
99 static bool GetStackSample(Isolate* isolate, v8::RegisterState* state,
66 RecordCEntryFrame record_c_entry_frame, 100 RecordCEntryFrame record_c_entry_frame,
67 void** frames, size_t frames_limit, 101 void** frames, size_t frames_limit,
68 v8::SampleInfo* sample_info); 102 v8::SampleInfo* sample_info,
103 bool use_simulator_reg_state = true);
69 StateTag state; // The state of the VM. 104 StateTag state; // The state of the VM.
70 void* pc; // Instruction pointer. 105 void* pc; // Instruction pointer.
71 union { 106 union {
72 void* tos; // Top stack value (*sp). 107 void* tos; // Top stack value (*sp).
73 void* external_callback_entry; 108 void* external_callback_entry;
74 }; 109 };
75 static const unsigned kMaxFramesCountLog2 = 8; 110 static const unsigned kMaxFramesCountLog2 = 8;
76 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; 111 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
77 void* stack[kMaxFramesCount]; // Call stack. 112 void* stack[kMaxFramesCount]; // Call stack.
78 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. 113 unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames.
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 uint32_t index; // Index of the time interval that was changed. 860 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. 861 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. 862 uint32_t size; // New value of size field for the interval with this index.
828 }; 863 };
829 864
830 865
831 } // namespace v8 866 } // namespace v8
832 867
833 868
834 #endif // V8_V8_PROFILER_H_ 869 #endif // V8_V8_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698