| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 098e3f9a83e0b168f5072fbb6c9b141bfd893928..769eb2ed239664d4191a3222ab5da6f26808fdaf 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -9642,6 +9642,18 @@ void debug::ResetBlackboxedStateCache(Isolate* v8_isolate,
|
| }
|
| }
|
|
|
| +void debug::SetIdle(Isolate* v8_isolate, bool is_idle) {
|
| + i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
| + v8::StateTag state = isolate->current_vm_state();
|
| + DCHECK(state == v8::EXTERNAL || state == v8::IDLE);
|
| + if (isolate->js_entry_sp() != NULL) return;
|
| + if (is_idle) {
|
| + isolate->set_current_vm_state(v8::IDLE);
|
| + } else if (state == v8::IDLE) {
|
| + isolate->set_current_vm_state(v8::EXTERNAL);
|
| + }
|
| +}
|
| +
|
| int debug::EstimatedValueSize(Isolate* v8_isolate, v8::Local<v8::Value> value) {
|
| i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
|
| ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
| @@ -10011,14 +10023,7 @@ void CpuProfiler::SetIdle(bool is_idle) {
|
| i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this);
|
| i::Isolate* isolate = profiler->isolate();
|
| if (!isolate->is_profiling()) return;
|
| - v8::StateTag state = isolate->current_vm_state();
|
| - DCHECK(state == v8::EXTERNAL || state == v8::IDLE);
|
| - if (isolate->js_entry_sp() != NULL) return;
|
| - if (is_idle) {
|
| - isolate->set_current_vm_state(v8::IDLE);
|
| - } else if (state == v8::IDLE) {
|
| - isolate->set_current_vm_state(v8::EXTERNAL);
|
| - }
|
| + debug::SetIdle(reinterpret_cast<v8::Isolate*>(isolate), is_idle);
|
| }
|
|
|
|
|
|
|