2017-07-28 04:42:53 +00:00
|
|
|
// Copyright 2017 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.
|
2018-01-15 15:58:36 +00:00
|
|
|
(() => {
|
2017-07-28 04:42:53 +00:00
|
|
|
|
2018-01-15 15:58:36 +00:00
|
|
|
function make_tostring() {
|
|
|
|
return new Function("result = array.toString();");
|
2017-07-28 04:42:53 +00:00
|
|
|
}
|
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
createSuite('SmiToString', 1000, make_tostring(), SmiToStringSetup);
|
|
|
|
createSuite('StringToString', 1000, make_tostring(), StringToStringSetup);
|
|
|
|
createSuite('SparseSmiToString', 1000, make_tostring(), SparseSmiToStringSetup);
|
|
|
|
createSuite(
|
|
|
|
'SparseStringToString', 1000, make_tostring(), SparseStringToStringSetup);
|
2017-07-28 04:42:53 +00:00
|
|
|
|
|
|
|
var array;
|
|
|
|
var result;
|
|
|
|
var array_size = 1000;
|
|
|
|
|
|
|
|
function SmiToStringSetup() {
|
|
|
|
array = new Array();
|
|
|
|
for (var i = 0; i < array_size; ++i) array[i] = i;
|
|
|
|
}
|
2018-01-15 15:58:36 +00:00
|
|
|
|
2017-07-28 04:42:53 +00:00
|
|
|
function StringToStringSetup() {
|
|
|
|
array = new Array();
|
|
|
|
for (var i = 0; i < array_size; ++i) array[i] = `Item no. ${i}`;
|
|
|
|
}
|
2018-01-15 15:58:36 +00:00
|
|
|
|
2017-07-28 04:42:53 +00:00
|
|
|
function SparseSmiToStringSetup() {
|
|
|
|
SmiToStringSetup();
|
|
|
|
array.length = array.length * 2;
|
|
|
|
}
|
2018-01-15 15:58:36 +00:00
|
|
|
|
2017-07-28 04:42:53 +00:00
|
|
|
function SparseStringToStringSetup() {
|
|
|
|
StringToStringSetup();
|
|
|
|
array.length = array.length * 2;
|
|
|
|
}
|
2018-01-15 15:58:36 +00:00
|
|
|
|
|
|
|
})();
|