OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_DEBUG_DEBUG_INTERFACE_H_ | 5 #ifndef V8_DEBUG_DEBUG_INTERFACE_H_ |
6 #define V8_DEBUG_DEBUG_INTERFACE_H_ | 6 #define V8_DEBUG_DEBUG_INTERFACE_H_ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "include/v8-debug.h" | 10 #include "include/v8-debug.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 bool IsSuspended(); | 208 bool IsSuspended(); |
209 | 209 |
210 static v8::Local<debug::GeneratorObject> Cast(v8::Local<v8::Value> value); | 210 static v8::Local<debug::GeneratorObject> Cast(v8::Local<v8::Value> value); |
211 }; | 211 }; |
212 | 212 |
213 /* | 213 /* |
214 * Provide API layer between inspector and code coverage. | 214 * Provide API layer between inspector and code coverage. |
215 */ | 215 */ |
216 class V8_EXPORT_PRIVATE Coverage { | 216 class V8_EXPORT_PRIVATE Coverage { |
217 public: | 217 public: |
| 218 enum Mode { |
| 219 // Make use of existing information in feedback vectors on the heap. |
| 220 kBestEffort, |
| 221 // Disable optimization and prevent feedback vectors from being garbage |
| 222 // collected in order to get precise invocation counts. |
| 223 kPreciseCount, |
| 224 }; |
| 225 |
218 class ScriptData; // Forward declaration. | 226 class ScriptData; // Forward declaration. |
219 | 227 |
220 class V8_EXPORT_PRIVATE FunctionData { | 228 class V8_EXPORT_PRIVATE FunctionData { |
221 public: | 229 public: |
222 int StartOffset(); | 230 int StartOffset(); |
223 int EndOffset(); | 231 int EndOffset(); |
224 uint32_t Count(); | 232 uint32_t Count(); |
225 MaybeLocal<String> Name(); | 233 MaybeLocal<String> Name(); |
226 | 234 |
227 private: | 235 private: |
(...skipping 12 matching lines...) Expand all Loading... |
240 | 248 |
241 private: | 249 private: |
242 explicit ScriptData(i::CoverageScript* script) : script_(script) {} | 250 explicit ScriptData(i::CoverageScript* script) : script_(script) {} |
243 i::CoverageScript* script_; | 251 i::CoverageScript* script_; |
244 | 252 |
245 friend class v8::debug::Coverage; | 253 friend class v8::debug::Coverage; |
246 }; | 254 }; |
247 | 255 |
248 static Coverage Collect(Isolate* isolate, bool reset_count); | 256 static Coverage Collect(Isolate* isolate, bool reset_count); |
249 | 257 |
250 static void TogglePrecise(Isolate* isolate, bool enable); | 258 static void SelectMode(Isolate* isolate, Mode mode); |
251 | 259 |
252 size_t ScriptCount(); | 260 size_t ScriptCount(); |
253 ScriptData GetScriptData(size_t i); | 261 ScriptData GetScriptData(size_t i); |
254 bool IsEmpty() { return coverage_ == nullptr; } | 262 bool IsEmpty() { return coverage_ == nullptr; } |
255 | 263 |
256 ~Coverage(); | 264 ~Coverage(); |
257 | 265 |
258 private: | 266 private: |
259 explicit Coverage(i::Coverage* coverage) : coverage_(coverage) {} | 267 explicit Coverage(i::Coverage* coverage) : coverage_(coverage) {} |
260 i::Coverage* coverage_; | 268 i::Coverage* coverage_; |
261 }; | 269 }; |
262 } // namespace debug | 270 } // namespace debug |
263 } // namespace v8 | 271 } // namespace v8 |
264 | 272 |
265 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ | 273 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ |
OLD | NEW |