[VM runtime] The 'checked' parameter of Isolate.spanwUri should control asserts

only, but not type checks in Dart2 strong mode (fixes #33120).

Change-Id: Ib8ca63aa3113b80243b6f8eb4015cb5c24140a88
Reviewed-on: https://dart-review.googlesource.com/55442
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
Régis Crelier 2018-05-16 18:13:22 +00:00 committed by commit-bot@chromium.org
parent f32509b849
commit c60ea740cb
2 changed files with 11 additions and 7 deletions

View file

@ -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);

View file

@ -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