diff --git a/pkg/dart2bytecode/bin/kernel_service.dart b/pkg/dart2bytecode/bin/kernel_service.dart index 2742b782be4..277db07ac3b 100644 --- a/pkg/dart2bytecode/bin/kernel_service.dart +++ b/pkg/dart2bytecode/bin/kernel_service.dart @@ -38,6 +38,7 @@ Uint8List _generateBytecode( emitLocalVarInfo: true, emitInstanceFieldInitializers: true, embedSourceText: true, + recordCoverage: true, ), ); return byteSink.builder.takeBytes(); diff --git a/pkg/dart2bytecode/lib/options.dart b/pkg/dart2bytecode/lib/options.dart index 929364f05f1..82d7481b63f 100644 --- a/pkg/dart2bytecode/lib/options.dart +++ b/pkg/dart2bytecode/lib/options.dart @@ -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? 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'; } diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart index 7cedafc93b4..c0481c32b4d 100644 --- a/pkg/test_runner/lib/src/compiler_configuration.dart +++ b/pkg/test_runner/lib/src/compiler_configuration.dart @@ -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(