[vm] Fix handling of unwind errors in RegExp_ExecuteMatch* native methods
Fixes https://github.com/dart-lang/sdk/issues/35588
Change-Id: I59b4bd82033108e206572b27fda737a675c0da62
Reviewed-on: https://dart-review.googlesource.com/c/88620
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/regexp_assembler_ir.cc b/runtime/vm/regexp_assembler_ir.cc
index 3001f99..888061d 100644
--- a/runtime/vm/regexp_assembler_ir.cc
+++ b/runtime/vm/regexp_assembler_ir.cc
@@ -322,6 +322,9 @@
const Object& retval =
Object::Handle(zone, DartEntry::InvokeFunction(fun, args));
+ if (retval.IsUnwindError()) {
+ Exceptions::PropagateError(Error::Cast(retval));
+ }
if (retval.IsError()) {
const Error& error = Error::Cast(retval);
OS::PrintErr("%s\n", error.ToErrorCString());
diff --git a/tests/lib_2/isolate/kill_regexp_test.dart b/tests/lib_2/isolate/kill_regexp_test.dart
new file mode 100644
index 0000000..33cb8eb
--- /dev/null
+++ b/tests/lib_2/isolate/kill_regexp_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2018, 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=--intrinsify
+// VMOptions=--no_intrinsify
+
+import "dart:isolate";
+import "dart:async";
+import "package:expect/expect.dart";
+
+isomain1(replyPort) {
+ final regexp = new RegExp('[ab]c');
+ while (true) {
+ Expect.equals(4, regexp.allMatches("acbcacbc").length);
+ }
+}
+
+void main() {
+ for (int i = 0; i < 20; ++i) {
+ ReceivePort reply = new ReceivePort();
+ Isolate.spawn(isomain1, reply.sendPort).then((Isolate isolate) {
+ new Timer(new Duration(milliseconds: 50), () {
+ print('killing isolate $i');
+ isolate.kill(priority: Isolate.immediate);
+ });
+ });
+ reply.close();
+ }
+}