Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
b09ca497
Unverified
Commit
b09ca497
authored
Feb 22, 2024
by
Martin Kustermann
Committed by
GitHub
Feb 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use inlining annotations on important methods for all targets (#143923)
parent
44e440ae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
persistent_hash_map.dart
packages/flutter/lib/src/foundation/persistent_hash_map.dart
+12
-4
object.dart
packages/flutter/lib/src/rendering/object.dart
+2
-0
framework.dart
packages/flutter/lib/src/widgets/framework.dart
+8
-0
No files found.
packages/flutter/lib/src/foundation/persistent_hash_map.dart
View file @
b09ca497
...
...
@@ -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
<
Object
?>
_copy
(
List
<
Object
?>
array
)
{
final
List
<
Object
?>
clone
=
_makeArray
(
array
.
length
);
for
(
int
j
=
0
;
j
<
array
.
length
;
j
++)
{
...
...
@@ -384,17 +390,19 @@ List<Object?> _copy(List<Object?> 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
<
Object
?>
_makeArray
(
int
length
)
{
return
List
<
Object
?>.
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
<
T
>(
Object
?
o
)
{
return
o
as
T
;
}
packages/flutter/lib/src/rendering/object.dart
View file @
b09ca497
...
...
@@ -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
>(
T
Function
()
inner
)
{
RenderObject
?
debugPreviousActiveLayout
;
assert
(()
{
...
...
packages/flutter/lib/src/widgets/framework.dart
View file @
b09ca497
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment