[vm/bytecode] Generate explicit DebugCheck for assignment to static field

Instead of always implying debugger stop at StoreStaticTOS bytecode,
bytecode generator now explicitly generates (or omits) DebugCheck bytecode.
This is needed to match behavior of AST flow graph builder of omitting
extra debugger stops when RHS expression is not trivial.

Fixes service/debugging_test with bytecode.

Change-Id: Id2e70998efb2a32a101fba4133ffa6a259ab1eb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116443
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2019-09-09 23:24:09 +00:00 committed by commit-bot@chromium.org
parent 95db62d6a2
commit 76bc894576
4 changed files with 4 additions and 5 deletions

View file

@ -3214,6 +3214,10 @@ class BytecodeGenerator extends RecursiveVisitor<Null> {
final target = node.target;
if (target is Field) {
if (options.emitDebuggerStops &&
_variableSetNeedsDebugCheck(node.value)) {
asm.emitDebugCheck();
}
int cpIndex = cp.addStaticField(target);
asm.emitStoreStaticTOS(cpIndex);
} else {

View file

@ -1229,8 +1229,6 @@ void BytecodeFlowGraphBuilder::BuildStoreStaticTOS() {
UNIMPLEMENTED(); // TODO(alexmarkov): interpreter
}
BuildDebugStepCheck();
LoadStackSlots(1);
Operand cp_index = DecodeOperandD();

View file

@ -978,8 +978,6 @@ class KernelBytecode {
// - The bytecode compiler may emit a DebugStepCheck call.
DART_FORCE_INLINE static bool IsDebugCheckedOpcode(const KBCInstr* instr) {
switch (DecodeOpcode(instr)) {
case KernelBytecode::kStoreStaticTOS:
case KernelBytecode::kStoreStaticTOS_Wide:
case KernelBytecode::kDebugCheck:
case KernelBytecode::kDirectCall:
case KernelBytecode::kDirectCall_Wide:

View file

@ -2267,7 +2267,6 @@ SwitchDispatch:
{
BYTECODE(StoreStaticTOS, D);
DEBUG_CHECK;
RawField* field = reinterpret_cast<RawField*>(LOAD_CONSTANT(rD));
RawInstance* value = static_cast<RawInstance*>(*SP--);
field->StorePointer(&field->ptr()->value_.static_value_, value, thread);