Commit Graph

1361 Commits

Author SHA1 Message Date
Dominic Gannaway
e78c69c28a Skip check on elementTypes in CreateListFromArrayLike if parameter is default
Summary:
Release notes: none

When we create an array with `CreateListFromArrayLike`, if the `elementTypes` parameter is left undefined, then skip the check that might throw an invariant if the passed in value is abstract.
Closes https://github.com/facebook/prepack/pull/1986

Differential Revision: D8071410

Pulled By: trueadm

fbshipit-source-id: f5944ecfc928fb9efe9120153e102faec9d5e2b6
2018-05-20 13:59:03 -07:00
Dominic Gannaway
4dda80e5be Add no-use-before-define to debug-fb-www script
Summary:
Release notes: none

This adds the `no-use-before-define` rule to `debug-fb-www` script. `variables` and `functions` are set to false, which allows them to be skipped if defined in a parent scope or if the function is in the same scope (as it gets hoisted), see: https://github.com/eslint/eslint/pull/7948/files. With our current internal bundle and latest master, this brings about a new error that wasn't previously emitted: `'_$Fg' was used before it was defined. (5525:15)`.  Fixes https://github.com/facebook/prepack/issues/1982
Closes https://github.com/facebook/prepack/pull/1984

Differential Revision: D8055274

Pulled By: trueadm

fbshipit-source-id: 93a672dd22bce8cd798ebbb7ed90536a847f9ecb
2018-05-18 02:16:46 -07:00
Herman Venter
21cb2b4da5 Avoid redundant conversions to object
Summary:
Release note: none

When debugging another issue, I noticed that member expressions do explicit conversions of abstract base objects to object and that call expressions obtain a temporal value for the function but then go ahead without it, leaving a useless assignment in the timeline.
Closes https://github.com/facebook/prepack/pull/1983

Reviewed By: trueadm

Differential Revision: D8055038

Pulled By: hermanventer

fbshipit-source-id: 4dd394bb0c4df2f9656be453b8feae57cc0db516
2018-05-18 01:19:22 -07:00
Dominic Gannaway
da243f5b48 Fix bug with arrays with widened numeric properties
Summary:
Release notes: none

This PR fixes a bug where prototype methods on unknown arrays with widened numeric properties were incorrectly being used instead of following the route to filter which methods were safe or not. The functionality and logic for this was pulled out, into its own function so it can be re-used in places and tidied up.
Closes https://github.com/facebook/prepack/pull/1981

Differential Revision: D8043347

Pulled By: trueadm

fbshipit-source-id: 05415e5bdcb85818681a72323df16711a89f7c5c
2018-05-17 14:22:26 -07:00
Herman Venter
529ea0d760 Don't rotate effects trees
Summary:
Release note: fix numerous problems with code ordering
Closes: #1914

We've been seeing an endless stream of bugs where code is either missing or in the wrong place. A lot of these were due to the complexity of joinEffectsAndPromoteNested and some more are due to a fundamental flaw in its algorithm: it rotates branches of the effects tree in order to group together all completions of a given type. That can cause generators to end up in the wrong place in the temporal sequence.

We also had a problem with generators being duplicated in the tree.

This pull request introduces a new algorithm for doing what joinEffectsAndPromoteNested does. This too is complicated and I spent days on debugging and fixing many subtle issues. So, for now, I'm only doing it for calls. More will come in later pull requests.

I am not super confident that I've found and addressed all subtle bugs. I think we can expect to run into quite a few more of those. I am, however, reasonably confident that we now have the right approach to dealing with abrupt control flow.

Please have a careful look, but let's get this landed as soon as possible because it is on the critical path.
Closes https://github.com/facebook/prepack/pull/1979

Differential Revision: D8044482

Pulled By: hermanventer

