diff --git a/packages/flutter/lib/src/foundation/persistent_hash_map.dart b/packages/flutter/lib/src/foundation/persistent_hash_map.dart index 59bc692beb0..1cd4e499b13 100644 --- a/packages/flutter/lib/src/foundation/persistent_hash_map.dart +++ b/packages/flutter/lib/src/foundation/persistent_hash_map.dart @@ -65,7 +65,9 @@ abstract class _TrieNode { static const int hashBitsPerLevel = 5; static const int hashBitsPerLevelMask = (1 << hashBitsPerLevel) - 1; + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') static int trieIndex(int hash, int bitIndex) { return (hash >>> bitIndex) & hashBitsPerLevelMask; } @@ -266,7 +268,9 @@ class _CompressedNode extends _TrieNode { return _FullNode(nodes); } + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') int _compressedIndex(int bit) { return _bitCount(occupiedIndices & (bit - 1)); } @@ -351,8 +355,9 @@ class _HashCollisionNode extends _TrieNode { /// Returns number of bits set in a 32bit integer. /// /// dart2js safe because we work with 32bit integers. -@pragma('vm:prefer-inline') @pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') int _bitCount(int n) { assert((n & 0xFFFFFFFF) == n); n = n - ((n >> 1) & 0x55555555); @@ -367,8 +372,9 @@ int _bitCount(int n) { /// /// Caveat: do not replace with List.of or similar methods. They are /// considerably slower. -@pragma('vm:prefer-inline') @pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') List _copy(List array) { final List clone = _makeArray(array.length); for (int j = 0; j < array.length; j++) { @@ -384,17 +390,19 @@ List _copy(List array) { /// (growable array instance pointing to a fixed array instance) and /// consequently fixed length arrays are faster to allocated, require less /// memory and are faster to access (less indirections). -@pragma('vm:prefer-inline') @pragma('dart2js:tryInline') +@pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') List _makeArray(int length) { return List.filled(length, null); } /// This helper method becomes an no-op when compiled with dart2js on /// with high level of optimizations enabled. -@pragma('dart2js:tryInline') @pragma('dart2js:as:trust') +@pragma('dart2js:tryInline') @pragma('vm:prefer-inline') +@pragma('wasm:prefer-inline') T _unsafeCast(Object? o) { return o as T; } diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 4d01ad06f5f..9a534b34d59 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -1925,7 +1925,9 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge /// This is useful when you have to temporarily clear that variable to /// disable some false-positive checks, such as when computing toStringDeep /// or using custom trees. + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') static T _withDebugActiveLayoutCleared(T Function() inner) { RenderObject? debugPreviousActiveLayout; assert(() { diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index edbf1600c66..f6fd1a087f4 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -3763,7 +3763,9 @@ abstract class Element extends DiagnosticableTree implements BuildContext { /// /// See the [RenderObjectElement] documentation for more information on slots. @protected + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') Element? updateChild(Element? child, Widget? newWidget, Object? newSlot) { if (newWidget == null) { if (child != null) { @@ -4285,7 +4287,9 @@ abstract class Element extends DiagnosticableTree implements BuildContext { /// The element returned by this function will already have been mounted and /// will be in the "active" lifecycle state. @protected + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') Element inflateWidget(Widget newWidget, Object? newSlot) { final bool isTimelineTracked = !kReleaseMode && _isProfileBuildsEnabledFor(newWidget); if (isTimelineTracked) { @@ -5167,7 +5171,9 @@ abstract class Element extends DiagnosticableTree implements BuildContext { /// Another example is the [AnimatedBuilder.child] property, which allows the /// non-animating parts of a subtree to remain static even as the /// [AnimatedBuilder.builder] callback recreates the other components. + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') void rebuild({bool force = false}) { assert(_lifecycleState != _ElementLifecycle.initial); if (_lifecycleState != _ElementLifecycle.active || (!_dirty && !force)) { @@ -6485,7 +6491,9 @@ abstract class RenderObjectElement extends Element { _performRebuild(); // calls widget.updateRenderObject() } + @pragma('dart2js:tryInline') @pragma('vm:prefer-inline') + @pragma('wasm:prefer-inline') void _performRebuild() { assert(() { _debugDoingBuild = true;