Skip to content

Commit

Permalink
Remove execution context check from shouldProfile (#30971)
Browse files Browse the repository at this point in the history
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 [8152e5c](8152e5c)
  • Loading branch information
sebmarkbage committed Sep 16, 2024
1 parent f5d6218 commit 5776f4e
Show file tree
Hide file tree
Showing 34 changed files with 1,415 additions and 1,518 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d7167c35059bc6a0ad84eb34e65b3b66328d5dd8
8152e5cd27721e792f395c0b62c8a7769a54777a
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d7167c35059bc6a0ad84eb34e65b3b66328d5dd8
8152e5cd27721e792f395c0b62c8a7769a54777a
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-classic-d7167c35-20240916";
exports.version = "19.0.0-www-classic-8152e5cd-20240916";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1981,7 +1981,7 @@ __DEV__ &&
exports.useTransition = function () {
return resolveDispatcher().useTransition();
};
exports.version = "19.0.0-www-modern-d7167c35-20240916";
exports.version = "19.0.0-www-modern-8152e5cd-20240916";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-d7167c35-20240916";
exports.version = "19.0.0-www-classic-8152e5cd-20240916";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -665,4 +665,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-d7167c35-20240916";
exports.version = "19.0.0-www-modern-8152e5cd-20240916";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-classic-d7167c35-20240916";
exports.version = "19.0.0-www-classic-8152e5cd-20240916";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-www-modern-d7167c35-20240916";
exports.version = "19.0.0-www-modern-8152e5cd-20240916";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
112 changes: 52 additions & 60 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9663,10 +9663,7 @@ __DEV__ &&
}
}
function shouldProfile$1(current) {
return (
0 !== (current.mode & 2) &&
(executionContext & CommitContext) !== NoContext
);
return 0 !== (current.mode & 2);
}
function commitHookLayoutEffects(finishedWork, hookFlags) {
shouldProfile$1(finishedWork)
Expand Down Expand Up @@ -10068,26 +10065,6 @@ __DEV__ &&
commitTime
);
}
function commitProfilerUpdate(
finishedWork,
current,
commitTime,
effectDuration
) {
if (executionContext & CommitContext)
try {
runWithFiberInDEV(
finishedWork,
commitProfiler,
finishedWork,
current,
commitTime,
effectDuration
);
} catch (error$20) {
captureCommitPhaseError(finishedWork, finishedWork.return, error$20);
}
}
function commitProfilerPostCommitImpl(
finishedWork,
current,
Expand Down Expand Up @@ -10238,12 +10215,6 @@ __DEV__ &&
);
}
}
function shouldProfile(current) {
return (
0 !== (current.mode & 2) &&
(executionContext & CommitContext) !== NoContext
);
}
function commitBeforeMutationEffects(root, firstChild) {
focusedInstanceHandle = null;
for (nextEffect = firstChild; null !== nextEffect; ) {
Expand Down Expand Up @@ -10462,14 +10433,26 @@ __DEV__ &&
break;
case 12:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
if (flags & 4)
a: for (
flags = finishedWork.stateNode.effectDuration,
commitProfilerUpdate(finishedWork, current, commitTime, flags),
finishedWork = finishedWork.return;
null !== finishedWork;

) {
if (flags & 4) {
flags = finishedWork.stateNode.effectDuration;
try {
runWithFiberInDEV(
finishedWork,
commitProfiler,
finishedWork,
current,
commitTime,
flags
);
} catch (error$20) {
captureCommitPhaseError(
finishedWork,
finishedWork.return,
error$20
);
}
finishedWork = finishedWork.return;
a: for (; null !== finishedWork; ) {
switch (finishedWork.tag) {
case 3:
finishedWork.stateNode.effectDuration += flags;
Expand All @@ -10480,6 +10463,7 @@ __DEV__ &&
}
finishedWork = finishedWork.return;
}
}
break;
case 13:
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
Expand Down Expand Up @@ -10865,7 +10849,7 @@ __DEV__ &&
(tag & Layout) === NoFlags ||
(enableSchedulingProfiler &&
markComponentLayoutEffectUnmountStarted(deletedFiber),
shouldProfile(deletedFiber)
0 !== (deletedFiber.mode & 2)
? (startLayoutEffectTimer(),
(inst.destroy = void 0),
safelyCallDestroy(
Expand Down Expand Up @@ -10908,7 +10892,7 @@ __DEV__ &&
: (tag & Layout) !== NoFlags &&
(enableSchedulingProfiler &&
markComponentLayoutEffectUnmountStarted(deletedFiber),
shouldProfile(deletedFiber)
0 !== (deletedFiber.mode & 2)
? (startLayoutEffectTimer(),
(inst.destroy = void 0),
safelyCallDestroy(
Expand Down Expand Up @@ -11117,7 +11101,7 @@ __DEV__ &&
finishedWork.return
),
commitHookEffectListMount(Insertion | HasEffect, finishedWork),
shouldProfile(finishedWork)
0 !== (finishedWork.mode & 2)
? (startLayoutEffectTimer(),
commitHookEffectListUnmount(
Layout | HasEffect,
Expand Down Expand Up @@ -11432,7 +11416,7 @@ __DEV__ &&
case 11:
case 14:
case 15:
if (shouldProfile(finishedWork))
if (0 !== (finishedWork.mode & 2))
try {
startLayoutEffectTimer(),
commitHookEffectListUnmount(
Expand Down Expand Up @@ -11550,20 +11534,27 @@ __DEV__ &&
finishedWork,
includeWorkInProgressEffects
);
if (includeWorkInProgressEffects && flags & 4)
a: for (
includeWorkInProgressEffects =
finishedWork.stateNode.effectDuration,
commitProfilerUpdate(
finishedWork,
current,
commitTime,
includeWorkInProgressEffects
),
finishedWork = finishedWork.return;
null !== finishedWork;

) {
if (includeWorkInProgressEffects && flags & 4) {
includeWorkInProgressEffects =
finishedWork.stateNode.effectDuration;
try {
runWithFiberInDEV(
finishedWork,
commitProfiler,
finishedWork,
current,
commitTime,
includeWorkInProgressEffects
);
} catch (error$20) {
captureCommitPhaseError(
finishedWork,
finishedWork.return,
error$20
);
}
finishedWork = finishedWork.return;
a: for (; null !== finishedWork; ) {
switch (finishedWork.tag) {
case 3:
finishedWork.stateNode.effectDuration +=
Expand All @@ -11576,6 +11567,7 @@ __DEV__ &&
}
finishedWork = finishedWork.return;
}
}
break;
case 13:
recursivelyTraverseReappearLayoutEffects(
Expand Down Expand Up @@ -11803,7 +11795,7 @@ __DEV__ &&
committedLanes,
committedTransitions
);
if (flags & 2048 && executionContext & CommitContext)
if (flags & 2048)
a: for (
finishedRoot = finishedWork.stateNode.passiveEffectDuration,
commitProfilerPostCommit(
Expand Down Expand Up @@ -17136,11 +17128,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-d7167c35-20240916",
version: "19.0.0-www-classic-8152e5cd-20240916",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-d7167c35-20240916"
reconcilerVersion: "19.0.0-www-classic-8152e5cd-20240916"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17174,7 +17166,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-d7167c35-20240916";
exports.version = "19.0.0-www-classic-8152e5cd-20240916";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Loading

0 comments on commit 5776f4e

Please sign in to comment.