facebookarchive/prepack

Fuse adjacent JOIN_GENERATORS with same path condition

Open

#2565 opened on Sep 22, 2018

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (14,268 stars) (520 forks)batch import
Instant Renderenhancementhelp wantedlevel 2 (easy)

Description

This...

let x = __abstract("boolean", "(x)");
if (x) console.log("Hello");
if (x) console.log(" World");

currently prepacks to

(function () {
  var _0 = x;

  if (_0) {
    console.log("Hello");
  }

  if (_0) {
    console.log(" World");
  }
})();

but should Prepack to

(function () {
  var _0 = x;

  if (_0) {
    console.log("Hello");
    console.log(" World");
  }
})();

(Seen arising from actual product code.)

Contributor guide