-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent a v8 deopt when profiling #14383
Conversation
9af5dea
to
c5b7d26
Compare
ReactDOM: size: 0.0%, gzip: -0.0% Details of bundled changes.Comparing: 8482cbe...c5b7d26 react-dom
react-art
react-native-renderer
react-test-renderer
react-reconciler
Generated by 🚫 dangerJS |
Nice work finding that we can set them back to ints straight after. Seems like a simple fix to me. I was going to suggest just removing the preventExtensions logic, but this is better. |
Thanks Dom! (and thanks for the help digging into this on Friday) |
🤣 thanks for digging into this, you're both awesome |
@@ -254,6 +254,23 @@ function FiberNode( | |||
this.alternate = null; | |||
|
|||
if (enableProfilerTimer) { | |||
// Note: The following is done to avoid a v8 deopt. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/deopt/performance cliff/
(It's not a deopt.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I was referring to the fact that the result is Fibers all having different shapes (which seemed like a deopt to me) but admittedly, I was just guessing at terminology 😄
Edit I've updated the wording based on your clarification ~ 1dc108e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To give some more background, a deopt happens when we're running optimized machine code generated by the optimizing compiler (TurboFan in V8's case), and one of the assumptions in the optimized code turns out to be invalid. In such cases we have to deopt and go back to running bytecode in the interpreter (Ignition in V8's case). (Our JSConf talk includes some more detail and visualizations that make this more clear, in case you're interested.)
This V8 bug however occurs before we even get to optimized code.
You can verify this yourself by running our reduced test case with --no-opt
: it still reproduces.
Resolves #14365