Skip to content

Commit 33f5014

Browse files
ofrobotstargos
authored andcommitted
deps: v8: fix potential segfault in profiler
This change fixes a potential segfault in the sampling heap profiler. This landed as part of a larger change upstream [1]. This is the minimal backport that avoids the segfault. [1]: https://git.io/vdTYL PR-URL: #15498 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d7456ab commit 33f5014

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Reset this number to 0 on major V8 upgrades.
2929
# Increment by one for each non-official patch applied to deps/v8.
30-
'v8_embedder_string': '-node.1',
30+
'v8_embedder_string': '-node.2',
3131

3232
# Enable disassembler for `--print-code` v8 options
3333
'v8_enable_disassembler': 1,

deps/v8/src/profiler/sampling-heap-profiler.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,11 @@ class SamplingAllocationObserver : public AllocationObserver {
172172
void Step(int bytes_allocated, Address soon_object, size_t size) override {
173173
USE(heap_);
174174
DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
175-
DCHECK(soon_object);
176-
profiler_->SampleObject(soon_object, size);
175+
if (soon_object) {
176+
// TODO(ofrobots): it would be better to sample the next object rather
177+
// than skipping this sample epoch if soon_object happens to be null.
178+
profiler_->SampleObject(soon_object, size);
179+
}
177180
}
178181

179182
intptr_t GetNextStepSize() override { return GetNextSampleInterval(rate_); }

0 commit comments

Comments
 (0)