forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv8.js
More file actions
39 lines (33 loc) · 1.3 KB
/
v8.js
File metadata and controls
39 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
// This file provides access to some of V8's native runtime functions. See
// https://github.com/v8/v8/wiki/Built-in-functions for further information
// about their implementation.
// They have to be loaded before anything else to make sure we deactivate them
// before executing any other code. Gaining access is achieved by using a
// specific flag that is used internally in the startup phase.
// Clone the provided Map Iterator.
function previewMapIterator(it) {
return %MapIteratorClone(it);
}
// Clone the provided Set Iterator.
function previewSetIterator(it) {
return %SetIteratorClone(it);
}
// Retrieve all WeakMap instance key / value pairs up to `max`. `max` limits the
// number of key / value pairs returned. Make sure it is a positive number,
// otherwise V8 aborts. Passing through `0` returns all elements.
function previewWeakMap(weakMap, max) {
return %GetWeakMapEntries(weakMap, max);
}
// Retrieve all WeakSet instance values up to `max`. `max` limits the
// number of key / value pairs returned. Make sure it is a positive number,
// otherwise V8 aborts. Passing through `0` returns all elements.
function previewWeakSet(weakSet, max) {
return %GetWeakSetValues(weakSet, max);
}
module.exports = {
previewMapIterator,
previewSetIterator,
previewWeakMap,
previewWeakSet
};