node/test/parallel/test-process-hrtime-bigint.js
Renegade334 5ac6ee7716 process: fix hrtime fast call signatures
PR-URL: https://github.com/nodejs/node/pull/59600
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2025-09-24 14:11:35 +00:00

28 lines
803 B
JavaScript

// Flags: --allow-natives-syntax --expose-internals --no-warnings
'use strict';
// Tests that process.hrtime.bigint() works.
const common = require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const start = process.hrtime.bigint();
assert.strictEqual(typeof start, 'bigint');
const end = process.hrtime.bigint();
assert.strictEqual(typeof end, 'bigint');
assert(end - start >= 0n);
eval('%PrepareFunctionForOptimization(process.hrtime.bigint)');
assert(process.hrtime.bigint());
eval('%OptimizeFunctionOnNextCall(process.hrtime.bigint)');
assert(process.hrtime.bigint());
if (common.isDebug) {
const { getV8FastApiCallCount } = internalBinding('debug');
assert.strictEqual(getV8FastApiCallCount('process.hrtimeBigInt'), 1);
}