fbshipit-source-id: 317402c5601fdea7366c9daf7762af0217302b54
2018-05-17 11:45:18 -07:00
Dominic Gannaway
b9d43d5e7d Move React side-effect logic in to the ThrowCompletion
Summary:
Release notes: none

This moves the side-effect detection logic for React component renders into the ThrowCompletion itself.
Closes https://github.com/facebook/prepack/pull/1977

Differential Revision: D8031923

Pulled By: trueadm

fbshipit-source-id: 189a2c7b729276193344a926db8f5a747460a8da
2018-05-16 14:08:52 -07:00
Xun Li
1f02f31308 Fix issue #1841.
Summary:
When either name or msg of Error is abstract, we do not want to partially evaluate it because the checks on string emptiness can be overwhelming, and better done in the VM than in JS.
Added a test to check these cases.
(I messed up my previous pull request. Sending a new one here.)
Closes https://github.com/facebook/prepack/pull/1974

Differential Revision: D8028508

Pulled By: lxfind

fbshipit-source-id: 8e1d1f2151e0b08b519935387298d4ffcd579f9b
2018-05-16 11:56:50 -07:00
Tim Seckinger
5df51ac6f4 stop the prototype cycle check if an object uses non-ordinary prototype methods
Summary:
Release Notes: stop the prototype cycle check if an object (e.g. proxy) uses non-ordinary prototype methods

Fixes #1017
Closes https://github.com/facebook/prepack/pull/1976

Differential Revision: D8027102

Pulled By: NTillmann

fbshipit-source-id: 886e6ce474255dadf937662e30a65adbfac5a1f1
2018-05-16 11:06:51 -07:00
Dylan
9eefb43b42 Implement const/let pattern declarations (ES6 destructuring)
Summary:
This should resolve #415.

Relevant part of the spec here: https://www.ecma-international.org/ecma-262/6.0/#sec-let-and-const-declarations-runtime-semantics-evaluation

For `// 3. Let env be the running execution context’s LexicalEnvironment.`, I assumed that the `env` variable passed to the function already fulfills and it's not necessary to retrieve it here.

I've omitted the `ReturnIfAbrupt(Value)` steps from the spec, as this is also done for the rest of the implementation in this file.

test262 has one additional test pass as a result of this change, though somewhat surprisingly it's for `for`.
I've verified in the command line REPL that destructuring assignment works as expected in the basic case.
Closes https://github.com/facebook/prepack/pull/1967

Differential Revision: D8027013

Pulled By: NTillmann

fbshipit-source-id: 845527bcca55c845aca993fd2c97349efcbd5f59
2018-05-16 10:33:19 -07:00
Dominic Gannaway
f807a17b74 Further follow-up Array.from fixes
Summary:
Release notes: none

This is a follow up to the changes in https://github.com/facebook/prepack/pull/1926. This PR correctly fixes the derived values for waiting and ensures that the unknown array objects have their dependencies properly resolved. This fixes part of the issue in https://github.com/facebook/prepack/issues/1962, but it brought about another issue that this PR doesn't aim to solve – dependencies on an abstract function call's unbound/bound bindings.
Closes https://github.com/facebook/prepack/pull/1970

Differential Revision: D8024402

Pulled By: trueadm

fbshipit-source-id: b9f9e725b7b22241209ef5a6f3b29dc0f2eeddeb
2018-05-16 05:15:03 -07:00
Nikolai Tillmann
ea0624b108 Distribute conditionals in certain relational expressions
Summary:
Release notes: More simplification rules

The existing simplifier would never go into relational expressions
and distribute conditional expressions. It does now.

With this change, `AbstractValue.createFromBinaryOp` joins many other
value factory functions that may return non-abstract values.

This caused various changes downstream in types, and dealing with concrete
instead of abstract values.

Adding regression test.
Closes https://github.com/facebook/prepack/pull/1972

Differential Revision: D8023363

Pulled By: NTillmann

