[vm] Add deopt info for runtime calls in slow path

Fixes https://github.com/dart-lang/sdk/issues/44266

TEST=runtime/observatory/tests/service/pause_on_exception_from_slow_path_test.dart

Change-Id: I35736ea9aab4e61f14b304dbe7ac93a771145bdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173360
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Alexander Markov
2020-11-20 22:40:14 +00:00
committed by commit-bot@chromium.org
parent c6c4661567
commit 4320933925
3 changed files with 42 additions and 1 deletions
@@ -0,0 +1,39 @@
// Copyright (c) 2020, 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.
// VMOptions=--deterministic --optimization-counter-threshold=1000
import 'dart:convert';
import 'package:observatory/service_io.dart';
import 'package:test/test.dart';
import 'test_helper.dart';
import 'service_test_common.dart';
class X {
late String _y;
@pragma('vm:never-inline')
String get y => _y;
}
testeeMain() async {
final x = X();
x._y = "";
for (var i = 0; i < 2000; i++) x.y;
X().y;
}
var tests = <IsolateTest>[
hasStoppedWithUnhandledException,
(Isolate isolate) async {
print("We stopped!");
var stack = await isolate.getStack();
}
];
main(args) => runIsolateTests(args, tests,
pause_on_unhandled_exceptions: true,
testeeConcurrent: testeeMain,
extraArgs: extraDebuggingArgs);
@@ -153,6 +153,7 @@ next_through_simple_linear_2_test: SkipByDesign
next_through_simple_linear_test: SkipByDesign
parameters_in_scope_at_entry_test: Skip, Timeout
pause_idle_isolate_test: Skip, Timeout
pause_on_exception_from_slow_path_test: SkipByDesign
pause_on_exceptions_test: SkipByDesign
pause_on_start_then_step_test: SkipByDesign
pause_on_unhandled_async_exceptions2_test: SkipByDesign
@@ -849,6 +849,7 @@ CompilerDeoptInfo* FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id) {
CompilerDeoptInfo* FlowGraphCompiler::AddSlowPathDeoptInfo(intptr_t deopt_id,
Environment* env) {
ASSERT(deopt_id != DeoptId::kNone);
deopt_id = DeoptId::ToDeoptAfter(deopt_id);
CompilerDeoptInfo* info =
new (zone()) CompilerDeoptInfo(deopt_id, ICData::kDeoptUnknown, 0, env);
info->set_pc_offset(assembler()->CodeSize());
@@ -3083,7 +3084,7 @@ void ThrowErrorSlowPathCode::EmitNativeCode(FlowGraphCompiler* compiler) {
instruction()->token_pos(), try_index_);
AddMetadataForRuntimeCall(compiler);
compiler->RecordSafepoint(locs, num_args);
if ((try_index_ != kInvalidTryIndex) ||
if (!FLAG_precompiled_mode || (try_index_ != kInvalidTryIndex) ||
(compiler->CurrentTryIndex() != kInvalidTryIndex)) {
Environment* env =
compiler->SlowPathEnvironmentFor(instruction(), num_args);