Skip to content

Commit a3830eb

Browse files
committed
v8: add GCProfiler support for erm
1 parent 15bdf38 commit a3830eb

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/v8.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ class GCProfiler {
488488
return JSONParse(data);
489489
}
490490
}
491+
492+
[SymbolDispose]() {
493+
this.stop();
494+
}
491495
}
492496

493497
module.exports = {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
const { GCProfiler } = require('v8');
6+
7+
{
8+
const profiler = new GCProfiler();
9+
profiler.start();
10+
11+
const result = profiler[Symbol.dispose]();
12+
13+
assert.strictEqual(result, undefined);
14+
assert.strictEqual(profiler.stop(), undefined);
15+
}
16+
17+
{
18+
const profiler = new GCProfiler();
19+
profiler.start();
20+
21+
profiler[Symbol.dispose]();
22+
// Repeat invocations should not throw
23+
profiler[Symbol.dispose]();
24+
25+
assert.strictEqual(profiler.stop(), undefined);
26+
}

0 commit comments

Comments
 (0)