Skip to content

Commit

Permalink
Delete unused eventTimes Fiber field (#26599)
Browse files Browse the repository at this point in the history
DiffTrain build for commit 58742c2.
  • Loading branch information
acdlite committed Apr 11, 2023
1 parent c67e7ff commit 06b60a9
Show file tree
Hide file tree
Showing 13 changed files with 245 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,7 @@ function createLaneMap(initial) {

return laneMap;
}
function markRootUpdated(root, updateLane, eventTime) {
function markRootUpdated(root, updateLane) {
root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update
// could unblock them. Clear the suspended lanes so that we can try rendering
// them again.
Expand All @@ -1597,12 +1597,6 @@ function markRootUpdated(root, updateLane, eventTime) {
root.suspendedLanes = NoLanes;
root.pingedLanes = NoLanes;
}

var eventTimes = root.eventTimes;
var index = laneToIndex(updateLane); // We can always overwrite an existing timestamp because we prefer the most
// recent event, and we assume time is monotonically increasing.

eventTimes[index] = eventTime;
}
function markRootSuspended$1(root, suspendedLanes) {
root.suspendedLanes |= suspendedLanes;
Expand Down Expand Up @@ -1632,7 +1626,6 @@ function markRootFinished(root, remainingLanes) {
root.entangledLanes &= remainingLanes;
root.errorRecoveryDisabledLanes &= remainingLanes;
var entanglements = root.entanglements;
var eventTimes = root.eventTimes;
var expirationTimes = root.expirationTimes;
var hiddenUpdates = root.hiddenUpdates; // Clear the lanes that no longer have pending work

Expand All @@ -1642,7 +1635,6 @@ function markRootFinished(root, remainingLanes) {
var index = pickArbitraryLaneIndex(lanes);
var lane = 1 << index;
entanglements[index] = NoLanes;
eventTimes[index] = NoTimestamp;
expirationTimes[index] = NoTimestamp;
var hiddenUpdatesForLane = hiddenUpdates[index];

Expand Down Expand Up @@ -7098,7 +7090,7 @@ function forceStoreRerender(fiber) {
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}

Expand Down Expand Up @@ -7606,8 +7598,7 @@ function refreshCache(fiber, seedKey, seedValue) {
var root = enqueueUpdate(provider, refreshUpdate, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, provider, lane, eventTime);
scheduleUpdateOnFiber(root, provider, lane);
entangleTransitions(root, provider, lane);
} // TODO: If a refresh never commits, the new cache created here must be
// released. A simple case is start refreshing a cache boundary, but then
Expand Down Expand Up @@ -7663,8 +7654,7 @@ function dispatchReducerAction(fiber, queue, action) {
var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
scheduleUpdateOnFiber(root, fiber, lane);
entangleTransitionUpdate(root, queue, lane);
}
}
Expand Down Expand Up @@ -7745,8 +7735,7 @@ function dispatchSetState(fiber, queue, action) {
var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
scheduleUpdateOnFiber(root, fiber, lane);
entangleTransitionUpdate(root, queue, lane);
}
}
Expand Down Expand Up @@ -9091,8 +9080,7 @@ var classComponentUpdater = {
var root = enqueueUpdate(fiber, update, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
scheduleUpdateOnFiber(root, fiber, lane);
entangleTransitions(root, fiber, lane);
}
},
Expand All @@ -9114,8 +9102,7 @@ var classComponentUpdater = {
var root = enqueueUpdate(fiber, update, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
scheduleUpdateOnFiber(root, fiber, lane);
entangleTransitions(root, fiber, lane);
}
},
Expand All @@ -9137,8 +9124,7 @@ var classComponentUpdater = {
var root = enqueueUpdate(fiber, update, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, fiber, lane, eventTime);
scheduleUpdateOnFiber(root, fiber, lane);
entangleTransitions(root, fiber, lane);
}
}
Expand Down Expand Up @@ -12604,16 +12590,9 @@ function updateDehydratedSuspenseComponent(
// Intentionally mutating since this render will get interrupted. This
// is one of the very rare times where we mutate the current tree
// during the render phase.
suspenseState.retryLane = attemptHydrationAtLane; // TODO: Ideally this would inherit the event time of the current render

var eventTime = NoTimestamp;
suspenseState.retryLane = attemptHydrationAtLane;
enqueueConcurrentRenderForLane(current, attemptHydrationAtLane);
scheduleUpdateOnFiber(
root,
current,
attemptHydrationAtLane,
eventTime
); // Throw a special object that signals to the work loop that it should
scheduleUpdateOnFiber(root, current, attemptHydrationAtLane); // Throw a special object that signals to the work loop that it should
// interrupt the current render.
//
// Because we're inside a React-only execution stack, we don't
Expand Down Expand Up @@ -17555,7 +17534,7 @@ function detachOffscreenInstance(instance) {

if (root !== null) {
instance._pendingVisibility |= OffscreenDetached;
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}
function attachOffscreenInstance(instance) {
Expand All @@ -17576,7 +17555,7 @@ function attachOffscreenInstance(instance) {

if (root !== null) {
instance._pendingVisibility &= ~OffscreenDetached;
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}

Expand Down Expand Up @@ -19866,11 +19845,7 @@ var isFlushingPassiveEffects = false;
var didScheduleUpdateDuringPassiveEffects = false;
var NESTED_PASSIVE_UPDATE_LIMIT = 50;
var nestedPassiveUpdateCount = 0;
var rootWithPassiveNestedUpdates = null; // If two updates are scheduled within the same event, we should treat their
// event times as simultaneous, even if the actual clock time has advanced
// between the first and second call.

var currentEventTime = NoTimestamp;
var rootWithPassiveNestedUpdates = null;
var currentEventTransitionLane = NoLanes;
var isRunningInsertionEffect = false;
function getWorkInProgressRoot() {
Expand All @@ -19882,20 +19857,6 @@ function getWorkInProgressRootRenderLanes() {
function isWorkLoopSuspendedOnData() {
return workInProgressSuspendedReason === SuspendedOnData;
}
function requestEventTime() {
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
// We're inside React, so it's fine to read the actual time.
return now$1();
} // We're not inside React, so we may be in the middle of a browser event.

if (currentEventTime !== NoTimestamp) {
// Use the same start time for all updates until we enter React again.
return currentEventTime;
} // This is the first update since React yielded. Compute a new start time.

currentEventTime = now$1();
return currentEventTime;
}
function requestUpdateLane(fiber) {
// Special cases
var mode = fiber.mode;
Expand Down Expand Up @@ -19979,7 +19940,7 @@ function requestRetryLane(fiber) {
return claimNextRetryLane();
}

function scheduleUpdateOnFiber(root, fiber, lane, eventTime) {
function scheduleUpdateOnFiber(root, fiber, lane) {
{
if (isRunningInsertionEffect) {
error("useInsertionEffect must not schedule updates.");
Expand All @@ -20005,7 +19966,7 @@ function scheduleUpdateOnFiber(root, fiber, lane, eventTime) {
markRootSuspended(root, workInProgressRootRenderLanes);
} // Mark that the root has a pending update.

markRootUpdated(root, lane, eventTime);
markRootUpdated(root, lane);

if (
(executionContext & RenderContext) !== NoLanes &&
Expand Down Expand Up @@ -20071,10 +20032,8 @@ function isUnsafeClassRenderPhaseUpdate(fiber) {
function performConcurrentWorkOnRoot(root, didTimeout) {
{
resetNestedUpdateFlag();
} // Since we know we're in a React event, we can clear the current
// event time. The next update will compute a new event time.
}

currentEventTime = NoTimestamp;
currentEventTransitionLane = NoLanes;

if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
Expand Down Expand Up @@ -22095,10 +22054,9 @@ function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) {
var errorInfo = createCapturedValueAtFiber(error, sourceFiber);
var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane);
var root = enqueueUpdate(rootFiber, update, SyncLane);
var eventTime = requestEventTime();

if (root !== null) {
markRootUpdated(root, SyncLane, eventTime);
markRootUpdated(root, SyncLane);
ensureRootIsScheduled(root);
}
}
Expand Down Expand Up @@ -22134,10 +22092,9 @@ function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) {
var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber);
var update = createClassErrorUpdate(fiber, errorInfo, SyncLane);
var root = enqueueUpdate(fiber, update, SyncLane);
var eventTime = requestEventTime();

if (root !== null) {
markRootUpdated(root, SyncLane, eventTime);
markRootUpdated(root, SyncLane);
ensureRootIsScheduled(root);
}

Expand Down Expand Up @@ -22256,11 +22213,10 @@ function retryTimedOutBoundary(boundaryFiber, retryLane) {
retryLane = requestRetryLane(boundaryFiber);
} // TODO: Special case idle priority?

var eventTime = requestEventTime();
var root = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);

if (root !== null) {
markRootUpdated(root, retryLane, eventTime);
markRootUpdated(root, retryLane);
ensureRootIsScheduled(root);
}
}
Expand Down Expand Up @@ -22912,7 +22868,7 @@ function scheduleFibersWithFamiliesRecursively(
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}

Expand Down Expand Up @@ -23700,7 +23656,6 @@ function FiberRootNode(
this.next = null;
this.callbackNode = null;
this.callbackPriority = NoLane;
this.eventTimes = createLaneMap(NoLanes);
this.expirationTimes = createLaneMap(NoTimestamp);
this.pendingLanes = NoLanes;
this.suspendedLanes = NoLanes;
Expand Down Expand Up @@ -23797,7 +23752,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-next-0b931f90e-20230411";
var ReactVersion = "18.3.0-next-58742c21b-20230411";

// Might add PROFILE later.

Expand Down Expand Up @@ -23905,8 +23860,7 @@ function updateContainer(element, container, parentComponent, callback) {
var root = enqueueUpdate(current$1, update, lane);

if (root !== null) {
var eventTime = requestEventTime();
scheduleUpdateOnFiber(root, current$1, lane, eventTime);
scheduleUpdateOnFiber(root, current$1, lane);
entangleTransitions(root, current$1, lane);
}

Expand Down Expand Up @@ -24070,7 +24024,7 @@ var setSuspenseHandler = null;
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}
};
Expand All @@ -24091,7 +24045,7 @@ var setSuspenseHandler = null;
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}
};
Expand All @@ -24112,7 +24066,7 @@ var setSuspenseHandler = null;
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
}
}; // Support DevTools props for function components, forwardRef, memo, host components, etc.
Expand All @@ -24127,7 +24081,7 @@ var setSuspenseHandler = null;
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
};

Expand All @@ -24141,7 +24095,7 @@ var setSuspenseHandler = null;
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
};

Expand All @@ -24155,15 +24109,15 @@ var setSuspenseHandler = null;
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
};

scheduleUpdate = function (fiber) {
var root = enqueueConcurrentRenderForLane(fiber, SyncLane);

if (root !== null) {
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
scheduleUpdateOnFiber(root, fiber, SyncLane);
}
};

Expand Down
Loading

0 comments on commit 06b60a9

Please sign in to comment.