Upload Kmake

This commit is contained in:
Gorochu
2026-05-26 23:36:42 -07:00
parent ba051b2f74
commit 555ec72358
41615 changed files with 13344630 additions and 1 deletions

View File

@ -0,0 +1,53 @@
// Copyright 2019 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.
function setupArray(length) {
var a = new Array(length);
for (var i=0;i<length;i++) {
a[i] = ''+i;
}
return Object.freeze(a);
}
const frozenArray = setupArray(200);
function driverArrayIndexOf(n) {
let result = 0;
for (var i=0;i<n;i++) {
result += frozenArray.indexOf(''+i)==-1?0:1;
}
return result;
}
function ArrayIndexOf() {
driverArrayIndexOf(1e4);
}
function ArrayIndexOfWarmUp() {
driverArrayIndexOf(1e1);
driverArrayIndexOf(1e2);
driverArrayIndexOf(1e3);
}
createSuite('ArrayIndexOf', 10, ArrayIndexOf, ArrayIndexOfWarmUp);
function driverArrayIncludes(n) {
let result = 0;
for (var i=0;i<n;i++) {
result += frozenArray.includes(''+i)?0:1;
}
return result;
}
function ArrayIncludes() {
driverArrayIncludes(1e4);
}
function ArrayIncludesWarmUp() {
driverArrayIncludes(1e1);
driverArrayIncludes(1e2);
driverArrayIncludes(1e3);
}
createSuite('ArrayIncludes', 10, ArrayIncludes, ArrayIncludesWarmUp);

View File

@ -0,0 +1,32 @@
// Copyright 2019 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.
function setupArrayMap(length) {
var a = new Array(length);
for (var i=0;i<length;i++) {
a[i] = ''+i;
}
return Object.freeze(a);
}
const frozenArrayMap = setupArrayMap(200);
function driverArrayMap(n) {
let result = 0;
for (var i=0;i<n;i++) {
result = frozenArrayMap.map(Number);
}
return result;
}
function ArrayMap() {
driverArrayMap(1e3);
}
function ArrayMapWarmUp() {
driverArrayMap(1e1);
driverArrayMap(1e2);
}
createSuite('ArrayMap', 10, ArrayMap, ArrayMapWarmUp);

View File

@ -0,0 +1,59 @@
// Copyright 2019 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.
function setupArrayReduce(length) {
let a = new Array(length);
for (let i=0;i<length;i++) {
a[i] = ''+i;
}
return Object.freeze(a);
}
const kArraylength = 200;
const frozenArrayReduce = setupArrayReduce(kArraylength);
const reducer = (accumulator, currentValue) => accumulator + Number(currentValue);
function driverArrayReduce(n) {
let result = 0;
for (let i=0;i<n;i++) {
result = frozenArrayReduce.reduce(reducer);
}
return result;
}
const kIterations = 1e3;
function ArrayReduce() {
driverArrayReduce(kIterations);
}
const kIterationsWarmUp = [1e1, 1e2];
function ArrayReduceWarmUp() {
driverArrayReduce(kIterationsWarmUp[0]);
driverArrayReduce(kIterationsWarmUp[1]);
}
const kRun = 1e1;
createSuite('ArrayReduce', kRun, ArrayReduce, ArrayReduceWarmUp);
function driverArrayReduceRight(n) {
let result = 0;
for (let i=0;i<n;i++) {
result = frozenArrayReduce.reduceRight(reducer);
}
return result;
}
function ArrayReduceRight() {
driverArrayReduceRight(kIterations);
}
function ArrayReduceRightWarmUp() {
driverArrayReduceRight(kIterationsWarmUp[0]);
driverArrayReduceRight(kIterationsWarmUp[1]);
}
createSuite('ArrayReduceRight', kRun, ArrayReduceRight, ArrayReduceRightWarmUp);

View File

@ -0,0 +1,23 @@
// Copyright 2019 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.
function driver(n) {
let result = 0;
for (var i=0;i<n;i++) {
result += frozenArray.hasOwnProperty(''+i)==-1?0:1;
}
return result;
}
function HasOwnProperty() {
driver(1e4);
}
function HasOwnPropertyWarmUp() {
driver(1e1);
driver(1e2);
driver(1e3);
}
createSuite('HasOwnProperty', 10, HasOwnProperty, HasOwnPropertyWarmUp);

