Skip to content
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

RFC Implementation: Speculative work #18262

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c9c7f80
implement initial reification functionality
gnoff Feb 18, 2020
6e23780
implement a working reification for function and context provider com…
gnoff Feb 19, 2020
eae61cb
hacky hook bailout to demo deferred bailouts
gnoff Feb 19, 2020
fbeccb0
tune up speculative work bailout. implement context selectors
gnoff Feb 20, 2020
38f3f9e
handle effects properly
gnoff Feb 20, 2020
59ee9cb
remove reify fiber property in lieu of speculativeWorkMode
gnoff Feb 21, 2020
c17f532
add feature flag and restore original work mode
gnoff Feb 21, 2020
adf1f5b
fixup context error warning and reduce test load
gnoff Feb 21, 2020
ce71231
fix bug in completeUnitOfWork and get ReactNewContext tests working
gnoff Feb 22, 2020
344972a
remove tracing
gnoff Feb 22, 2020
fae3f57
crude perf measure
gnoff Feb 23, 2020
6abfd74
fix dependency bug when applying stashed selection in updateContext hook
gnoff Feb 24, 2020
ff55c0a
add experimental nextChildren residue bailout
gnoff Feb 24, 2020
e3bd338
support additional fiber types for specualtive work
gnoff Mar 3, 2020
26fdebd
implement context reader propagation
gnoff Mar 14, 2020
585c539
in progress implementation of reifyNextWork as alternative to specula…
gnoff Mar 15, 2020
b59c99b
support contexts in reifyingNextWork
gnoff Mar 15, 2020
03490c6
fix bitwise not bug
gnoff Mar 15, 2020
5c62e8c
add support for forwardRef and memo apis
gnoff Mar 15, 2020
b7992f2
remove loop breaker
gnoff Mar 15, 2020
daaa863
be defensive about checking bailouts in reify step
gnoff Mar 16, 2020
7d9949f
first pass at a real bailoutReducer
gnoff Mar 17, 2020
8300bde
add test for exercising reducer bailout
gnoff Apr 14, 2020
1272f5a
remove logging
gnoff Apr 14, 2020
5eb9508
remove speculative work implementation
gnoff Apr 14, 2020
c8a5937
additional cleanup
gnoff Apr 14, 2020
c1c0529
explore force scheduling work to help with react fresh cases
gnoff May 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ export type Fiber = {|
sibling: Fiber | null,
index: number,

// identifier of last rendered children
residue: any,

// The ref last used to attach this node.
// I'll avoid adding an owner field for prod and model that as functions.
ref:
Expand Down Expand Up @@ -277,6 +280,8 @@ function FiberNode(
this.sibling = null;
this.index = 0;

this.residue = null;
gnoff marked this conversation as resolved.
Show resolved Hide resolved

this.ref = null;

this.pendingProps = pendingProps;
Expand Down Expand Up @@ -367,6 +372,8 @@ const createFiber = function(
return new FiberNode(tag, pendingProps, key, mode);
};

export const voidFiber = createFiber(0, null, null, 0);

function shouldConstruct(Component: Function) {
const prototype = Component.prototype;
return !!(prototype && prototype.isReactComponent);
Expand Down Expand Up @@ -465,6 +472,8 @@ export function createWorkInProgress(
workInProgress.memoizedState = current.memoizedState;
workInProgress.updateQueue = current.updateQueue;

workInProgress.residue = current.residue;

// Clone the dependencies object. This is mutated during the render phase, so
// it cannot be shared with the current fiber.
const currentDependencies = current.dependencies;
Expand Down
Loading