Summary:
…pecify modules
Release Notes: None
Sometimes it'll be useful to allow the user to specify which specific modules you want to speculatively execute. This allows that by turning `--initializeMoreModules` into `--modulesToInitialize <ALL | comma separated list of modules>`
Updated tests as well.
Pull Request resolved: https://github.com/facebook/prepack/pull/2576
Differential Revision: D10092554
Pulled By: cblappert
fbshipit-source-id: bf601e14c2be59c865ae9513c914f39325521945
Summary:
Release note: Rewrote the joining logic to always do a full join at every join point
Closes#2151#2222#2279
I've spent a lot of time in the last few months trying to sort out problems that arise from effects being applied too many or too few times. Fixing these feel a bit like playing wack a mole and in the end no fix goes unpunished.
Stepping back a bit from the fray, it seems to me that the root cause of all this pain is the fact that joins of different kinds of completions get delayed.
Before we had path conditions and the simplifier this seemed like a rather good thing since exceptional paths did not contribute values to the normal paths and we thus had fewer abstract values to deal with and fewer places where Prepack would grind to a halt.
In the current state of things, however, it seems perfectly possible to join in all branches at every join point. I've had to decrease some limits, in particular the number of times we go around a loop with conditional exits. I've also had to make the test runner impose a limit on how many times the simplifier can invoke Path.implies.
Nevertheless, the tests seem to pass and hopefully this will also fix quite a lot of bugs that have been unresolved for many months already.
Pull Request resolved: https://github.com/facebook/prepack/pull/2402
Differential Revision: D9236263
Pulled By: hermanventer
fbshipit-source-id: 92a25b591591297afeba536429226c5a0291f451
Summary:
Resolves#2186. Embeds the value `__empty` in array and object literals for properties that are conditionally set, instead of handling such values via assignments and deletes. Raises an exception if there is a cycle in object or array creation (InstantRender does not support these).
Pull Request resolved: https://github.com/facebook/prepack/pull/2364
Differential Revision: D9169335
Pulled By: sb98052
fbshipit-source-id: f83d85677b30f10f3c548349e93ce792fc6c1ca0
Summary:
Release notes: Removing --abstractEffectsInAdditionalFunctions option
It is now the new default, as nothing seems to depend on the old behavior.
Closes https://github.com/facebook/prepack/pull/1623
Differential Revision: D7342083
Pulled By: NTillmann
fbshipit-source-id: c02d13bddd0ff3d8a113a6a5a83c1bf35c96ba4d
Summary:
Release notes: `__registerAdditionalFunction` is now `__optimize`
This PR renames `__registerAdditionalFunction` to `__optimize` and removes all tests that use the `// additional functions` logic in favor of declaratively using `__optimize`. Also the serializer option for `additionalFunctions` is removed too.
Closes https://github.com/facebook/prepack/pull/1561
Differential Revision: D7219751
Pulled By: trueadm
fbshipit-source-id: 7984496b3a68db3194fb3696839cb11fdd0b7843
Summary:
Release note: none
Abstract values from the global scope are not registered as additional roots, so the usual common ancestor logic fails in this case.
Also fix a bug in test-error-handler.js that allowed this regression to go undetected.
Closes https://github.com/facebook/prepack/pull/1511
Differential Revision: D7128652
Pulled By: hermanventer
fbshipit-source-id: 4317d50810dfdf0ce3b97e17a0c169e056389ca5
Summary:
Release note: fixes issue #1340
When the target platform is JSC, issue a compile time diagnostic if an argument is provided to the set constructor. Then proceed as if there were no argument, which is what JSC does at runtime.
Closes https://github.com/facebook/prepack/pull/1386
Differential Revision: D6863721
Pulled By: hermanventer
fbshipit-source-id: 9ee3af5e8028ea1657e0b39d31393036c66f744a
Summary:
This is a follow up to #1142. If we call an unknown function it might throw which will take a different control flow. #1264 is the follow up to do this properly but since we don't have a use case right now, we can just issue a recoverable error if this happens.
Closes https://github.com/facebook/prepack/pull/1284
Differential Revision: D6669732
Pulled By: sebmarkbage
fbshipit-source-id: 32ff40d4afba589ce60193b01034dfb8bc764378
Summary:
Release notes: Percentage output of passing tests (passed tests / total tests) should be rounded down instead of up.
From an example I encountered earlier, when we had number of tests passed = 1157 and total tests = 1159, we would display, "Passed: 1157/1159 100%". We should instead display "Passed: 1157/1159 99%"
Closes https://github.com/facebook/prepack/pull/1260
Reviewed By: hermanventer
Differential Revision: D6558323
Pulled By: jhalley
fbshipit-source-id: 01751bacb83760ae49a56a9ef56983fee94487d2
Summary:
Release note: Changed some erroneous console.log statements to console.error
This addresses issue https://github.com/facebook/prepack/issues/1201. Went through all uses of console.log in the codebase and converted them to console.error if that's what they're supposed to be.
Closes https://github.com/facebook/prepack/pull/1253
Reviewed By: hermanventer
Differential Revision: D6550963
Pulled By: jhalley
fbshipit-source-id: aec0f2f9a0e5745f563628b849fde110388b12cd
Summary:
Instead of delaying modules that throw conditionally, let the exception bubble up to the require call and then forget it (after emitting a warning). This allows more global state to be optimized and should be OK if it is understood that throwing an unhandled exception in module initialization code is not a supported scenario.
Probably, the temporal point where the require call happens should contain a conditional throw statement, which would be equivalent to current behavior. For now, this causes invariants to fire in the serializer, probably because of bugs in how the state at the time of the exception is restored and presented to the throw statement.
It is also an option to let the exception escape the require call itself and possibly bubble all the way to the top level. This would be more correct than the current behavior since it should match the runtime behavior of the unprepacked code. This too is currently buggy. It also a bit of performance concern because it uses much more saved state.
Closes https://github.com/facebook/prepack/pull/1104
Differential Revision: D6189032
Pulled By: hermanventer
fbshipit-source-id: 71c6352eddca4d88ae030fdcbfb76e7a39839e73
Summary:
Set up an evaluation environment before parsing since the parse helper expects to be able to turn syntax errors into runtime errors.
Catch such errors and report them via handleError when not running eval.
Fixes issue: #900
Closes https://github.com/facebook/prepack/pull/916
Differential Revision: D5689361
Pulled By: hermanventer
fbshipit-source-id: b43a5c6b30e3e93d9e8fb3cc746cbb11f7951bae
Summary:
By allowing prepack CLI to prepack multiple files, user can specify separate model file together with source file. Also, it can allow pre-bundled files to be prepacked together.
I also removed prepackString() API to prefer prepackSources() because they are almost identical logic while prepackSources() API supports multiple files.
Closes https://github.com/facebook/prepack/pull/865
Differential Revision: D5566968
Pulled By: yinghuitan
fbshipit-source-id: ce00087e444b5cdf34b5cfb6913062fc0ee440b7
Summary:
- Clean up options and create new `prepack-options.js` file
- Add `PartialEvaluatorOptions` type which contains only `sourceMaps`
- Fix test code related to above change
https://github.com/facebook/prepack/issues/841
Closes https://github.com/facebook/prepack/pull/878
Reviewed By: NTillmann
Differential Revision: D5605347
Pulled By: cblappert
fbshipit-source-id: 024284a9904dff765417c2c849c4642e781affb3
Summary:
Additional functions may be properties of global objects, so just parse the option string as an expression and evaluate it in the global environment.
Closes https://github.com/facebook/prepack/pull/858
Differential Revision: D5541434
Pulled By: hermanventer
fbshipit-source-id: b0b39f2b0ff072ebafeba3e33cd2cd1365dfd4b8
Summary:
If one additional function reads a property that is written by another additional function, it becomes potentially dependent on the other function running before it does. Additional functions are supposed to be independent of each other, so we now detect this and report errors.
Closes https://github.com/facebook/prepack/pull/850
Differential Revision: D5529672
Pulled By: hermanventer
fbshipit-source-id: f810d27d1fbf03d6538d70e61a1d9e7c0fe55309
Summary:
An instance of this class is a single diagnostic message, so the plural just seems wrong.
Closes https://github.com/facebook/prepack/pull/811
Differential Revision: D5420522
Pulled By: hermanventer
fbshipit-source-id: c848911a27d2c445ba98ee04988f5c4afe261dc1
Summary:
We usually need at least two files: 1) the environmental model and 2) the bundle to be Prepacked.
In general, there is no good reason to not allow as many files as the caller wants.
To make this not be a breaking chance, I've added a new API for this: prepackSources.
Further complications result from working around a bug in Babel and not increasing the module cycle length for Flow.
Closes https://github.com/facebook/prepack/pull/776
Differential Revision: D5366190
Pulled By: hermanventer
fbshipit-source-id: 74595b1b60e8e8a6d24cb974b5be10210d745266
Summary:
Except for the web site.
Also reorganized the API a bit and deprecated some calls.
Closes https://github.com/facebook/prepack/pull/763
Differential Revision: D5351215
Pulled By: hermanventer
fbshipit-source-id: c5da7f81138f7b0cb97d28da25c5e3fe8836ccb9
Summary:
Now give error messages for instanceof operators when the right operand is too abstract.
Closes https://github.com/facebook/prepack/pull/735
Differential Revision: D5281708
Pulled By: hermanventer
fbshipit-source-id: 78b848a46860ccbf67554fb25d235740df3ac06b
Summary:
Give a more detailed error when the in operation is not safe to do at Prepack time.
Closes https://github.com/facebook/prepack/pull/733
Differential Revision: D5281195
Pulled By: hermanventer
fbshipit-source-id: ea92b418cf6a836b2934ecca64ac1b3f3a0898d8
Added interface for reporting compilation/evaluation errors with relevant metadata
The new interface is used in a single location as a proof-of-concept
* Cleaning up the interface for handling recoverable errors
* more general recoverable error
* Addressed review comments
* Addressed review comments + added basic tests
* Address review comments #2
* Addressed CR comment about errorHandler in Options
* Fixing typo in import
* Address more review comments
* Fix linter errors
* Fix more linter errors
* Adjust test runners to run the new test