Skip to content

Commit

Permalink
deps: v8: fix potential segfault in profiler
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ofrobots authored and targos committed Oct 19, 2017
1 parent d7456ab commit 33f5014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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.1',
'v8_embedder_string': '-node.2',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,
Expand Down
7 changes: 5 additions & 2 deletions deps/v8/src/profiler/sampling-heap-profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,11 @@ class SamplingAllocationObserver : public AllocationObserver {
void Step(int bytes_allocated, Address soon_object, size_t size) override {
USE(heap_);
DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
DCHECK(soon_object);
profiler_->SampleObject(soon_object, size);
if (soon_object) {
// TODO(ofrobots): it would be better to sample the next object rather
// than skipping this sample epoch if soon_object happens to be null.
profiler_->SampleObject(soon_object, size);
}
}

intptr_t GetNextStepSize() override { return GetNextSampleInterval(rate_); }
Expand Down

0 comments on commit 33f5014

Please sign in to comment.