haikuwebkit/PerformanceTests/ARES-6/babylon_benchmark.js

69 lines
2.4 KiB
JavaScript
Raw Permalink Normal View History

Add a new test to ARES6 https://bugs.webkit.org/show_bug.cgi?id=170077 Rubber stamped by Filip Pizlo. This patch adds a new test to ARES6. The test is called Babylon. Babylon is the JavaScript parser that is part of the Babel transpiler. The test runs the parser on 4 different JS scripts. * ARES-6/Babylon: Added. * ARES-6/Babylon/AUTHORS: Added. * ARES-6/Babylon/air-blob.js: Added. (Reg): (Reg.fromReg): (Reg.prototype.get index): (Reg.prototype.get type): (Reg.prototype.get name): (Reg.prototype.get isCalleeSave): (Reg.prototype.get isReg): (Reg.prototype.hash): (Reg.prototype.toString): (Reg.extract): (Reg.forEachFast): (Reg.forEach): (newGPR): (Reg.gprs.Reg.fprs.Reg.calleeSaveGPRs.Reg.calleeSaveFPRs.Reg.calleeSaves): * ARES-6/Babylon/babylon-blob.js: Added. (export.default.Parser): (export.default.Parser.prototype.isReservedWord): (export.default.Parser.prototype.hasPlugin): (export.default.Parser.prototype.extend): (export.default.Parser.prototype.loadPlugins): (export.default.Parser.prototype.parse): * ARES-6/Babylon/basic-blob.js: Added. (Basic.NumberApply): (Basic.Variable): (Basic.Const): (Basic.NumberPow): (Basic.NumberMul): (Basic.NumberDiv): (Basic.NumberNeg): (Basic.NumberAdd): (Basic.NumberSub): (Basic.StringVar): (Basic.Equals): (Basic.NotEquals): (Basic.LessThan): (Basic.GreaterThan): (Basic.LessEqual): (Basic.GreaterEqual): (Basic.GoTo): (Basic.GoSub): (Basic.Def): (Basic.Let): (Basic.If): (Basic.Return): (Basic.Stop): (Basic.On): (sideState.shouldStop): (Basic.For): (Basic.Next): (Basic.Print): (Basic.Input): (Basic.Read): (Basic.Restore): (Basic.Dim): (Basic.Randomize): (Basic.End): (Basic.Program): * ARES-6/Babylon/benchmark.js: Added. (this.performance.performance.now.currentTime): (else.this.preciseTime.currentTime): (else.currentTime): (BabylonBenchmark.appendSource): (BabylonBenchmark): (BabylonBenchmark.prototype.runIteration.parse): (BabylonBenchmark.prototype.runIteration.parseExpression): (BabylonBenchmark.prototype.runIteration): (runBenchmark): * ARES-6/Babylon/index.js: Added. (isIdentifierStart): (isIdentifierChar): (isNewLine): (Position): (SourceLocation): (getLineInfo): (TokenType): (KeywordTokenType): (BinopTokenType): (TokContext): (tt.parenR.updateContext.tt.braceR.updateContext): (tt.name.updateContext): (tt.braceL.updateContext): (tt.dollarBraceL.updateContext): (tt.parenL.updateContext): (tt.incDec.updateContext): (tt._function.updateContext): (tt.backQuote.updateContext): (State.prototype.init): (State.prototype.curPosition): (State.prototype.clone): (State): (Token): (codePointToString): (Tokenizer): (Tokenizer.prototype.next): (Tokenizer.prototype.eat): (Tokenizer.prototype.match): (Tokenizer.prototype.isKeyword): (Tokenizer.prototype.lookahead): (Tokenizer.prototype.setStrict): (Tokenizer.prototype.curContext): (Tokenizer.prototype.nextToken): (Tokenizer.prototype.readToken): (Tokenizer.prototype.fullCharCodeAtPos): (Tokenizer.prototype.pushComment): (Tokenizer.prototype.skipBlockComment): (Tokenizer.prototype.skipLineComment): (Tokenizer.prototype.skipSpace): (Tokenizer.prototype.finishToken): (Tokenizer.prototype.readToken_dot): (Tokenizer.prototype.readToken_slash): (Tokenizer.prototype.readToken_mult_modulo): (Tokenizer.prototype.readToken_pipe_amp): (Tokenizer.prototype.readToken_caret): (Tokenizer.prototype.readToken_plus_min): (Tokenizer.prototype.readToken_lt_gt): (Tokenizer.prototype.readToken_eq_excl): (Tokenizer.prototype.getTokenFromCode): (Tokenizer.prototype.finishOp): (Tokenizer.prototype.readRegexp): (Tokenizer.prototype.readInt): (Tokenizer.prototype.readRadixNumber): (Tokenizer.prototype.readNumber): (Tokenizer.prototype.readCodePoint): (Tokenizer.prototype.readString): (Tokenizer.prototype.readTmplToken): (Tokenizer.prototype.readEscapedChar): (Tokenizer.prototype.readHexChar): (Tokenizer.prototype.readWord1): (Tokenizer.prototype.readWord): (Tokenizer.prototype.braceIsBlock): (Tokenizer.prototype.updateContext): (getOptions): (prototype.isReservedWord): (prototype.hasPlugin): (prototype.extend): (prototype.loadPlugins): (prototype.parse): (last): (pp.addComment): (pp.processComment): (pp.checkPropClash): (pp.getExpression): (pp.parseExpression): (pp.parseMaybeAssign): (pos.set i): * ARES-6/Babylon/inspector-blob.js: Added. (WebInspector.ScriptSyntaxTree): (WebInspector.ScriptSyntaxTree.prototype.get parsedSuccessfully): (WebInspector.ScriptSyntaxTree.prototype.forEachNode): (WebInspector.ScriptSyntaxTree.prototype.filter): (WebInspector.ScriptSyntaxTree.prototype.containersOfOffset): (WebInspector.ScriptSyntaxTree.prototype.filterByRange.filterForNodesInRange): (WebInspector.ScriptSyntaxTree.prototype.filterByRange): (WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement.removeFunctionsFilter): (WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement): (WebInspector.ScriptSyntaxTree.functionReturnDivot): (WebInspector.ScriptSyntaxTree.prototype.updateTypes): (WebInspector.ScriptSyntaxTree.prototype._gatherIdentifiersInDeclaration.gatherIdentifiers): (WebInspector.ScriptSyntaxTree.prototype._gatherIdentifiersInDeclaration): (WebInspector.ScriptSyntaxTree.prototype._defaultParserState): (WebInspector.ScriptSyntaxTree.prototype._recurse): (WebInspector.ScriptSyntaxTree.prototype._recurseArray): (WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree): * ARES-6/about.html: * ARES-6/babylon_benchmark.js: Added. * ARES-6/cli.js: * ARES-6/glue.js: * ARES-6/index.html: * ARES-6/results.js: (Results.prototype.reportResult): (Results.prototype.reportResult.averageAbovePercentile): Deleted. * ARES-6/styles.css: (.test): (@media only screen and (max-width: 784px)): Canonical link: https://commits.webkit.org/187329@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-03 19:04:16 +00:00
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
"use strict";
const BabylonBenchmarkCode = String.raw`
<script src="Babylon/index.js"></script>
<script src="Babylon/benchmark.js"></script>
<script>
var results = [];
var benchmark = new BabylonBenchmark();
var numIterations = 200;
for (var i = 0; i < numIterations; ++i) {
var before = currentTime();
benchmark.runIteration();
var after = currentTime();
results.push(after - before);
}
reportResult(results);
</script>`;
let runBabylonBenchmark = null;
if (!isInBrowser) {
let sources = [
"Babylon/index.js"
, "Babylon/benchmark.js"
];
runBabylonBenchmark = makeBenchmarkRunner(sources, "BabylonBenchmark");
}
const BabylonBenchmarkRunner = {
name: "Babylon",
code: BabylonBenchmarkCode,
run: runBabylonBenchmark,
cells: {}
};
if (isInBrowser) {
BabylonBenchmarkRunner.cells = {
firstIteration: document.getElementById("BabylonFirstIteration"),
averageWorstCase: document.getElementById("BabylonAverageWorstCase"),
steadyState: document.getElementById("BabylonSteadyState"),
message: document.getElementById("BabylonMessage")
};
}