Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
72 lines (58 loc) · 2.28 KB

File metadata and controls

72 lines (58 loc) · 2.28 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_DEBUG_DEBUG_COVERAGE_H_
#define V8_DEBUG_DEBUG_COVERAGE_H_
#include <vector>
#include "src/debug/debug-interface.h"
#include "src/objects.h"
namespace v8 {
namespace internal {
// Forward declaration.
class Isolate;
struct CoverageBlock {
CoverageBlock(int s, int e, uint32_t c) : start(s), end(e), count(c) {}
CoverageBlock() : CoverageBlock(kNoSourcePosition, kNoSourcePosition, 0) {}
int start;
int end;
uint32_t count;
};
struct CoverageFunction {
CoverageFunction(int s, int e, uint32_t c, Handle<String> n)
: start(s), end(e), count(c), name(n), has_block_coverage(false) {}
int start;
int end;
uint32_t count;
Handle<String> name;
// Blocks are sorted by start position, from outer to inner blocks.
std::vector<CoverageBlock> blocks;
bool has_block_coverage;
};
struct CoverageScript {
// Initialize top-level function in case it has been garbage-collected.
explicit CoverageScript(Handle<Script> s) : script(s) {}
Handle<Script> script;
// Functions are sorted by start position, from outer to inner function.
std::vector<CoverageFunction> functions;
};
class Coverage : public std::vector<CoverageScript> {
public:
// Collecting precise coverage only works if the modes kPreciseCount or
// kPreciseBinary is selected. The invocation count is reset on collection.
// In case of kPreciseCount, an updated count since last collection is
// returned. In case of kPreciseBinary, a count of 1 is returned if a
// function has been executed for the first time since last collection.
static std::unique_ptr<Coverage> CollectPrecise(Isolate* isolate);
// Collecting best effort coverage always works, but may be imprecise
// depending on selected mode. The invocation count is not reset.
static std::unique_ptr<Coverage> CollectBestEffort(Isolate* isolate);
// Select code coverage mode.
static void SelectMode(Isolate* isolate, debug::Coverage::Mode mode);
private:
static std::unique_ptr<Coverage> Collect(
Isolate* isolate, v8::debug::Coverage::Mode collectionMode);
Coverage() {}
};
} // namespace internal
} // namespace v8
#endif // V8_DEBUG_DEBUG_COVERAGE_H_
Morty Proxy This is a proxified and sanitized view of the page, visit original site.