fbshipit-source-id: a3cd6f7752ba24d039c6085bec2ee93f7587af26
2018-05-15 23:56:32 -07:00
Nikolai Tillmann
1d8e2d935e Move evaluateWithAbstractConditional
Summary:
Release notes: None

All other evaluate... functions are in Realm, so this is moving evaluateWithAbstractConditional there.
Closes https://github.com/facebook/prepack/pull/1971

Differential Revision: D8018543

Pulled By: NTillmann

fbshipit-source-id: 4690cd6b85e3c8e3c7afa82d8b18908c4b36b46c
2018-05-15 16:54:57 -07:00
Victor Hom
62bbdd4aee update the --timeout error
Summary:
Release Note: none

this is to fix issue #1952 where the --timeout throws a fatal error without more information

Would need to add a new error number to the wiki, unless there is an existing one that I should use instead.
Closes https://github.com/facebook/prepack/pull/1966

Differential Revision: D8017667

Pulled By: NTillmann

fbshipit-source-id: 8978092c3d4b505463850a5598f5eeaabcbffe1b
2018-05-15 16:33:23 -07:00
Nikolai Tillmann
505aa2bb28 Better crash logging
Summary:
Release notes: None

Provide a more insightful way of logging rich abstract values
for debugging.
Closes https://github.com/facebook/prepack/pull/1964

Differential Revision: D8015093

Pulled By: NTillmann

fbshipit-source-id: 47d9b42470df79133e90f44fb1e23fd8bf40f254
2018-05-15 14:05:45 -07:00
Dominic Gannaway
41df8539d8 General clean up of React reconciler + serializer code
Summary:
Release notes: none

This is a tidy up of the React reconciler and optimization code. I've removed the React logic from `serializer/functions.js` and put it all in its own module so that it's easier to debug and read the React specific code from generic Prepack optimization code. Furthermore, I took some time to rename `render` in reconciler to `resolve` as it's not actually doing any "rendering".
Closes https://github.com/facebook/prepack/pull/1968

Differential Revision: D8010381

Pulled By: trueadm

fbshipit-source-id: c61bdfec91f250f898d54623d92c20a545b965d7
2018-05-15 09:38:44 -07:00
Dominic Gannaway
c114aa6acd Add all missing console methods
Summary:
Release notes: adds support for more `console` methods

This adds all the other console methods that I could see on MDN.
Closes https://github.com/facebook/prepack/pull/1969

Differential Revision: D8009408

Pulled By: trueadm

fbshipit-source-id: cb75730f1b84e8b4812187a288c3eec0f3b7ef51
2018-05-15 06:52:50 -07:00
Nikolai Tillmann
3b3c4f371c Simplifying some code.
Summary:
Release notes: None

It seemed overly complicated; so I deleted some code.
Everything still seems to work.
Closes https://github.com/facebook/prepack/pull/1965

Reviewed By: trueadm

Differential Revision: D8004394

Pulled By: NTillmann

fbshipit-source-id: 37a7e2b97fdb1796684883d0399504441ecac4b4
2018-05-15 05:20:35 -07:00
Nikolai Tillmann
6b3866885f Fixing AbstractObjectValue's $Get
Summary:
Release notes: None

It used to bail out for conditional abstract values when accessing
a prototype that existed on neither side of the condition. No more.
Also, things used to be wrong in the presence of object prototypes.
That's also getting fixed.

Adding regression tests.
Closes https://github.com/facebook/prepack/pull/1963

Differential Revision: D8000539

Pulled By: NTillmann

fbshipit-source-id: 5214f213ea49c63e9637126360d3c90aace92d20
2018-05-14 18:03:46 -07:00
Dominic Gannaway
0e74417689 Make React component state final as its immutable
Summary:
Release notes: none

Two things are in this PR:
- The `setState` implementation now correctly assigns the state to a new object rather than mutating the existing state.
- The state object from React component is made final, like `props` are.
Closes https://github.com/facebook/prepack/pull/1961

Differential Revision: D7996744

Pulled By: trueadm

fbshipit-source-id: 10a4c9d735c146dff9ce87292344e9c9ccbf93d1
2018-05-14 15:02:34 -07:00
Nikolai Tillmann
ad9ed9ba97 Don't treat original constructor specially in the visitor.
Summary:
Release notes: None

This fixes #1957.
Turns out that the special case is no longer needed, and just removing that code fixes the issue now.
Adding regression test.
Closes https://github.com/facebook/prepack/pull/1958

Differential Revision: D7995563

Pulled By: NTillmann

fbshipit-source-id: 6822c5433679fd88bd5a052ca23824cb3f3eabba
2018-05-14 13:55:47 -07:00
Herman Venter
770bfef8ca Objects that are temporal should set _isScopedTemplate to true
Summary:
Release note: Fixes problem with result of Array.filter (and similar) applied to arrays with unknown properties

Closes: #1924

Generator.deriveConcrete can result in temporal object values. These must be marked with _isScopedTemplate to prevent them from being hoisted.
Closes https://github.com/facebook/prepack/pull/1926

Reviewed By: trueadm

Differential Revision: D7949463

Pulled By: hermanventer

fbshipit-source-id: 2f15117725c37e9b09cae8ac469ee5b2eb481b6c
2018-05-14 13:55:46 -07:00
Nikolai Tillmann
9685f866ce Fix frozen lazy objects
Summary:
Release notes: None

The `Object.freeze` command (or similar) was put into the body
where the object was allocated, not where it got initialized.
This would cause the initialization code to silently fail later on when the object was used for the first time.

This fixes it, and adds a regression test.
Closes https://github.com/facebook/prepack/pull/1936

Differential Revision: D7994911

Pulled By: NTillmann

fbshipit-source-id: 6ec0706357706f7bf80f62690be9aea1f30f8a72
2018-05-14 13:05:44 -07:00
Paulo Cunha
3e88d55ca3 Refactor effects.data into properties
Summary:
Release Note: none

Hi! I started trying to learn this codebase today and found this TODO from cblappert in `realm.js`:
aa700a2667/src/realm.js (L88)

Sounded like a good task to get into, so I went through the codebase and did the necessary replacements. If this wasn't the intent, please disregard this PR.
Closes https://github.com/facebook/prepack/pull/1943

Differential Revision: D7994498

Pulled By: hermanventer

fbshipit-source-id: 58292d4d0969408bdb03a2461b6edb9a47f4238f
2018-05-14 13:05:44 -07:00
Dan Abramov
f3fe533480 Follow up to ConditionalExpression changes
Summary:
Followup to https://github.com/facebook/prepack/pull/1954 comments.

Also changes `IfStatement` to use `evaluateCompletion()` instead of `evaluate()` since presumably that was the original intent (?) If not then we should remove the `AbruptCompletion` check.
Closes https://github.com/facebook/prepack/pull/1956

Differential Revision: D7993877

Pulled By: gaearon

fbshipit-source-id: f3078da8fb7fadf1d1b6d03ff6375e2e0926ddd9
2018-05-14 12:19:19 -07:00
Dan Abramov
b594b283c2 Don't treat makePartial() as a mutation in havoc checker
Summary:
Fixes https://github.com/facebook/prepack/issues/1931.

The issue is that this call may happen on a havoced object:

41e9dcb398/src/intrinsics/ecma262/Object.js (L98-L100)

That fails. But I'm not sure it makes sense to even check havocing for internal properties like `_isPartial_binding`.

Maybe there's a deeper problem here. I don't see it but at least this gets the ball rolling.
Closes https://github.com/facebook/prepack/pull/1955

Differential Revision: D7992958

Pulled By: gaearon