View File

@ -0,0 +1,25 @@
// Copyright 2018 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.
d8.file.execute('../base.js');
d8.file.execute('tagged-template.js');
d8.file.execute('array-indexof-includes.js');
d8.file.execute('spread-call.js');
d8.file.execute('has-own-property.js');
d8.file.execute('array-map.js');
d8.file.execute('array-reduce.js');
function PrintResult(name, result) {
console.log(name);
console.log(name + '-Numbers(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError });

View File

@ -0,0 +1,59 @@
// Copyright 2019 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.
function setupArray(length) {
var a = new Array(length);
for (var i=0;i<length;i++) {
a[i] = ''+i;
}
return Object.freeze(a);
}
const frozenSpreadArray = setupArray(100);
function foo() {
var result = arguments[0];
for (var i = 1; i < arguments.length; ++i) {
result += arguments[i];
}
return result;
}
// ----------------------------------------------------------------------------
// Benchmark: SpreadCall
// ----------------------------------------------------------------------------
function SpreadCall() {
foo(...frozenSpreadArray);
}
// ----------------------------------------------------------------------------
// Benchmark: SpreadCallSpreadLiteral
// ----------------------------------------------------------------------------
function SpreadCallSpreadLiteral() {
foo(...[...frozenSpreadArray]);
}
// ----------------------------------------------------------------------------
// Benchmark: ApplySpreadLiteral
// ----------------------------------------------------------------------------
function ApplySpreadLiteral() {
foo.apply(this, [...frozenSpreadArray]);
}
// ----------------------------------------------------------------------------
// Setup and Run
// ----------------------------------------------------------------------------
function CreateBenchmark(name, f) {
new BenchmarkSuite(name, [10], [ new Benchmark(name, false, false, 0, f) ]);
}
CreateBenchmark('ApplySpreadLiteral', ApplySpreadLiteral);
CreateBenchmark('SpreadCall', SpreadCall);
CreateBenchmark('SpreadCallSpreadLiteral', SpreadCallSpreadLiteral);

View File

@ -0,0 +1,65 @@
// Copyright 2019 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.
function tag(strings, ...values) {
let a = 0;
for (let i = 0; i < strings.length; ++i) a += strings[i].length;
return a;
}
function driver(n) {
let result = 0;
for (let i = 0; i < n; ++i) {
result += tag`${"Hello"} ${"cruel"} ${"slow"} ${"world"}!\n`;
result += tag`${"Why"} ${"is"} ${"this"} ${"so"} ${"damn"} ${"slow"}?!\n`;
}
return result;
}
function TaggedTemplate() {
driver(1e4);
}
function TaggedTemplateWarmUp() {
driver(1e1);
driver(1e2);
driver(1e3);
}
createSuite('TaggedTemplate', 10, TaggedTemplate, TaggedTemplateWarmUp);
var _templateObject = _taggedTemplateLiteralLoose(
["", " ", " ", " ", "!\n"],
["", " ", " ", " ", "!\\n"]
),
_templateObject2 = _taggedTemplateLiteralLoose(
["", " ", " ", " ", " ", " ", "?!\n"],
["", " ", " ", " ", " ", " ", "?!\\n"]
);
function _taggedTemplateLiteralLoose(strings, raw) {
strings.raw = raw;
return strings;
}
function driverLoose(n) {
var result = 0;
for (var i = 0; i < n; ++i) {
result += tag(_templateObject, "Hello", "cruel", "slow", "world");
result += tag(_templateObject2, "Why", "is", "this", "so", "damn", "slow");
}
return result;
}
function TaggedTemplateLoose() {
driverLoose(1e4);
}
function TaggedTemplateLooseWarmUp() {
driverLoose(1e1);
driverLoose(1e2);
driverLoose(1e3);
}
createSuite('TaggedTemplateLoose', 10, TaggedTemplateLoose, TaggedTemplateLooseWarmUp);