Summary:
Release note: Provide a way to temporarily disable effects tracking
The default error handler constructs a new Error object in order to reuse its logic for obtaining a call stack. Since the object is then thrown a away, it makes no sense to keep tracking its properties and doing so makes debugging more painful.
Pull Request resolved: https://github.com/facebook/prepack/pull/2304
Differential Revision: D8945121
Pulled By: hermanventer
fbshipit-source-id: 68fb8b84c2ef937fcdf3ecaccdff5041779424d5
Summary:
Release Notes: None
PR solved by hermanventer's recent PR, just adding another test case closer to the one in the issue.
Resolves#2248
Pull Request resolved: https://github.com/facebook/prepack/pull/2272
Differential Revision: D8938294
Pulled By: cblappert
fbshipit-source-id: 18e4fd3b8913400b98242eff06f011ed0140459b
Summary:
Release notes: much of the buildNode and inline Babel logic has been moved to a dedicated ResidualOperationSerializer class
Note: this PR is like *phase 1* of many phases to move around buildNodes and their logic. Furthermore, the ideas is to move all Babel coupled logic to the serialization phase and away from the generator and other generic areas. I've explained this more in detail below.
This PR moves much of the Babel logic involving build nodes, that was coupled to inline closures through many parts of the Prepack code base, to its own class `ResidualOperationSerializer`. We now use a helper function `createOperationDescriptor` to create `OperationDescriptor`s. `OperationDescriptor`s exist on both `AbstractValue` and `GeneratorEntry`, and replaces the old `buildNode` and `_buildNode` properties and unifies all the logic. The `buildNode` field has now changed to `operationDescriptor` respectfully.
We now have a `OperationDescriptorType` enum that tells the class which build node to use, along with some associated data that is needed to construct the build node (previously this data was captured in the closure). The idea is to remove the data/kind arguments from `createOperationDescriptor` in follow up PRs, but that will take quite a bit more work, thus why this is a phase 1 PR.
In many cases, we now have no instances of importing Babel in many of the files and this unifies much (but not all) of the Babel node creation logic into a single file – allowing for easy extension in the future.
This PR took forever to do and is very large, so there might be bits that I missed, but hopefully I haven't. All tests etc pass locally.
Pull Request resolved: https://github.com/facebook/prepack/pull/2296
Differential Revision: D8923889
Pulled By: trueadm
fbshipit-source-id: aa3a27efd97f10cc941159735d598199deb24f52
Summary:
I want to better understand the bugs we have in abstract evaluation. One of my ideas to do this is to replace all the literals in test262 tests with abstract values and see what our test coverage is. The first step to do this is to serialize the test262 sources after running them in Prepack and checking if their generated JavaScript runs correctly. This PR does that by adding a `--serializer` flag.
With my methodology, all test262 harnesses are serialized every time since they are in the global scope. This unfortunately seems to be unavoidable since doing otherwise would change program semantics and break the tests.
Running `time yarn test-test262` takes about 2 minutes and has a 98% pass rate. Running `time yarn test-test262 --serializer` takes about 5 minutes and has a 95% pass rate. [Here’s a diff of the two results.](https://gist.github.com/calebmer/1c9fe396b63ba055458c599c2be18a58)
[Here is a selection of some of the bugs](https://gist.github.com/calebmer/1ac381096a4aa7be1fc7dc2163276ab4) in the serializer caught by running test262 with the Prepack serializer. I might open issues for these, but they can be a bit pedantic. I might fix some of them depending on how important they are to the React code we want to compile.
Notably we have:
- Lots of invariants being triggered. I particularly saw [a lot of this invariant](7d355ef4c5/src/serializer/ResidualHeapVisitor.js (L531)). (An example of this is [`07.md`](https://gist.github.com/calebmer/1ac381096a4aa7be1fc7dc2163276ab4#file-07-md).)
- Lots of values that are visited, but not serialized. (An example of this is [`01.md`](https://gist.github.com/calebmer/1ac381096a4aa7be1fc7dc2163276ab4#file-01-md).)
- Some incorrect outputs only caught by executing code. Could not be caught by static analysis. Particularly around class serialization.
I’ll build off this PR to get coverage for the abstract evaluator next, but I found these results interesting on their own so decided to do this in two PRs.
Pull Request resolved: https://github.com/facebook/prepack/pull/2290
Differential Revision: D8908479
Pulled By: calebmer
fbshipit-source-id: aa57d47611fbd92af33e4647fed7bf7990fb6de1
Summary:
Release notes: Enhanced dead code elimination for optimized functions
This resolves#2276: Visiting+emitting modified bindings now participates
in the fixed point computation, checking for whether the modified binding
is actually getting visited for other reasons.
The previously existing code that did CSE by mutating the generator entry
got removed, as it wouldn't work exactly like that anymore (can't return value
because actual analysis gets postponed for fixed point computation). Filed #2286
to keep track of that and more needed changes around CSE for values stored in locations
participating in effects tracking. --- Turns out that we didn't have a test anyway
that would detect whether binding CSE happens or not.
Added regression test.
Pull Request resolved: https://github.com/facebook/prepack/pull/2287
Differential Revision: D8902345
Pulled By: NTillmann
fbshipit-source-id: 6ba3fb9755312956829050f0278dee2d85d6a261
Summary:
In an effort to make debugging easier, add utilities that help pretty-print generators and effects with all the important fields (and none of the internal ones that you see in a debugger). Depth of recursion of printer is customizable.
Currently doesn't pass Flow because I have a helper function that takes an Object and returns an Object. Not sure how to make that type more specific.
Open to feedback on ways to change the output to be more readable/useful.
Output looks like this for a simple set of effects:
```
{
result: [ReturnCompletion value [Abstract 1735003607742184]],
generator: {
_entries: {
index: 39,
declared: [Abstract 1735003607742184],
args: []
},
id: 35,
_name: evaluateNodeForEffects,
pathConditions: [[Abstract 1735003607742177], [Abstract 1735003607742183]]
},
canBeApplied: true,
_id: 33
}
```
Pull Request resolved: https://github.com/facebook/prepack/pull/2270
Differential Revision: D8896030
Pulled By: cblappert
fbshipit-source-id: 4f15a047b43d41ccad53222850fad2bf3216b08c
Summary:
Release notes: None
I updated the code of conduct links, the old ones were 404.
Please note ReactJS and Prepack have different CoC.
Pull Request resolved: https://github.com/facebook/prepack/pull/2284
Differential Revision: D8895997
Pulled By: sb98052
fbshipit-source-id: 90d84fa6215b9d1f1705de43511552e78be8dd00
Summary: Bump version of alpha version of Prepack.
Reviewed By: gaearon
Differential Revision: D8892572
fbshipit-source-id: 129a265b5c8a725d4a09daa6811c0cc1a7ba2249
Summary:
- Support modeling of shapes of optimized function arguments
- fix test262 to fail CircleCI test if not enough tests pass
- upgrades Prepack to use Babel 7.0.0-beta.53
- Nuclide compatibility fix
Reviewed By: gaearon
Differential Revision: D8892151
fbshipit-source-id: 8f1397d25d26e822709ed53c8e6d37055fe396ec
Summary:
`flow check` runs a complete Flow check.
This is good for CI, but it means every re-check after edit is as slow as first check.
I'm changing local `yarn flow` to use a Flow server instead. This should speed up rechecks locally somewhat. Still won't save us from large recheck cycles, but at least we're not starting from a clean slate every time.
I'm adding `yarn flow-ci` with old behavior for the CI.
Finally, I replaced `--merge-timeout` with an equivalent recently added config option. This ensures it's respected both for the server and for the full check. Without it, the server dies.
Pull Request resolved: https://github.com/facebook/prepack/pull/2245
Differential Revision: D8891234
Pulled By: gaearon
fbshipit-source-id: 2c309a1718ed00ca5839cb3a586386e3e779f029
Summary:
This change allows modeling of optimized function arguments in different way than regular environment modeling. The main point of this modeling is being able to determine what getter should be used at this particular GraphQL property access at compile time. To achieve this Prepack should know the shape of arguments used for optimizing functions and should be able to infer the shape of value when it is needed.
Shape information is attached to AbstractValue (to pass it around) and on every property access a new AbstractValue is returned with shape information specific to this property.
As an output of this process, every member access to modeled values is replaced by function call like prop_string(obj, "key").
Structure of the model can be found in `ShapeInformation.js`.
Pull Request resolved: https://github.com/facebook/prepack/pull/2215
Reviewed By: NTillmann
Differential Revision: D8874743
Pulled By: hotsnr
fbshipit-source-id: 9e1b2254ef54986229be7d1195c1586b95d9a4be
Summary:
Release notes: None
IsCall used to fail on abstract values even if they have a set of values in their domain.
This in turn would make `typeof` not work on abstract values.
This makes it work, and adds a regression test.
Pull Request resolved: https://github.com/facebook/prepack/pull/2268
Differential Revision: D8878641
Pulled By: NTillmann
fbshipit-source-id: f6dda513786eaf3f02bd13d5c6474c2f20fb0082
Summary:
Release note: none
Generators that end up in joined effects, need to disappear from the generators in the forked completions from which they have been extracted. Also, they need to be applied to the generator containing the timeline in which the fork occurs, before the fork occurs.
With some luck, this may fix a lot of issues.
Pull Request resolved: https://github.com/facebook/prepack/pull/2274
Differential Revision: D8878320
Pulled By: hermanventer
fbshipit-source-id: a6cd41bf9e82bc4e362bda32a1e32c5fc90298cf
Summary:
Fixes#1867 and fixes#2058 which are issues blocking the React compiler.
Test case from #1867 copied below:
```js
(function() {
function fn(arg) {
if (arg.foo) {
if (arg.bar) {
return 42;
}
}
}
if (global.__optimize) {
__optimize(fn);
}
global.inspect = function() {
return JSON.stringify([
fn(null),
fn({}),
fn({foo: true}),
]);
};
})();
```
The fix is almost entirely in `joinOrForkResults` where I remove the call to `updatePossiblyNormalCompletionWithConditionalSimpleNormalCompletion` and replace it with a new `PossiblyNormalCompletion`. Here’s my understanding of the issue and the previous strategy. Hopefully hermanventer can correct me if I’m wrong or explain why it needs to be the way it was.
In our program above when we are joining the `arg.foo` consequent with its alternate we have the following completion for the `arg.foo` consequent:
- `PossiblyNormalCompletion` (join condition is `arg.bar`)
- `ReturnCompletion(42)` (value of `42`)
- `SimpleNormalCompletion(empty)` (there is no `else`)
We are joining this with an alternate of `SimpleNormalCompletion` since there is no `else` on the `arg.foo` if-statement. Before we would try and “sneak into” the two branches and add an abstract conditional to the result. However, the implementation was limited so we we only updated `SimpleNormalCompletion`. This meant we ended up changing our above completion to:
- `PossiblyNormalCompletion` (join condition is `arg.bar`)
- `ReturnCompletion(42)`
- `SimpleNormalCompletion(arg.foo ? empty : empty)`
The only change being the second `SimpleNormalCompletion` is now `arg.foo ? empty : empty`. This would serialize into roughly:
```js
function f() {
return _$1 ? 42 : undefined;
}
```
Where `_$1` is not declared! Since we were serializing a `PossiblyNormalCompletion` with a join condition of `arg.bar` and the `arg.foo ? empty : empty` abstract conditional simplified to just `empty` which means we never emit `arg.foo` so never emit `arg.bar` which has a dependency on `arg.foo`.
My strategy was to nest the `PossiblyNormalCompletion` in another `PossiblyNormalCompletion`. So the final completion for the code sample at the top of this PR is:
- `PossiblyNormalCompletion` (join condition is `arg.foo`)
- consequent: `PossiblyNormalCompletion` (join condition is `arg.bar`)
- consequent: `ReturnCompletion(42)`
- alternate: `SimpleNormalCompletion(empty)`
- alternate: `SimpleNormalCompletion(empty)`
I’m confused as to why this was not done in the first place and instead an update strategy was used.
I then wrote a test (now in `test/serializer/optimized-functions/NestedConditions.js`) to enumerate a bunch of nested conditional cases. The rest of the fixes come from there. Notably the refactor of `replacePossiblyNormalCompletionWithForkedAbruptCompletion` which did not produce the same output when `consequent` and `alternate` were flipped.
Pull Request resolved: https://github.com/facebook/prepack/pull/2255
Differential Revision: D8865130
Pulled By: calebmer
fbshipit-source-id: 4964acc11b6403b9956cf29decefb1971340516d
Summary:
Release notes: none
When we check to do the temporal `Object.assign` merge optimization, we should properly account for any "prefix" args that occur before "to" and the "suffix" args. Test case added that came up in testing.
Pull Request resolved: https://github.com/facebook/prepack/pull/2261
Differential Revision: D8874714
Pulled By: trueadm
fbshipit-source-id: 59869f556c1300424c5a1b59d3df1fdd139b41fe
Summary:
Release note: none
This fixes a problem reported as a comment in PR #2258.
The underlying problem was that Realm.evaluateForEffects would just append the normal effects, captured since the last non complete join, into the saved partially normal completion that becomes the result of the returned Effects. This is not quite right because applying the resulting Effects should restore the complete set of normal effects that were in force when evaluateForEffects completed.
Pull Request resolved: https://github.com/facebook/prepack/pull/2271
Differential Revision: D8870763
Pulled By: hermanventer
fbshipit-source-id: 027924f2b250174393c60d90c2feefdb5a55eec3
Summary:
Release note: none
The main part of this PR is to ensure that completions and the effects they complete are always 1-1.
Along the way some bugs got fixed#2241.
This also includes a little side project: limiting the console spew when doing "yarn test-serializer --fast", which is something I do all the time and I'm much happier this way.
Pull Request resolved: https://github.com/facebook/prepack/pull/2258
Differential Revision: D8864448
Pulled By: hermanventer
fbshipit-source-id: a7f257a7e07211ecd6069b84330aa3305609c5d2
Summary:
Since I'm adding a new experiment I figured I'd delete an equivalent sized one.
Last year I added an option that runs the Prepack program by invoking Node.js JS runtime which lets us prepack the whole module system and initialization. It's essentially a packager with perfect Node.js module resolution semantics. It did this by modeling Node's native environment as Prepack bindings.
This PR removes that whole option.
There's a few reasons why I don't think that worked out as a good idea.
- It's not solving a real need. It is hard to keep different module systems in tact. There is always something in the ecosystem that breaks down and using the canonical one solves that. However, in practice, if there is a need for bundling the ecosystem itself adapts to the toolchain. So it's not actually that hard to bundle up a CLI even with Webpack, even if it's strictly not 100% compatible, by tweaking a few downstream depenencies.
- Running the resulting bundle is tricky. The resulting bundle includes the JS parts of Node. This overlaps with what Node.js adds at runtime so it runs it twice. The ideal is actually to build a custom distribution of Node.js but this is generally overkill for what people want.
- Bindings change a lot. While Node.js's API notoriously doesn't change much. The internals do change a lot. By picking the API boundary in the middle of the internals of Node.js, it risks changing with any version. While technically observable changes, nobody else relies on these details. If this option was worth its weight, someone could probably maintain it but so far that has not been the case so we had to disable this option in CI to upgrade Node.
However, going forward I think there are alternative approaches we can explore.
- First class module system. This is something we really need at some point. A first class module system would be able to load Node.js module files from disk and package them up while excluding others. It doesn't have to be literally Node.js's module system. Close enough is ok. Especially as standards compliant ECMAScript modules get more popular. This lets us target compiling output that runs after Node's initialization.
- By introducing havocing and membranes in the boundaries, it becomes possible to initialize Node.js modules without actually knowing the internal of the boundaries.
- We've started optimizing residual functions which is much more interesting. However, this requires that code puts some constraints on how it works with its environment. It's not designed to be fully backwards compatible. That's probably a good thing but that also means that we can put constraints on the modules being Prepacked.
This removes the ability to prepack Prepack itself which is unfortunate but already wasn't being tested. To speed up Prepack itself, the [LLVM backend](https://github.com/facebook/prepack/pull/2264) seems much more useful if it can ever work on Prepack itself.
Pull Request resolved: https://github.com/facebook/prepack/pull/2267
Differential Revision: D8863788
Pulled By: sebmarkbage
fbshipit-source-id: d777ec9a95c8523b3386cfad553d9f691ec59074
Summary:
This fixes an issue where get on abstract top val didn't consider Receiver.
This also illustrates two common patterns of getters that are not pure. One is reading a mutable property known by Prepack and one is lazily initializing a shared mutable property.
I believe we'll want to continue supporting these patterns since they almost always work anyway. Note that supporting these don't add much negative consequence. We can still eliminate unused getters. Most of the time these patterns doesn't happen where the prototype is unknown or havoced.
Usually the getter is abstract because the Receiver itself is unknown or havoced (not its prototype). So havocing even more doesn't have any further negative downside.
Pull Request resolved: https://github.com/facebook/prepack/pull/2257
Differential Revision: D8862827
Pulled By: sebmarkbage
fbshipit-source-id: 7e6e98f8b85b6fceaa5131136cc6163d94f5d289
Summary:
Release note: fix test262 to fail CircleCI test if not enough tests pass
The check for the number of tests that pass returned 1 to its caller, who just ignored it and then returned 0. Instead of that, now just call process.exit(1) when the check fails.
Also updated the expected number of ES6 tests that pass. It appears that updating Babel had a positive effect on those. Possibly it also causes one more ES5 test to fail when running locally (but not on Circle). That might be because of an ES5 test that now times out and an ES6 test that now does not. I have not investigated this as it seems of little importance right now.
Pull Request resolved: https://github.com/facebook/prepack/pull/2263
Reviewed By: trueadm
Differential Revision: D8859210
Pulled By: hermanventer
fbshipit-source-id: 724dcde05927cc914f6f9517f14dc230b8b0ad2e
Summary:
Release notes: upgrades Prepack to use Babel 7.0.0-beta.53
This is a big PR that updates all of Prepack to Babel 7. Babylon is now `babel/parser` and pretty much all of the the previous Babel packages are now located in scoped packages. I had to make a bunch of changes around Jest/Flow/Webpack to get this all working. The build times of building Prepack itself seem considerably faster (easily twice as fast locally). I followed most of the Babel 6 -> 7 upgrade guide from the Babel site in terms of changing nodes and type definitions to match the new ones.
Pull Request resolved: https://github.com/facebook/prepack/pull/2256
Differential Revision: D8850583
Pulled By: trueadm
fbshipit-source-id: 2d2aaec25c6a1ccd1ec0c08c5e7e2a71f78ac2d8
Summary:
I generated the following program (now added to test cases) and while I would expect its evaluation in Prepack to terminate reasonably quickly, I did not see the program terminate after five minutes of execution:
https://gist.github.com/calebmer/2bf1d84a5b7849fa732bce69811df10b
After this change that same program’s Prepack evaluation terminates in about two seconds. This change also saves about 2.8s on the evaluation of our internal bundle which is about 3% of the total time.
What was happening? Why did my program fail to terminate execution in five minutes? Why was the internal bundle relatively ok compared to my extreme case?
In my program, I would [expect the component `Mu`](https://gist.github.com/calebmer/2bf1d84a5b7849fa732bce69811df10b#file-program-js-L289-L291) to be inlined about 60 times. Which means there should only be about 60 calls to `ReactElementSet#add` for each of `Mu`’s `div`s. However, after some basic instrumentation I observed way over ten thousand visits to these React elements.
This pair of method calls happens a couple times in `ReactEquivalenceSet` and friends.
5f7256f17e/src/react/ReactEquivalenceSet.js (L233-L234)
Both `getEquivalentPropertyValue`…
5f7256f17e/src/react/ReactEquivalenceSet.js (L255)
…and `getValue`…
5f7256f17e/src/react/ReactEquivalenceSet.js (L104)
…end up calling `ReactElementSet#add` with the same React element. Then `ReactElementSet#add` ends up recursing into children. So the root element is added 2 times, so the root’s children are added 4 times each, so each child of those elements are added 8 times each, and so on. So if a leaf element is `n` deep in the tree it will be added `2^n` times. The most nested `Mu` child was 9 elements deep. `Mu` appeared 60 times at many levels of nesting.
I’m not entirely sure why my generated case was so much worse then our internal bundle. My two best guesses are: lots of repeated components or deeper nesting?
My fix was to move the `getValue` call into `getEquivalentPropertyValue`. This way if `getEquivalentPropertyValue` already finds an equivalent value we can short-circuit and not run `getValue` which will perform the same operation.
Pull Request resolved: https://github.com/facebook/prepack/pull/2243
Reviewed By: trueadm
Differential Revision: D8811463
Pulled By: calebmer
fbshipit-source-id: 4f30a75e96c6592456f5b21ee9c2ee3e40b56d81
Summary:
Release notes: none
The previous way we deal with side-effect callbacks was confusing and hard to understand. This PR now introduces a Set to store callbacks in and the old logic has been removed.
Pull Request resolved: https://github.com/facebook/prepack/pull/2254
Differential Revision: D8840154
Pulled By: trueadm
fbshipit-source-id: ce5b03f186414285d5ca6d2d0c2c385f3c56f981
Summary:
Release note: none
When joining a SimpleNormalCompletion with a PossiblyNormalCompletion, do not move the join condition to a leaf position.
Pull Request resolved: https://github.com/facebook/prepack/pull/2250
Differential Revision: D8838821
Pulled By: hermanventer
fbshipit-source-id: 6e102307af31e2ff2f3fbc7ec7f5ad516df5f7a5
Summary:
stop abstract loops from getting stuck in infinite loops when body contains a return, throw or break completion
Object.assign should no longer lose values when snapshotting in certain cases
Allow __optimize to work in conditional contexts
Move abstract Object.assign temporals into a helper function
new color scheme for the website
Add ability to rewrite generated code via global.__output
adds an optimization to Object.assign that attempts to merge calls together where possible
Added --expectedCounts parameter to test262-runner so that success can depend on the value of the time-out and the version of the test suite that is used.
Updated the test262 submodule to latest version
Reviewed By: cblappert
Differential Revision: D8837068
fbshipit-source-id: 218879046dbb0e307cbf3a13ba9a66d11e99a3f0
Summary:
Release notes: stop abstract loops from getting stuck in infinite loops when body contains a return, throw or break completion
Fixes https://github.com/facebook/prepack/issues/2053. This PR adds logic to "for loops" where they might get stuck in an infinite loop when there is no incrementor but there is a return, throw or break completion in the loop body. We check this via a new function `andfailIfContainsBreakOrReturnOrThrowCompletion` and only do this after `100` iterations of evaluating the loop body. I was thinking of making the iteration count configurable but wanted feedback on the approach first. I tried `1000` iterations, but it actually ended up taking about 2 minutes to evaluate the test case :/
Pull Request resolved: https://github.com/facebook/prepack/pull/2247
Differential Revision: D8827425
Pulled By: trueadm
fbshipit-source-id: d05f539e2c8a6dce15b7f23c1b76e89087437738
Summary:
Release notes: Object.assign should no longer lose values when snapshotting in certain cases
Fixes https://github.com/facebook/prepack/issues/2240. This PR does a few things:
- Improves the value of Object.assign when snapshots are involved. Previously, the `removeProperties` property passed to `getSnapshot` was being called in all cases, now it only does it when it makes sense – i.e. the next "source" is partial. I've explained this in comments and broken this logic out into its own function.
- Removed the duplicate Object.assign logic for `react/utils`, we no longer need this as the fallback route never gets triggered anymore and it's just dead code.
- Updated the dead code tests with assertions to ensure we check the $ variable matches the Object.assign and also updated a few tests that were affected by this PR (as the Object.assign variable changed).
Pull Request resolved: https://github.com/facebook/prepack/pull/2246
Differential Revision: D8827443
Pulled By: trueadm
fbshipit-source-id: ec600baf7d08916b6c62f0aeaa09d739fba4415b
Summary:
Release note: none
I'm trying to move from a world where we pass arounds effects and completions separately to a world where only completions are passed around. To get there, we need to get a one to one correspondence between completions and the effects that they complete. This is not currently the case and getting there seems to be quite a bit of work.
To make things more reviewable, I'm breaking out the first part of that. Hence, the todos in the code.
This bit only sets up Effects to always make itself be the value of the effects property of its completion (result). Because of existing cases where a single completion can complete several Effects objects, there is an exemption for such cases, along with todos.
Pull Request resolved: https://github.com/facebook/prepack/pull/2244
Differential Revision: D8825625
Pulled By: hermanventer
fbshipit-source-id: 7fb835d68e806ffd96845983f4d3db6837d1ad5a
Summary:
Release note: none
This just removes code that became redundant because of earlier PRs. To put it another way: ErasedAbruptCompletion is now gone!!!
Pull Request resolved: https://github.com/facebook/prepack/pull/2237
Differential Revision: D8811164
Pulled By: hermanventer
fbshipit-source-id: c7ca973f5ab6f3f7b5d4d78f70e2a3590cbe52e6
Summary:
This lets the simplifier do it work and allows intermediate objects to be dead code eliminated.
If this looks good, I'll do $SetPartial and $Delete too.
Pull Request resolved: https://github.com/facebook/prepack/pull/2219
Differential Revision: D8809146
Pulled By: sebmarkbage
fbshipit-source-id: 9fbfa87f5079b60f234ce4c1b2c745ac72a6b2af
Summary:
Release note: none
I'd like to get rid of ErasedAbruptCompletion and restore the invariant that any subclass of AbruptCompletion is strictly abrupt. To do that, I need to relax some invariants in PossiblyNormalCompletion.
This is also a first step towards fixing the code for composing possibly normal completions correctly.
I've pulled this out into a relatively small PR to make reviewing easier. Hence, the remaining TODO in the code.
Even this smallish change results in some regression because previously different code paths were followed that allowed simplification to succeed that will now fail. Fixing that is too ambitious for this PR and will have to wait.
Pull Request resolved: https://github.com/facebook/prepack/pull/2230
Differential Revision: D8808922
Pulled By: hermanventer
fbshipit-source-id: 4afce5e27bc30290b2b237b40c1e92f8c22bd100
Summary:
This will fix CI on master. I forgot it's possible to land a change internally without it passing the CI checks.
Pull Request resolved: https://github.com/facebook/prepack/pull/2242
Differential Revision: D8801741
Pulled By: gaearon
fbshipit-source-id: 454fcb29e023a502557b67e0ed12a304c4e5fabc
Summary:
Release note: none
Resolves#2238
This is a quick fix for the above issue. The underlying cause is that we do not construct completions with effects, but rely on incremental updates in special situations, such as the constructor for ForkedAbruptCompletions.
I'll try to fix the underlying cause in a subsequent PR.
Pull Request resolved: https://github.com/facebook/prepack/pull/2239
Differential Revision: D8795886
Pulled By: hermanventer
fbshipit-source-id: 677f2481ae3d6463a73f36a7e7106afbd92b068e
Summary:
Release notes: None
Found and fixed some minor issues.
This fixes#2177.
Pull Request resolved: https://github.com/facebook/prepack/pull/2231
Differential Revision: D8789870
Pulled By: NTillmann
fbshipit-source-id: 4ea3de2cbac08dbf6538af344eade1c45d9b9afd
Summary:
…local state
The logic was already there for the React Compiler's invocations of evaluatePure, this PR just generalizes it a little to be used for optmized functions as well.
Additionally, adds the ability to check for compiler info/warning logs in test-runner + updates test-error-handler.
See #1589
Pull Request resolved: https://github.com/facebook/prepack/pull/2175
Differential Revision: D8786744
Pulled By: cblappert
fbshipit-source-id: 110a4732dd6bd129b4d91047c3c9a24f5249a5e9
Summary:
Release Notes: None
Before `__optimize` wouldn't work when called in a conditional context, now if `__optimize` is called in some conditional context, we extract the FunctionValue from the AbstractValue in the `__optimizedFunctions` map.
Also fixes a bug where __optimize would silently noop when given something other than an `ECMAScriptSourceFunctionValue` causing two tests to fail with `TypeError`. Issue #2213 is setup to track this.
Pull Request resolved: https://github.com/facebook/prepack/pull/2214
Differential Revision: D8785643
Pulled By: cblappert
fbshipit-source-id: 3db992d693dd431aa8a2c5e6eb7ad0a1ecb6b79e
Summary:
This will fail CI if we forgot to run `yarn prettier` before committing.
We do the same in React repo. It prevents committing stale files that later cause unexpected changes.
Pull Request resolved: https://github.com/facebook/prepack/pull/2212
Differential Revision: D8784406
Pulled By: gaearon
fbshipit-source-id: ca948b8e088be8886c8ba865f280ba8d72750f69
Summary:
Release notes: none
As per Nikolai's comment https://github.com/facebook/prepack/pull/2206#discussion_r201142434, this PR moves the creation of the `Object.assign` abstract temporals into their own static abstract value creation method `AbstractValue.createTemporalObjectAssign`.
Pull Request resolved: https://github.com/facebook/prepack/pull/2232
Differential Revision: D8782639
Pulled By: trueadm
fbshipit-source-id: 9a41a66d5b7e41982de96684e627ef5e103cc638
Summary:
Release notes: None
It used to be a case that the Generator constructor simply
harvested whatever was currently set in the realm as the current
path condition.
This makes it explicit, and fixes some places where likely the wrong
path condition was picked up. At least one place caused an issue in
InstantRender that is now fixed (but I couldn't extract a small repro).
Leaving behind a number of `TODO #2222`s in the code to review once more.
Pull Request resolved: https://github.com/facebook/prepack/pull/2224
Differential Revision: D8779258
Pulled By: NTillmann
fbshipit-source-id: a0f3dea4b03eaa71b12943f813eb7fc440d29fca
Summary:
Release notes: Add ability to rewrite generated code via global.__output
When a special global variable __output is set to an object,
then all global generator entries are forgotten
and replaced by a series of assignments to reflecting the key-value
pairs of the __output object.
This is needed for instant render to emit single render functions only.
Pull Request resolved: https://github.com/facebook/prepack/pull/2218
Differential Revision: D8778269
Pulled By: NTillmann
fbshipit-source-id: 1dbc5ddd68aa5fd7845da8a7f551c8c7ba2b8919