fbshipit-source-id: 3e843ae159896c15b8f9dc2fd6956b148a2ef44f
2018-05-14 11:59:52 -07:00
Nikolai Tillmann
287aab9bcd Replace expensive second babel-traverse pass with fast custom visitor.
Summary:
Release notes: Speeding up Prepack by 22%, saving 8% memory.

This closes #1812.

This completely refactors the `ClosureRefReplacer` into a new
standalone `ResidualFunctionInstantiator`.

By avoiding babel-traverse, this visitor implementation is way faster.
Also, it only clones those nodes which are being changes, preserving all others,
insteading of cloning an entire function if any node needs to change; in this way,
memory is saved as well.

On a large internal benchmark (27MB minified JavaScript bundle with 31MB sourcemaps file), this change reduces overall time from 200s down to 157s: 22% faster. This due to savings during serialization, which goes down from 71s to 23s (while making the visitor 6s slower due to additional work).

Also, overall memory usage goes down from 3582MB to 3307MB, a 8% savings. Again, mostly due to savings in serialization, where surviving allocations going down from 337MB to 51MB, while slightly increasing allocations in the visitor.
Closes https://github.com/facebook/prepack/pull/1947

Differential Revision: D7990897

Pulled By: NTillmann

fbshipit-source-id: 93ffa0a06e75566db1d5564924c3f840cc2262df
2018-05-14 11:59:51 -07:00
Dan Abramov
200b5c5f59 Conditional return completions might need to be dereferenced
Summary:
Fixes https://github.com/facebook/prepack/issues/1953.

We used to delegate handling of conditional expression to `IfStatement`. But this is not entirely accurate because conditional expression completion might be an identifier. `IfStatement` rules are too restrictive.

I copy pasted the code from IfStatement and added `GetValue` dereferencing [to match the specification](http://www.ecma-international.org/ecma-262/7.0/#sec-conditional-operator-runtime-semantics-evaluation). I also removed `UpdateEmpty()` calls which seem to only be relevant to `IfStatement` evaluation.

Adds a regression test.
Closes https://github.com/facebook/prepack/pull/1954

Differential Revision: D7988920

Pulled By: gaearon

fbshipit-source-id: ac130076dbaa04d5d661adb984b408b4d3b57fa3
2018-05-14 08:09:16 -07:00
Dan
41e9dcb398 Fix havoc logic for conditional abstracts
Summary:
Fixes https://github.com/facebook/prepack/issues/1883.

As I noted there,

>This seems to happen because the logic in `visitObjectPropertiesWithComputedNames` hasn't been updated in the same way that [its twin in the residual heap visitor has been](aa700a2667/src/serializer/ResidualHeapVisitor.js (L361-L388)).

This brings them in line.

Regression case included. It used to fail with bad output even after this change, but https://github.com/facebook/prepack/pull/1937 fixed that, so now it passes.
Closes https://github.com/facebook/prepack/pull/1942

Reviewed By: trueadm

Differential Revision: D7987993

Pulled By: gaearon

fbshipit-source-id: 1ebda0c38f2f932aa18872bfc9a919938fc2ef96
2018-05-14 02:52:09 -07:00
saigowthamr
f720dab2a5 Matching end tags Errors fixed
Summary:
Corrected matching end tags  div and p tags  fixed
Closes https://github.com/facebook/prepack/pull/1907

Differential Revision: D7925198

Pulled By: NTillmann

fbshipit-source-id: b92c2dbaada71e9afdd0193692b1ec2e401999e4
2018-05-13 09:38:09 -07:00
Paulo Cunha
afca7d742c make some files flow strict
Summary:
Release Notes: none

Made some files flow strict, where there weren't complicated dependencies to solve.
It's low hanging fruit for https://github.com/facebook/prepack/issues/1941.
Closes https://github.com/facebook/prepack/pull/1949

Differential Revision: D7985674

Pulled By: NTillmann

fbshipit-source-id: b20a94dccf540798e2e724499f3d2e65847e73f6
2018-05-13 09:26:00 -07:00
Victor Hom
7e3209b701 add reading wiki link to places
Summary:
Release Note: none

I just wanted to add the reading links as suggested in #1887

arrived to the wiki from Twitter -> the issue -> to the Wiki :)

