4bc9d31957
This reduces ACX gallery main module by 4.3%.
If a constant is used by multiple (non-main) modules this CL will
* force the constant to be lazy now
* make a global in the main module
* make each use lazily initialize with a module-local initializer
function (i.e. several modules may have the same initializer
function)
I plan on doing more optimizations for this multi-module constant
use scenario.
Change-Id: If5c6d5de474f9794415c889f0bd98465b73e4b96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/458860
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
13 lines
455 B
Dart
13 lines
455 B
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.
|
|
|
|
import 'deferred.constant.multi_module_use.h.2.dart';
|
|
|
|
@pragma('wasm:never-inline')
|
|
MyConstClass modH0Use(bool nonShared) {
|
|
return nonShared
|
|
? const MyConstClass('h0-nonshared-const')
|
|
: const MyConstClass('shared-const');
|
|
}
|