Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/cacheir/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  call-any-native.js   Sprache: JAVA

 
// Test non-constructor calls

var funcs = [Math.max, Math.min, Math.floor, Math.ceil, Math.sin,
             Math.cos, Math.tan, Math.log, Math.acos, Math.asin];

// Calculate expected values
var expected = [Math.max(0.5, 2), Math.min(0.5, 2),
                Math.floor(0.5, 2), Math.ceil(0.5, 2),
                Math.sin(0.5, 2), Math.cos(0.5, 2),
                Math.tan(0.5, 2), Math.log(0.5, 2),
                Math.acos(0.5, 2), Math.asin(0.5, 2)];

// Test a polymorphic call site
for (var n = 0; n < 50; n++) {
    for (var i = 0; i < funcs.length; i++) {
        assertEq(funcs[i](0.5, 2), expected[i]);
    }
}

// Test a polymorphic spread call site
var spreadinput = [0.5, 2];
for (var n = 0; n < 50; n++) {
    for (var i = 0; i < funcs.length; i++) {
        assertEq(funcs[i](...spreadinput), expected[i]);
    }
}

// Test constructors

function f1(x) {this[0] = x; this.length = 3;}
function f2(x) {this[0] = x; this.length = 3;}
function f3(x) {this[0] = x; this.length = 3;}
function f4(x) {this[0] = x; this.length = 3;}
function f5(x) {this[0] = x; this.length = 3;}
function f6(x) {this[0] = x; this.length = 3;}
function f7(x) {this[0] = x; this.length = 3;}
function f8(x) {this[0] = x; this.length = 3;}
function f9(x) {this[0] = x; this.length = 3;}

var constructors = [f1,f2,f3,f4,f5,f6,f7,f8,f9,Array];

// Test a polymorphic constructor site
for (var n = 0; n < 50; n++) {
    for (var i = 0; i < constructors.length; i++) {
        let x = new constructors[i](1,2,3);
        assertEq(x.length, 3);
        assertEq(x[0], 1);
    }
}

var constructorinput = [1,2,3];
// Test a polymorphic spread constructor site
for (var n = 0; n < 50; n++) {
    for (var i = 0; i < constructors.length; i++) {
        let x = new constructors[i](...constructorinput);
        assertEq(x.length, 3);
        assertEq(x[0], 1);
    }
}

Messung V0.5
C=96 H=91 G=93

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.