Let me know if you want the copy updated and shifted around anywhere.
Closes https://github.com/facebook/prepack/pull/1948

Differential Revision: D7985678

Pulled By: NTillmann

fbshipit-source-id: 22cd999bf4ff8dd26618b06d94f751834533b726
2018-05-13 09:25:59 -07:00
Manas
5185a3557a Adds support for spread syntax
Summary:
Addresses #927
Adds support for spread syntax
Closes https://github.com/facebook/prepack/pull/1932

Differential Revision: D7976863

Pulled By: sebmarkbage

fbshipit-source-id: 05836c8398df4699729a1b697b5da0c90df1b992
2018-05-11 14:40:30 -07:00
Nikolai Tillmann
aa700a2667 Don't insist on giving all abstract values unique names.
Summary:
Release notes: More compact code generation by avoiding introducing local variables for abstract values when possible.

This fixes #1765.
Closes https://github.com/facebook/prepack/pull/1921

Differential Revision: D7946593

Pulled By: NTillmann

fbshipit-source-id: a33a9cbe8ffcd9ca43afa4101954c9b59401fb4c
2018-05-11 11:18:18 -07:00
Dan Abramov
20683624ab Put EmptyValue into correct join branch
Summary:
Fixes https://github.com/facebook/prepack/issues/1935.
The issue was that we'd always put `EmptyValue` into the right branch even if it happened in the left one.

Adds a regression test.
Closes https://github.com/facebook/prepack/pull/1937

Reviewed By: trueadm

Differential Revision: D7967344

Pulled By: gaearon

fbshipit-source-id: ece8550787679e2fc33f040989ceae0cf3a7c2a2
2018-05-11 07:07:02 -07:00
Xun Li
306ea4f625 Update Flow version
Summary:
Update to 72. Run yarn flow and verify it's all good
Closes https://github.com/facebook/prepack/pull/1939

Differential Revision: D7961902

Pulled By: lxfind

fbshipit-source-id: 246d8abef788685d4d6e57406e15f8f8e56650c2
2018-05-10 20:11:23 -07:00
Dan Abramov
10a600854c Fix a simplifer issue
Summary:
This might be wrong, I haven't though about it in depth yet.
Appears to fix https://github.com/facebook/prepack/issues/1930 and https://github.com/facebook/prepack/issues/1830.

Tests pass.
Closes https://github.com/facebook/prepack/pull/1933

Differential Revision: D7954943

Pulled By: gaearon

fbshipit-source-id: e19166cc22efcffbe7c4082d3df5e5c82c9f79e8
2018-05-10 12:09:08 -07:00
Nikolai Tillmann
4b980396c9 Don't serialize changes to property bindings that represent internal slots
Summary:
Release notes: None

This fixes #1856, at least in the sense that Prepack won't silently generate wrong code.
Instead, Prepack will now issue an error indicating that a Prepack limitation was hit.

Adding error-handler regression test.

Also fixed reference to PP1023 (no wiki page) to be PP0023 (matching wiki page) instead.
Closes https://github.com/facebook/prepack/pull/1929

Differential Revision: D7954903

Pulled By: NTillmann

fbshipit-source-id: f9676f33e74ff36067832333a7ee9a26ec77126d
2018-05-10 12:09:01 -07:00
Dominic Gannaway
00d8a1a820 Throw an error when side-effectful logic happens in a React component tree
Summary:
Release notes: the React reconciler now throw a FatalError upon encountering side-effects in a render

This PR revamps the current React system's restrictions for what you can and can't do during the React reconcilation phase. This is a pretty large update but provides much better boundaries between what is "safe" and not "safe", thus reducing the constraints.

