Commit 1bcc69d7 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

Revert "[cpu-profiler] Fix a bug which caused a pure virtual function call"

This reverts commit c92a1dda.

Reason for revert: Breaks arm sim: https://ci.chromium.org/p/v8/builders/luci.v8.ci/V8%20Linux%20-%20arm%20-%20sim/15207

Original change's description:
> [cpu-profiler] Fix a bug which caused a pure virtual function call
> 
> We need to remove each Sampler from the SamplerManager before we call
> the Sampler destructor. This is because the signal handler can interrupt
> the destructor, and call DoSampler(), which calls sampler->SampleStack()
> on the sampler being destructed, causing general unhappiness and
> "Pure virtual function called!" crashes.
> 
> Bug: v8:8346, v8:5193
> Change-Id: Iaa595a196eab33fb1af31584e9a68fd1ce0a18f6
> Reviewed-on: https://chromium-review.googlesource.com/c/1293949
> Commit-Queue: Peter Marshall <petermarshall@chromium.org>
> Reviewed-by: Alexei Filippov <alph@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#56882}

TBR=alph@chromium.org,yangguo@chromium.org,petermarshall@chromium.org

Change-Id: I517e07d75045f6253e7f12714304fba77959fbc2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:8346, v8:5193
Reviewed-on: https://chromium-review.googlesource.com/c/1296472Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56889}
parent 4e908576
......@@ -615,18 +615,13 @@ Sampler::Sampler(Isolate* isolate)
data_ = new PlatformData;
}
void Sampler::UnregisterIfRegistered() {
Sampler::~Sampler() {
DCHECK(!IsActive());
#if defined(USE_SIGNALS)
if (IsRegistered()) {
SamplerManager::instance()->RemoveSampler(this);
SetRegistered(false);
}
#endif
}
Sampler::~Sampler() {
DCHECK(!IsActive());
DCHECK(!IsRegistered());
delete data_;
}
......
......@@ -60,12 +60,6 @@ class Sampler {
// with the CpuProfiler.
bool IsRegistered() const { return base::Relaxed_Load(&registered_) != 0; }
// The sampler must be unregistered with the SamplerManager before ~Sampler()
// is called. If this doesn't happen, the signal handler might interrupt
// during the destructor and call DoSample(), which calls the pure virtual
// function Sampler::SampleStack(), causing a crash.
void UnregisterIfRegistered();
void DoSample();
void SetHasProcessingThread(bool value) {
......
......@@ -65,7 +65,6 @@ SamplingEventsProcessor::SamplingEventsProcessor(Isolate* isolate,
SamplingEventsProcessor::~SamplingEventsProcessor() {
sampler_->DecreaseProfilingDepth();
sampler_->UnregisterIfRegistered();
}
ProfilerEventsProcessor::~ProfilerEventsProcessor() = default;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment