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,44 @@
// Copyright 2016 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 benchName(bench, setup) {
var name = bench.name;
if (setup) name += "/" + setup.name;
return name;
}
function slowBenchName(bench, setup) {
return benchName(bench, setup) + " (Slow)";
}
function slow(setupFunction) {
return () => {
setupFunction();
// Trigger RegExp slow paths.
const regExpExec = re.exec;
re.exec = (str) => regExpExec.call(re, str);
};
}
function createHaystack() {
let s = "abCdefgz";
for (let i = 0; i < 3; i++) s += s;
return s;
}
function createBenchmarkSuite(name) {
return new BenchmarkSuite(
name, [1000],
benchmarks.map(([bench, setup]) =>
new Benchmark(benchName(bench, setup), false, false, 0, bench,
setup, null, null, 2)));
}
function createSlowBenchmarkSuite(name) {
return new BenchmarkSuite(
"Slow" + name, [1000],
benchmarks.map(([bench, setup]) =>
new Benchmark(slowBenchName(bench, setup), false, false, 0, bench,
slow(setup), null, null, 2)));
}

View File

@ -0,0 +1,55 @@
// Copyright 2016 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 SimpleCtor() {
new RegExp("[Cz]");
}
function FlagsCtor() {
new RegExp("[Cz]", "guiym");
}
function SimpleCtorWithoutNew() {
RegExp("[Cz]");
}
function FlagsCtorWithoutNew() {
RegExp("[Cz]", "guiym");
}
function CtorWithRegExpPattern() {
new RegExp(/[Cz]/);
}
function CtorWithRegExpPatternAndFlags() {
new RegExp(/[Cz]/, "guiym");
}
class SubRegExp extends RegExp {
get source() { return "[Cz]"; }
get flags() { return "guiym"; }
}
function CtorWithRegExpSubclassPattern() {
new RegExp(new SubRegExp(/[Cz]/));
}
function CtorWithUndefinedPattern() {
new RegExp();
}
function CtorWithFlagsAndUndefinedPattern() {
new RegExp(undefined, "guiym");
}
var benchmarks = [ [SimpleCtor, undefined],
[FlagsCtor, undefined],
[SimpleCtorWithoutNew, undefined],
[FlagsCtorWithoutNew, undefined],
[CtorWithRegExpPattern, undefined],
[CtorWithRegExpPatternAndFlags, undefined],
[CtorWithRegExpSubclassPattern, undefined],
[CtorWithUndefinedPattern, undefined],
[CtorWithFlagsAndUndefinedPattern, undefined],
];

View File

@ -0,0 +1,57 @@
// Copyright 2016 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");
var str;
var re;
function Exec() {
re.exec(str);
}
function Exec1Setup() {
re = /[Cz]/;
str = createHaystack();
}
function Exec2Setup() {
re = /[Cz]/g;
str = createHaystack();
}
function Exec3Setup() {
re = /([Cz])/y;
str = createHaystack();
}
function Exec4Setup() {
re = /[cZ]/;
str = createHaystack();
}
function Exec5Setup() {
re = /[cZ]/g;
str = createHaystack();
}
function Exec6Setup() {
re = /([cZ])/y;
str = createHaystack();
}
function Exec7Setup() {
re = /[Cz]/gy;
re.lastIndex = 2 ** 32;
str = createHaystack();
}
var benchmarks = [ [Exec, Exec1Setup],
[Exec, Exec2Setup],
[Exec, Exec3Setup],
[Exec, Exec4Setup],
[Exec, Exec5Setup],
[Exec, Exec6Setup],
[Exec, Exec7Setup],
];

View File

@ -0,0 +1,21 @@
// Copyright 2016 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 re;
function Global() {
var g = re.global;
}
function Flags() {
var f = re.flags;
}
function Setup() {
re = /[Cz]/giym;
}
var benchmarks = [ [Global, Setup],
[Flags, Setup],
];

View File

