[vm,dynamic_modules] Add record-coverage bytecode option.

This CL only adds the option and appropriate uses of it. Followup
CLs will use it to actually generate appropriate instructions and
metadata for collecting coverage information.

TEST=ci (just adding flag)

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try
Change-Id: I194154ef926abe7dae8bb93f397fb68029e2db3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501500
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This commit is contained in:
Tess Strickland
2026-05-12 07:46:06 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent eae9edeb2e
commit 1fb0c0c231
3 changed files with 9 additions and 1 deletions
@@ -38,6 +38,7 @@ Uint8List _generateBytecode(
emitLocalVarInfo: true,
emitInstanceFieldInitializers: true,
embedSourceText: true,
recordCoverage: true,
),
);
return byteSink.builder.takeBytes();
+6
View File
@@ -15,6 +15,7 @@ class BytecodeOptions {
'closure-context-lowering':
'Use the closure context lowering in Kernel AST instead of computing it',
'embed-source-text': 'Embed the source text of scripts',
'record-coverage': 'Emit instructions and metadata for recording coverage',
};
bool enableAsserts;
@@ -27,6 +28,7 @@ class BytecodeOptions {
bool showBytecodeSizeStatistics;
bool isClosureContextLoweringEnabled;
bool embedSourceText;
bool recordCoverage;
BytecodeOptions({
this.enableAsserts = false,
@@ -39,6 +41,7 @@ class BytecodeOptions {
this.showBytecodeSizeStatistics = false,
this.isClosureContextLoweringEnabled = false,
this.embedSourceText = false,
this.recordCoverage = false,
}) {}
void parseCommandLineFlags(List<String>? flags) {
@@ -71,6 +74,9 @@ class BytecodeOptions {
case 'embed-source-text':
embedSourceText = true;
break;
case 'record-coverage':
recordCoverage = true;
break;
default:
throw 'Unexpected bytecode flag $flag';
}
@@ -1893,7 +1893,8 @@ class BytecodeCompilerConfiguration extends CompilerConfiguration {
arguments.contains('--enable_asserts'))
'--enable-asserts',
if (!isProductMode)
'--bytecode-options=source-positions,embed-source-text',
'--bytecode-options=source-positions,embed-source-text'
'${_isAot ? '' : ',record-coverage'}',
];
return CompilationCommand(