1. A new error `ReconcilerRenderBailOut` is thrown if something occurs in the React reconciliation that causes the render to fail and it's a hard fail – no recovering and continuing.
2. If you mutate a binding/object outside the render phase, given the React component render phase is meant to be "pure", a `ReconcilerRenderBailOut` will be thrown.
3. If you `throw` during the React reconciliation phase, again a `ReconcilerRenderBailOut` will be thrown.

In the future, we should maybe loosen the constraints around all this and maybe allow `throw`, but right now it's causing too much friction. We should attempt to make React components render phase as pure as possible – as it results in much better optimizations by a compiler because we can assert far more without things tripping us up.

Another point, regarding (1), is that we should ideally be able to recover from the error thrown in Prepack. The reason we can't and is something that might be a very deep issue in Prepack, is that effects don't properly restore when we have nested PossiblyNormalCompletions at work. Bindings get mutated on records from changes made within `evaluateForEffects` but never get reset when in nested PossiblyNormalCompletion. If I remove all the things that can cause `PossiblyNormalCompletion`s then everything works fine and bindings do get restored. We can remove the constraint on (1) once we've found and fixed that issue.
Closes https://github.com/facebook/prepack/pull/1860

Differential Revision: D7950562

Pulled By: trueadm

fbshipit-source-id: 4657e68b084c7069622e88c9655823b5f1f9386f
2018-05-10 07:50:24 -07:00
Johannes Bader
4cabb50ce9 Improve code generation in presence of exceptions
Summary:
Release Note: none

Addresses #1870 by making `emitConditionalThrow` use `joinGenerators` rather than `_deconstruct` (which is then also no longer referenced).

Resulting code for example in issue:
``` JS
(function () {
  var $$0 = {
    enumerable: false,
    configurable: true,
    writable: true
  };

  var _$0 = this;

  var _$1 = _$0.Error;
  var _$2 = _$1.prototype;
  var _$3 = _$0.Object;
  var _$4 = _$3.defineProperty;

  var _4 = function () {
    return 42;
  };

  var __constructor = function () {};

  inspect = _4;
  var _0 = false;
  var _3 = _$2;

  if (_0) {
    var _1 = (__constructor.prototype = _3, new __constructor());

    $$0.value = "Error\n    at no-filename-specified:4:18\n    at no-filename-specified:1:1", _$4(_1, "stack", $$0);
    throw _1;
  }
}).call(this);
```
Closes https://github.com/facebook/prepack/pull/1889

Differential Revision: D7946748

Pulled By: olydis

fbshipit-source-id: d760b66405b55edc7967e31abd2d81596d7090a5
2018-05-09 23:47:54 -07:00
Jeffrey Tan
c2e614182e Fix ESLint crash
Summary:
Release note: None
ESLint crashes with the flow fix I did earlier. Turns out updating ESLint to latest version fixed it.
Closes https://github.com/facebook/prepack/pull/1927

Reviewed By: NTillmann

Differential Revision: D7946856

Pulled By: yinghuitan

fbshipit-source-id: 44995ed89b516651d85918c6b08b6048916bbb09
2018-05-09 22:13:21 -07:00
Herman Venter
8f2e2fe353 Prevent CSE from hoisting Object.assign calls.
Summary:
Release note: none

Resolves issue #1865

Abstract values that are known to result in objects (of unknown identity) should not be eligible for Common Subexpression Elimination (CSE).
Closes https://github.com/facebook/prepack/pull/1925

Differential Revision: D7941893

Pulled By: hermanventer

fbshipit-source-id: 454e26c6d042093b9fbae06d73110202083731b6
2018-05-09 15:49:56 -07:00
Jeffrey Tan
8423a122ce Fix flow error
Summary:
Release note: none.
Fix flow error for debugger.
Closes https://github.com/facebook/prepack/pull/1923

Differential Revision: D7940395

Pulled By: yinghuitan

