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

Quelle  access-formals.js   Sprache: JAVA

 
function g1(x, args) {
    args[0] = 88;
}

// We assume we can optimize arguments access in |f|.
//
// Then the apply-call invalidates the arguments optimization,
// and creates a real arguments object.
//
// Test that x and y fetch the values from the args object when
// that happens.
function f1(x, y, o) {
    var res = 0;
    for (var i=0; i<50; i++) {
 res += x + y;
 if (i > 10)
     o.apply(null, arguments);
    }
    return res;
}

var o1 = {apply: g1};
assertEq(f1(3, 5, o1), 3630);
assertEq(f1(3, 5, o1), 3630);

// In strict mode, the arguments object does not alias formals.
function g2(x, args) {
    args[0] = 88;
}

function f2(x, y, o) {
    "use strict";
    var res = 0;
    for (var i=0; i<50; i++) {
 res += x + y;
 if (i > 10)
     o.apply(null, arguments);
    }
    return res;
}

var o2 = {apply: g2};
assertEq(f2(3, 5, o2), 400);
assertEq(f2(3, 5, o2), 400);

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

¤ 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.