Files
sdk/pkg/vm/lib/bytecode/options.dart
T
Ryan Macnak c6bc0031f3 [vm, bytecode] Field initializer for schema changes.
Bug: https://github.com/dart-lang/sdk/issues/32299
Change-Id: Id6359ad36db183f4cdd091e7fd778c879e868d99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108901
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-07-15 22:58:16 +00:00

76 lines
2.4 KiB
Dart

// Copyright (c) 2019, 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.
library vm.bytecode.options;
/// 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',
'debugger-stops': 'Emit bytecode instructions for stopping in the debugger',
'show-bytecode-size-stat': 'Show bytecode size breakdown',
'source-positions': 'Emit source positions',
'instance-field-initializers': 'Emit separate instance field initializers',
};
bool enableAsserts;
bool causalAsyncStacks;
bool emitSourcePositions;
bool emitSourceFiles;
bool emitLocalVarInfo;
bool emitDebuggerStops;
bool emitAnnotations;
bool emitInstanceFieldInitializers;
bool omitAssertSourcePositions;
bool showBytecodeSizeStatistics;
Map<String, String> environmentDefines;
BytecodeOptions(
{this.enableAsserts = false,
this.causalAsyncStacks,
this.emitSourcePositions = false,
this.emitSourceFiles = false,
this.emitLocalVarInfo = false,
this.emitDebuggerStops = false,
this.emitAnnotations = false,
this.emitInstanceFieldInitializers = false,
this.omitAssertSourcePositions = false,
this.showBytecodeSizeStatistics = false,
this.environmentDefines = const <String, String>{}}) {
causalAsyncStacks ??=
environmentDefines['dart.developer.causal_async_stacks'] == 'true';
}
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 'debugger-stops':
emitDebuggerStops = true;
break;
case 'annotations':
emitAnnotations = true;
break;
case 'instance-field-initializers':
emitInstanceFieldInitializers = true;
break;
case 'show-bytecode-size-stat':
showBytecodeSizeStatistics = true;
break;
default:
throw 'Unexpected bytecode flag $flag';
}
}
}
}