From c60ea740cb24208182b2dacfdc86ddc0751add61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Crelier?= Date: Wed, 16 May 2018 18:13:22 +0000 Subject: [PATCH] [VM runtime] The 'checked' parameter of Isolate.spanwUri should control asserts only, but not type checks in Dart2 strong mode (fixes #33120). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib8ca63aa3113b80243b6f8eb4015cb5c24140a88 Reviewed-on: https://dart-review.googlesource.com/55442 Commit-Queue: RĂ©gis Crelier Reviewed-by: Vyacheslav Egorov --- runtime/lib/isolate.cc | 7 ++++--- sdk/lib/isolate/isolate.dart | 11 +++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc index 5e299993dd6..f4f53b24ee0 100644 --- a/runtime/lib/isolate.cc +++ b/runtime/lib/isolate.cc @@ -357,10 +357,11 @@ DEFINE_NATIVE_ENTRY(Isolate_spawnUri, 12) { // If we were passed a value then override the default flags state for // checked mode. if (!checked.IsNull()) { - bool val = checked.value(); + bool is_checked = checked.value(); Dart_IsolateFlags* flags = state->isolate_flags(); - flags->enable_asserts = val; - flags->enable_type_checks = val; + flags->enable_asserts = is_checked; + // Do not enable type checks in strong mode. + flags->enable_type_checks = is_checked && !flags->strong; } ThreadPool::Task* spawn_task = new SpawnIsolateTask(state); diff --git a/sdk/lib/isolate/isolate.dart b/sdk/lib/isolate/isolate.dart index 496c820e3fd..7a677b06184 100644 --- a/sdk/lib/isolate/isolate.dart +++ b/sdk/lib/isolate/isolate.dart @@ -271,10 +271,13 @@ class Isolate { * before those methods can complete. * * If the [checked] parameter is set to `true` or `false`, - * the new isolate will run code in checked mode, - * respectively in production mode, if possible. - * If the parameter is omitted, the new isolate will inherit the - * value from the current isolate. + * the new isolate will run code in checked mode (enabling asserts and type + * checks), respectively in production mode (disabling asserts and type + * checks), if possible. If the parameter is omitted, the new isolate will + * inherit the value from the current isolate. + * + * In Dart2 strong mode, the `checked` parameter only controls asserts, but + * not type checks. * * It may not always be possible to honor the `checked` parameter. * If the isolate code was pre-compiled, it may not be possible to change