Index: src/debug/debug-coverage.h |
diff --git a/src/debug/debug-coverage.h b/src/debug/debug-coverage.h |
index a84186d6def8af646fffe049dc6072c66199ca4c..e54b4c3448bc6a14bf56b8e7f4b55f4409e8cd43 100644 |
--- a/src/debug/debug-coverage.h |
+++ b/src/debug/debug-coverage.h |
@@ -7,7 +7,6 @@ |
#include <vector> |
-#include "src/allocation.h" |
#include "src/debug/debug-interface.h" |
#include "src/objects.h" |
@@ -17,31 +16,35 @@ namespace internal { |
// Forward declaration. |
class Isolate; |
-class Coverage : public AllStatic { |
+struct CoverageRange { |
+ CoverageRange(int s, int e, uint32_t c, Handle<String> n) |
+ : start(s), end(e), count(c), name(n) {} |
+ int start; |
+ int end; |
+ uint32_t count; |
+ Handle<String> name; |
+ std::vector<CoverageRange> inner; |
+}; |
+ |
+struct CoverageScript { |
+ // Initialize top-level function in case it has been garbage-collected. |
+ CoverageScript(Isolate* isolate, Handle<Script> s, int source_length); |
+ Handle<Script> script; |
+ CoverageRange toplevel; |
+}; |
+ |
+class Coverage : public std::vector<CoverageScript> { |
public: |
- struct Range { |
- Range(int s, int e, uint32_t c) : start(s), end(e), count(c) {} |
- int start; |
- int end; |
- uint32_t count; |
- std::vector<uint16_t> name; |
- std::vector<Range> inner; |
- }; |
- |
- struct ScriptData { |
- // Initialize top-level function in case it has been garbage-collected. |
- ScriptData(Handle<Script> s, int source_length) |
- : script(s), toplevel(0, source_length, 1) {} |
- Handle<Script> script; |
- Range toplevel; |
- }; |
- |
- V8_EXPORT_PRIVATE static std::vector<ScriptData> Collect(Isolate* isolate); |
+ // Allocate a new Coverage object and populate with result. |
+ // The ownership is transferred to the caller. |
+ static Coverage* Collect(Isolate* isolate); |
// Enable precise code coverage. This disables optimization and makes sure |
// invocation count is not affected by GC. |
- V8_EXPORT_PRIVATE static void EnablePrecise(Isolate* isolate); |
- V8_EXPORT_PRIVATE static void DisablePrecise(Isolate* isolate); |
+ static void TogglePrecise(Isolate* isolate, bool enable); |
+ |
+ private: |
+ Coverage() {} |
}; |
} // namespace internal |