• bmeurer's avatar
    [js-perf-test] Add microbenchmarks for materialized rest parameters. · 07e163bd
    bmeurer authored
    Functions that take mandatory parameters plus a number of optional
    parameters, that need to be materialized as an Array are quite common.
    The simplest possible case of this is essentially:
    
      function foo(mandatory, ...args) { return args; }
    
    Babel translates this to something like:
    
      function foo(mandatory) {
        "use strict";
        for (var _len = arguments.length,
                 args = Array(_len > 1 ? _len - 1 : 0),
                 _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }
        return args;
      }
    
    The key to great performance here is to make sure that we don't
    materialize the (unmapped) arguments object in this case, plus that we
    have some kind of fast-path for the Array constructor and the
    initialization loop.
    
    This microbenchmark ensures that we have decent performance even in the
    case where the assignment to args is polymorphic, i.e. the arguments
    have seen different elements kinds, starting with FAST_HOLEY_ELEMENTS
    and then FAST_HOLEY_SMI_ELEMENTS.
    
    R=yangguo@chromium.org
    BUG=v8:6262
    
    Review-Url: https://codereview.chromium.org/2823343004
    Cr-Commit-Position: refs/heads/master@{#44709}
    07e163bd
Name
Last commit
Last update
..
Array Loading commit data...
AsyncAwait Loading commit data...
Classes Loading commit data...
Closures Loading commit data...
Collections Loading commit data...
Exceptions Loading commit data...
ForLoops Loading commit data...
Generators Loading commit data...
Iterators Loading commit data...
Keys Loading commit data...
Object Loading commit data...
PropertyQueries Loading commit data...
RegExp Loading commit data...
RestParameters Loading commit data...
Scope Loading commit data...
SixSpeed Loading commit data...
SpreadCalls Loading commit data...
StringIterators Loading commit data...
Strings Loading commit data...
Templates Loading commit data...
TypedArrays Loading commit data...
JSTests.json Loading commit data...
RegExp.json Loading commit data...
SixSpeed.json Loading commit data...
base.js Loading commit data...