Skip to content

Commit 52878f5

Browse files
committed
Remove execution context check from shouldProfile (#30971)
I don't know why this is here since all these callsites are within the CommitWork/CommitEffects helpers. This should help with inlining. DiffTrain build for commit 8152e5c.
1 parent 4c48f1f commit 52878f5

File tree

14 files changed

+291
-327
lines changed

14 files changed

+291
-327
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.0.0-native-fb-26855e46-20240916
1+
19.0.0-native-fb-8152e5cd-20240916

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 52 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<f8a96fa0f2e72cb61ce052e8a5718a5b>>
10+
* @generated SignedSource<<13016889a9d577c3ebecd5eeb820686d>>
1111
*/
1212

1313
"use strict";
@@ -8512,10 +8512,7 @@ __DEV__ &&
85128512
}
85138513
}
85148514
function shouldProfile$1(current) {
8515-
return (
8516-
0 !== (current.mode & 2) &&
8517-
(executionContext & CommitContext) !== NoContext
8518-
);
8515+
return 0 !== (current.mode & 2);
85198516
}
85208517
function commitHookLayoutEffects(finishedWork, hookFlags) {
85218518
shouldProfile$1(finishedWork)
@@ -8897,26 +8894,6 @@ __DEV__ &&
88978894
commitTime
88988895
);
88998896
}
8900-
function commitProfilerUpdate(
8901-
finishedWork,
8902-
current,
8903-
commitTime,
8904-
effectDuration
8905-
) {
8906-
if (executionContext & CommitContext)
8907-
try {
8908-
runWithFiberInDEV(
8909-
finishedWork,
8910-
commitProfiler,
8911-
finishedWork,
8912-
current,
8913-
commitTime,
8914-
effectDuration
8915-
);
8916-
} catch (error$20) {
8917-
captureCommitPhaseError(finishedWork, finishedWork.return, error$20);
8918-
}
8919-
}
89208897
function commitProfilerPostCommitImpl(
89218898
finishedWork,
89228899
current,
@@ -9046,12 +9023,6 @@ __DEV__ &&
90469023
);
90479024
}
90489025
}
9049-
function shouldProfile(current) {
9050-
return (
9051-
0 !== (current.mode & 2) &&
9052-
(executionContext & CommitContext) !== NoContext
9053-
);
9054-
}
90559026
function commitBeforeMutationEffects(root, firstChild) {
90569027
for (nextEffect = firstChild; null !== nextEffect; )
90579028
if (
@@ -9234,14 +9205,26 @@ __DEV__ &&
92349205
break;
92359206
case 12:
92369207
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
9237-
if (flags & 4)
9238-
a: for (
9239-
flags = finishedWork.stateNode.effectDuration,
9240-
commitProfilerUpdate(finishedWork, current, commitTime, flags),
9241-
finishedWork = finishedWork.return;
9242-
null !== finishedWork;
9243-
9244-
) {
9208+
if (flags & 4) {
9209+
flags = finishedWork.stateNode.effectDuration;
9210+
try {
9211+
runWithFiberInDEV(
9212+
finishedWork,
9213+
commitProfiler,
9214+
finishedWork,
9215+
current,
9216+
commitTime,
9217+
flags
9218+
);
9219+
} catch (error$20) {
9220+
captureCommitPhaseError(
9221+
finishedWork,
9222+
finishedWork.return,
9223+
error$20
9224+
);
9225+
}
9226+
finishedWork = finishedWork.return;
9227+
a: for (; null !== finishedWork; ) {
92459228
switch (finishedWork.tag) {
92469229
case 3:
92479230
finishedWork.stateNode.effectDuration += flags;
@@ -9252,6 +9235,7 @@ __DEV__ &&
92529235
}
92539236
finishedWork = finishedWork.return;
92549237
}
9238+
}
92559239
break;
92569240
case 13:
92579241
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
@@ -9438,7 +9422,7 @@ __DEV__ &&
94389422
: offscreenSubtreeWasHidden ||
94399423
(tag & Layout) === NoFlags ||
94409424
(markComponentLayoutEffectUnmountStarted(deletedFiber),
9441-
shouldProfile(deletedFiber)
9425+
0 !== (deletedFiber.mode & 2)
94429426
? (startLayoutEffectTimer(),
94439427
(inst.destroy = void 0),
94449428
runWithFiberInDEV(
@@ -9608,7 +9592,7 @@ __DEV__ &&
96089592
finishedWork.return
96099593
),
96109594
commitHookEffectListMount(Insertion | HasEffect, finishedWork),
9611-
shouldProfile(finishedWork)
9595+
0 !== (finishedWork.mode & 2)
96129596
? (startLayoutEffectTimer(),
96139597
commitHookEffectListUnmount(
96149598
Layout | HasEffect,
@@ -9895,7 +9879,7 @@ __DEV__ &&
98959879
case 11:
98969880
case 14:
98979881
case 15:
9898-
if (shouldProfile(finishedWork))
9882+
if (0 !== (finishedWork.mode & 2))
98999883
try {
99009884
startLayoutEffectTimer(),
99019885
commitHookEffectListUnmount(
@@ -10013,20 +9997,27 @@ __DEV__ &&
100139997
finishedWork,
100149998
includeWorkInProgressEffects
100159999
);
10016-
if (includeWorkInProgressEffects && flags & 4)
10017-
a: for (
10018-
includeWorkInProgressEffects =
10019-
finishedWork.stateNode.effectDuration,
10020-
commitProfilerUpdate(
10021-
finishedWork,
10022-
current,
10023-
commitTime,
10024-
includeWorkInProgressEffects
10025-
),
10026-
finishedWork = finishedWork.return;
10027-
null !== finishedWork;
10028-
10029-
) {
10000+
if (includeWorkInProgressEffects && flags & 4) {
10001+
includeWorkInProgressEffects =
10002+
finishedWork.stateNode.effectDuration;
10003+
try {
10004+
runWithFiberInDEV(
10005+
finishedWork,
10006+
commitProfiler,
10007+
finishedWork,
10008+
current,
10009+
commitTime,
10010+
includeWorkInProgressEffects
10011+
);
10012+
} catch (error$20) {
10013+
captureCommitPhaseError(
10014+
finishedWork,
10015+
finishedWork.return,
10016+
error$20
10017+
);
10018+
}
10019+
finishedWork = finishedWork.return;
10020+
a: for (; null !== finishedWork; ) {
1003010021
switch (finishedWork.tag) {
1003110022
case 3:
1003210023
finishedWork.stateNode.effectDuration +=
@@ -10039,6 +10030,7 @@ __DEV__ &&
1003910030
}
1004010031
finishedWork = finishedWork.return;
1004110032
}
10033+
}
1004210034
break;
1004310035
case 13:
1004410036
recursivelyTraverseReappearLayoutEffects(
@@ -10161,7 +10153,7 @@ __DEV__ &&
1016110153
committedLanes,
1016210154
committedTransitions
1016310155
);
10164-
if (flags & 2048 && executionContext & CommitContext) {
10156+
if (flags & 2048) {
1016510157
finishedRoot = finishedWork.stateNode.passiveEffectDuration;
1016610158
try {
1016710159
runWithFiberInDEV(
@@ -15131,11 +15123,11 @@ __DEV__ &&
1513115123
(function () {
1513215124
var internals = {
1513315125
bundleType: 1,
15134-
version: "19.0.0-native-fb-26855e46-20240916",
15126+
version: "19.0.0-native-fb-8152e5cd-20240916",
1513515127
rendererPackageName: "react-test-renderer",
1513615128
currentDispatcherRef: ReactSharedInternals,
1513715129
findFiberByHostInstance: getInstanceFromNode,
15138-
reconcilerVersion: "19.0.0-native-fb-26855e46-20240916"
15130+
reconcilerVersion: "19.0.0-native-fb-8152e5cd-20240916"
1513915131
};
1514015132
internals.overrideHookState = overrideHookState;
1514115133
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -15280,5 +15272,5 @@ __DEV__ &&
1528015272
flushSyncWorkAcrossRoots_impl(0, !0));
1528115273
}
1528215274
};
15283-
exports.version = "19.0.0-native-fb-26855e46-20240916";
15275+
exports.version = "19.0.0-native-fb-8152e5cd-20240916";
1528415276
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<bc1eceaf1fd7b02a6c11ab1548ce65c8>>
10+
* @generated SignedSource<<a43f354b5e521c320a4cf4fa89fe5295>>
1111
*/
1212

1313
"use strict";
@@ -9494,14 +9494,14 @@ function wrapFiber(fiber) {
94949494
}
94959495
var internals$jscomp$inline_1266 = {
94969496
bundleType: 0,
9497-
version: "19.0.0-native-fb-26855e46-20240916",
9497+
version: "19.0.0-native-fb-8152e5cd-20240916",
94989498
rendererPackageName: "react-test-renderer",
94999499
currentDispatcherRef: ReactSharedInternals,
95009500
findFiberByHostInstance: function (mockNode) {
95019501
mockNode = nodeToInstanceMap.get(mockNode);
95029502
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
95039503
},
9504-
reconcilerVersion: "19.0.0-native-fb-26855e46-20240916"
9504+
reconcilerVersion: "19.0.0-native-fb-8152e5cd-20240916"
95059505
};
95069506
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
95079507
var hook$jscomp$inline_1267 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -9637,4 +9637,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
96379637
flushSyncWorkAcrossRoots_impl(0, !0));
96389638
}
96399639
};
9640-
exports.version = "19.0.0-native-fb-26855e46-20240916";
9640+
exports.version = "19.0.0-native-fb-8152e5cd-20240916";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<dbe78fc2470626489c135a835a479928>>
10+
* @generated SignedSource<<7fc82ac71e4522bb6e3dcfef512e6ba4>>
1111
*/
1212

1313
"use strict";
@@ -6408,7 +6408,7 @@ function unwindInterruptedWork(current, interruptedWork) {
64086408
}
64096409
}
64106410
function shouldProfile$1(current) {
6411-
return 0 !== (current.mode & 2) && 0 !== (executionContext & 4);
6411+
return 0 !== (current.mode & 2);
64126412
}
64136413
function commitHookLayoutEffects(finishedWork, hookFlags) {
64146414
shouldProfile$1(finishedWork)
@@ -6641,33 +6641,32 @@ function commitProfilerUpdate(
66416641
commitTime,
66426642
effectDuration
66436643
) {
6644-
if (executionContext & 4)
6645-
try {
6646-
var _finishedWork$memoize = finishedWork.memoizedProps,
6647-
id = _finishedWork$memoize.id,
6648-
onCommit = _finishedWork$memoize.onCommit,
6649-
onRender = _finishedWork$memoize.onRender;
6650-
current = null === current ? "mount" : "update";
6651-
currentUpdateIsNested && (current = "nested-update");
6652-
"function" === typeof onRender &&
6653-
onRender(
6654-
id,
6655-
current,
6656-
finishedWork.actualDuration,
6657-
finishedWork.treeBaseDuration,
6658-
finishedWork.actualStartTime,
6659-
commitTime
6660-
);
6661-
"function" === typeof onCommit &&
6662-
onCommit(
6663-
finishedWork.memoizedProps.id,
6664-
current,
6665-
effectDuration,
6666-
commitTime
6667-
);
6668-
} catch (error) {
6669-
captureCommitPhaseError(finishedWork, finishedWork.return, error);
6670-
}
6644+
try {
6645+
var _finishedWork$memoize = finishedWork.memoizedProps,
6646+
id = _finishedWork$memoize.id,
6647+
onCommit = _finishedWork$memoize.onCommit,
6648+
onRender = _finishedWork$memoize.onRender;
6649+
current = null === current ? "mount" : "update";
6650+
currentUpdateIsNested && (current = "nested-update");
6651+
"function" === typeof onRender &&
6652+
onRender(
6653+
id,
6654+
current,
6655+
finishedWork.actualDuration,
6656+
finishedWork.treeBaseDuration,
6657+
finishedWork.actualStartTime,
6658+
commitTime
6659+
);
6660+
"function" === typeof onCommit &&
6661+
onCommit(
6662+
finishedWork.memoizedProps.id,
6663+
current,
6664+
effectDuration,
6665+
commitTime
6666+
);
6667+
} catch (error) {
6668+
captureCommitPhaseError(finishedWork, finishedWork.return, error);
6669+
}
66716670
}
66726671
function isHostParent(fiber) {
66736672
return 5 === fiber.tag || 3 === fiber.tag || 4 === fiber.tag;
@@ -6722,11 +6721,8 @@ function insertOrAppendPlacementNode(node, before, parent) {
67226721
var offscreenSubtreeIsHidden = !1,
67236722
offscreenSubtreeWasHidden = !1,
67246723
PossiblyWeakSet = "function" === typeof WeakSet ? WeakSet : Set,
6725-
nextEffect = null;
6726-
function shouldProfile(current) {
6727-
return 0 !== (current.mode & 2) && 0 !== (executionContext & 4);
6728-
}
6729-
var shouldFireAfterActiveInstanceBlur = !1;
6724+
nextEffect = null,
6725+
shouldFireAfterActiveInstanceBlur = !1;
67306726
function commitBeforeMutationEffects(root, firstChild) {
67316727
for (nextEffect = firstChild; null !== nextEffect; )
67326728
if (
@@ -7076,7 +7072,7 @@ function commitDeletionEffectsOnFiber(
70767072
: offscreenSubtreeWasHidden ||
70777073
0 === (prevHostParent & 4) ||
70787074
(markComponentLayoutEffectUnmountStarted(deletedFiber),
7079-
shouldProfile(deletedFiber)
7075+
0 !== (deletedFiber.mode & 2)
70807076
? (startLayoutEffectTimer(),
70817077
(prevHostParentIsContainer.destroy = void 0),
70827078
safelyCallDestroy(
@@ -7237,7 +7233,7 @@ function commitMutationEffectsOnFiber(finishedWork, root) {
72377233
flags & 4 &&
72387234
(commitHookEffectListUnmount(3, finishedWork, finishedWork.return),
72397235
commitHookEffectListMount(3, finishedWork),
7240-
shouldProfile(finishedWork)
7236+
0 !== (finishedWork.mode & 2)
72417237
? (startLayoutEffectTimer(),
72427238
commitHookEffectListUnmount(5, finishedWork, finishedWork.return),
72437239
recordLayoutEffectDuration(finishedWork))
@@ -7488,7 +7484,7 @@ function recursivelyTraverseDisappearLayoutEffects(parentFiber) {
74887484
case 11:
74897485
case 14:
74907486
case 15:
7491-
if (shouldProfile(finishedWork))
7487+
if (0 !== (finishedWork.mode & 2))
74927488
try {
74937489
startLayoutEffectTimer(),
74947490
commitHookEffectListUnmount(4, finishedWork, finishedWork.return);
@@ -7726,7 +7722,7 @@ function commitPassiveMountOnFiber(
77267722
committedLanes,
77277723
committedTransitions
77287724
);
7729-
if (flags & 2048 && executionContext & 4) {
7725+
if (flags & 2048) {
77307726
finishedRoot = finishedWork.stateNode.passiveEffectDuration;
77317727
try {
77327728
var _finishedWork$memoize2 = finishedWork.memoizedProps,
@@ -10066,14 +10062,14 @@ function wrapFiber(fiber) {
1006610062
}
1006710063
var internals$jscomp$inline_1144 = {
1006810064
bundleType: 0,
10069-
version: "19.0.0-native-fb-26855e46-20240916",
10065+
version: "19.0.0-native-fb-8152e5cd-20240916",
1007010066
rendererPackageName: "react-test-renderer",
1007110067
currentDispatcherRef: ReactSharedInternals,
1007210068
findFiberByHostInstance: function (mockNode) {
1007310069
mockNode = nodeToInstanceMap.get(mockNode);
1007410070
return void 0 !== mockNode ? mockNode.internalInstanceHandle : null;
1007510071
},
10076-
reconcilerVersion: "19.0.0-native-fb-26855e46-20240916",
10072+
reconcilerVersion: "19.0.0-native-fb-8152e5cd-20240916",
1007710073
getLaneLabelMap: function () {
1007810074
for (
1007910075
var map = new Map(), lane = 1, index$137 = 0;
@@ -10224,4 +10220,4 @@ exports.unstable_batchedUpdates = function (fn, a) {
1022410220
flushSyncWorkAcrossRoots_impl(0, !0));
1022510221
}
1022610222
};
10227-
exports.version = "19.0.0-native-fb-26855e46-20240916";
10223+
exports.version = "19.0.0-native-fb-8152e5cd-20240916";

0 commit comments

Comments
 (0)