common.js 1.14 KB
Newer Older
1 2 3 4 5
// Copyright 2014 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.

var N = 10;
6
var LargeN = 1e4;
7
var keys;
8
var keyValuePairs;
9

10 11 12
function SetupKeyValuePairsFromKeys() {
  keyValuePairs = keys.map((v) => [v, v]);
}
13

14 15
function SetupSmiKeys(count = 2 * N) {
  keys = Array.from({ length : count }, (v, i) => i);
16 17
}

18 19 20 21
function SetupSmiKeyValuePairs(count = 2 * N) {
  SetupSmiKeys(count);
  SetupKeyValuePairsFromKeys();
}
22

23 24
function SetupStringKeys(count = 2 * N) {
  keys = Array.from({ length : count }, (v, i) => 's' + i);
25 26
}

27 28 29 30
function SetupStringKeyValuePairs(count = 2 * N) {
  SetupStringKeys(count);
  SetupKeyValuePairsFromKeys();
}
31

32 33
function SetupObjectKeys(count = 2 * N) {
  keys = Array.from({ length : count }, (v, i) => ({}));
34
}
35 36 37 38 39 40 41 42 43 44 45 46 47 48

function SetupObjectKeyValuePairs(count = 2 * N) {
  SetupObjectKeys(count);
  SetupKeyValuePairsFromKeys();
}

function SetupDoubleKeys(count = 2 * N) {
  keys = Array.from({ length : count }, (v, i) => i + 0.234);
}

function SetupDoubleKeyValuePairs(count = 2 * N) {
  SetupDoubleKeys(count);
  SetupKeyValuePairsFromKeys();
}