fbshipit-source-id: 0b3094e72a24dec0bb02dcb096401b19be009c87
2018-05-09 14:33:17 -07:00
Dominic Gannaway
78b4bfea1b The catch should rethrow error if it cannot handle it
Summary:
Release notes: none

Fix for a try/catch block that should rethrow an error if it cannot handle it.
Closes https://github.com/facebook/prepack/pull/1922

Differential Revision: D7937748

Pulled By: trueadm

fbshipit-source-id: 19c5ff60b3bba51ae444053dc3dc3ece21aa4336
2018-05-09 12:53:55 -07:00
Nikolai Tillmann
9aafca71a1 Fixing getParent call.
Summary:
Release notes: None

This was just wrong (result of a bad merge).
I don't know how this could have Flow type checked.
Code only runs with --debugScopes.
Closes https://github.com/facebook/prepack/pull/1918

Differential Revision: D7936513

Pulled By: NTillmann

fbshipit-source-id: 1062dba0db3fd3690da149814217015623adfbcc
2018-05-09 12:12:19 -07:00
Nikolai Tillmann
693250fea2 Adding regression test for #1881
Summary:
Release notes: None

Closes https://github.com/facebook/prepack/pull/1919

Differential Revision: D7936510

Pulled By: NTillmann

fbshipit-source-id: 5165537ff8d3b9800ab3cbdda250d38f13059a2c
2018-05-09 12:12:19 -07:00
Nikolai Tillmann
86bb9e2bab Making setting up bindings faster
Summary:
Release notes: None

Besides general deep AST traversals, the only other thing that shows up high in the profiler is setting up bindings.
This change tries to make it a bit more efficient.
Also cleans up types.
Closes https://github.com/facebook/prepack/pull/1720

Differential Revision: D7936521

Pulled By: NTillmann

fbshipit-source-id: a759a976dd80a5176022e566e0f832e1e9fc39a2
2018-05-09 12:12:19 -07:00
Dominic Gannaway
475928e65c Missed more Gets in react/utils
Summary:
Release notes: none

Conversion of Get -> getProperty on ReactElement objects.
Closes https://github.com/facebook/prepack/pull/1920

Differential Revision: D7935203

Pulled By: trueadm

fbshipit-source-id: ad33d28a786c4d6bcbad04909d45c7acae1ff969
2018-05-09 11:09:05 -07:00
Dominic Gannaway
19b2bde1bb Fixes an issue with getOwnPropertyDescriptor
Summary:
Release notes: fixes an issue with getOwnPropertyDescriptor when dealing with a native prototype function

This PR fixes #1285, specifically when using `Object.getOwnPropertyDescriptor` on a native prototype function, we have to resort to returning a temporal abstract as this function isn't available at build time. I also renamed all the tests with typos in them.

cc anilanar
Closes https://github.com/facebook/prepack/pull/1913

Differential Revision: D7935215

Pulled By: trueadm

fbshipit-source-id: d7e33cf8bd73aa2c1156966ad86e9da9fb0404e4
2018-05-09 11:09:05 -07:00
Herman Venter
bfde1606e1 Stop processing statements after program terminating exception
Summary:
Release note: Do not generate code for unreachable global code statements

Resolves issue #1906

If an unconditional throw is encountered, it does not make sense to keep processing top level statements.
Closes https://github.com/facebook/prepack/pull/1908

Differential Revision: D7934963

Pulled By: hermanventer

fbshipit-source-id: d6e6b26d7ad7c54a065e43a74ad1b27959159c7a
2018-05-09 10:50:17 -07:00
Dan Abramov
c4c1593b22 Add a serializer regression test for #1833
Summary:
Regression test.
Closes https://github.com/facebook/prepack/pull/1916

Differential Revision: D7931571

Pulled By: gaearon

fbshipit-source-id: a442ad2cb68c97d731dd8fbe03886562c8dde18c
2018-05-09 09:40:25 -07:00