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" |
11 #include "include/v8-util.h" | 11 #include "include/v8-util.h" |
12 #include "include/v8.h" | 12 #include "include/v8.h" |
13 | 13 |
14 #include "src/debug/interface-types.h" | 14 #include "src/debug/interface-types.h" |
15 #include "src/globals.h" | 15 #include "src/globals.h" |
16 | 16 |
17 namespace v8 { | 17 namespace v8 { |
18 | 18 |
19 namespace internal { | 19 namespace internal { |
| 20 struct CoverageBlock; |
20 struct CoverageFunction; | 21 struct CoverageFunction; |
21 struct CoverageScript; | 22 struct CoverageScript; |
22 class Coverage; | 23 class Coverage; |
23 class Script; | 24 class Script; |
24 } | 25 } |
25 | 26 |
26 namespace debug { | 27 namespace debug { |
27 | 28 |
28 void SetContextId(Local<Context> context, int id); | 29 void SetContextId(Local<Context> context, int id); |
29 int GetContextId(Local<Context> context); | 30 int GetContextId(Local<Context> context); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 // Only return a yes/no result. Optimization and GC are not affected. | 239 // Only return a yes/no result. Optimization and GC are not affected. |
239 // Collecting best effort coverage does not reset counters. | 240 // Collecting best effort coverage does not reset counters. |
240 kBestEffort, | 241 kBestEffort, |
241 // Disable optimization and prevent feedback vectors from being garbage | 242 // Disable optimization and prevent feedback vectors from being garbage |
242 // collected in order to preserve precise invocation counts. Collecting | 243 // collected in order to preserve precise invocation counts. Collecting |
243 // precise count coverage resets counters to get incremental updates. | 244 // precise count coverage resets counters to get incremental updates. |
244 kPreciseCount, | 245 kPreciseCount, |
245 // We are only interested in a yes/no result for the function. Optimization | 246 // We are only interested in a yes/no result for the function. Optimization |
246 // and GC can be allowed once a function has been invoked. Collecting | 247 // and GC can be allowed once a function has been invoked. Collecting |
247 // precise binary coverage resets counters for incremental updates. | 248 // precise binary coverage resets counters for incremental updates. |
248 kPreciseBinary | 249 kPreciseBinary, |
| 250 // Similar to the precise coverage modes but provides coverage at a |
| 251 // lower granularity. Design doc: goo.gl/lA2swZ. |
| 252 kBlockCount, |
249 }; | 253 }; |
250 | 254 |
251 class ScriptData; // Forward declaration. | 255 // Forward declarations. |
| 256 class ScriptData; |
| 257 class FunctionData; |
| 258 |
| 259 class V8_EXPORT_PRIVATE BlockData { |
| 260 public: |
| 261 int StartOffset() const; |
| 262 int EndOffset() const; |
| 263 uint32_t Count() const; |
| 264 |
| 265 private: |
| 266 explicit BlockData(i::CoverageBlock* block) : block_(block) {} |
| 267 i::CoverageBlock* block_; |
| 268 |
| 269 friend class v8::debug::Coverage::FunctionData; |
| 270 }; |
252 | 271 |
253 class V8_EXPORT_PRIVATE FunctionData { | 272 class V8_EXPORT_PRIVATE FunctionData { |
254 public: | 273 public: |
255 int StartOffset() const; | 274 int StartOffset() const; |
256 int EndOffset() const; | 275 int EndOffset() const; |
257 uint32_t Count() const; | 276 uint32_t Count() const; |
258 MaybeLocal<String> Name() const; | 277 MaybeLocal<String> Name() const; |
| 278 size_t BlockCount() const; |
| 279 BlockData GetBlockData(size_t i) const; |
259 | 280 |
260 private: | 281 private: |
261 explicit FunctionData(i::CoverageFunction* function) | 282 explicit FunctionData(i::CoverageFunction* function) |
262 : function_(function) {} | 283 : function_(function) {} |
263 i::CoverageFunction* function_; | 284 i::CoverageFunction* function_; |
264 | 285 |
265 friend class v8::debug::Coverage::ScriptData; | 286 friend class v8::debug::Coverage::ScriptData; |
266 }; | 287 }; |
267 | 288 |
268 class V8_EXPORT_PRIVATE ScriptData { | 289 class V8_EXPORT_PRIVATE ScriptData { |
(...skipping 21 matching lines...) Expand all Loading... |
290 ~Coverage(); | 311 ~Coverage(); |
291 | 312 |
292 private: | 313 private: |
293 explicit Coverage(i::Coverage* coverage) : coverage_(coverage) {} | 314 explicit Coverage(i::Coverage* coverage) : coverage_(coverage) {} |
294 i::Coverage* coverage_; | 315 i::Coverage* coverage_; |
295 }; | 316 }; |
296 } // namespace debug | 317 } // namespace debug |
297 } // namespace v8 | 318 } // namespace v8 |
298 | 319 |
299 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ | 320 #endif // V8_DEBUG_DEBUG_INTERFACE_H_ |
OLD | NEW |