-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Relax constraints on Metro requires opt.
Summary: When I adapted MetroRequireOpt from the previous CJS module code, I had not understood that the previous code has a constraint that the newer code doesn't: it required *all* uses of require to be resolved in order to correctly do any optimization. The new version is (at least so far), more lenient: it is a "pure optimization": the substitution of the Require bytecode instruction for a call to the require function is semantics-preserving. So we no longer have to track whether there any failures to track require calls, nor to back out when there are. Also, we no longer care if the require function escapes: that might mean we make some require calls we can't optimize, but it doesn't keep us from optimizing the ones we can identify. Also, embarrassingly, I left in code that did the old optimization! It wasn't executing, because the vector of calls to optimize was left empty. But this now deletes that vector and the code that uses it. Reviewed By: avp Differential Revision: D68634817 fbshipit-source-id: cf29349f62a66382d51c1b57f9dff421ca9ba93f
1 parent
2401637
commit fa229d4
Showing
1 changed file
with
8 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters