Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v14.14.0 proposal #35648

Merged
merged 82 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
f544f7a
lib: replace Float64Array global with primordials
Sebastien-Ahkrin Jan 6, 2020
d6ba4ec
lib: replace Int32Array global with primordials
Sebastien-Ahkrin Jan 6, 2020
ebf3900
lib: replace Int8Array global with primordials
Sebastien-Ahkrin Jan 6, 2020
30c6b3e
lib: replace String global with primordials
Sebastien-Ahkrin Jan 6, 2020
8cdc59b
doc: fix YAML syntax errors
aduh95 Oct 6, 2020
3a77d1e
test: adjust comments for upcoming lint rule
Trott Oct 3, 2020
e8434d8
tools,test: enable multiline-comment-style rule in tests
Trott Oct 3, 2020
3c90b1a
errors: support possible deletion of globalThis.Error
targos Sep 28, 2020
77f1e1e
lib: use global Error constructors from primordials
targos Sep 28, 2020
5d727f0
lib: use Number.parseInt from primordials
targos Sep 28, 2020
7e8fdd3
lib: use Number.parseFloat from primordials
targos Sep 28, 2020
fa171db
lib: use remaining typed arrays from primordials
targos Sep 28, 2020
8877430
doc: add aduh95 to collaborators
aduh95 Oct 7, 2020
c995242
n-api: support for object freeze/seal
codebytere Sep 26, 2020
2f13199
http: make response.setTimeout() work
bnoordhuis Jun 9, 2020
93f947a
src: expose v8::Isolate setup callbacks
codebytere Oct 5, 2020
2e67d65
src: fix freeing unintialized pointer bug in ParseSoaReply
AasthaGupta Oct 4, 2020
d53cfcd
doc: improve kbd element rendering
Trott Oct 4, 2020
f552e5c
build: improved release lint error message
codebytere Oct 6, 2020
1610728
fs: add rm method
iansu Oct 4, 2020
7092756
lib: change http client path assignment
dekinderfiets Oct 5, 2020
328c624
doc: fix util.inspect change history
aduh95 Oct 6, 2020
51b988b
doc: fix deprecation history
aduh95 Oct 1, 2020
01c9c59
doc: add history entry for exports patterns
aduh95 Sep 29, 2020
85dc84d
doc: use sentence case for class property
Trott Oct 7, 2020
7685297
test: add ALPNProtocols option to clientOptions
lpinca Oct 3, 2020
9c74d45
build: fuzzer that targets node::LoadEnvironment()
DavidKorczynski Aug 19, 2020
84c0ade
build: add Commit Queue actions url to failure comment
lundibundi Sep 15, 2020
863ba4b
doc: refactor the n-api matrix
mhdawson Oct 9, 2020
e8fcbc8
build: fix landed message for multiple commits in commit-queue
lundibundi Sep 16, 2020
a555246
doc: harmonize YAML comments style in deprecations.md
aduh95 Oct 1, 2020
02bf73e
doc: remove outstanding YAML comment
aduh95 Oct 1, 2020
b3f15b7
doc: fix missing PR-URLs in YAML comments
aduh95 Oct 1, 2020
28c94ca
doc: harmonize version list style in YAML comments
aduh95 Oct 1, 2020
bd34410
Revert "tools: add missing uv_setup_argv() calls"
BethGriggs Oct 14, 2020
b730528
build: gitHub actions: Python 3.9 and actions/setup-python@v2
cclauss Oct 6, 2020
8cacca0
doc: changes description must end with a period
aduh95 Oct 1, 2020
62755b6
doc: harmonize changes list ordering
aduh95 Oct 1, 2020
7d1cdd4
doc: move package.import content higher
MylesBorins Oct 7, 2020
6ff152c
http: allow passing array of key/val into writeHead
ronag Sep 20, 2020
c865b02
doc: improve SIGINT error text
Trott Oct 8, 2020
4164477
doc: simplify wording in tracing APIs doc
PoojaDurgad Oct 8, 2020
541082c
src: move node_process to modern THROW_ERR*
jasnell Oct 2, 2020
5946b1e
src: move node_contextify to modern THROW_ERR_*
jasnell Oct 2, 2020
ddf13e0
doc: make fs.rm()'s force docs consistent
cjihrig Oct 8, 2020
b074717
doc: remove incorrect synchronous label
cjihrig Oct 8, 2020
8e3b11a
fs: use errno constant with ERR_FS_EISDIR
cjihrig Oct 8, 2020
1fadcf2
fs: simplify validateRmOptions() error handling
cjihrig Oct 9, 2020
1ad9aca
fs: remove extraneous assignments in rmdir()
cjihrig Oct 9, 2020
64ebbdd
doc: fixup perf_hooks
aduh95 Oct 6, 2020
a19b320
tools: bump cpplint.py to 1.4.6
Trott Oct 9, 2020
2992d0b
tools: refloat 7 Node.js patches to cpplint.py
Trott Oct 9, 2020
937fa5d
fs: use validateBoolean() in rm/rmdir validation
cjihrig Oct 9, 2020
3a401b8
fs: update rm/rmdir validation messages
cjihrig Oct 11, 2020
4d1d3f4
src: reduced substring calls
yashLadha Aug 17, 2020
cb2f6ff
module: use Wasm CJS lexer when available
guybedford Oct 10, 2020
970975b
doc: use kbd element in process doc
Trott Oct 10, 2020
c1bb364
doc: run license builder
MylesBorins Oct 9, 2020
9d1b7ac
doc: edit fs.md for minor style changes
Trott Oct 5, 2020
809cd07
doc: document rmdir/recursive deprecation
bcoe Oct 9, 2020
4a2ba43
test: do not use the same EventEmitter instance
lpinca Oct 8, 2020
4025fc8
doc: add PoojaDurgad as a triager
PoojaDurgad Sep 11, 2020
59a2cb5
inspector: do not hardcode Debugger.CallFrameId in tests
dgozman Oct 9, 2020
7e7afc5
crypto: update certdata to NSS 3.56
codebytere Oct 7, 2020
cad86d4
doc: add symlink information for process.execpath
PoojaDurgad Oct 10, 2020
16f8298
doc: revise description of process.ppid
PoojaDurgad Oct 10, 2020
9288f9d
doc: harmonize YAML comments
aduh95 Oct 9, 2020
cd0b136
lib: fix readFile flag option typo
Sep 22, 2020
939f8e8
fs: throw rm() validation errors
cjihrig Oct 11, 2020
3d21792
test: mark test-webcrypto-encrypt-decrypt-aes flaky
jasnell Oct 10, 2020
00eff4a
doc: add missing deprecation number
bcoe Oct 13, 2020
41d7500
doc: fix unit of size argument of readable.read
tniessen Sep 4, 2020
a3c7f8e
fs: rimraf should not recurse on failure
bcoe Oct 9, 2020
78259b6
doc: add doc for starting ci job via label
juanarbol Oct 7, 2020
6284f0d
doc: use test username instead of real
PoojaDurgad Oct 12, 2020
16c17dd
build: fix Commit Queue failure comment
aduh95 Oct 11, 2020
0c87776
doc: document Buffer.concat may use internal pool
puzpuzpuz Oct 7, 2020
b8529a7
deps: V8: cherry-pick 3176bfd447a9
addaleax Oct 12, 2020
775af7a
test: add regression test for v8.getHeapSnapshot() crash
addaleax Oct 12, 2020
b82fc40
module: cjs-module-lexer@0.4.1 big endian fix
guybedford Oct 13, 2020
573410f
stream: multiple stream backports
ronag Oct 10, 2020
354b6a9
2020-10-15, Version 14.14.0 (Current)
MylesBorins Oct 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/auto-start-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2