@ -0,0 +1,32 @@
// Copyright 2016 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");
var str;
var re;
function SimpleMatch() {
str.match(re);
}
function Match1Setup() {
re = /[Cz]/;
str = createHaystack();
}
function Match2Setup() {
re = /[Cz]/g;
str = createHaystack();
}
function Match3Setup() {
re = /[cZ]/; // Not found.
str = createHaystack();
}
var benchmarks = [ [SimpleMatch, Match1Setup],
[SimpleMatch, Match2Setup],
[SimpleMatch, Match3Setup],
];

View File

@ -0,0 +1,57 @@
// Copyright 2016 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.
// This benchmark was ported from
// https://github.com/mathiasbynens/string-prototype-replace-regexp-benchmark.
d8.file.execute("base.js");
var str;
var re;
function StringReplace1() {
str.replace(re, "");
}
function StringReplace2() {
str.replace(re, "xyz");
}
function StringReplace3() {
str.replace(re, "x$1yz");
}
function FunctionReplace1() {
str.replace(re, String);
}
function Replace1Setup() {
re = /[Cz]/;
str = createHaystack();
}
function Replace2Setup() {
re = /[Cz]/g;
str = createHaystack();
}
function Replace3Setup() {
re = /([Cz])/;
str = createHaystack();
}
function Replace4Setup() {
re = /([Cz])/g;
str = createHaystack();
}
var benchmarks = [ [ StringReplace1, Replace1Setup],
[ StringReplace1, Replace2Setup],
[ StringReplace2, Replace1Setup],
[ StringReplace2, Replace2Setup],
[ StringReplace3, Replace3Setup],
[ StringReplace3, Replace4Setup],
[ FunctionReplace1, Replace3Setup],
[ FunctionReplace1, Replace4Setup],
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,33 @@
// Copyright 2016 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");
var str;
var re;
function SimpleSearch() {
str.search(re);
}
function Search1Setup() {
re = /[Cz]/;
str = createHaystack();
}
function Search2Setup() {
re = /[Cz]/;
re.lastIndex = 42; // Force lastIndex restoration.
str = createHaystack();
}
function Search3Setup() {
re = /[cZ]/; // Not found.
str = createHaystack();
}
var benchmarks = [ [SimpleSearch, Search1Setup],
[SimpleSearch, Search2Setup],
[SimpleSearch, Search3Setup],
];

View File

@ -0,0 +1,56 @@
// Copyright 2016 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");
var str;
var re;
function SimpleSplit() {
str.split(re);
}
function Split1Setup() {
re = /[Cz]/;
str = createHaystack();
}
function Split2Setup() {
re = /[Cz]/u;
str = createHaystack();
}
function Split3Setup() {
re = /[Cz]/y;
str = createHaystack();
}
function Split4Setup() {
re = /[Cz]/uy;
str = createHaystack();
}
function Split5Setup() {
re = /[Cz]/;
str = "";
}
function Split6Setup() {
re = /[cZ]/; // No match.
str = createHaystack();
}
function Split7Setup() {
re = /[A-Za-z\u0080-\u00FF ]/;
str = "hipopótamo maçã pólen ñ poção água língüa";
}
var benchmarks = [ [SimpleSplit, Split1Setup],
[SimpleSplit, Split2Setup],
[SimpleSplit, Split3Setup],
[SimpleSplit, Split4Setup],
[SimpleSplit, Split5Setup],
[SimpleSplit, Split6Setup],
[SimpleSplit, Split7Setup],
];

View File

@ -0,0 +1,26 @@
// Copyright 2016 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");
var str;
var re;
function SimpleTest() {
re.test(str);
}
function Test1Setup() {
re = /[Cz]/;
str = createHaystack();
}
function Test2Setup() {
re = /[cZ]/; // Not found.
str = createHaystack();
}
var benchmarks = [ [SimpleTest, Test1Setup],
[SimpleTest, Test2Setup],
];

View File

@ -0,0 +1,29 @@
// 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 ConstCaseInsensitiveTest() {
/[a-t]/i.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz");
}
function ConstCaseInsensitiveNonLatin1Test() {
/[α-ζ]/i.test("βκςΑφabcdeβκEFGαοςερκ");
}
const icre = /[a-t]/i;
function GlobalConstCaseInsensitiveRegExpTest() {
icre.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz");
}
const icre2 = /[α-ζ]/i;
function GlobalConstCaseInsensitiveNonLatin1RegExpTest() {
icre2.test("βκςΑφabcdeβκEFGαοςερκ");
}
benchmarks = [ [ConstCaseInsensitiveTest, () => {}],
[ConstCaseInsensitiveNonLatin1Test, () => {}],
[GlobalConstCaseInsensitiveRegExpTest, () => {}],
[GlobalConstCaseInsensitiveNonLatin1RegExpTest, () => {}],
];
createBenchmarkSuite("CaseInsensitiveTest");

View File

@ -0,0 +1,46 @@
// 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.
// The following RegExp regression case from
// https://bugs.chromium.org/p/chromium/issues/detail?id=977003
let g = "[\\t\\n\\f ]";
let W = g + "*";
let h = "[\\ud800-\\udbff][\\udc00-\\udfff]";
let k = "[\\u0080-\\ud7ff\\ue000-\\ufffd]|" + h;
let U = "[0-9a-fA-F]{1,6}" + g + "?";
let E = "(?:" + U + "|[\\u0020-\\u007e\\u0080-\\ud7ff\\ue000\\ufffd]|" + h + ")";
let m = "\\\\" + E;
let o = "(?:[\\t\\x21\\x23-\\x26\\x28-\\x5b\\x5d-\\x7e]|" + k + "|" + m + ")";
let p = '[^\'"\\n\\f\\\\]|\\\\[\\s\\S]';
let q = '"(?:\'|' + p + ')*"' + '|\'(?:\"|' + p + ')*\'';
let r = "[-+]?(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)";
let t = "(?:[a-zA-Z_]|" + k + "|" + m + ")";
let u = "(?:[a-zA-Z0-9_-]|" + k + "|" + m + ")";
let v = u + "+";
let I = "-?" + t + u + "*";
let x = "(?:@?-?" + t + "|#)" + u + "*";
let y = r + "(?:%|" + I + ")?";
let z = "url[(]" + W + "(?:" + q + "|" + o + "*)" + W + "[)]";
let B = "U[+][0-9A-F?]{1,6}(?:-[0-9A-F]{1,6})?";
let C = "<\!--";
let F = "-->";
let S = g + "+";
let G = "/(?:[*][^*]*[*]+(?:[^/][^*]*[*]+)*/|/[^\\n\\f]*)";
let J = "(?!url[(])" + I + "[(]";
let R = "[~|^$*]=";
let T = '[^"\'\\\\/]|/(?![/*])';
let V = "\\uFEFF";
let Y = [V, B, z, J, x, q, y, C, F, S, G, R, T].join("|");
function ComplexGlobalCaseInsensitiveMatch() {
// keep the RegExp in the measurement but not string concat nor join.
let X = new RegExp(Y, "gi");
"abcſABCβκς".match(X);
"color:".match(X);
}
benchmarks = [ [ComplexGlobalCaseInsensitiveMatch, () => {}],
];
createBenchmarkSuite("ComplexCaseInsensitiveTest");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_ctor.js");
createBenchmarkSuite("Ctor");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_exec.js");
createBenchmarkSuite("Exec");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_flags.js");
createBenchmarkSuite("Flags");

View File

