OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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_COVERAGE_H_ | 5 #ifndef V8_DEBUG_DEBUG_COVERAGE_H_ |
6 #define V8_DEBUG_DEBUG_COVERAGE_H_ | 6 #define V8_DEBUG_DEBUG_COVERAGE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/debug/debug-interface.h" | 10 #include "src/debug/debug-interface.h" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // Forward declaration. | 16 // Forward declaration. |
17 class Isolate; | 17 class Isolate; |
18 | 18 |
| 19 struct CoverageBlock { |
| 20 CoverageBlock(int s, int e, uint32_t c) : start(s), end(e), count(c) {} |
| 21 int start; |
| 22 int end; |
| 23 uint32_t count; |
| 24 }; |
| 25 |
19 struct CoverageFunction { | 26 struct CoverageFunction { |
20 CoverageFunction(int s, int e, uint32_t c, Handle<String> n) | 27 CoverageFunction(int s, int e, uint32_t c, Handle<String> n) |
21 : start(s), end(e), count(c), name(n) {} | 28 : start(s), end(e), count(c), name(n) {} |
22 int start; | 29 int start; |
23 int end; | 30 int end; |
24 uint32_t count; | 31 uint32_t count; |
25 Handle<String> name; | 32 Handle<String> name; |
| 33 // Blocks are sorted by start position, from outer to inner blocks. |
| 34 std::vector<CoverageBlock> blocks; |
26 }; | 35 }; |
27 | 36 |
28 struct CoverageScript { | 37 struct CoverageScript { |
29 // Initialize top-level function in case it has been garbage-collected. | 38 // Initialize top-level function in case it has been garbage-collected. |
30 explicit CoverageScript(Handle<Script> s) : script(s) {} | 39 explicit CoverageScript(Handle<Script> s) : script(s) {} |
31 Handle<Script> script; | 40 Handle<Script> script; |
32 // Functions are sorted by start position, from outer to inner function. | 41 // Functions are sorted by start position, from outer to inner function. |
33 std::vector<CoverageFunction> functions; | 42 std::vector<CoverageFunction> functions; |
34 }; | 43 }; |
35 | 44 |
(...skipping 16 matching lines...) Expand all Loading... |
52 static Coverage* Collect(Isolate* isolate, | 61 static Coverage* Collect(Isolate* isolate, |
53 v8::debug::Coverage::Mode collectionMode); | 62 v8::debug::Coverage::Mode collectionMode); |
54 | 63 |
55 Coverage() {} | 64 Coverage() {} |
56 }; | 65 }; |
57 | 66 |
58 } // namespace internal | 67 } // namespace internal |
59 } // namespace v8 | 68 } // namespace v8 |
60 | 69 |
61 #endif // V8_DEBUG_DEBUG_COVERAGE_H_ | 70 #endif // V8_DEBUG_DEBUG_COVERAGE_H_ |
OLD | NEW |