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/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/base/macros.h" | |
12 | 11 |
13 namespace v8 { | 12 namespace v8 { |
14 namespace internal { | 13 namespace internal { |
15 | 14 |
16 // Forward declaration. | 15 // Forward declaration. |
17 class Isolate; | 16 class Isolate; |
18 | 17 |
19 class Coverage : public AllStatic { | 18 class Coverage : public AllStatic { |
20 public: | 19 public: |
21 struct RangeEntry { | 20 struct RangeEntry { |
22 int end_position; | 21 int end_position; |
23 uint32_t count; | 22 uint32_t count; |
24 }; | 23 }; |
25 | 24 |
26 struct ScriptData { | 25 struct ScriptData { |
27 ScriptData(int s, std::vector<RangeEntry> e) | 26 ScriptData(int s, std::vector<RangeEntry> e) |
28 : script_id(s), entries(std::move(e)) {} | 27 : script_id(s), entries(std::move(e)) {} |
29 int script_id; | 28 int script_id; |
30 std::vector<RangeEntry> entries; | 29 std::vector<RangeEntry> entries; |
31 }; | 30 }; |
32 | 31 |
33 static std::vector<ScriptData> Collect(Isolate* isolate); | 32 static std::vector<ScriptData> Collect(Isolate* isolate); |
| 33 |
| 34 // Enable precise code coverage. This disables optimization and makes sure |
| 35 // invocation count is not affected by GC. |
| 36 static void EnablePrecise(Isolate* isolate); |
| 37 static void DisablePrecise(Isolate* isolate); |
34 }; | 38 }; |
35 | 39 |
36 } // namespace internal | 40 } // namespace internal |
37 } // namespace v8 | 41 } // namespace v8 |
38 | 42 |
39 #endif // V8_DEBUG_DEBUG_COVERAGE_H_ | 43 #endif // V8_DEBUG_DEBUG_COVERAGE_H_ |
OLD | NEW |