summaryrefslogtreecommitdiff
path: root/doc/api/vm.md
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2018-06-28 12:05:19 +0530
committerMichaƫl Zasso <targos@protonmail.com>2018-08-29 16:41:01 +0200
commit1abbe0a2123e8333922894258389c2d5c1568472 (patch)
tree606df1005680a3769966b19f98c740ff5576f748 /doc/api/vm.md
parent1a25f9639a9668d8ea90022b0f3d3b47d29971b6 (diff)
downloadandroid-node-v8-1abbe0a2123e8333922894258389c2d5c1568472.tar.gz
android-node-v8-1abbe0a2123e8333922894258389c2d5c1568472.tar.bz2
android-node-v8-1abbe0a2123e8333922894258389c2d5c1568472.zip
vm: add bindings for v8::CompileFunctionInContext
Adds a method compileFunction to the vm module, which serves as a binding for v8::CompileFunctionInContext with appropriate args for specifying the details, and provide params for the wrapper. Eventually, we would be changing Module._compile to use this internally over the standard Module.wrap PR-URL: https://github.com/nodejs/node/pull/21571 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc/api/vm.md')
-rw-r--r--doc/api/vm.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/api/vm.md b/doc/api/vm.md
index defa029821..e7aafb9e74 100644
--- a/doc/api/vm.md
+++ b/doc/api/vm.md
@@ -637,6 +637,34 @@ console.log(globalVar);
// 1000
```
+## vm.compileFunction(code[, params[, options]])
+<!-- YAML
+added: REPLACEME
+-->
+* `code` {string} The body of the function to compile.
+* `params` {string[]} An array of strings containing all parameters for the
+ function.
+* `options` {Object}
+ * `filename` {string} Specifies the filename used in stack traces produced
+ by this script. **Default:** `''`.
+ * `lineOffset` {number} Specifies the line number offset that is displayed
+ in stack traces produced by this script. **Default:** `0`.
+ * `columnOffset` {number} Specifies the column number offset that is displayed
+ in stack traces produced by this script. **Default:** `0`.
+ * `cachedData` {Buffer} Provides an optional `Buffer` with V8's code cache
+ data for the supplied source.
+ * `produceCachedData` {boolean} Specifies whether to produce new cache data.
+ **Default:** `false`.
+ * `parsingContext` {Object} The sandbox/context in which the said function
+ should be compiled in.
+ * `contextExtensions` {Object[]} An array containing a collection of context
+ extensions (objects wrapping the current scope) to be applied while
+ compiling. **Default:** `[]`.
+
+Compiles the given code into the provided context/sandbox (if no context is
+supplied, the current context is used), and returns it wrapped inside a
+function with the given `params`.
+
## vm.createContext([sandbox[, options]])
<!-- YAML
added: v0.3.1