import { type Newable } from '@inversifyjs/common'; import { type ResolutionParams } from '../../resolution/models/ResolutionParams.js'; import { type Resolved } from '../../resolution/models/Resolved.js'; /** * Builds a `resolveNode` for a zero-argument instance binding by generating * a brand new function via the `Function` constructor for every binding. * * This is not just an inlining trick: the `Function` constructor result is * cached by V8 keyed on the *exact source text* passed to it. If every * binding generated the exact same source text (e.g. always naming the * constructor parameter `ctor`), V8 would transparently reuse the very same * compiled function (and its feedback vector) for every binding sharing * this code path. Since that single shared `new ctor()` call site would * then observe a different class on every binding, its type feedback would * become polymorphic/megamorphic across all of them, defeating the purpose * of generating specialized code and forcing V8 back to the generic, * non-inlined construction path. * * Suffixing every identifier with a per-binding id keeps the source text * (and therefore the compiled function and its feedback) unique per * binding, so the `new ctor()` call site stays monomorphic and V8 can * inline/optimize it as if it had been hand-written for that one class. */ export declare function buildZeroConstructorArgumentsResolverJit(implementationType: Newable, resolveActivations?: (params: ResolutionParams, instance: Resolved) => Resolved): (params: ResolutionParams) => Resolved; //# sourceMappingURL=buildZeroConstructorArgumentsResolverJit.d.ts.map