Files
sdk/pkg/dart2bytecode/lib/options.dart
T
Tess Strickland 134d45a41b [vm,dyn_modules] Remove the 'debugger-stops' bytecode option.
This CL does not yet remove the DebugCheck instruction from the
assembler/reader/interpreter and replace the DebugCheck opcode with
Unused##. Once the debugger fixups are complete without needing it,
then I'll remove that side of things.

Calls to _emitSourcePositions in the BytecodeGenerator have been
either replaced with asm.emitSourcePosition() or removed entirely
if the emit<Opcode> method in the assembler already calls
emitSourcePosition internally.

Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-dyn-mac-debug-arm64-try
Change-Id: Ibcb24da4a7b7a80c4d6ae56485cf33287a5aa68b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/474180
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2026-01-20 02:27:30 -08:00

80 lines
2.6 KiB
Dart

// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
/// Collection of options for bytecode generator.
class BytecodeOptions {
static Map<String, String> commandLineFlags = {
'annotations': 'Emit Dart annotations',
'local-var-info': 'Emit debug information about local variables',
'show-bytecode-size-stat': 'Show bytecode size breakdown',
'source-positions': 'Emit source positions',
'instance-field-initializers': 'Emit separate instance field initializers',
'keep-unreachable-code':
'Do not remove unreachable code (useful if collecting code coverage)',
'closure-context-lowering':
'Use the closure context lowering in Kernel AST instead of computing it',
'embed-source-text': 'Embed the source text of scripts',
};
bool enableAsserts;
bool emitSourcePositions;
bool emitLocalVarInfo;
bool emitAnnotations;
bool emitInstanceFieldInitializers;
bool omitAssertSourcePositions;
bool keepUnreachableCode;
bool showBytecodeSizeStatistics;
bool isClosureContextLoweringEnabled;
bool embedSourceText;
BytecodeOptions({
this.enableAsserts = false,
this.emitSourcePositions = false,
this.emitLocalVarInfo = false,
this.emitAnnotations = false,
this.emitInstanceFieldInitializers = false,
this.omitAssertSourcePositions = false,
this.keepUnreachableCode = false,
this.showBytecodeSizeStatistics = false,
this.isClosureContextLoweringEnabled = false,
this.embedSourceText = false,
}) {}
void parseCommandLineFlags(List<String>? flags) {
if (flags == null) {
return;
}
for (String flag in flags) {
switch (flag) {
case 'source-positions':
emitSourcePositions = true;
break;
case 'local-var-info':
emitLocalVarInfo = true;
break;
case 'annotations':
emitAnnotations = true;
break;
case 'instance-field-initializers':
emitInstanceFieldInitializers = true;
break;
case 'keep-unreachable-code':
keepUnreachableCode = true;
break;
case 'show-bytecode-size-stat':
showBytecodeSizeStatistics = true;
break;
case 'closure-context-lowering':
isClosureContextLoweringEnabled = true;
break;
case 'embed-source-text':
embedSourceText = true;
break;
default:
throw 'Unexpected bytecode flag $flag';
}
}
}
}