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 jasnell committed Sep 25, 2017
1 parent 90d14df commit 2e75ac0
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 @@ -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 2e75ac0

Please sign in to comment.