mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] Apply --no-causal-async-stacks and --lazy-async-stacks to profile/release builds (#49377)
This commit is contained in:
parent
4964fb62e1
commit
347823234f
@ -49,7 +49,6 @@ class GenSnapshot {
|
||||
Iterable<String> additionalArgs = const <String>[],
|
||||
}) {
|
||||
final List<String> args = <String>[
|
||||
'--causal_async_stacks',
|
||||
...additionalArgs,
|
||||
];
|
||||
|
||||
@ -156,6 +155,13 @@ class AOTSnapshotter {
|
||||
genSnapshotArgs.add('--no-use-integer-division');
|
||||
}
|
||||
|
||||
// Optimization arguments.
|
||||
genSnapshotArgs.addAll(<String>[
|
||||
// Faster async/await
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
]);
|
||||
|
||||
genSnapshotArgs.add(mainPath);
|
||||
|
||||
// TODO(jonahwilliams): fully remove input checks once all callers are
|
||||
|
@ -95,7 +95,6 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
|
||||
bool linkPlatformKernelIn = false,
|
||||
bool aot = false,
|
||||
@required BuildMode buildMode,
|
||||
bool causalAsyncStacks = true,
|
||||
bool trackWidgetCreation,
|
||||
List<String> extraFrontEndOptions,
|
||||
// These arguments are currently unused.
|
||||
@ -133,7 +132,6 @@ class CodeGeneratingKernelCompiler implements KernelCompiler {
|
||||
linkPlatformKernelIn: linkPlatformKernelIn,
|
||||
aot: aot,
|
||||
buildMode: buildMode,
|
||||
causalAsyncStacks: causalAsyncStacks,
|
||||
trackWidgetCreation: trackWidgetCreation,
|
||||
extraFrontEndOptions: extraFrontEndOptions,
|
||||
sdkRoot: sdkRoot,
|
||||
|
@ -277,7 +277,6 @@ class KernelCompiler {
|
||||
@required BuildMode buildMode,
|
||||
bool linkPlatformKernelIn = false,
|
||||
bool aot = false,
|
||||
bool causalAsyncStacks = true,
|
||||
@required bool trackWidgetCreation,
|
||||
List<String> extraFrontEndOptions,
|
||||
String packagesPath,
|
||||
@ -313,7 +312,7 @@ class KernelCompiler {
|
||||
'--sdk-root',
|
||||
sdkRoot,
|
||||
'--target=$targetModel',
|
||||
'-Ddart.developer.causal_async_stacks=$causalAsyncStacks',
|
||||
'-Ddart.developer.causal_async_stacks=${buildMode == BuildMode.debug}',
|
||||
for (final Object dartDefine in dartDefines)
|
||||
'-D$dartDefine',
|
||||
..._buildModeOptions(buildMode),
|
||||
@ -451,7 +450,6 @@ class _RejectRequest extends _CompilationRequest {
|
||||
abstract class ResidentCompiler {
|
||||
factory ResidentCompiler(String sdkRoot, {
|
||||
@required BuildMode buildMode,
|
||||
bool causalAsyncStacks,
|
||||
bool trackWidgetCreation,
|
||||
String packagesPath,
|
||||
List<String> fileSystemRoots,
|
||||
@ -512,7 +510,6 @@ class DefaultResidentCompiler implements ResidentCompiler {
|
||||
DefaultResidentCompiler(
|
||||
String sdkRoot, {
|
||||
@required this.buildMode,
|
||||
this.causalAsyncStacks = true,
|
||||
this.trackWidgetCreation = true,
|
||||
this.packagesPath,
|
||||
this.fileSystemRoots,
|
||||
@ -531,7 +528,6 @@ class DefaultResidentCompiler implements ResidentCompiler {
|
||||
sdkRoot = sdkRoot.endsWith('/') ? sdkRoot : '$sdkRoot/';
|
||||
|
||||
final BuildMode buildMode;
|
||||
final bool causalAsyncStacks;
|
||||
final bool trackWidgetCreation;
|
||||
final String packagesPath;
|
||||
final TargetModel targetModel;
|
||||
@ -651,7 +647,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
|
||||
sdkRoot,
|
||||
'--incremental',
|
||||
'--target=$targetModel',
|
||||
'-Ddart.developer.causal_async_stacks=$causalAsyncStacks',
|
||||
'-Ddart.developer.causal_async_stacks=${buildMode == BuildMode.debug}',
|
||||
for (final Object dartDefine in dartDefines)
|
||||
'-D$dartDefine',
|
||||
if (outputPath != null) ...<String>[
|
||||
|
@ -98,7 +98,8 @@ Future<void> _genSnapshot(
|
||||
|
||||
final List<String> command = <String>[
|
||||
genSnapshot,
|
||||
'--no_causal_async_stacks',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'--deterministic',
|
||||
'--snapshot_kind=app-aot-blobs',
|
||||
'--vm_snapshot_data=$vmSnapshotData',
|
||||
|
@ -71,6 +71,7 @@ class FuchsiaKernelCompiler {
|
||||
|
||||
if (buildInfo.isProfile) '-Ddart.vm.profile=true',
|
||||
if (buildInfo.mode.isRelease) '-Ddart.vm.release=true',
|
||||
'-Ddart.developer.causal_async_stacks=${buildInfo.isDebug}',
|
||||
|
||||
// Use bytecode and drop the ast in JIT release mode.
|
||||
if (buildInfo.isJitRelease) ...<String>[
|
||||
|
@ -121,7 +121,6 @@ void main() {
|
||||
verify(mockProcessManager.start(
|
||||
<String>[
|
||||
'gen_snapshot',
|
||||
'--causal_async_stacks',
|
||||
'--additional_arg',
|
||||
],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
@ -146,7 +145,6 @@ void main() {
|
||||
verify(mockProcessManager.start(
|
||||
<String>[
|
||||
'gen_snapshot_armv7',
|
||||
'--causal_async_stacks',
|
||||
'--additional_arg',
|
||||
],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
@ -171,7 +169,6 @@ void main() {
|
||||
verify(mockProcessManager.start(
|
||||
<String>[
|
||||
'gen_snapshot_arm64',
|
||||
'--causal_async_stacks',
|
||||
'--additional_arg',
|
||||
],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
@ -184,7 +181,7 @@ void main() {
|
||||
platform: TargetPlatform.android_x64, mode: BuildMode.release))
|
||||
.thenReturn('gen_snapshot');
|
||||
when(mockProcessManager.start(
|
||||
<String>['gen_snapshot', '--causal_async_stacks', '--strip'],
|
||||
<String>['gen_snapshot', '--strip'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment')))
|
||||
.thenAnswer((_) => Future<Process>.value(mockProc));
|
||||
@ -202,7 +199,7 @@ void main() {
|
||||
darwinArch: null,
|
||||
additionalArgs: <String>['--strip']);
|
||||
verify(mockProcessManager.start(
|
||||
<String>['gen_snapshot', '--causal_async_stacks', '--strip'],
|
||||
<String>['gen_snapshot', '--strip'],
|
||||
workingDirectory: anyNamed('workingDirectory'),
|
||||
environment: anyNamed('environment')))
|
||||
.called(1);
|
||||
@ -331,6 +328,8 @@ void main() {
|
||||
'--assembly=$assembly',
|
||||
'--no-sim-use-hardfp',
|
||||
'--no-use-integer-division',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
|
||||
@ -388,6 +387,8 @@ void main() {
|
||||
'--assembly=$assembly',
|
||||
'--no-sim-use-hardfp',
|
||||
'--no-use-integer-division',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
|
||||
@ -448,6 +449,8 @@ void main() {
|
||||
'--assembly=$assembly',
|
||||
'--no-sim-use-hardfp',
|
||||
'--no-use-integer-division',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
verifyNever(mockXcode.cc(argThat(contains('-fembed-bitcode'))));
|
||||
@ -493,6 +496,8 @@ void main() {
|
||||
'--deterministic',
|
||||
'--snapshot_kind=app-aot-assembly',
|
||||
'--assembly=${globals.fs.path.join(outputPath, 'snapshot_assembly.S')}',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
}, overrides: contextOverrides);
|
||||
@ -531,6 +536,8 @@ void main() {
|
||||
'--assembly=${globals.fs.path.join(outputPath, 'snapshot_assembly.S')}',
|
||||
'--no-sim-use-hardfp',
|
||||
'--no-use-integer-division',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
}, overrides: contextOverrides);
|
||||
@ -567,6 +574,8 @@ void main() {
|
||||
'--deterministic',
|
||||
'--snapshot_kind=app-aot-assembly',
|
||||
'--assembly=${globals.fs.path.join(outputPath, 'snapshot_assembly.S')}',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
}, overrides: contextOverrides);
|
||||
@ -597,6 +606,8 @@ void main() {
|
||||
'--strip',
|
||||
'--no-sim-use-hardfp',
|
||||
'--no-use-integer-division',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
}, overrides: contextOverrides);
|
||||
@ -625,6 +636,8 @@ void main() {
|
||||
'--snapshot_kind=app-aot-elf',
|
||||
'--elf=build/foo/app.so',
|
||||
'--strip',
|
||||
'--no-causal-async-stacks',
|
||||
'--lazy-async-stacks',
|
||||
'main.dill',
|
||||
]);
|
||||
}, overrides: contextOverrides);
|
||||
|
@ -64,6 +64,10 @@ void main() {
|
||||
expect(mockFrontendServerStdIn.getAndClear(), isEmpty);
|
||||
expect(testLogger.errorText, equals('\nCompiler message:\nline1\nline2\n'));
|
||||
expect(output.outputFilename, equals('/path/to/main.dart.dill'));
|
||||
final VerificationResult argVerification = verify(mockProcessManager.start(captureAny));
|
||||
expect(argVerification.captured.single, containsAll(<String>[
|
||||
'-Ddart.developer.causal_async_stacks=true',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
OutputPreferences: () => OutputPreferences(showColor: false),
|
||||
@ -94,6 +98,7 @@ void main() {
|
||||
'-Ddart.vm.profile=true',
|
||||
'-Ddart.vm.product=false',
|
||||
'--bytecode-options=source-positions',
|
||||
'-Ddart.developer.causal_async_stacks=false',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
@ -126,6 +131,7 @@ void main() {
|
||||
'-Ddart.vm.profile=false',
|
||||
'-Ddart.vm.product=true',
|
||||
'--bytecode-options=source-positions',
|
||||
'-Ddart.developer.causal_async_stacks=false',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
ProcessManager: () => mockProcessManager,
|
||||
|
Loading…
Reference in New Issue
Block a user