From 55706b4e2baec11bdff5a1a10946d79605936277 Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Fri, 26 May 2023 21:27:58 +0530 Subject: [PATCH] doc,vm: clarify usage of cachedData in vm.compileFunction() Fixes: https://github.com/nodejs/node/issues/48175 Signed-off-by: Darshan Sen --- doc/api/vm.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/vm.md b/doc/api/vm.md index 7631b39353b7d2..19d39c77a01720 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1005,7 +1005,8 @@ changes: is displayed in stack traces produced by this script. **Default:** `0`. * `cachedData` {Buffer|TypedArray|DataView} Provides an optional `Buffer` or `TypedArray`, or `DataView` with V8's code cache data for the supplied - source. + source. This must be produced by a prior call to [`vm.compileFunction()`][] + with the same `code` and `params`. * `produceCachedData` {boolean} Specifies whether to produce new cache data. **Default:** `false`. * `parsingContext` {Object} The [contextified][] object in which the said @@ -1593,6 +1594,7 @@ are not controllable through the timeout either. [`script.runInContext()`]: #scriptrunincontextcontextifiedobject-options [`script.runInThisContext()`]: #scriptruninthiscontextoptions [`url.origin`]: url.md#urlorigin +[`vm.compileFunction()`]: #vmcompilefunctioncode-params-options [`vm.createContext()`]: #vmcreatecontextcontextobject-options [`vm.runInContext()`]: #vmrunincontextcode-contextifiedobject-options [`vm.runInThisContext()`]: #vmruninthiscontextcode-options