# Install dependencies
- name: Install jq
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-tarball.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ env:
jobs:
build-tarball:
env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand All @@ -39,13 +39,13 @@ jobs:
path: tarballs
test-tarball-linux:
env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
needs: build-tarball
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- v[0-9]+.x

env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
FLAKY_TESTS: dontcare

jobs:
Expand All @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install deps
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- v[0-9]+.x

env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
NODE_VERSION: 10.x

jobs:
Expand All @@ -30,7 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
- 'doc/**'

env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
FLAKY_TESTS: dontcare

jobs:
Expand All @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- v[0-9]+.x

env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
FLAKY_TESTS: dontcare

jobs:
Expand All @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- v[0-9]+.x

env:
PYTHON_VERSION: 3.8
PYTHON_VERSION: 3.9
FLAKY_TESTS: dontcare

jobs:
Expand All @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Environment Information
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ release.
</tr>
<tr>
<td valign="top">
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.13.1">14.13.1</a></b><br/>
<b><a href="doc/changelogs/CHANGELOG_V14.md#14.14.0">14.14.0</a></b><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.13.1">14.13.1</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.13.0">14.13.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.12.0">14.12.0</a><br/>
<a href="doc/changelogs/CHANGELOG_V14.md#14.11.0">14.11.0</a><br/>
Expand Down
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,7 @@ The externally maintained libraries used by Node.js are:

