Skip to content

Commit

Permalink
[Fiber] Set profiler values to doubles (#30942)
Browse files Browse the repository at this point in the history
At some point this trick was added to initialize the value first to NaN
and then replace them with zeros and negative ones.

This is to address the issue noted in
#14365 where these hidden
classes can be initialized to SMIs at first and then deopt when we
realize they're actually doubles.

However, this fix has been long broken and has deopted the profiling
build for years because closure compiler optimizes out the first write.

I'm not sure because I haven't A/B-tested this in the JIT yet but I
think we can use negative zero and -1.1 as the initial values instead
since they're not simple integers. Negative zero `===` zero (but not
Object.is) so is the same as far as our code is concerned. The negative
value is just `< 0` comparisons.

DiffTrain build for [94e4aca](94e4aca)
  • Loading branch information
sebmarkbage committed Sep 13, 2024
1 parent fadd1ee commit 037b2e3
Show file tree
Hide file tree
Showing 34 changed files with 216 additions and 216 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
473522093d3dd95582729d01cd5c0d15dcc9cd3b
94e4acaa1477e65cac02ba86058cde0afe4c8f1f
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
473522093d3dd95582729d01cd5c0d15dcc9cd3b
94e4acaa1477e65cac02ba86058cde0afe4c8f1f
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-47352209-20240912";
exports.version = "19.0.0-www-classic-94e4acaa-20240913";
"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-47352209-20240912";
exports.version = "19.0.0-www-modern-94e4acaa-20240913";
"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-47352209-20240912";
exports.version = "19.0.0-www-classic-94e4acaa-20240913";
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-47352209-20240912";
exports.version = "19.0.0-www-modern-94e4acaa-20240913";
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-47352209-20240912";
exports.version = "19.0.0-www-classic-94e4acaa-20240913";
"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-47352209-20240912";
exports.version = "19.0.0-www-modern-94e4acaa-20240913";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
36 changes: 18 additions & 18 deletions compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7385,8 +7385,8 @@ __DEV__ &&
(nextProps.childLanes = 0),
(nextProps.pendingProps = primaryChildProps),
workInProgress.mode & 2 &&
((nextProps.actualDuration = 0),
(nextProps.actualStartTime = -1),
((nextProps.actualDuration = -0),
(nextProps.actualStartTime = -1.1),
(nextProps.selfBaseDuration = didSuspend.selfBaseDuration),
(nextProps.treeBaseDuration = didSuspend.treeBaseDuration)),
(workInProgress.deletions = null));
Expand Down Expand Up @@ -7516,10 +7516,10 @@ __DEV__ &&
: ((progressedPrimaryFragment.childLanes = 0),
(progressedPrimaryFragment.pendingProps = primaryChildren),
workInProgress.mode & 2 &&
((progressedPrimaryFragment.actualDuration = 0),
(progressedPrimaryFragment.actualStartTime = -1),
(progressedPrimaryFragment.selfBaseDuration = 0),
(progressedPrimaryFragment.treeBaseDuration = 0)));
((progressedPrimaryFragment.actualDuration = -0),
(progressedPrimaryFragment.actualStartTime = -1.1),
(progressedPrimaryFragment.selfBaseDuration = -0),
(progressedPrimaryFragment.treeBaseDuration = -0)));
fallbackChildren = createFiberFromFragment(
fallbackChildren,
mode,
Expand Down Expand Up @@ -14250,9 +14250,9 @@ __DEV__ &&
this.deletions = null;
this.childLanes = this.lanes = 0;
this.alternate = null;
this.actualDuration = 0;
this.actualStartTime = -1;
this.treeBaseDuration = this.selfBaseDuration = 0;
this.actualDuration = -0;
this.actualStartTime = -1.1;
this.treeBaseDuration = this.selfBaseDuration = -0;
this._debugOwner = this._debugInfo = null;
this._debugNeedsRemount = !1;
this._debugHookTypes = null;
Expand Down Expand Up @@ -14288,10 +14288,10 @@ __DEV__ &&
key: key,
pendingProps: pendingProps,
mode: mode,
actualDuration: 0,
actualStartTime: -1,
selfBaseDuration: 0,
treeBaseDuration: 0,
actualDuration: -0,
actualStartTime: -1.1,
selfBaseDuration: -0,
treeBaseDuration: -0,
_debugInfo: null,
_debugOwner: null,
_debugNeedsRemount: !1,
Expand Down Expand Up @@ -14327,8 +14327,8 @@ __DEV__ &&
(workInProgress.flags = 0),
(workInProgress.subtreeFlags = 0),
(workInProgress.deletions = null),
(workInProgress.actualDuration = 0),
(workInProgress.actualStartTime = -1));
(workInProgress.actualDuration = -0),
(workInProgress.actualStartTime = -1.1));
workInProgress.flags = current.flags & 31457280;
workInProgress.childLanes = current.childLanes;
workInProgress.lanes = current.lanes;
Expand Down Expand Up @@ -17062,11 +17062,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-47352209-20240912",
version: "19.0.0-www-classic-94e4acaa-20240913",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
reconcilerVersion: "19.0.0-www-classic-94e4acaa-20240913"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -17100,7 +17100,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-47352209-20240912";
exports.version = "19.0.0-www-classic-94e4acaa-20240913";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
24 changes: 12 additions & 12 deletions compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -13747,9 +13747,9 @@ __DEV__ &&
this.deletions = null;
this.childLanes = this.lanes = 0;
this.alternate = null;
this.actualDuration = 0;
this.actualStartTime = -1;
this.treeBaseDuration = this.selfBaseDuration = 0;
this.actualDuration = -0;
this.actualStartTime = -1.1;
this.treeBaseDuration = this.selfBaseDuration = -0;
this._debugOwner = this._debugInfo = null;
this._debugNeedsRemount = !1;
this._debugHookTypes = null;
Expand Down Expand Up @@ -13785,10 +13785,10 @@ __DEV__ &&
key: key,
pendingProps: pendingProps,
mode: mode,
actualDuration: 0,
actualStartTime: -1,
selfBaseDuration: 0,
treeBaseDuration: 0,
actualDuration: -0,
actualStartTime: -1.1,
selfBaseDuration: -0,
treeBaseDuration: -0,
_debugInfo: null,
_debugOwner: null,
_debugNeedsRemount: !1,
Expand Down Expand Up @@ -13824,8 +13824,8 @@ __DEV__ &&
(workInProgress.flags = 0),
(workInProgress.subtreeFlags = 0),
(workInProgress.deletions = null),
(workInProgress.actualDuration = 0),
(workInProgress.actualStartTime = -1));
(workInProgress.actualDuration = -0),
(workInProgress.actualStartTime = -1.1));
workInProgress.flags = current.flags & 31457280;
workInProgress.childLanes = current.childLanes;
workInProgress.lanes = current.lanes;
Expand Down Expand Up @@ -16508,11 +16508,11 @@ __DEV__ &&
(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-modern-47352209-20240912",
version: "19.0.0-www-modern-94e4acaa-20240913",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getInstanceFromNode,
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
reconcilerVersion: "19.0.0-www-modern-94e4acaa-20240913"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -16546,7 +16546,7 @@ __DEV__ &&
exports.Shape = Shape;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-47352209-20240912";
exports.version = "19.0.0-www-modern-94e4acaa-20240913";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -10852,13 +10852,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1417 = {
bundleType: 0,
version: "19.0.0-www-classic-47352209-20240912",
version: "19.0.0-www-classic-94e4acaa-20240913",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
reconcilerVersion: "19.0.0-www-classic-94e4acaa-20240913"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1418 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10884,4 +10884,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-classic-47352209-20240912";
exports.version = "19.0.0-www-classic-94e4acaa-20240913";
6 changes: 3 additions & 3 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -10366,13 +10366,13 @@ var slice = Array.prototype.slice,
})(React.Component);
var internals$jscomp$inline_1409 = {
bundleType: 0,
version: "19.0.0-www-modern-47352209-20240912",
version: "19.0.0-www-modern-94e4acaa-20240913",
rendererPackageName: "react-art",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: function () {
return null;
},
reconcilerVersion: "19.0.0-www-modern-47352209-20240912"
reconcilerVersion: "19.0.0-www-modern-94e4acaa-20240913"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1410 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand All @@ -10398,4 +10398,4 @@ exports.RadialGradient = RadialGradient;
exports.Shape = TYPES.SHAPE;
exports.Surface = Surface;
exports.Text = Text;
exports.version = "19.0.0-www-modern-47352209-20240912";
exports.version = "19.0.0-www-modern-94e4acaa-20240913";
40 changes: 20 additions & 20 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9631,8 +9631,8 @@ __DEV__ &&
(JSCompiler_object_inline_stack_2415.pendingProps =
componentStack),
workInProgress.mode & ProfileMode &&
((JSCompiler_object_inline_stack_2415.actualDuration = 0),
(JSCompiler_object_inline_stack_2415.actualStartTime = -1),
((JSCompiler_object_inline_stack_2415.actualDuration = -0),
(JSCompiler_object_inline_stack_2415.actualStartTime = -1.1),
(JSCompiler_object_inline_stack_2415.selfBaseDuration =
JSCompiler_temp.selfBaseDuration),
(JSCompiler_object_inline_stack_2415.treeBaseDuration =
Expand Down Expand Up @@ -9776,10 +9776,10 @@ __DEV__ &&
: ((progressedPrimaryFragment.childLanes = 0),
(progressedPrimaryFragment.pendingProps = primaryChildren),
workInProgress.mode & ProfileMode &&
((progressedPrimaryFragment.actualDuration = 0),
(progressedPrimaryFragment.actualStartTime = -1),
(progressedPrimaryFragment.selfBaseDuration = 0),
(progressedPrimaryFragment.treeBaseDuration = 0)));
((progressedPrimaryFragment.actualDuration = -0),
(progressedPrimaryFragment.actualStartTime = -1.1),
(progressedPrimaryFragment.selfBaseDuration = -0),
(progressedPrimaryFragment.treeBaseDuration = -0)));
fallbackChildren = createFiberFromFragment(
fallbackChildren,
mode,
Expand Down Expand Up @@ -17475,9 +17475,9 @@ __DEV__ &&
this.deletions = null;
this.childLanes = this.lanes = 0;
this.alternate = null;
this.actualDuration = 0;
this.actualStartTime = -1;
this.treeBaseDuration = this.selfBaseDuration = 0;
this.actualDuration = -0;
this.actualStartTime = -1.1;
this.treeBaseDuration = this.selfBaseDuration = -0;
this._debugOwner = this._debugInfo = null;
this._debugNeedsRemount = !1;
this._debugHookTypes = null;
Expand Down Expand Up @@ -17513,10 +17513,10 @@ __DEV__ &&
key: key,
pendingProps: pendingProps,
mode: mode,
actualDuration: 0,
actualStartTime: -1,
selfBaseDuration: 0,
treeBaseDuration: 0,
actualDuration: -0,
actualStartTime: -1.1,
selfBaseDuration: -0,
treeBaseDuration: -0,
_debugInfo: null,
_debugOwner: null,
_debugNeedsRemount: !1,
Expand Down Expand Up @@ -17552,8 +17552,8 @@ __DEV__ &&
(workInProgress.flags = 0),
(workInProgress.subtreeFlags = 0),
(workInProgress.deletions = null),
(workInProgress.actualDuration = 0),
(workInProgress.actualStartTime = -1));
(workInProgress.actualDuration = -0),
(workInProgress.actualStartTime = -1.1));
workInProgress.flags = current.flags & 31457280;
workInProgress.childLanes = current.childLanes;
workInProgress.lanes = current.lanes;
Expand Down Expand Up @@ -27802,11 +27802,11 @@ __DEV__ &&
: flushSyncErrorInBuildsThatSupportLegacyMode;
(function () {
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-www-classic-47352209-20240912" !== isomorphicReactPackageVersion)
if ("19.0.0-www-classic-94e4acaa-20240913" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-dom: 19.0.0-www-classic-47352209-20240912\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-dom: 19.0.0-www-classic-94e4acaa-20240913\nLearn more: https://react.dev/warnings/version-mismatch")
);
})();
("function" === typeof Map &&
Expand Down Expand Up @@ -27850,11 +27850,11 @@ __DEV__ &&
!(function () {
var internals = {
bundleType: 1,
version: "19.0.0-www-classic-47352209-20240912",
version: "19.0.0-www-classic-94e4acaa-20240913",
rendererPackageName: "react-dom",
currentDispatcherRef: ReactSharedInternals,
findFiberByHostInstance: getClosestInstanceFromNode,
reconcilerVersion: "19.0.0-www-classic-47352209-20240912"
reconcilerVersion: "19.0.0-www-classic-94e4acaa-20240913"
};
internals.overrideHookState = overrideHookState;
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
Expand Down Expand Up @@ -28507,7 +28507,7 @@ __DEV__ &&
exports.useFormStatus = function () {
return resolveDispatcher().useHostTransitionStatus();
};
exports.version = "19.0.0-www-classic-47352209-20240912";
exports.version = "19.0.0-www-classic-94e4acaa-20240913";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Loading

0 comments on commit 037b2e3

Please sign in to comment.