Ignore CpuProfiler::SetIdle call when not profiling.

It truned out we can enter nested message loop and call
SetIdle from inside the compilation in some obscure
situations. To not whitelist all the possible StateTag values,
we'd better ignore this call when not profiling as it has
no effect anyway.

This patch also reverts DCHECK change from https://codereview.chromium.org/1922703005/.

BUG=none
LOG=N

Review-Url: https://codereview.chromium.org/1936703002
Cr-Commit-Position: refs/heads/master@{#35946}
This commit is contained in:
dgozman 2016-05-02 10:32:01 -07:00 committed by Commit bot
parent 567aa1be6d
commit eda8ea1688

View File

@ -8361,9 +8361,11 @@ CpuProfile* CpuProfiler::StopProfiling(Local<String> title) {
void CpuProfiler::SetIdle(bool is_idle) {
i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this);
if (!profiler->is_profiling()) return;
i::Isolate* isolate = profiler->isolate();
v8::StateTag state = isolate->current_vm_state();
DCHECK(state == v8::JS || state == v8::EXTERNAL || state == v8::IDLE);
DCHECK(state == v8::EXTERNAL || state == v8::IDLE);
if (isolate->js_entry_sp() != NULL) return;
if (is_idle) {
isolate->set_current_vm_state(v8::IDLE);