Commit Graph

1596 Commits

Author SHA1 Message Date
Dominic Gannaway
5beedbe85b
Update README.md
Update README to remove part where we plan on working again on Prepack in a few months, as this wasn't and is no longer the case.
2021-01-21 17:51:21 +00:00
Andres Suarez
98d33f9f5e Text lint all .gitignore files
Reviewed By: scottrice, pallotron

Differential Revision: D15353820

fbshipit-source-id: 74f9eaadc90363a958692259f5cb66cef91ac8ef
2019-05-15 11:36:48 -07:00
Adrian Zgorzalek
1b39b402e1 Upgrade prettier to 1.17.0
Summary:
Run `js1 upgrade prettier 1.17.0` and `xplat/js/scripts/update-oss-yarn-lockfile.sh` and `hg revert -r .^ xplat/js/rome`

allow-large-files

Reviewed By: zackargyle, pvdz

Differential Revision: D15164375

fbshipit-source-id: 2fe68733dfa93ea64a67d170ba2f80c5af086917
2019-05-07 14:33:51 -07:00
Andres Suarez
c22a637aa1 Remove flow-bin dep and pin flowconfig version to 0.83.0
Reviewed By: scottrice

Differential Revision: D14565357

fbshipit-source-id: 08385bcd5fab9a89409526b3c10f8e22f77b81b7
2019-03-22 09:24:18 -07:00
Peter van der Zee
e8475936ec Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
2019-03-14 08:31:22 -07:00
Tiago Tristao
93d82b55a6 Merge adjacent JOIN_GENERATORS with the same path conditions (#2623)
Summary:
Release notes: Adjacent JOIN_GENERATORS with same path conditions are now merged for optimization.

This pull request attempts to tackle https://github.com/facebook/prepack/issues/2565. Some assumptions were made (for lack of certainty) but commented on for further improvement.
Pull Request resolved: https://github.com/facebook/prepack/pull/2623

Differential Revision: D13864274

Pulled By: NTillmann

fbshipit-source-id: 50f965f4fc3e906d78af9a610b487b2854b085b2
2019-01-29 15:22:19 -08:00
Daniel Sainati
011e69c153 remove deprecated utilities
Summary: Remove `$Subtype` and `$Supertype` utilities. Replacement was done on a best-effort basis. In many cases it sufficed to replace `$Supertype<T>` and `$Subtype<T>` with `T`, but when this was not possible `any | T` and `any & T` were used instead.

Reviewed By: jbrown215

Differential Revision: D13624765

fbshipit-source-id: 82ee9d43cfc318ed4bd2d84e0f4c5c1d8f488a9c
2019-01-15 14:06:03 -08:00
Nikolai Tillmann
deda70726d Update README to reflect current project status.
Summary: Pull Request resolved: https://github.com/facebook/prepack/pull/2621

Differential Revision: D13553330

Pulled By: NTillmann

fbshipit-source-id: 71b66a97f9243ecfa68fc108cb3243d8cd5200f4
2018-12-27 11:07:50 -08:00
Jean Lauliac
b96c110952 metro-buck: only uses object to store modules
Summary: MobileLab seems to point out that just using an object yields the same performance, but smaller memory usage: https://our.intern.facebook.com/intern/fblearner/details/89442096/. Plus, it simplifies the code.

Reviewed By: fromcelticpark

Differential Revision: D13450992

fbshipit-source-id: 87afccfbebdc533801f52cff367cf517611b4317
2018-12-18 05:02:09 -08:00
Henrik Nilsson
3ceb537dca Fix typo
Summary: Pull Request resolved: https://github.com/facebook/prepack/pull/2618

Differential Revision: D13025895

Pulled By: NTillmann

fbshipit-source-id: 5bb64de1599d24826bea7fc7f100f74b0fecf64d
2018-11-12 10:06:49 -08:00
Chris Blappert
3929e795ff Fix Prepack Model
Reviewed By: dcaspi

Differential Revision: D10368705

fbshipit-source-id: 4024174232fc79f24771e1a7da76793efc64265e
2018-11-06 22:22:19 -08:00
Chris Blappert
217868ba09 Test cases of resolved issues (#2614)
Summary:
Release Notes: None

Went through optimized functions issues looking for ones that have already been resolved and not closed. These were the only ones I found that didn't have a corresponding PR adding a test case linked from the issue.
Pull Request resolved: https://github.com/facebook/prepack/pull/2614

Differential Revision: D10516188

Pulled By: cblappert

fbshipit-source-id: aaf23d3aa857cc495b804fb1e05c2cb4955fd85f
2018-10-23 14:39:08 -07:00
Chris Blappert
683bb2a280 Bump flow version (#2615)
Summary:
Release Notes: None

Bump flow version to the most recent. Surprisingly, no flow errors.
Pull Request resolved: https://github.com/facebook/prepack/pull/2615

Reviewed By: hermanventer

Differential Revision: D10512118

Pulled By: cblappert

fbshipit-source-id: 6f5a8555dc7ea46d86bd0411fc03d5a0dac5a5f2
2018-10-23 12:08:16 -07:00
Chris Blappert
a78cf01589 Update React Native Model
Summary:
Release Notes: None

Fix some model issues for Prepack.

Reviewed By: NTillmann

Differential Revision: D10205606

fbshipit-source-id: d99a10c3dc9d0c5fcf3650a359e6c17f01204bef
2018-10-22 17:38:04 -07:00
Sapan Bhatia
d6da6bf8ab Split mechanism and policy in the leaking visitor (#2594)
Summary:
The leaking, havocing, materialization and alias tracking implementation consists of two parts. The first part helps compute values reachable from other values with various constraints. The second part is the one that actually uses these reachable values and performs the action needed. This PR splits the first (mechanism) part from the second (policy) part.

Reachability can be used by invoking the following function:

```js
computeReachableObjectsAndBindings(
    realm: Realm,
    rootValue: Value,
    filterValue: Value => boolean,
    readOnly?: boolean
  ): [Set<ObjectValue>, Set<Binding>]
```
...to compute all possible values that `rootValue` could evaluate to. It returns a tuple consisting of a set of reachable objects and a set of reachable bindings.

`filterValue` limits the values that we traverse. For leaking, `filterValue` checks that a value has not already been leaked (since interactions with leaked values cause leaking), if a value is certainly not an object, if it is frozen, in scope etc. You could use this to find particular types of reachable objects.

If the `readOnly` flag is set, then only read bindings are returned.
Pull Request resolved: https://github.com/facebook/prepack/pull/2594

Differential Revision: D10488695

Pulled By: sb98052

fbshipit-source-id: c8f0a63148f4cccd6434ebe07bebfb38dcd5cf08
2018-10-22 13:41:32 -07:00
Sapan Bhatia
f309cf0049 Optionally remove module factory functions (#2605)
Summary:
Re-submission of #2602, with a bug fix for speculatively executed modules.

The bad import is fixed, and guarded by #2604, which correctly flagged this PR.

```
/home/circleci/project/src/utils/modules.js
  44:1  error  '../../lib/values/ECMAScriptSourceFunctionValue.js' import is restricted from being used by a pattern  no-restricted-imports

✖ 1 problem (1 error, 0 warnings)
```
Pull Request resolved: https://github.com/facebook/prepack/pull/2605

Differential Revision: D10446661

Pulled By: sb98052

fbshipit-source-id: fcd635e2c9637211f843fd7c3098673a112399bd
2018-10-22 10:40:15 -07:00
Sapan Bhatia
f97ccf38d5 Lint rule to prevent imports of modules from lib/* (#2604)
Summary:
Adds a lint rule that rejects imports such as the following:

```js
import ECMAScriptSourceFunctionValue from "../../lib/values/ECMAScriptSourceFunctionValue.js";
```

The path should contain `src` instead of `lib`.
Pull Request resolved: https://github.com/facebook/prepack/pull/2604

Differential Revision: D10432286

Pulled By: sb98052

fbshipit-source-id: 55542de99643a7bf49f8a290a35af35f9b795c7b
2018-10-17 12:56:12 -07:00
Yujie Liu
7207bfd361 Revert D10402515: [prepack][PR] Optionally remove optimized module factory functions
Differential Revision:
D10402515

Original commit changeset: 7ad3a84a754e

fbshipit-source-id: 13d503fd79508f9c0ad0d8825f085ec6803a9429
2018-10-16 13:47:36 -07:00
Sapan Bhatia
2954b937be Optionally remove optimized module factory functions (#2602)
Summary:
When module factory functions optimized by Prepack are reachable from the global code, they are residualized, even though there is an implicit contract that they will not be used. This PR implements an option to remove them. This is a short-term fix, and may be refined in the future and generalized to be more flexible.

Test cases coming up.
Pull Request resolved: https://github.com/facebook/prepack/pull/2602

Differential Revision: D10402515

Pulled By: sb98052

fbshipit-source-id: 7ad3a84a754e4347774e0e95df197c2348f9d332
2018-10-16 08:08:31 -07:00
Dominic Gannaway
06736f0df5 Rearchitect evaluatePure and side-effect tracking (#2587)
Summary:
Release notes: the side-effect detection system within pure scopes has been improved

This PR revamps the entire `evaluatePure` system. The old system had so many small issues with it was the cause of many edge-cases that were hard to patch up. Specifically, the PR makes the following changes:

- `realm.evaluatePure` -> `realm.evaluateWithPureScope` and now can only be used a single instance. Nesting further `realm.evaluateWithPureScope` calls will trigger an invariant and is strictly forbidden. Furthermore, it now only takes a single argument – the function you're wrapped around.
- All places that used pure scope wrappers have been updated to conditionally enable it depending if the `realm.isInPureScope()` returns `true` or `false`.
- `realm.evaluateFunctionForPureEffects` has been added, this works like `evaluateForEffects` except it requires a root function and a callback for side-effects. The callback for side-effects works like the old callback that was `evaluatePure`.
- `realm.evaluateFunctionForPureEffectsInGlobalEnv` has been added a convenience wrapper around `realm.evaluateFunctionForPureEffects`.
- When we leak bindings, we no longer set their value to `undefined` or `realm.intrinsics.undefined`. We now set the value to a special "leaked abstract", specifically – `realm.intrinsics.__leakedValue` – like `topValue` and `bottomValue`.

Unsurprisingly, this now fixes a host of bugs that existed before. Including fixes for https://github.com/facebook/prepack/issues/2598, https://github.com/facebook/prepack/issues/2579, https://github.com/facebook/prepack/issues/2446, https://github.com/facebook/prepack/issues/2599 and probably many other issues too.

The logic for detection of side-effects works very differently from before but after speaking to sebmarkbage last week, he pointed me in this direction to track side-effects rather than how we did it before. We now find side-effects from a given set of effects, rather than in an ad-hoc manor as mutations occur on objects/bindings. This PR requires https://github.com/facebook/prepack/pull/2596 as a dependency as it re-uses the logic.

Closes https://github.com/facebook/prepack/pull/2587. Fixes https://github.com/facebook/prepack/issues/2598. Fixes https://github.com/facebook/prepack/issues/2579. Fixes https://github.com/facebook/prepack/issues/2446. Fixes https://github.com/facebook/prepack/issues/2599.
Pull Request resolved: https://github.com/facebook/prepack/pull/2600

Differential Revision: D10368159

Pulled By: trueadm

fbshipit-source-id: ded248f5cfd8648913cae9b9c697d723a82c59ab
2018-10-12 15:45:50 -07:00
Dominic Gannaway
608b6529c4 Fix for ReactElement temporals in React branches (#2597)
Summary:
Release notes: none

This fixes a React reconciliation bug where lazy ReactElement temporals were not correctly being put into the correct branches. Previously, `wrapReactElementInBranchOrReturnValue` was only called on the "result" of an `applyBranchedLogicValue` where it should have been applied after each ReactElement creation given that `applyBranchedLogicValue` is recursive.
Pull Request resolved: https://github.com/facebook/prepack/pull/2597

Differential Revision: D10298262

Pulled By: trueadm

fbshipit-source-id: 4868ab7f2514734913a626e4e7e7e3259e4199b5
2018-10-10 06:54:57 -07:00
Dominic Gannaway
224ca4a0d0 Adds createdAbstracts Set to effects/realm for tracking (#2593)
Summary:
Release notes: adds `createdAbstracts` `Set` to both `Effects` and `Realm`.

For a feature I'm working on, where we can optionally inline function calls depending on a bunch of pre-defined heuristics, I've run into the need for a feature for tracking abstract values. When we use `evaluateForEffects` we currently get quite a bit of information of what occurred, nicely packaged up in effects. One of those is `createdObjects`, which is super useful for many cases, but I believe we also need, is a way of knowing what `AbstractValue`s were created in effects too. This PR adds that functionality.
Pull Request resolved: https://github.com/facebook/prepack/pull/2593

Differential Revision: D10276125

Pulled By: trueadm

fbshipit-source-id: 299b0f91d93b1491987b10e769ca77f17e64716d
2018-10-09 15:38:37 -07:00
Chris Blappert
6347397ee2 Allow speculative module intialization to take file (#2590)
Summary:
Release Notes: `--initializeMoreModules` can take a JSON file of module ids to initialize

Allows testing this in `test-internal` with a new `.modules` file.

Also fixes ReproPackageManager to not exit prepack if a file can't be found while zipping a repro.
Pull Request resolved: https://github.com/facebook/prepack/pull/2590

Differential Revision: D10208977

Pulled By: cblappert

fbshipit-source-id: 7a5620f16829c39f2d8f936c6beb8b66e7c102be
2018-10-09 13:12:46 -07:00
Nikolai Tillmann
b942cd9635 Making peephole optimization in _getPropertyAssignmentStatement aware of implied conditions (#2592)
Summary:
Release notes: None

Added regression test.
Pull Request resolved: https://github.com/facebook/prepack/pull/2592

Differential Revision: D10227678

Pulled By: NTillmann

fbshipit-source-id: abeedaa43ce688fa9cb4ea095b3d7180a545fba5
2018-10-05 17:25:56 -07:00
Nikolai Tillmann
5828c0a666 Disable generation of .bind() calls instead of wrapper functions (#2577)
Summary:
Release notes: None

Large internal benchmarks triggered a bug with this optimization.
Pull Request resolved: https://github.com/facebook/prepack/pull/2577

Differential Revision: D10226968

Pulled By: NTillmann

fbshipit-source-id: bc5c962f9e45913d0844ad12321a2ff68eb71d44
2018-10-05 16:56:45 -07:00
Sapan Bhatia
31697d5de0 Support optimized Array.filter and make filter-map compositions correct (#2582)
Summary:
Adds optimized operator support for `Array.filter`, and makes compositions in which `Array.filter` is called on a mapped array correct. Aliasing information kept in the mapped array is exposed to the `Array.filter` call, which collects it in the resulting array.

Resolves #2580
Pull Request resolved: https://github.com/facebook/prepack/pull/2582

Differential Revision: D10204091

Pulled By: sb98052

fbshipit-source-id: a365d3d7120cbae344c64c540e5b63a889b6c699
2018-10-04 14:19:03 -07:00
Dan Abramov
8ca388ab0e New weekly branch: 0.2.55-alpha.0
Summary: 0.2.55-alpha.0

Reviewed By: trueadm

Differential Revision: D10191871

fbshipit-source-id: 27fcfbc607c0f92761495c241ded23dd16e92476
2018-10-04 08:10:02 -07:00
Dan Abramov
8c92608360 Weekly release v0.2.54
Summary:
* Fix referentialization of optimized functions
* Fix serialization issues for nested optimized functions
* Model aliasing effects for array loop operators
* Fix dependency issues with cyclic prototype dependencies
* Fix problem where a bind call can use a variable before its definition
* Speed up visitor by skipping redundant generator scopes

Reviewed By: trueadm

Differential Revision: D10191866

fbshipit-source-id: 669d6c7a49f10f3222c3dd56537e0f76a4e9d2c6
2018-10-04 08:10:00 -07:00
Dominic Gannaway
1f5664ff15 Adds RCTActivityIndicatorView literal reference (#2588)
Summary:
Release notes: none

When testing our internal React Native bundle, we need to supply a string reference to `RCTActivityIndicatorView` for JSX elements.
Pull Request resolved: https://github.com/facebook/prepack/pull/2588

Differential Revision: D10193281

Pulled By: trueadm

fbshipit-source-id: ce7785d9c71ea4c278118e08c1438dbb5259f8b8
2018-10-04 06:39:47 -07:00
Chris Blappert
473470a9a5 Filter ModifiedBindings by environment's creating optimized function (#2551)
Summary:
Release Notes: None

Changes the logic for determining which ModifiedBindings need serialization to work properly in the face of nested optimized functions. We should only serialize `ModifiedBinding`s if their environment was not created by the optimized function or its children (i.e. the binding should not be local to the optimized function).

This also solves the issue that React components don't have a parent chain which is important for properly handling nested optimized functions. Solves #2550.

Solves #2430, Solves #2426, Solves #2423, Solves #2422 (some were solved by previous PRs, just adding the tests here as well).
Pull Request resolved: https://github.com/facebook/prepack/pull/2551

Differential Revision: D10010048

Pulled By: cblappert

fbshipit-source-id: 2a855017514832a70d024f1ae9a91e9f07736ce0
2018-10-03 11:25:04 -07:00
Dominic Gannaway
7f0c13a680 Fixes a bug in evaluatePure (#2585)
Summary:
Release notes: none

When working on a separate issue that involved touching `evaluatePure`, I ran into a bug where `createdObjectsTrackedForLeaks` were not being populated by any objects returned from nested `evalautePure` calls. This fixes it and adds a helper function to `__evaluatePureFunction ` for testing this.
Pull Request resolved: https://github.com/facebook/prepack/pull/2585

Differential Revision: D10162545

Pulled By: trueadm

fbshipit-source-id: a2fcdcf19545a036aa5fbd003ea0929722ab7bde
2018-10-03 07:39:42 -07:00
Sapan Bhatia
ffd230e4d5 Model aliasing effects for array loop operators (#2570)
Summary:
This PR guarantees the correctness of optimized `Array.map` operators, even in the face of aliasing effects. It does four things:

1. Trigger generic leaking if an array operator is re-specialized in the non-Instant Render use case.
2. Tracks aliasing effects created by specialized operators, and triggers leaking or materialization when needed to ensure correct behavior
3. Deactivates immediate transitive materialization following the use of specialized operators, instead deferring this to the leaking implementation. The leaking implementation reaches aliased objects via a new arg added to widened numeric arrays. The arg is an abstract value of kind "mayAliasSet" that is set to top, but whose may alias set is tracked. If leaking does not happen, then materialization is avoided.
4. It permits benign mutations in Instant Render, where the mutations do not cause references to non-final snapshots of the object.

Follow up:
- Model aliasing effects losslessly via widened objects: #2569
- Add support for `filter` and `reduce`

Resolves #2449
Pull Request resolved: https://github.com/facebook/prepack/pull/2570

Differential Revision: D10149117

Pulled By: sb98052

fbshipit-source-id: eb686982574c8ef868934472903c405f3d63bbed
2018-10-02 12:39:46 -07:00
Dominic Gannaway
4f250d11e1 Remove side-effects from react-mocks (#2584)
Summary:
Release notes: none

Some internal changes to the `react-mocks` where side-effects were observed in small cases that needed tweaking (only affects internal React testing).
Pull Request resolved: https://github.com/facebook/prepack/pull/2584

Differential Revision: D10147064

Pulled By: trueadm

fbshipit-source-id: bb4c196ae6f03abdc1c2e39b27b740a21989b61f
2018-10-02 11:11:17 -07:00
Dominic Gannaway
5fc6feeeb2 Unify logic for checking for intrinsic objects that have been derived (#2581)
Summary:
Release notes: none

This PR cleans up some of the `onArrayWithWidenedNumericProperty` logic, making it more generic for cases where we want to use concrete derived object values. Furthermore, it strengthens the validation process by checking for existence of `isScopedTemplate` on the internal object.
Pull Request resolved: https://github.com/facebook/prepack/pull/2581

Differential Revision: D10141954

Pulled By: trueadm

fbshipit-source-id: 8de828080b8a41357830cdbf7e49359512bc7244
2018-10-02 03:41:39 -07:00
Dominic Gannaway
ed784d6899 Add abstract support to Object.getOwnPropertySymbols (#2575)
Summary:
Release notes: none

Fixes https://github.com/facebook/prepack/issues/2574. This PR adds abstract value support to `Object.getOwnPropertySymbols` like we have done other internal methods (like `Object.keys` and `Array.from`) where we know the internal method creates an array with unknown numeric properties.
Pull Request resolved: https://github.com/facebook/prepack/pull/2575

Differential Revision: D10114237

Pulled By: trueadm

fbshipit-source-id: 07301147e2dff1ab370243a8dc9648745bbbbb96
2018-09-28 16:11:27 -07:00
Chris Blappert
0ef3c43563 Change initializeMoreModules to modulesToInitialize allowing you to s… (#2576)
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
2018-09-27 15:10:17 -07:00
Dominic Gannaway
47cb48b438 Adds support for abstract length arrays in React reconcilation and serialization (#2571)
Summary:
Release notes: none

This PR fixes issues with the React hoisting and equivalence system mechanics and serialization where previous, there was no support for abstract length arrays. This includes an optimization for when the React serializer outputs ReactElement children that are conditionals with one side being an empty value (in this case, we can use an empty string instead).

Tests attached that focus on the areas covered in this PR.
Pull Request resolved: https://github.com/facebook/prepack/pull/2571

Differential Revision: D10082133

Pulled By: trueadm

fbshipit-source-id: d7de1834e10a5c4b3f35a90b9676ec72c6e797e2
2018-09-27 00:50:24 -07:00
Sapan Bhatia
9681e2eeee Expand x==null using a disjunction (#2572)
Summary:
Fixes #2563, #2564
Pull Request resolved: https://github.com/facebook/prepack/pull/2572

Differential Revision: D10027955

Pulled By: sb98052

fbshipit-source-id: 4023e3c32362cb95f477d4d990dd9b8edb5a963c
2018-09-25 06:25:02 -07:00
Nikolai Tillmann
7f3b5d4caf Make sure all optimized functions are included in IR dumping (#2568)
Summary:
Release notes: None

Dumping happened before `processCollectedNestedOptimizedFunctions`,
which caused them to not be included. This is being fixed, plus some
minor refactoring to hide implementation details.
Pull Request resolved: https://github.com/facebook/prepack/pull/2568

Differential Revision: D10023363

Pulled By: NTillmann

fbshipit-source-id: 6abe2b5358f23705b501fc818536fb30d42a3b17
2018-09-24 19:33:51 -07:00
Dominic Gannaway
0e52d02190 Adds React pe-functional-components benchmark and some React SSR changes (#2560)
Summary:
Release notes: none

All these changes are only internal changes related to React.

This PR adds the `pe-functional-components` benchmark as tests to the React reconciler. The test was taken from: https://github.com/facebook/react/tree/master/scripts/bench/benchmarks/pe-functional-components.

In order to make the server side renderer test pass, a few TODOs had to be filled in (logic was missing) and the JSON logic has to be updated to account for empty strings in children that the compiler merges.
Pull Request resolved: https://github.com/facebook/prepack/pull/2560

Differential Revision: D10008375

Pulled By: trueadm

fbshipit-source-id: 3b39a3e6387e23e17532a2343bd84ebebb7ee9cd
2018-09-24 03:56:52 -07:00
Nikolai Tillmann
465b8defba Speeding up visitor by skipping redundant generator scopes (#2562)
Summary:
Release notes: None

There's no need to re-visit deep value chains in nested generators,
if a value was already visited in a parent generator.
This greatly speeds up certain internal RN scenarios.
Pull Request resolved: https://github.com/facebook/prepack/pull/2562

Differential Revision: D10001612

Pulled By: NTillmann

fbshipit-source-id: a4f66b1a4835121cef4e3bc424f507f5b2c843f9
2018-09-21 19:11:06 -07:00
Chris Blappert
d3ca583d46 Bump flow version (#2557)
Summary:
Release Notes: None

Bump flow version to newest version to stop Nuclide and `yarn flow` from fighting locally.
Pull Request resolved: https://github.com/facebook/prepack/pull/2557

Reviewed By: QueryConnectionException

Differential Revision: D9952840

Pulled By: cblappert

fbshipit-source-id: 2b52c04abd79a645b772c3a45d6ec81c831a27d3
2018-09-20 13:58:44 -07:00
Nikolai Tillmann
4b911f2138 Refactoring of Generator DAG to Generator Tree. (#2434)
Summary:
Release notes: None

To avoid all kinds of serialization issues, generators should form
a tree, and not a DAG. This is an attempt to establish that.
Pull Request resolved: https://github.com/facebook/prepack/pull/2434

Differential Revision: D9887684

Pulled By: NTillmann

fbshipit-source-id: c11c50c56dcd6eff02bd03448756bf79f6e2c820
2018-09-20 10:09:19 -07:00
Herman Venter
0dced15809 Fix problem where a bind call can use a variable before its definition (#2558)
Summary:
Release note: none

A large internal test case came up with a situation where an optimized function is rewritten with a version that early binds a yet to be declared value to one of its parameters.

This should probably never happen, so the if condition guarding this code path has been strengthened to prevent this.
Pull Request resolved: https://github.com/facebook/prepack/pull/2558

Reviewed By: trueadm

Differential Revision: D9967064

Pulled By: hermanventer

fbshipit-source-id: bf56872ea42ee8faefc347a6393cdcd9b3c518e9
2018-09-20 05:25:32 -07:00
Nikolai Tillmann
cd7cfb45c9 Fixing dependency issues with cyclic prototype dependencies. (#2556)
Summary:
Release notes: none

This fixes #2555.
We were waiting on the wrong thing in the serializer.
Adding regression tests.
Pull Request resolved: https://github.com/facebook/prepack/pull/2556

Differential Revision: D9949808

Pulled By: NTillmann

fbshipit-source-id: a4ef5ece8c5dab6fa579a20dbb35ce7bf794bfc0
2018-09-20 05:25:31 -07:00
Chris Blappert
feb0c2831f Attach Path Condition to Optimized Functions (#2537)
Summary:
Release Notes: None

Optimized functions will now be evaluated with the path condition at the time of function closure creation.

Resolves issue #2422
Pull Request resolved: https://github.com/facebook/prepack/pull/2537

Differential Revision: D9886282

Pulled By: cblappert

fbshipit-source-id: cae0282903d639ff0d94d0f4091c6f8ef9ef9a98
2018-09-19 18:11:38 -07:00
Chris Blappert
571dc330bb Fix referentialization of optimized functions (#2544)
Summary:
Release Notes: None

Before, during referentialization, we would always default to the global scope if the value was accessed in more than one optimized function scope. Now we look for the outermost optimized function.

This logic already existed in ResidualHeapSerializer, so I refactored it out into `serializer/utils.js`.

Fixes #2428
Pull Request resolved: https://github.com/facebook/prepack/pull/2544

Differential Revision: D9926077

Pulled By: cblappert

fbshipit-source-id: c4ee6c07c7409534e9be14df25b582078a7ec77c
2018-09-19 18:11:37 -07:00
Chris Blappert
48802fc106 New Prepack Alpha
Summary: New Prepack alpha v0.2.54-alpha.0

Reviewed By: gaearon

Differential Revision: D9927381

fbshipit-source-id: 7028459c6eafc38420579b8f656bed582a0a3dde
2018-09-19 17:04:39 -07:00
Chris Blappert
df84eff5bb New Prepack Version v0.2.53
Summary:
New Prepack version:
- Bugfixes
- User-level stack overflows no longer crash prepack
- Website shows warnings when Prepack produces diagnostics

Reviewed By: gaearon

Differential Revision: D9927380

fbshipit-source-id: 519d7f04b65228ba78d2febc5309492ff8315a4e
2018-09-19 17:04:36 -07:00
Sapan Bhatia
827146302a Helper to inspect values at a particular AST node (#2554)
Summary:
This is a helper for inspecting values at a particular node in the AST. E.g.

```js

let n = global.__abstract ? __abstract("number", "10") : 10;
let x = {foo:1};
let y = {foo:2};
let c = __abstract("boolean", "c");

let i = 0;
let obj = {};
do {
  i++;
  obj.j = i;
  obj.foo = c ? x : y;
} while (i < n);

__debugValue(obj);        // Breaks with obj in context

inspect = function() {
  return i + " " + obj.j;
};
```
Pull Request resolved: https://github.com/facebook/prepack/pull/2554

Differential Revision: D9922908

Pulled By: sb98052

fbshipit-source-id: dab9cae64a461283d8dec7f0bb7f8fae87a01c78
2018-09-18 13:55:33 -07:00