• bmeurer's avatar
    [turbofan] Constant-fold certain JSOrdinaryHasInstance nodes. · c9c7dd0d
    bmeurer authored
    Move JSOrdinaryHasInstance lowering to JSNativeContextSpecialization,
    which was previously mostly done in JSTypedLowering (for no reason).
    Add new logic to the lowering to constant-fold OrdinaryHasInstance
    checks when the map of the left-hand side and the "prototype" of the
    right-hand side is known. This address the performance issue with the
    (base) class constructors generated by Babel, i.e.:
    
      function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) {
          throw new TypeError("Cannot call a class as a function");
        }
      }
    
      var C = function C() { _classCallCheck(this, C); };
    
    for
    
      class C {}
    
    Also ensure that a known constructor being used inside an instanceof
    get's a proper initial map on-demand.
    
    BUG=v8:6275
    R=mstarzinger@chromium.org
    
    Review-Url: https://codereview.chromium.org/2827013002
    Cr-Commit-Position: refs/heads/master@{#44727}
    c9c7dd0d
js-native-context-specialization.h 9.02 KB