Files
sdk/tests/web/wasm/source_map_simple_optimized_deferred_test.dart
Martin Kustermann f32057642b [dart2wasm] Run an additional -Os in open world compilation
This reduces e main module size by ~ 0.5-1%

When compiling with deferred loading, we optimize each module
individually with open world assumptions.

Currently we run only one -Os pass which leaves code behind that can be
optimized by another -Os. See e.g. discussion at [0].

The additional -Os pass is much faster than the first, so it doesn't add
meaningful compile-time.

[0] https://github.com/WebAssembly/binaryen/issues/8077

Change-Id: Id8c5e49d97439e28b2f7d9c5a0c206eec0893cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490101
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2026-03-24 13:07:26 -07:00

29 lines
1.2 KiB
Dart

// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// dart2wasmOptions=-O4 --no-strip-wasm --enable-deferred-loading --extra-compiler-option=-DTEST_COMPILATION_DIR=$TEST_COMPILATION_DIR
import 'source_map_simple_lib.dart' as Lib;
void main() {
Lib.testMain('source_map_simple_optimized_deferred', frameDetails);
}
const List<(String?, int?, int?, String?)?> frameDetails = [
('source_map_simple_lib.dart', 18, 3, 'g'),
('source_map_simple_lib.dart', 14, 3, 'f'),
// The wasm runtime will produce stack frames including `_invokeMain`. But
// `wasm-opt` will inline `f` into `_invokeMain` which will make the source
// maps map `_invokeMain+<offset>` to be `f`.
];
/*
at $.Error._throwWithCurrentStackTrace (wasm://wasm/$-0009ed7a:wasm-function[57]:0xb2bb)
at $.g (wasm://wasm/$-0009ed7a:wasm-function[194]:0xe340)
at $._invokeMain (wasm://wasm/$-0009ed7a:wasm-function[52]:0xa82c)
at InstantiatedApp.invokeMain (.../source_map_simple_optimized_deferred_test.mjs:413:37)
at main (.../run_wasm.js:428:21)
at async action (.../run_wasm.js:353:38)
*/