0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 03:07:54 +01:00
nodejs/typings/globals.d.ts
Michaël Zasso 1d35a066e7
src,test: ensure that V8 fast APIs are called
Adds a debug-only macro that can be used to track when a V8 fast API is
called. A map of counters is maintained in in thread-local storage and
an internal API can be called to get the total count associated with
a call id.
Specific tests are added and `crypto.timingSafeEqual` as well as
internal documentation are updated to show how to use the macro
and test fast API calls without running long loops.

PR-URL: https://github.com/nodejs/node/pull/54317
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2024-08-13 12:37:02 +00:00

67 lines
2.1 KiB
TypeScript

import { AsyncWrapBinding } from './internalBinding/async_wrap';
import { BlobBinding } from './internalBinding/blob';
import { ConfigBinding } from './internalBinding/config';
import { ConstantsBinding } from './internalBinding/constants';
import { DebugBinding } from './internalBinding/debug';
import { HttpParserBinding } from './internalBinding/http_parser';
import { FsBinding } from './internalBinding/fs';
import { FsDirBinding } from './internalBinding/fs_dir';
import { MessagingBinding } from './internalBinding/messaging';
import { OptionsBinding } from './internalBinding/options';
import { OSBinding } from './internalBinding/os';
import { SerdesBinding } from './internalBinding/serdes';
import { SymbolsBinding } from './internalBinding/symbols';
import { TimersBinding } from './internalBinding/timers';
import { TypesBinding } from './internalBinding/types';
import { URLBinding } from './internalBinding/url';
import { UtilBinding } from './internalBinding/util';
import { WorkerBinding } from './internalBinding/worker';
import { ModulesBinding } from './internalBinding/modules';
declare type TypedArray =
| Uint8Array
| Uint8ClampedArray
| Uint16Array
| Uint32Array
| Int8Array
| Int16Array
| Int32Array
| Float32Array
| Float64Array
| BigUint64Array
| BigInt64Array;
interface InternalBindingMap {
async_wrap: AsyncWrapBinding;
blob: BlobBinding;
config: ConfigBinding;
constants: ConstantsBinding;
debug: DebugBinding;
fs: FsBinding;
fs_dir: FsDirBinding;
http_parser: HttpParserBinding;
messaging: MessagingBinding;
modules: ModulesBinding;
options: OptionsBinding;
os: OSBinding;
serdes: SerdesBinding;
symbols: SymbolsBinding;
timers: TimersBinding;
types: TypesBinding;
url: URLBinding;
util: UtilBinding;
worker: WorkerBinding;
}
type InternalBindingKeys = keyof InternalBindingMap;
declare function internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T]
declare global {
namespace NodeJS {
interface Global {
internalBinding<T extends InternalBindingKeys>(binding: T): InternalBindingMap[T]
}
}
}