• jarin's avatar
    [turbofan] Add type to the allocation operator. · e97b29a4
    jarin authored
    This gives us more precise type information, so we can avoid some type
    guards to refine the type information back.
    
    The motivation for this is to help escape analysis by not introducing
    redundant type guards (which escape analysis cannot handle yet even
    though it could and should do).
    
    Motivating example:
    
    In the example below, the out-of-object property array for properties
    fld5 and fld6 gets type Any when it is created by "o.fld5 = 5" (for
    object literals, we store 4 properties in-objeca, the rest goes out
    of object).
    
    When we run load elimination for the load the out-of-object property
    array (to store 6 into o.fld6), load elimination inserts TypeGuard to
    enforce the Type::Internal() type. This makes escape analysis bail out
    on this object, and we do not eliminate the object creation.
    
    function f() {
      var o = {};
      o.fld1 = 1;
      o.fld2 = 2;
      o.fld3 = 3;
      o.fld4 = 4;
      o.fld5 = 5;
      o.fld6 = 6;
    }
    
    f();
    f();
    %OptimizeFunctionOnNextCall(f);
    f();
    
    Review-Url: https://codereview.chromium.org/2797993006
    Cr-Commit-Position: refs/heads/master@{#44470}
    e97b29a4
escape-analysis-unittest.cc 16.3 KB