@ -0,0 +1,17 @@
// 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.
function ConstTest() {
/[Cz]/.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz");
}
const cre = /[Cz]/;
function GlobalConstTest() {
cre.test("abCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgzabCdefgz");
}
var benchmarks = [ [ConstTest, () => {}],
[GlobalConstTest, () => {}],
];
createBenchmarkSuite("InlineTest");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_match.js");
createBenchmarkSuite("Match");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_replace.js");
createBenchmarkSuite("Replace");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replace_emoji_g.js");
createBenchmarkSuite("ReplaceEmoji_g");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replace_emoji_gu.js");
createBenchmarkSuite("ReplaceEmoji_gu");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replace_emoji_gv.js");
createBenchmarkSuite("ReplaceEmoji_gv");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replaceall_emoji_g.js");
createBenchmarkSuite("ReplaceAllEmoji_g");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replaceall_emoji_gu.js");
createBenchmarkSuite("ReplaceAllEmoji_gu");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replaceall_emoji_gv.js");
createBenchmarkSuite("ReplaceAllEmoji_gv");

56
deps/v8/test/js-perf-test/RegExp/run.js vendored Normal file
View File

@ -0,0 +1,56 @@
// Copyright 2016 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('ctor.js');
d8.file.execute('exec.js');
d8.file.execute('flags.js');
d8.file.execute('inline_test.js')
d8.file.execute('complex_case_test.js');
d8.file.execute('case_test.js');
d8.file.execute('match.js');
d8.file.execute('replaceall_emoji_g.js');
d8.file.execute('replaceall_emoji_gu.js');
d8.file.execute('replaceall_emoji_gv.js');
d8.file.execute('replace_emoji_g.js');
d8.file.execute('replace_emoji_gu.js');
d8.file.execute('replace_emoji_gv.js');
d8.file.execute('replace.js');
d8.file.execute('search.js');
d8.file.execute('slow_exec.js');
d8.file.execute('slow_flags.js');
d8.file.execute('slow_match.js');
d8.file.execute('slow_replaceall_emoji_g.js');
d8.file.execute('slow_replaceall_emoji_gu.js');
d8.file.execute('slow_replaceall_emoji_gv.js');
d8.file.execute('slow_replace_emoji_g.js');
d8.file.execute('slow_replace_emoji_gu.js');
d8.file.execute('slow_replace_emoji_gv.js');
d8.file.execute('slow_replace.js');
d8.file.execute('slow_search.js');
d8.file.execute('slow_split.js');
d8.file.execute('slow_test.js');
d8.file.execute('split.js');
d8.file.execute('test.js');
var success = true;
function PrintResult(name, result) {
print(name + '-RegExp(Score): ' + result);
}
function PrintError(name, error) {
PrintResult(name, error);
success = false;
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError });

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_search.js");
createBenchmarkSuite("Search");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_exec.js");
createSlowBenchmarkSuite("Exec");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_flags.js");
createSlowBenchmarkSuite("Flags");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_match.js");
createSlowBenchmarkSuite("Match");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_replace.js");
createSlowBenchmarkSuite("Replace");

View File

@ -0,0 +1,7 @@
// Copyright 2016 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("base_replace_emoji_g.js");
createSlowBenchmarkSuite("ReplaceEmoji_g");

View File

@ -0,0 +1,7 @@
// Copyright 2016 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("base_replace_emoji_gu.js");
createSlowBenchmarkSuite("ReplaceEmoji_gu");

View File

@ -0,0 +1,7 @@
// Copyright 2016 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("base_replace_emoji_gv.js");
createSlowBenchmarkSuite("ReplaceEmoji_gv");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replaceall_emoji_g.js");
createSlowBenchmarkSuite("ReplaceAllEmoji_g");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replaceall_emoji_gu.js");
createSlowBenchmarkSuite("ReplaceAllEmoji_gu");

View File

@ -0,0 +1,7 @@
// Copyright 2024 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("base_replaceall_emoji_gv.js");
createSlowBenchmarkSuite("ReplaceAllEmoji_gv");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_search.js");
createSlowBenchmarkSuite("Search");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_split.js");
createSlowBenchmarkSuite("Split");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_test.js");
createSlowBenchmarkSuite("Test");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_split.js");
createBenchmarkSuite("Split");

View File

@ -0,0 +1,8 @@
// Copyright 2016 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("base_test.js");
createBenchmarkSuite("Test");