Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

invariant: havoc in pure scope outside of optimized function #2419

Closed
calebmer opened this issue Aug 13, 2018 · 1 comment
Closed

invariant: havoc in pure scope outside of optimized function #2419

calebmer opened this issue Aug 13, 2018 · 1 comment
Assignees

Comments

@calebmer
Copy link
Contributor

calebmer commented Aug 13, 2018

https://github.com/facebook/prepack/blob/55c55f70c9f8de05bfa96582bd8c66ccc41f6e0f/src/serializer/ResidualHeapVisitor.js#L1215

__evaluatePureFunction(() => {
  const x = {};

  var havoc = __abstract("function", "(() => {})");
  havoc(() => x);
});
Invariant Violation: 
debug-fb-www.js:208
This is likely a bug in Prepack, not your code. Feel free to open an issue on GitHub.
    at invariant (/Users/calebmer/prepack/src/invariant.js:18:15)
    at Object.visitBindingAssignment (/Users/calebmer/prepack/src/serializer/ResidualHeapVisitor.js:1215:21)
    at BindingAssignmentEntry.visit (/Users/calebmer/prepack/src/utils/generator.js:523:26)
    at visitFn (/Users/calebmer/prepack/src/utils/generator.js:1038:46)
    at Generator.visit (/Users/calebmer/prepack/src/utils/generator.js:1044:7)
    at _withScope (/Users/calebmer/prepack/src/serializer/ResidualHeapVisitor.js:1232:17)
    at ResidualHeapVisitor._withScope (/Users/calebmer/prepack/src/serializer/ResidualHeapVisitor.js:250:7)
    at ResidualHeapVisitor.visitGenerator (/Users/calebmer/prepack/src/serializer/ResidualHeapVisitor.js:1231:10)
    at ResidualHeapVisitor.visitRoots (/Users/calebmer/prepack/src/serializer/ResidualHeapVisitor.js:1283:10)
    at statistics.deepTraversal.measure (/Users/calebmer/prepack/src/serializer/serializer.js:204:70)
@calebmer
Copy link
Contributor Author

calebmer commented Aug 13, 2018

This is in code @cblappert was recently editing. I have a fix incoming.

facebook-github-bot pushed a commit that referenced this issue Aug 22, 2018
Summary:
Fixes #2419 #2386 #2439 #2447 #2432 #2437 #2442

* Fix havoced binding not in optimized function
* Allow arrays with widened numeric properties to update index properties
* Fix nested for statement bailout with nested for-in
* Don’t record modified bindings for immutable bindings when havocing

Reviewed By: trueadm, sebmarkbage

Differential Revision: D9456957

fbshipit-source-id: f266b8cc73012b9c721f0f9eebd48347bf0e37ae
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant