From a87d245fc2d0b5eedd5463e6f21bf12443489b15 Mon Sep 17 00:00:00 2001 From: Andrew Clark Date: Mon, 23 Sep 2019 11:12:47 -0700 Subject: [PATCH] [work loop] Prevent work loop from being inlined (#16865) Uses Closure Compiler's `@noinline` directive. See https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler#noinline --- packages/react-reconciler/src/ReactFiberWorkLoop.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 2e81624de3704..be45086f2f7fa 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -1422,6 +1422,8 @@ function inferTimeFromExpirationTimeWithSuspenseConfig( ); } +// The work loop is an extremely hot path. Tell Closure not to inline it. +/** @noinline */ function workLoopSync() { // Already timed out, so perform work without checking if we need to yield. while (workInProgress !== null) { @@ -1429,6 +1431,7 @@ function workLoopSync() { } } +/** @noinline */ function workLoop() { // Perform work until Scheduler asks us to yield while (workInProgress !== null && !shouldYield()) {