// This is similar to the corresponding JIT exit stub test in the // wasm/import-export.js file, but it also tests BigInt cases.
(function testImportJitExit() {
let options = getJitCompilerOptions(); if (!options["baseline.enable"]) return;
let baselineTrigger = options["baseline.warmup.trigger"];
let valueToConvert = 0; function ffi(n) { if (n == 1337n) { return BigInt(valueToConvert);
} return 42n;
}
// This case is intended to test that the I64 to BigInt argument // filling for the JIT exit stub does not interfere with the other // argument registers. It's important that the BigInt argument comes // first (to test that it doesn't clobber the subsequent ones). function ffi2(n, x1, x2, x3, x4, x5, x6) { return (
42n +
BigInt(x1) +
BigInt(x2) +
BigInt(x3) +
BigInt(x4) +
BigInt(x5) +
BigInt(x6)
);
}
// This case is for testing issues with potential GC. function ffi3(n1, n2, n3, n4) { return n3;
}
// Baseline compile ffis. for (let i = baselineTrigger + 1; i-- > 0; ) {
ffi(BigInt(i));
ffi2(BigInt(i), i, i, i, i, i, i);
ffi3(BigInt(i), BigInt(i), BigInt(i), BigInt(i));
}
// Enable the jit exit for each JS callee.
assertEq(ex.callffi(0n), 42n);
assertEq(ex.callffi2(2, 0n), 54n);
assertEq(ex.callffi3(0n, 1n, 2n, 3n), 2n);
// Test the jit exit under normal conditions.
assertEq(ex.callffi(0n), 42n);
assertEq(ex.callffi(1337n), 0n);
assertEq(ex.callffi2(2, 0n), 54n);
assertEq(ex.callffi3(0n, 1n, 2n, 3n), 2n);
// Test the jit exit with GC stress in order to ensure that // any trigger of GC in the stub do not cause errors. if (this.gczeal) { this.gczeal(2, 1); // Collect on every allocation
} for (let i = 0; i < 1000; i++) {
assertEq(ex.callffi3(0n, 1n, 2n, 3n), 2n);
}
})();
// Test JIT entry stub
(function testJitEntry() {
let options = getJitCompilerOptions(); if (!options["baseline.enable"]) return;
let baselineTrigger = options["baseline.warmup.trigger"];
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.