destructuring-parameters-literalcount-nolazy.js 895 Bytes
Newer Older
1 2 3 4
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
5
// Flags: --harmony-destructuring-bind
6
// Flags: --no-lazy --allow-natives-syntax
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41


var t1 = [1];
var t2 = [2];
var t3 = [3];
var t4 = [4];
var t5 = [5];
function g({x = {a:10,b:20}},
           {y = [1,2,3],
            n = [],
            p = /abc/}) {
  assertSame(10, x.a);
  assertSame(20, x.b);
  assertSame(2, y[1]);
  assertSame(0, n.length);
  assertTrue(p.test("abc"));
}
g({},{});
%OptimizeFunctionOnNextCall(g);
g({},{});


var h = ({x = {a:10,b:20}},
         {y = [1,2,3],
          n = [],
          p = /abc/ }) => {
    assertSame(10, x.a);
    assertSame(20, x.b);
    assertSame(2, y[1]);
    assertSame(0, n.length);
    assertTrue(p.test("abc"));
  };
h({},{});
%OptimizeFunctionOnNextCall(h);
h({},{});