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 <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
ofrobots authored and MylesBorins committed Oct 25, 2017
1 parent 1483ebd commit f22132e
Showing 1 changed file with 5 additions and 2 deletions.
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 @@ -146,8 +146,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 f22132e

Please sign in to comment.