- GYP, located at tools/gyp, is licensed as follows:
"""
Copyright (c) 2020 Node.js contributors. All rights reserved.
Copyright (c) 2009 Google Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,9 @@ endif
.PHONY: release-only
release-only: check-xz
@if [ "$(DISTTYPE)" = "release" ] && `grep -q REPLACEME doc/api/*.md`; then \
echo 'Please update REPLACEME in Added: tags in doc/api/*.md (See doc/guides/releases.md)' ; \
echo 'Please update REPLACEME tags in the following doc/api/*.md files (See doc/guides/releases.md):\n' ; \
REPLACEMES="$(shell grep -l REPLACEME doc/api/*.md)" ; \
echo "$$REPLACEMES\n" | tr " " "\n" ; \
exit 1 ; \
fi
@if [ "$(DISTTYPE)" = "release" ] && \
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ For information about the governance of the Node.js project, see

* [addaleax](https://github.com/addaleax) -
**Anna Henningsen** &lt;anna@addaleax.net&gt; (she/her)
* [aduh95](https://github.com/aduh95) -
**Antoine du Hamel** &lt;duhamelantoine1995@gmail.com&gt; (he/him)
* [ak239](https://github.com/ak239) -
**Aleksei Koziatinskii** &lt;ak239spb@gmail.com&gt;
* [AndreasMadsen](https://github.com/AndreasMadsen) -
Expand Down Expand Up @@ -568,6 +570,11 @@ For information about the governance of the Node.js project, see
Collaborators follow the [Collaborator Guide](./doc/guides/collaborator-guide.md) in
maintaining the Node.js project.

### Triagers

* [PoojaDurgad](https://github.com/PoojaDurgad) -
**Pooja Durgad** &lt;Pooja.D.P@ibm.com&gt;

### Release Keys

Primary GPG keys for Node.js Releasers (some Releasers sign with subkeys):
Expand Down
40 changes: 40 additions & 0 deletions benchmark/esm/cjs-parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';
const fs = require('fs');
const path = require('path');
const common = require('../common.js');
const { strictEqual } = require('assert');

const tmpdir = require('../../test/common/tmpdir');
const benchmarkDirectory =
path.resolve(tmpdir.path, 'benchmark-esm-parse');

const bench = common.createBenchmark(main, {
n: [1e2]
});

async function main({ n }) {
tmpdir.refresh();

fs.mkdirSync(benchmarkDirectory);

let sampleSource = 'try {\n';
for (let i = 0; i < 1000; i++) {
sampleSource += 'sample.js(() => file = /test/);\n';
}
sampleSource += '} catch {}\nexports.p = 5;\n';

for (let i = 0; i < n; i++) {
const sampleFile = path.join(benchmarkDirectory, `sample${i}.js`);
fs.writeFileSync(sampleFile, sampleSource);
}

bench.start();
for (let i = 0; i < n; i++) {
const sampleFile = path.join(benchmarkDirectory, `sample${i}.js`);
const m = await import('file:' + sampleFile);
strictEqual(m.p, 5);
}
bench.end(n);

tmpdir.refresh();
}
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.16',
'v8_embedder_string': '-node.17',

##### V8 defaults for Node.js #####

Expand Down
3 changes: 2 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# as is the fact that the ] goes on a new line.
_=[ 'exec' '/bin/sh' '-c' '''
test ${FORCE_PYTHON2} && exec python2 "$0" "$@" # workaround for gclient
command -v python3.9 >/dev/null && exec python3.9 "$0" "$@"
command -v python3.8 >/dev/null && exec python3.8 "$0" "$@"
command -v python3.7 >/dev/null && exec python3.7 "$0" "$@"
command -v python3.6 >/dev/null && exec python3.6 "$0" "$@"
Expand All @@ -19,7 +20,7 @@ import sys
from distutils.spawn import find_executable

print('Node.js configure: Found Python {0}.{1}.{2}...'.format(*sys.version_info))
acceptable_pythons = ((3, 8), (3, 7), (3, 6), (3, 5), (2, 7))
acceptable_pythons = ((3, 9), (3, 8), (3, 7), (3, 6), (3, 5), (2, 7))
if sys.version_info[:2] in acceptable_pythons:
import configure
else:
Expand Down
1 change: 1 addition & 0 deletions deps/cjs-module-lexer/dist/lexer.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions deps/cjs-module-lexer/dist/lexer.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/cjs-module-lexer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cjs-module-lexer",
"version": "0.4.0",
"version": "0.4.2",
"description": "Lexes CommonJS modules, returning their named exports metadata",
"main": "lexer.js",
"exports": {
Expand Down
3 changes: 2 additions & 1 deletion deps/v8/src/api/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10745,7 +10745,8 @@ static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {

void HeapSnapshot::Delete() {
i::Isolate* isolate = ToInternal(this)->profiler()->isolate();
if (isolate->heap_profiler()->GetSnapshotsCount() > 1) {
if (isolate->heap_profiler()->GetSnapshotsCount() > 1 ||
isolate->heap_profiler()->IsTakingSnapshot()) {
ToInternal(this)->Delete();
} else {
// If this is the last snapshot, clean up all accessory data as well.
Expand Down
12 changes: 9 additions & 3 deletions deps/v8/src/profiler/heap-profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ namespace internal {
HeapProfiler::HeapProfiler(Heap* heap)
: ids_(new HeapObjectsMap(heap)),
names_(new StringsStorage()),
is_tracking_object_moves_(false) {}
is_tracking_object_moves_(false),
is_taking_snapshot_(false) {}

HeapProfiler::~HeapProfiler() = default;

Expand All @@ -28,7 +29,8 @@ void HeapProfiler::DeleteAllSnapshots() {
}

void HeapProfiler::MaybeClearStringsStorage() {
if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_) {
if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_ &&
!is_taking_snapshot_) {
names_.reset(new StringsStorage());
}
}
Expand Down Expand Up @@ -66,6 +68,7 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
v8::ActivityControl* control,
v8::HeapProfiler::ObjectNameResolver* resolver,
bool treat_global_objects_as_roots) {
is_taking_snapshot_ = true;
HeapSnapshot* result = new HeapSnapshot(this, treat_global_objects_as_roots);
{
HeapSnapshotGenerator generator(result, control, resolver, heap());
Expand All @@ -78,6 +81,7 @@ HeapSnapshot* HeapProfiler::TakeSnapshot(
}
ids_->RemoveDeadEntries();
is_tracking_object_moves_ = true;
is_taking_snapshot_ = false;

heap()->isolate()->debug()->feature_tracker()->Track(
DebugFeatureTracker::kHeapSnapshot);
Expand Down Expand Up @@ -138,10 +142,12 @@ void HeapProfiler::StopHeapObjectsTracking() {
}
}

int HeapProfiler::GetSnapshotsCount() {
int HeapProfiler::GetSnapshotsCount() const {
return static_cast<int>(snapshots_.size());
}

bool HeapProfiler::IsTakingSnapshot() const { return is_taking_snapshot_; }

HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
return snapshots_.at(index).get();
}
Expand Down
4 changes: 3 additions & 1 deletion deps/v8/src/profiler/heap-profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class HeapProfiler : public HeapObjectAllocationTracker {

SnapshotObjectId PushHeapObjectsStats(OutputStream* stream,
int64_t* timestamp_us);
int GetSnapshotsCount();
int GetSnapshotsCount() const;
bool IsTakingSnapshot() const;
HeapSnapshot* GetSnapshot(int index);
SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
SnapshotObjectId GetSnapshotObjectId(NativeObject obj);
Expand Down Expand Up @@ -93,6 +94,7 @@ class HeapProfiler : public HeapObjectAllocationTracker {
std::unique_ptr<StringsStorage> names_;
std::unique_ptr<AllocationTracker> allocation_tracker_;
bool is_tracking_object_moves_;
bool is_taking_snapshot_;
base::Mutex profiler_mutex_;
std::unique_ptr<SamplingHeapProfiler> sampling_heap_profiler_;
std::vector<std::pair<v8::HeapProfiler::BuildEmbedderGraphCallback, void*>>
Expand Down
37 changes: 37 additions & 0 deletions deps/v8/test/cctest/test-heap-profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4126,3 +4126,40 @@ TEST(Bug8373_2) {

heap_profiler->StopTrackingHeapObjects();
}

TEST(HeapSnapshotDeleteDuringTakeSnapshot) {
// Check that a heap snapshot can be deleted during GC while another one
// is being taken.

LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
int gc_calls = 0;
v8::Global<v8::Object> handle;

{
struct WeakData {
const v8::HeapSnapshot* snapshot;
int* gc_calls;
v8::Global<v8::Object>* handle;
};
WeakData* data =
new WeakData{heap_profiler->TakeHeapSnapshot(), &gc_calls, &handle};

v8::HandleScope scope(env->GetIsolate());
handle.Reset(env->GetIsolate(), v8::Object::New(env->GetIsolate()));
handle.SetWeak(
data,
[](const v8::WeakCallbackInfo<WeakData>& data) {
std::unique_ptr<WeakData> weakdata{data.GetParameter()};
const_cast<v8::HeapSnapshot*>(weakdata->snapshot)->Delete();
++*weakdata->gc_calls;
weakdata->handle->Reset();
},
v8::WeakCallbackType::kParameter);
}
CHECK_EQ(gc_calls, 0);

CHECK(ValidateSnapshot(heap_profiler->TakeHeapSnapshot()));
CHECK_EQ(gc_calls, 1);
}
Loading