Files
sdk/pkg/vm/lib/bytecode/options.dart
T
Alexander Markov 9503969664 [vm/bytecode] Add DebugCheck bytecode instruction
DebugCheck bytecode instruction is generated after parameter variables
are declared and copied into their locations in the prologue.
It helps debugger to stop in the beginning of a function at the point
where parameters can be inspected. It is generated only if
'--bytecode-options=debugger-stops' is specified.

Change-Id: I0f3b1ea8dc45d762a5dcee75b5d3a4ffc0b2a1b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108371
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-07-09 19:14:53 +00:00

70 lines
2.1 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',
};
bool enableAsserts;
bool causalAsyncStacks;
bool emitSourcePositions;
bool emitSourceFiles;
bool emitLocalVarInfo;
bool emitDebuggerStops;
bool emitAnnotations;
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.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 'show-bytecode-size-stat':
showBytecodeSizeStatistics = true;
break;
default:
throw 'Unexpected bytecode flag $flag';
}
}
}
}