Summary:
Improved source location information
Only havoc abstract value args when really necessary
Debugger recognizes sourcemaps and opens the correct file/line when debugging in Nuclide.
Make React tests fast
Special case an expression simplification for Instant Render
Fix temporal assignments to intrinsics that happen inside non deterministic loops
Enhanced handling of Array.map applied to abstract arrays
Support dynamic invariants via __assume
We got a logo!
Add React Native mocks to Prepack
Reviewed By: simonhj
Differential Revision: D8739156
fbshipit-source-id: d535dfe0c5bcbee4aaed28f75d45cbedcc51344b
Summary:
Release notes: None
This came about as an offshoot of #2185. PropertyBinding.object cannot be of type AbstractObjectValue. This change narrows its type to ObjectValue, and eliminates checks that become unnecessary.
Outcome of a manual search via Grasp: PropertyBinding.object is assigned at two points - in methods/properties.js and react/util.js. There are also invariants at two places to guard this condition (object instanceof ObjectValue.) yarn flow does not report errors.
Closes https://github.com/facebook/prepack/pull/2208
Differential Revision: D8738889
Pulled By: sb98052
fbshipit-source-id: 52807e28a699b95934b8d53f0c81ccc6b06a79bb
Summary:
Release notes: none
In an attempt to pull out some of the work from https://github.com/facebook/prepack/pull/2148 to make things easier to consume and review. This PR is one part, where we check the temporal alias values (if an object value has it) and see if we can dedupe the trees. Example below:
Closes https://github.com/facebook/prepack/pull/2193
Differential Revision: D8732542
Pulled By: trueadm
fbshipit-source-id: 352d0048acfef69b5a257c0fe280435fa7baaa7f
Summary:
Release notes: none
We were missing logic for handling abstract arrays with unknown numeric properties when we attempt to get a partial value on the array. I've added a regression test too.
Closes https://github.com/facebook/prepack/pull/2205
Differential Revision: D8732181
Pulled By: trueadm
fbshipit-source-id: 6002eac4b7d4d0b842407a3bb9ea9bcec19f486b
Summary:
Release notes: none
Make it easier to do local development testing of our internal bundle without having to hack the settings each time.
Closes https://github.com/facebook/prepack/pull/2202
Differential Revision: D8731922
Pulled By: trueadm
fbshipit-source-id: 71d92c3b90f448667c4a9ada1f1b0848ece5003b
Summary:
Release notes: adds React Native mocks to Prepack
This adds React Native mocks to Prepack and a few basic tests to demonstrate inlining of `View` and `Text`.
Closes https://github.com/facebook/prepack/pull/2096
Differential Revision: D8723932
Pulled By: NTillmann
fbshipit-source-id: 38bd265cd8935ebdf30266ec337378b4ea5b09d6
Summary:
Release notes: We got a logo!
Updating README to include logo.
Will create an issue to update website accordingly.
Closes https://github.com/facebook/prepack/pull/2189
Differential Revision: D8725906
Pulled By: NTillmann
fbshipit-source-id: 2f9b3b1d4afbd4fc42f137fcda9e4edac390d272
Summary:
Release notes: Support dynamic invariants via __assume
Resolves#2171. Implements an __assume primitive that injects dynamic invariants into the code.
Source:
```js
x = __abstract("number", "5");
__invariant(x==5, "x should be 5");
```
Generated:
```js
(function () {
var _$0 = this;
var _0 = 5;
_$0.x = _0;
var _1 = _0 == 5;
if (!_1) {
throw new Error("x should be 5");
}
}).call(this);
```
Closes https://github.com/facebook/prepack/pull/2195
Reviewed By: hermanventer
Differential Revision: D8725726
Pulled By: sb98052
fbshipit-source-id: 28db3272199cdb9ae669062344eb82f0ef619bd4
Summary:
Release notes: none
As pointed out by Herman in https://github.com/facebook/prepack/pull/2193#discussion_r199628160. We don't need `temporalAliasArgs`, so this PR removes it from the codebase and uses the existing way via the preludeGenerator.
This also adds a helper function to make it easier to relate derived abstract values to their temporal args. Furthermore, `derivedIds` now stores the `TemporalBuildNodeEntryArgs` rather than `Array<Value>`, as the follow up PRs for doing the React related logic need to access more than just the array of args, it also needs access to `isPure`, `skipInvariant` etc so it can properly clone derived abstract values.
Closes https://github.com/facebook/prepack/pull/2199
Differential Revision: D8724017
Pulled By: trueadm
fbshipit-source-id: 3ad72d3b230f1d2dc7f81c2a8d07dd33d0c7aa5c
Summary:
Release note: Enhanced handling of Array.map applied to abstract arrays
Fixes#2169.
If an abstract array is the join or a few concrete arrays, we apply the map over all of the concrete arrays and join the results. This is a bit of a hack, much like what we have for switch statements. The code from the latter has been factored out and reused for this.
Closes https://github.com/facebook/prepack/pull/2173
Differential Revision: D8721507
Pulled By: hermanventer
fbshipit-source-id: e08f2dc1d7e78c7b59f9ff7c76ad54b398b8afe9
Summary:
Release note: Fix temporal assignments to intrinsics that happen inside non deterministic loops
Tweak the property set logic to not short circuit when the target object is intrinsic and the RH value is the same as the current (tracked) property value.
Also fix the code generator for loop bodies to not get upset when the lh side is temporal, but rh side is not widened (because it is a constant).
Closes https://github.com/facebook/prepack/pull/2197
Differential Revision: D8721001
Pulled By: hermanventer
fbshipit-source-id: d38565a40fa7ab8b4e30596f0e1dcfc655a4fb5e
Summary:
Release note: special case expression simplification for Instant Render
When instant render is enabled turn x === undefined || x === null into __cannotBecomeObject(x) so that Instant Render can easily compile it down to a single byte code.
Closes https://github.com/facebook/prepack/pull/2188
Differential Revision: D8716594
Pulled By: hermanventer
fbshipit-source-id: bbcb25462f79852d8deac29bfed62e86745e5589
Summary:
Release notes: none
When the `objectWithoutProperties` mock was originally created, my knowledge of Prepack's internals wasn't as good as it was now. Now that I understand how AbstractObjectValues work, we can safely add the known values in `objectWithoutProperties` to the abstract backing object. The backing object was missing these values before and was an empty empty that was partial. This should give more data and value on our internal bundle, where before the values would be lost unnecessarily.
Closes https://github.com/facebook/prepack/pull/2194
Differential Revision: D8716289
Pulled By: trueadm
fbshipit-source-id: 451065473ea09943831f75c0bc15490e73c8d947
Summary:
Currently we have a single giant file with all tests, and a giant snapshot. This is both slow, and hard to work with and iterate on.
In this PR I will refactor our test setup.
- [x] Split it up into multiple files (gets the test running from 45s to 27s)
- [x] Run Prettier on test files
- [x] Split tests further for better performance
- [x] Make it possible to run one test file
- [x] Fix the issue with double test re-runs in watch mode on changes in the test file
- [x] Refactor error handling
- [x] Run Prettier on fixtures
- [x] Add a fast mode with `yarn test-react-fast <Filename>`
- [x] Fix double reruns on failure
Potential followups:
- [x] Figure out why test interruption broke (need https://github.com/facebook/jest/issues/6599 and https://github.com/facebook/jest/issues/6598 fixed)
- [x] Revisit weird things like `this['React']` assignment with a funny comment in every test
Closes https://github.com/facebook/prepack/pull/2187
Differential Revision: D8713639
Pulled By: gaearon
fbshipit-source-id: 5edbfa4e61610ecafff17c0e5e7f84d44cd51168
Summary:
Release Notes:
- Debugger recognizes sourcemaps and opens the correct file/line when debugging in Nuclide.
- Explanation of how sourcemap translation works in [this Quip](https://fb.quip.com/0uQCAtkuPAHF). This is probably useful to read before attempting to read the changes to `Debugger.js` and `PathNormalizer.js`.
- Removed unnecessary abstractions in `IsStatement` and `DebuggerOptions`.
- Refactored multi-file support to conform to Nuclide initialization protocol
- Refactored `DebuggerConfigArguments` so as to pass sourceFiles without increase Flow cycle length.
Example of FatalError on FB4A: https://www.dropbox.com/s/ig8vrlpcazbygo3/Prepack%20Fatal%20Diagnostic%20on%20FB4A.mov?dl=0
NOTE: Apologies for the large number of commits -- I incorrectly pulled in some from master when rebasing
Closes https://github.com/facebook/prepack/pull/2154
Differential Revision: D8707082
Pulled By: caiismyname
fbshipit-source-id: 812610c0345536a1ad9b480449c16f34018040c3
Summary:
Fixes#2179
In #2179 I describe why we might need to havoc some args to abstract values sometimes. This adds an invariant to ensure that we always have args in the cases we need to havoc.
If this abstract value cannot be an object, then we don't need to havoc since there's nothing that can be mutated.
If this has a known values domain, then we know the possible objects. We only need to havoc those, not the args.
Closes https://github.com/facebook/prepack/pull/2184
Differential Revision: D8701601
Pulled By: sebmarkbage
fbshipit-source-id: d5fecbed4cff8013bc768cb6e277094d9ff16d9c
Summary:
Release note: Improve source location information
Changes to make sure that the source location of the call expression appears in the corresponding execution context record. Also emit execution records with no source location from stack traces. These are due to calls to internal helper methods for iterating over objects and arrays for argument destructuring.
Finally fix a CompilerDiagnostic construction call to include a source location.
Closes https://github.com/facebook/prepack/pull/2183
Differential Revision: D8698271
Pulled By: hermanventer
fbshipit-source-id: 10f77f718db645a4784723c3eca4bd4e06eb43f8
Summary:
Release notes: None
Tweaking some behaviors to help with Instant Render automation.
This leaves behind some TODOs in the code, but unblock me for now.
Closes https://github.com/facebook/prepack/pull/2178
Differential Revision: D8689796
Pulled By: NTillmann
fbshipit-source-id: f919a8b6bbfb63513bb9467027676e0ba7d4230e
Summary:
Release Notes: None
It is okay for a define call to happen within a require call so long as the define call has happened by the time the require call has returned (since all define calls should have the same effect and only happen once). Previously if we encountered a module required before it was defined (or defined in a nested partial evaluation scope), we would not record it in ModuleTracer logic.
Closes https://github.com/facebook/prepack/pull/2168
Differential Revision: D8688788
Pulled By: cblappert
fbshipit-source-id: 6696ea54ed9ae7a3d7e8a944c45e14feccf3139b
Summary:
Release notes: none
Fixes nested `evaluatePure` calls, where before they would collide and overwrite one another. Also ensure React reconciler uses side-effect detection on nested optimized closures. This fixes a React test which should have been failing before, but wasn't.
Closes https://github.com/facebook/prepack/pull/2166
Differential Revision: D8681422
Pulled By: trueadm
fbshipit-source-id: 8941812407d1bda5af0343a09210aeff24a36cff
Summary:
Release notes: adds `mutatesOnly` to generator entries to better allow for DCE
This PR adds a new option that can be passed as an optional arg to `generator.deriveAbstract` called `mutatesOnly `. See https://github.com/facebook/prepack/pull/2132#pullrequestreview-130509488 for details. With it, we can better dead-code eliminate generator entries when the value entries that are flagged as mutating are dead code.
The test showing this is below:
Input:
```js
global.f = function() {
var x = global.__abstract ? global.__abstract({}, "({})") : {};
global.__makeSimple && __makeSimple(x);
Object.assign({}, x);
return 1;
};
if (global.__optimize) __optimize(f);
```
Output (with master):
```js
var _$2 = this;
var _$3 = _$2.Object;
var _$4 = _$3.assign;
var _0 = function () {
var _$0 = _$4({}, {});
return 1;
};
```
Output (with the changes in this PR):
```js
var _0 = function () {
return 1;
};
var _2 = function () {
return global.f();
};
```
Closes https://github.com/facebook/prepack/pull/2132
Differential Revision: D8667764
Pulled By: trueadm
fbshipit-source-id: 5121da7d73330befeb5a39ea50d7b773256d70bc
Summary:
Release note: More simplification of equality expressions
Resolves issue: #2172
Expressions like (c ? x : y) === null can sometimes be simplified by first rewriting them as (c ? x === null : y === null). Add such a case to the simplifier.
Closes https://github.com/facebook/prepack/pull/2174
Differential Revision: D8666251
Pulled By: hermanventer
fbshipit-source-id: 5b0d56fb091e25bfcdf879be3403cb5a982375ae
Summary:
Release Notes: None
Dan Caspi's change to internal test case created a giant switch statement, increasing evaluation time from 5.9s > 224s. This change brings it down to 6.2s by using `push` instead of `concat` in 2 places.
Closes https://github.com/facebook/prepack/pull/2161
Differential Revision: D8649236
Pulled By: cblappert
fbshipit-source-id: a0af4a7c4eaff30e6e8a7708006d84773a25517f
Summary:
Release note: Fix test runner and don't swallow invariant failures
The recent changes to make the serializer test runner deal with promises, caused it to list every test that follows a failing test as also failing.
I've also noticed that invariant failures can get swallowed. And as a result of that some test cases that should have failed with false invariants showed up as passing.
Those failures were recently introduced by PR #2134. It boils down to a single line fix, which is also included with this.
Closes https://github.com/facebook/prepack/pull/2155
Differential Revision: D8629298
Pulled By: hermanventer
fbshipit-source-id: 467f7efdf119ea9d29083d4e41054e583b38a1ff
Summary:
Release notes: none
To make https://github.com/facebook/prepack/pull/2096 easier to review, this pulls out the tidy ups from that PR.
- fix typo on function name `mergeAdjacentJSONTextNodes`
- move ReactDOM mock logic into its own file
Closes https://github.com/facebook/prepack/pull/2163
Differential Revision: D8625051
Pulled By: trueadm
fbshipit-source-id: 5345cc26f5c613b4afbb1c768213fd84caf5ebab
Summary:
Release notes: None
We used to find random bugs where the `computed` flag wasn't set right.
But even if it's set correctly, we sometimes generated suboptimal code,
e.g. `a["0"]` for an array access.
I reviewed all occurrences of `t.memberExpression`, and redirected all that involve
potentially interesting computations to a new helper function `memberExpressionHelper`
which does "the right thing". This function should always be used.
Added regression test for an array access that used to be suboptimal (observed in InstantRender).
Closes https://github.com/facebook/prepack/pull/2162
Differential Revision: D8625006
Pulled By: NTillmann
fbshipit-source-id: f9211260c08d9195a9f4cc48502cba0794fe84f9
Summary:
Release notes: adds basic ES2015 arrow function serialization
This allows Prepack to serialize back to arrow functions and also traverse them correctly when understanding `this`.
Closes https://github.com/facebook/prepack/pull/1650
Differential Revision: D8623368
Pulled By: trueadm
fbshipit-source-id: 9be7849770148b67e5f17eee88a633aac906b6e2
Summary:
Release note: none
This reverses PR #2136, which Dan has noted to lead to a 3x slowdown for an internal bundle. In order to fix the problem that Nikolai's PR addressed, the original code has been modified to not purge any local bindings that could possibly have been captured in a closure.
I expect that most effects will not be in a context that contains a closure, so this should help. It would be nice, however, to get some feedback on whether this is actually the case.
Closes https://github.com/facebook/prepack/pull/2152
Differential Revision: D8617877
Pulled By: hermanventer
fbshipit-source-id: 8e907ba1dded0428388fd42132658555e3b8e82e
Summary:
Release notes: standard for loops and while loops have a recovery mechanism in pure scope
This PR provides a bail-out recovery mechanism in pure scope for FatalErrors thrown and caught from for/while loops. Until now, if a FatalError occurs from trying to evaluate abstract for/while loops, we'd have to recover at a higher point in the callstack, which wasn't always possible (the loop may be at the root of a function/component).
The ideal long-term strategy is to properly model out the different cases for loops, but this is a complex and time-consuming process. This PR adds a recovery mechanism that serializes out the original for loop, but within a newly created wrapper function containing the loop logic and a function call to that newly created function wrapper. This allows us to still run the same code at runtime, where we were unable to evaluate and optimize it at build time.
For now, this PR only adds recovery support for standard `for` and `while` loops (as they go through the same code path). We already have some basic evaluation for `do while` loops, but trying to adapt that code to work with the failing test case (https://github.com/facebook/prepack/issues/2055) didn't work for me – we have so many strange problems to deal with first before we can properly handle that issue.
In cases where the loop uses `this`, the context is found and correctly called with the wrapper function. In cases of usage of `return`, `arguments` and labelled `break/continue` we bail out again as this is not currently supported in the scope of this PR (can be added in a follow up PR, but I wanted to keep the scope of this PR limited).
For example, take this failing case on master:
```js
function fn(props, splitPoint) {
var text = props.text || "";
text = text.replace(/\s*$/, "");
if (splitPoint !== null) {
while (text[splitPoint - 1] === "\n") {
splitPoint--;
}
}
return splitPoint;
}
```
This serializes out to:
```js
var _0 = function (props, splitPoint) {
var __scope_0 = new Array(1);
var __get_scope_binding_0 = function (__selector) {
var __captured;
switch (__selector) {
case 0:
__captured = [_G, _E];
break;
}
__scope_0[__selector] = __captured;
return __captured;
};
var _C = function () {
var __captured__scope_1 = __scope_0[0] || __get_scope_binding_0(0);
for (; __captured__scope_1[1][__captured__scope_1[0] - 1] === "\n";) {
__captured__scope_1[0]--;
}
};
var _$0 = props.text;
var _$2 = (_$0 || "").replace(/\s*$/, "");
var _6 = splitPoint !== null;
var _G = _6 ? void 0 : splitPoint;
var _E = _6 ? void 0 : _$2;
if (_6) {
(__scope_0[0] || __get_scope_binding_0(0))[0] = splitPoint;
(__scope_0[0] || __get_scope_binding_0(0))[1] = _$2;
var _$5 = _C();
}
var _$6 = (__scope_0[0] || __get_scope_binding_0(0))[0];
return _$6;
};
```
Furthermore, an idea that might be a good follow up PR would be to break the wrapper function into two functions, depending on some heuristics. If we can detect that the loop body does not have any unsupported side-effects like writing to variables that are havoced etc, we can then tell Prepack to optimize the inner function wrapper for the loop body. That way, at least some parts of the loop get optimized (the outer bindings will be havoced before this point, so it should work okay). I think I suggested this in person with hermanventer and sebmarkbage in Seattle as a potential way to optimize complex loops that we can't compute the fixed point for right now.
Fixes#2055
Closes https://github.com/facebook/prepack/pull/2118
Differential Revision: D8410341
Pulled By: trueadm
fbshipit-source-id: ee7e6b1bc1feadf0c924e4f82506ca32ca1dadc9
Summary:
Release notes: none
Fixes a bug where the argument list gets mutated and padded with undefined values, so instead we slice it a copy of it so we don't mutate the same array and pass the mutated array instead. Fixes https://github.com/facebook/prepack/issues/2153.
Closes https://github.com/facebook/prepack/pull/2156
Differential Revision: D8610746
Pulled By: trueadm
fbshipit-source-id: 1b6f37693323c813d60f43ab7e9977a99f86ff47
Summary:
Release notes: none
As we're updating state on a final object, in this case `state`, ensure we use `hardModifyReactObjectPropertyBinding`. Unblocks https://github.com/facebook/prepack/pull/2137.
Closes https://github.com/facebook/prepack/pull/2149
Reviewed By: hermanventer
Differential Revision: D8584676
Pulled By: trueadm
fbshipit-source-id: f23c77a5091b7c1023a48a5d29353bf9cdc06d65
Summary:
Release notes: in pure mode, allow Object.assign to continue evaluation rather than throwing FatalErrors
This PR adds bail-out support of `Object.assign` sources within the `Object.assign` implementation. This allows us to continue evaluation in pure scope without bailing out of the Object.assign entirely (like we currently do) upon a FatalError occurring. Given we have snapshotting in `Object.assign`, we don't need to havoc the sources.
This allows us to inline and evaluate far more within our internal bundles. Fixes https://github.com/facebook/prepack/issues/2064
Closes https://github.com/facebook/prepack/pull/2068
Differential Revision: D8579441
Pulled By: trueadm
fbshipit-source-id: 0e97b54e0c8af63f1e3cd08fca6c7f375ee3c615
Summary:
I haven't written the next parts yet but I figured let's put a link on the website so this doesn't get lost.
I think even the details there are useful enough for users and new contributors.
<img width="1513" alt="screen shot 2018-06-21 at 3 57 52 pm" src="https://user-images.githubusercontent.com/810438/41727325-f9ba32da-756b-11e8-94f0-c83b71df859b.png">
I put it at the top of Getting Started because IMO you'll want to read this (or at least see it) before trying to run Prepack.
I initially planned to put it in the docs themselves but only today realized there's no build process. I don't want to convert the guide to HTML so I'd rather keep it as a gist (and update it if necessary) in the meantime.
Closes https://github.com/facebook/prepack/pull/2147
Differential Revision: D8577403
Pulled By: gaearon
fbshipit-source-id: 2f7f64a0a4413066739b12c50b4d21779a16a568
Summary:
Release notes: none
This PR contains some fixes and small tidy ups that would have been in #2138. There was a bug to do with the React props equivalence system and snapshots that was found when https://github.com/facebook/prepack/pull/2137 was merged (along with the fix I commented to on that PR). This PR unblocks https://github.com/facebook/prepack/pull/2137 to land as it should now pass our internal bundle test.
Closes https://github.com/facebook/prepack/pull/2146
Differential Revision: D8556958
Pulled By: trueadm
fbshipit-source-id: dd774de76059e00af1dff305dd3618c3bfed06ea
Summary:
Release Notes: Add support for multiple input files for the debugger, in both debugger-cli and prepack-cli (used by debugger when launched from Nuclide).
Closes https://github.com/facebook/prepack/pull/2130
Differential Revision: D8554746
Pulled By: caiismyname
fbshipit-source-id: ffba51d0bc6f2b7fa171072a358bdfc5c911a2d7
Summary:
Release notes: Fixes to leaked declarative bindings
Leaked declarative bindings need to be accessed out-of-band as far
as the serializer is concerned which otherwise only puts final
values into locations.
To make that work, whenever two states are merged where a
declarative binding in one has been leaked but not in the other,
this now gets harmonized by also recording the materialization
side effect into the generator of the other.
The result is that a binding always ends up being fully leaked or not.
For leaked mutable bindings, the tracked value becomes irrelevant, and
is now truly made unavailable. For leaked immutable bindings, the last
value is retained, and we no longer need the strange `leakedImmutableValue` field.
Leaked bindings are now referentialized as simple variables, bypassing the
delayed captured-scope logic. This produces nicer more efficient code, but,
at least for now, has the downside that it rules out sharing of function bodies.
This change is a step towards the (to be publicly documented)
long-term plan to clean up Prepack's handling of leaking and havocing.
(Similar to what this change does for declarative bindings, we'll also must
revisit what happens for leaked object properties. But that's for later.)
This fixes#2122 (issue havocing value in conditional) and adds regression test.
This fixes#2007 (Conceptual issue with havoced bindings) and adds regression test.
Closes https://github.com/facebook/prepack/pull/2125
Differential Revision: D8549299
Pulled By: NTillmann
fbshipit-source-id: 28c3681beafd3890668b72a828f59582c636a6c9
Summary:
Release notes: none
After studying the issues in https://github.com/facebook/prepack/pull/2137, I understood that we currently make some assumptions in terms of the ReactElement equivalence system that are incompatible with what we want from Prepack going forward. This PR aims at fixing those assumptions so they fall more into line with the changes https://github.com/facebook/prepack/pull/2137.
This PR makes the following changes:
- All React equivalence is now handled explicitly in the ReactSet/ReactElementSet/ReactPropsSet to ensure all the logic is located together as one and not sprinkled around the codebase.
- We use `hardModifyReactObjectPropertyBinding` to modify final objects that React controls rather than `Properties.Set`. This function bypasses the normal route of putting the property changes on the effects – thus making it so the property changes are permanent and cannot be reverted. Given the object is immutable, there should never be a case where the property may change anyway – we only change the property as part of the equivalence phase and during reconciliation where the React internals are at play. This is only safe for objects explicitly created by React and marked as final by React – no other object can go through this codepath. Any attempt to use this dangerous function on a non-final object will result in an invariant.
- Various bug fixes were fixed that were found when #2137 was merged and existing tests failed.
- Removed all the logic around `makeNotFinal` and use `hardModifyReactObjectPropertyBinding` instead.
Closes https://github.com/facebook/prepack/pull/2138
Reviewed By: gaearon
Differential Revision: D8547558
Pulled By: trueadm
fbshipit-source-id: 192da9169947adadc41f43997dfbe0adb73cec3b
Summary:
Release note: none
Attempts adding support for promises in test-runner.js. `inspect` can now return Promises, which will be resolved before checking it value.
Closes https://github.com/facebook/prepack/pull/2115
Differential Revision: D8550825
Pulled By: hermanventer
fbshipit-source-id: 3f9781f6e34016dcb61bd436400a1bfb51932452