From 79f1fd80b4fb9ff431d1fcd3918f5648f1be8d07 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 13 Oct 2020 13:17:01 -0400 Subject: [PATCH 01/24] Roll Dart SDK from e256855d07ba to a3b62f366529 (4 revisions) (#21809) From bea1428f5a352bd3882b823813a23beee80e0dfd Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 16 Oct 2020 17:02:02 -0400 Subject: [PATCH 02/24] Roll Dart SDK from e655b9a3839e to b58cfe5ab24e (1 revision) (#21920) From dd0531c989e43d0adc6044d37addc7a6d3b55d83 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 20 Oct 2020 15:57:01 -0400 Subject: [PATCH 03/24] Roll Dart SDK from fc82eeed7df3 to 8be6a08153cc (1 revision) (#22005) From b28d5741af7f2b8eb2b980fbe70acd9091be5a5c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Sat, 7 Nov 2020 00:09:01 -0500 Subject: [PATCH 04/24] Roll Dart SDK from fe12b0536f42 to a188781c9fc8 (1 revision) (#22379) From 77005aeea300425fecb2bb51ac40db528624c914 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Tue, 24 Nov 2020 11:23:02 -0500 Subject: [PATCH 05/24] Roll Skia from 95b5fb9213d7 to 68ac3b9ec3ca (17 revisions) (#22713) From 4220747ba402dc74f29c78b063e382edd8827fc3 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 4 Dec 2020 18:43:02 -0500 Subject: [PATCH 06/24] Roll Dart SDK from 2c74e62a050c to f9760fc12871 (5 revisions) (#22881) From ffbf6efc39926c3a6324ac71645c799728f37704 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 14 Dec 2020 16:53:01 -0500 Subject: [PATCH 07/24] Roll Dart SDK from 68d1c7504f7d to f166571c7bc4 (1 revision) (#23056) From 4a5b65dcbcba1dacc1bf92746a9162f4a2fc918f Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 20 Jan 2021 23:59:02 -0500 Subject: [PATCH 08/24] Roll Dart SDK from 970d74c42472 to fd72dbb5b82b (1 revision) (#23820) From d97554675d3a326b2e3cc289822212872e1bb67f Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Mon, 10 May 2021 15:25:20 -0700 Subject: [PATCH 09/24] Trigger an engine build to re-open the tree (#26056) This commit is empty and simply triggers a new build to open the tree. Commit 106963e52e375e7b330791457dcd8798d151e482 was re-built after a succesful build; upload to the cloud storage bin failed. From 5a934b89976d2994ad0e0df57129463d3b774c57 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 12 May 2021 12:29:01 -0400 Subject: [PATCH 10/24] Roll Skia from d9a7c5953df3 to 827bb729a84d (2 revisions) (#26096) From 684b687b0d5ed6f24874ee7ffe1423d84741b1ce Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Fri, 14 May 2021 18:14:02 -0400 Subject: [PATCH 11/24] Roll Dart SDK from d616108772bd to a527411e5100 (0 revision) (#26156) From f3036cc801ac84636042e0f9173488398334a67c Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 24 May 2021 16:04:02 -0400 Subject: [PATCH 12/24] Roll Dart SDK from bb9d96ffbafa to 7250fd6379b2 (0 revision) (#26374) From 50c1142769af6287008825a4f4f46ca8d4478d91 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Thu, 3 Jun 2021 22:09:01 -0400 Subject: [PATCH 13/24] Roll Dart SDK from 202c42e3395c to 2e9c4305a6aa (1 revision) (#26578) From 0154641c99a405a451a6ad2649692b4083ade0bf Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 24 Jun 2021 13:16:03 -0700 Subject: [PATCH 14/24] Roll buildroot to 275038b8be7196927b0f71770701f3c2c3744860 (#26945) From 01333eb249b65357f037aacecd8fb52c2fda00e5 Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Tue, 20 Jul 2021 18:05:59 -0700 Subject: [PATCH 15/24] [test] empty commit (#27599) https://flutter-review.googlesource.com/c/infra/+/15660 From 210a3dde31b0f286a244ea5aafefeb71951069c1 Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Wed, 21 Jul 2021 12:46:03 -0400 Subject: [PATCH 16/24] Roll Dart SDK from e1414001c93b to 686070850ee3 (1 revision) (#27620) From 5fc99a29f858fdfd4613c2bce25de0162cdd9c7b Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Wed, 28 Jul 2021 10:01:06 -0700 Subject: [PATCH 17/24] Empty commit to apply latest LUCI config (#27767) From 5901e0e03809b69afca292823004b72a7a45994e Mon Sep 17 00:00:00 2001 From: skia-flutter-autoroll Date: Mon, 1 Nov 2021 04:03:01 -0400 Subject: [PATCH 18/24] Roll Dart SDK from 3b11f88c96a5 to 976f160b547f (3 revisions) (#29436) From 5c0e8bb2ae9eb85651034d8aada8ccf9ae57b2f6 Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Mon, 15 Nov 2021 15:38:07 -0800 Subject: [PATCH 19/24] Empty commit to fix main tree status (#29760) From b7f210a8af9caf81f130a89d2667caa9b9179735 Mon Sep 17 00:00:00 2001 From: asiva Date: Fri, 21 Jan 2022 09:33:01 -0800 Subject: [PATCH 20/24] Add option to enable serial GC This option can be used to avoid thread contention issues for the UI thread when running on low power devices with limited number of cores. --- common/settings.cc | 1 + common/settings.h | 1 + runtime/dart_vm.cc | 13 +++++++++++++ shell/common/switches.cc | 3 +++ shell/common/switches.h | 6 ++++++ 5 files changed, 24 insertions(+) diff --git a/common/settings.cc b/common/settings.cc index ec8ddf60f9c8d..2e3a1daf9f576 100644 --- a/common/settings.cc +++ b/common/settings.cc @@ -45,6 +45,7 @@ std::string Settings::ToString() const { stream << "endless_trace_buffer: " << endless_trace_buffer << std::endl; stream << "enable_dart_profiling: " << enable_dart_profiling << std::endl; stream << "disable_dart_asserts: " << disable_dart_asserts << std::endl; + stream << "enable_serial_gc: " << enable_serial_gc << std::endl; stream << "enable_observatory: " << enable_observatory << std::endl; stream << "enable_observatory_publication: " << enable_observatory_publication << std::endl; diff --git a/common/settings.h b/common/settings.h index b13416556f87e..76ec79c5d2012 100644 --- a/common/settings.h +++ b/common/settings.h @@ -140,6 +140,7 @@ struct Settings { bool endless_trace_buffer = false; bool enable_dart_profiling = false; bool disable_dart_asserts = false; + bool enable_serial_gc = false; // Whether embedder only allows secure connections. bool may_insecurely_connect_to_all_domains = true; diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 1334a150297eb..6aa218c78912b 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -59,6 +59,12 @@ static const char* kDartLanguageArgs[] = { static const char* kDartPrecompilationArgs[] = {"--precompilation"}; +static const char* kSerialGCArgs[] = {"--concurrent_mark=false", + "--concurrent_sweep=false", + "--compactor_tasks=1", + "--scavenger_tasks=0", + "--marker_tasks=0"}; + FML_ALLOW_UNUSED_TYPE static const char* kDartWriteProtectCodeArgs[] = { "--no_write_protect_code", @@ -358,6 +364,13 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartAssertArgs, fml::size(kDartAssertArgs)); } + // On low power devices with lesser number of cores, using concurrent + // marking or sweeping causes contention for the UI thread leading to + // Jank, this option can be used to turn off all concurrent GC activities. + if (settings_.enable_serial_gc) { + PushBackAll(&args, kSerialGCArgs, fml::size(kSerialGCArgs)); + } + if (settings_.start_paused) { PushBackAll(&args, kDartStartPausedArgs, fml::size(kDartStartPausedArgs)); } diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 64e4065d9fee4..29bc3d5e9e269 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -300,6 +300,9 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { settings.trace_startup = command_line.HasOption(FlagForSwitch(Switch::TraceStartup)); + settings.enable_serial_gc = + command_line.HasOption(FlagForSwitch(Switch::EnableSerialGC)); + #if !FLUTTER_RELEASE settings.trace_skia = true; diff --git a/shell/common/switches.h b/shell/common/switches.h index 61e5cc902a270..d7d7d5de6552a 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -193,6 +193,12 @@ DEF_SWITCH(DisableDartAsserts, "disabled. This flag may be specified if the user wishes to run " "with assertions disabled in the debug product mode (i.e. with JIT " "or DBC).") +DEF_SWITCH(EnableSerialGC, + "enable_serial_gc", + "On low power devices with low core counts, running concurrent " + "GC tasks on threads can cause them to contend with the UI thread " + "which could potentially lead to jank. This option turns off all " + "concurrent GC activities") DEF_SWITCH(DisallowInsecureConnections, "disallow-insecure-connections", "By default, dart:io allows all socket connections. If this switch " From 87e0aad50e761229f4111bbb15f933b39ba81a33 Mon Sep 17 00:00:00 2001 From: asiva Date: Fri, 21 Jan 2022 09:59:54 -0800 Subject: [PATCH 21/24] Fix format. --- runtime/dart_vm.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 6aa218c78912b..ad3612b14305e 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -59,11 +59,15 @@ static const char* kDartLanguageArgs[] = { static const char* kDartPrecompilationArgs[] = {"--precompilation"}; -static const char* kSerialGCArgs[] = {"--concurrent_mark=false", - "--concurrent_sweep=false", - "--compactor_tasks=1", - "--scavenger_tasks=0", - "--marker_tasks=0"}; +static const char* kSerialGCArgs[] = { + // clang-format off + "--concurrent_mark=false", + "--concurrent_sweep=false", + "--compactor_tasks=1", + "--scavenger_tasks=0", + "--marker_tasks=0", + // clang-format on +}; FML_ALLOW_UNUSED_TYPE static const char* kDartWriteProtectCodeArgs[] = { From 0d79c2da1fef88fcbea3f69d0b5c2981cebcc490 Mon Sep 17 00:00:00 2001 From: asiva Date: Fri, 21 Jan 2022 10:20:46 -0800 Subject: [PATCH 22/24] Added test. --- testing/dart/serial_gc_test.dart | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 testing/dart/serial_gc_test.dart diff --git a/testing/dart/serial_gc_test.dart b/testing/dart/serial_gc_test.dart new file mode 100644 index 0000000000000..cbac32ee49b8c --- /dev/null +++ b/testing/dart/serial_gc_test.dart @@ -0,0 +1,17 @@ +// Copyright 2022 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// FlutterTesterOptions=--serial_gc + +import 'package:litetest/litetest.dart'; + +void main() { + test('Serial GC option test ', () async { + bool threw = false; + for (int i = 0; i < 100; i++) { + var a = [100]; + } + expect(threw, false); + }); +} From 352cbc6cfe94e7cc8e5c4a288d1c5103afdc1050 Mon Sep 17 00:00:00 2001 From: asiva Date: Fri, 21 Jan 2022 10:45:43 -0800 Subject: [PATCH 23/24] Add build rule. --- testing/dart/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/testing/dart/BUILD.gn b/testing/dart/BUILD.gn index df78d209a9a16..aa0b6e2c4915b 100644 --- a/testing/dart/BUILD.gn +++ b/testing/dart/BUILD.gn @@ -34,6 +34,7 @@ tests = [ "platform_view_test.dart", "plugin_utilities_test.dart", "semantics_test.dart", + "serial_gc_test.dart", "spirv_exception_test.dart", "task_order_test.dart", "text_test.dart", From 1e4b15ca31e3cfcdeaf40896aa302223d0ecd56e Mon Sep 17 00:00:00 2001 From: asiva Date: Tue, 25 Jan 2022 16:01:12 -0800 Subject: [PATCH 24/24] Address review comments. --- shell/common/switches.h | 2 +- testing/dart/serial_gc_test.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/common/switches.h b/shell/common/switches.h index d7d7d5de6552a..6f39926e74a58 100644 --- a/shell/common/switches.h +++ b/shell/common/switches.h @@ -194,7 +194,7 @@ DEF_SWITCH(DisableDartAsserts, "with assertions disabled in the debug product mode (i.e. with JIT " "or DBC).") DEF_SWITCH(EnableSerialGC, - "enable_serial_gc", + "enable-serial-gc", "On low power devices with low core counts, running concurrent " "GC tasks on threads can cause them to contend with the UI thread " "which could potentially lead to jank. This option turns off all " diff --git a/testing/dart/serial_gc_test.dart b/testing/dart/serial_gc_test.dart index cbac32ee49b8c..72ed08372c644 100644 --- a/testing/dart/serial_gc_test.dart +++ b/testing/dart/serial_gc_test.dart @@ -1,8 +1,8 @@ -// Copyright 2022 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// FlutterTesterOptions=--serial_gc +// FlutterTesterOptions=--enable-serial-gc import 'package:litetest/litetest.dart';