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.
Sebastian Markbåge committed
Sep 16, 2024 at 15:00 UTC
8152e5cd27721e792f395c0b62c8a7769a54777a
2 files changed
+4
-16
packages/react-reconciler/src/ReactFiberCommitEffects.js
+2
-6
@@ -46,9 +46,6 @@ import {getPublicInstance} from './ReactFiberConfig';
46
import {
47
captureCommitPhaseError,
48
setIsRunningInsertionEffect,
49
- getExecutionContext,
50
- CommitContext,
51
- NoContext,
49
} from './ReactFiberWorkLoop';
50
import {
51
NoFlags as NoHookEffect,
@@ -81,8 +78,7 @@ function shouldProfile(current: Fiber): boolean {
78
return (
79
enableProfilerTimer &&
80
enableProfilerCommitHooks &&
84
- (current.mode & ProfileMode) !== NoMode &&
85
- (getExecutionContext() & CommitContext) !== NoContext
81
+ (current.mode & ProfileMode) !== NoMode
82
);
83
}
84
@@ -919,7 +915,7 @@ export function commitProfilerUpdate(
915
commitTime: number,
916
effectDuration: number,
917
) {
922
- if (enableProfilerTimer && getExecutionContext() & CommitContext) {
918
+ if (enableProfilerTimer) {
919
try {
920
if (__DEV__) {
921
runWithFiberInDEV(
packages/react-reconciler/src/ReactFiberCommitWork.js
+2
-10
@@ -145,9 +145,6 @@ import {
145
addMarkerProgressCallbackToPendingTransition,
146
addMarkerIncompleteCallbackToPendingTransition,
147
addMarkerCompleteCallbackToPendingTransition,
148
- getExecutionContext,
149
- CommitContext,
150
- NoContext,
148
setIsRunningInsertionEffect,
149
} from './ReactFiberWorkLoop';
150
import {
@@ -233,8 +230,7 @@ function shouldProfile(current: Fiber): boolean {
230
return (
231
enableProfilerTimer &&
232
enableProfilerCommitHooks &&
236
- (current.mode & ProfileMode) !== NoMode &&
237
- (getExecutionContext() & CommitContext) !== NoContext
233
+ (current.mode & ProfileMode) !== NoMode
234
);
235
}
236
@@ -2817,11 +2813,7 @@ function commitPassiveMountOnFiber(
2813
2814
// Only Profilers with work in their subtree will have a Passive effect scheduled.
2815
if (flags & Passive) {
2820
- if (
2821
- enableProfilerTimer &&
2822
- enableProfilerCommitHooks &&
2823
- getExecutionContext() & CommitContext
2824
- ) {
2816
+ if (enableProfilerTimer && enableProfilerCommitHooks) {
2817
const {passiveEffectDuration} = finishedWork.stateNode;
2818
2819
commitProfilerPostCommit(