Add a GN flag to set the Dart VM's optimization level (flutter/engine#43743)

And set the level to `-Oz` for iOS and Android.
This commit is contained in:
Zachary Anderson 2023-07-17 18:57:08 -07:00 committed by GitHub
parent 788fe03933
commit a48c39ab7e

View File

@ -399,6 +399,11 @@ def to_gn_args(args):
gn_args['dart_debug'] = True
gn_args['dart_debug_optimization_level'] = '0'
if args.dart_optimization_level:
gn_args['dart_default_optimization_level'] = args.dart_optimization_level
elif gn_args['target_os'] in ['android', 'ios']:
gn_args['dart_default_optimization_level'] = 'z'
gn_args['flutter_use_fontconfig'] = args.enable_fontconfig
gn_args['dart_component_kind'
] = 'static_library' # Always link Dart in statically.
@ -784,6 +789,12 @@ def parse_args(args):
'VM making it easier to step through VM code in the debugger.'
)
parser.add_argument(
'--dart-optimization-level',
type=str,
help='The default optimization level for the Dart VM runtime.',
)
parser.add_argument(
'--target-os',
type=str,