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,52 @@
// 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() {
function Simple() {
new Error("Simple Error");
}
class CustomError extends Error {};
function Custom() {
new CustomError("Custom Error");
}
function Inline() {
function Inner() {
new Error("Error from inlined function!");
}
function Middle() { Inner(); }
function Outer() { Middle(); }
%PrepareFunctionForOptimization(Outer);
Outer();
Outer();
%OptimizeFunctionOnNextCall(Outer);
Outer();
}
const kInitialRecursionValue = 10;
function Recursive() {
function StepOne(val) {
if (val <= 0) return new Error("Error in StepOne!");
StepTwo(val - 3);
StepTwo(val - 4);
}
function StepTwo(val) {
if (val <= 0) return new Error("Error in StepTwo!");
StepOne(val - 1);
StepOne(val - 2);
}
StepOne(kInitialRecursionValue);
}
createSuite('Simple-Capture-Error', 1000, Simple, () => {});
createSuite('Custom-Capture-Error', 1000, Custom, () => {});
createSuite('Inline-Capture-Error', 1000, Inline, () => {});
createSuite('Recursive-Capture-Error', 1000, Recursive, () => {});
})();

View File

@ -0,0 +1,25 @@
// 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.
d8.file.execute('../base.js');
d8.file.execute('serialize.js');
d8.file.execute('capture.js');
function PrintResult(name, result) {
print(name + '-StackTrace(Score): ' + result);
}
function PrintStep(name) {}
function PrintError(name, error) {
PrintResult(name, error);
}
BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;
BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
NotifyError: PrintError,
NotifyStep: PrintStep });

View File

@ -0,0 +1,89 @@
// 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() {
const kErrorCount = 100000;
let errorsCreatedBySetup;
function CreateErrors(fn) {
counter = 0;
errorsCreatedBySetup = [];
for (let i = 0; i < kErrorCount; ++i) {
errorsCreatedBySetup[i] = fn();
}
}
function SimpleSetup() {
CreateErrors(() => new Error("Simple Error"));
}
class CustomError extends Error {};
function CustomSetup() {
CreateErrors(() => new CustomError("Custom Error"));
}
function InlineSetup() {
function Inner() {
return new Error("Throwing from inlined function!");
}
function Middle() { return Inner(); }
function Outer() { return Middle(); }
%PrepareFunctionForOptimization(Outer);
Outer();
Outer();
%OptimizeFunctionOnNextCall(Outer);
Outer();
CreateErrors(() => Outer());
}
const kInitialRecursionValue = 12;
function RecursiveSetup() {
counter = 0;
errorsCreatedBySetup = [];
function StepOne(val) {
if (val <= 0) {
errorsCreatedBySetup.push(new Error("Error in StepOne!"));
return;
}
StepTwo(val - 3);
StepTwo(val - 4);
}
function StepTwo(val) {
if (val <= 0) {
errorsCreatedBySetup.push(new Error("Error in StepTwo!"));
return;
}
StepOne(val - 1);
StepOne(val - 2);
}
while (errorsCreatedBySetup.length < kErrorCount) {
StepOne(kInitialRecursionValue);
}
}
let counter;
function SerializeStack() {
if (counter < errorsCreatedBySetup.length) {
// Trigger serialization by accessing Error.stack.
%FlattenString(errorsCreatedBySetup[counter++].stack);
} else {
// All errors are serialized. The stack trace string is now cached, so
// re-iterating the array is a simple property lookup. Instead,
// a simple Error object is created and serialized, otherwise the benchmark
// result would fluctuate heavily if it reaches the end.
%FlattenString(new Error().stack);
}
}
createSuite('Simple-Serialize-Error.stack', 1000, SerializeStack, SimpleSetup);
createSuite('Custom-Serialize-Error.stack', 1000, SerializeStack, CustomSetup);
createSuite('Inline-Serialize-Error.stack', 1000, SerializeStack, InlineSetup);
createSuite('Recursive-Serialize-Error.stack', 1000, SerializeStack, RecursiveSetup);
})();