[vm] Add an isolate group flag for branch coverage.

Branch coverage can't be enabled by a simple global flag, because this
causes problems when functions in an app-jit snapshot that didn't have
the flag enabled are compiled by a VM that has the flag enabled. In
particular, the coverage array will see a different set of token
positions, causing some important asserts to fail.

Change-Id: I35227252b5d271f20b01de99466c06708ec83ed8
TEST=CI
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/223360
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
This commit is contained in:
Liam Appelbe
2021-12-14 22:53:36 +00:00
committed by Commit Bot
parent 296167d3c9
commit ac7bca37a8
5 changed files with 11 additions and 3 deletions
+1
View File
@@ -210,6 +210,7 @@ void DartDevIsolate::DartDevRunner::RunCallback(uword args) {
flags.use_field_guards = true;
flags.use_osr = true;
flags.is_system_isolate = true;
flags.branch_coverage = false;
char* error;
Dart_Isolate dartdev_isolate = runner->create_isolate_(
+1
View File
@@ -606,6 +606,7 @@ typedef struct {
bool null_safety;
bool is_system_isolate;
bool snapshot_is_dontneed_safe;
bool branch_coverage;
} Dart_IsolateFlags;
/**
+2
View File
@@ -1173,6 +1173,8 @@ char* Dart::FeaturesString(IsolateGroup* isolate_group,
ADD_ISOLATE_GROUP_FLAG(use_field_guards, use_field_guards,
FLAG_use_field_guards);
ADD_ISOLATE_GROUP_FLAG(use_osr, use_osr, FLAG_use_osr);
ADD_ISOLATE_GROUP_FLAG(branch_coverage, branch_coverage,
FLAG_branch_coverage);
}
// Generated code must match the host architecture and ABI.
+2 -1
View File
@@ -246,6 +246,7 @@ constexpr bool FLAG_support_il_printer = false;
D(support_rr, bool, false, "Support running within RR.") \
P(verify_entry_points, bool, false, \
"Throw API error on invalid member access throuh native API. See " \
"entry_point_pragma.md")
"entry_point_pragma.md") \
C(branch_coverage, false, false, bool, false, "Enable branch coverage")
#endif // RUNTIME_VM_FLAG_LIST_H_
+5 -2
View File
@@ -163,7 +163,9 @@ typedef FixedCache<intptr_t, CatchEntryMovesRefPtr, 16> CatchEntryMovesCache;
load_vmservice_library, false) \
V(NONPRODUCT, use_osr, UseOsr, use_osr, FLAG_use_osr) \
V(NONPRODUCT, snapshot_is_dontneed_safe, SnapshotIsDontNeedSafe, \
snapshot_is_dontneed_safe, false)
snapshot_is_dontneed_safe, false) \
V(NONPRODUCT, branch_coverage, BranchCoverage, branch_coverage, \
FLAG_branch_coverage)
#define BOOL_ISOLATE_FLAG_LIST_DEFAULT_GETTER(V) \
V(PRODUCT, copy_parent_code, CopyParentCode, copy_parent_code, false) \
@@ -796,7 +798,8 @@ class IsolateGroup : public IntrusiveDListEntry<IsolateGroup> {
V(Obfuscate) \
V(UseFieldGuards) \
V(UseOsr) \
V(SnapshotIsDontNeedSafe)
V(SnapshotIsDontNeedSafe) \
V(BranchCoverage)
// Isolate group specific flags.
enum FlagBits {