OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 8269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8280 | 8280 |
8281 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { | 8281 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { |
8282 return reinterpret_cast<CpuProfile*>( | 8282 return reinterpret_cast<CpuProfile*>( |
8283 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | 8283 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( |
8284 *Utils::OpenHandle(*title))); | 8284 *Utils::OpenHandle(*title))); |
8285 } | 8285 } |
8286 | 8286 |
8287 | 8287 |
8288 void CpuProfiler::SetIdle(bool is_idle) { | 8288 void CpuProfiler::SetIdle(bool is_idle) { |
8289 i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this); | 8289 i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this); |
8290 if (!profiler->is_profiling()) return; | |
8291 i::Isolate* isolate = profiler->isolate(); | 8290 i::Isolate* isolate = profiler->isolate(); |
| 8291 if (!isolate->is_profiling()) return; |
8292 v8::StateTag state = isolate->current_vm_state(); | 8292 v8::StateTag state = isolate->current_vm_state(); |
8293 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); | 8293 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); |
8294 if (isolate->js_entry_sp() != NULL) return; | 8294 if (isolate->js_entry_sp() != NULL) return; |
8295 if (is_idle) { | 8295 if (is_idle) { |
8296 isolate->set_current_vm_state(v8::IDLE); | 8296 isolate->set_current_vm_state(v8::IDLE); |
8297 } else if (state == v8::IDLE) { | 8297 } else if (state == v8::IDLE) { |
8298 isolate->set_current_vm_state(v8::EXTERNAL); | 8298 isolate->set_current_vm_state(v8::EXTERNAL); |
8299 } | 8299 } |
8300 } | 8300 } |
8301 | 8301 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8778 Address callback_address = | 8778 Address callback_address = |
8779 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8779 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8780 VMState<EXTERNAL> state(isolate); | 8780 VMState<EXTERNAL> state(isolate); |
8781 ExternalCallbackScope call_scope(isolate, callback_address); | 8781 ExternalCallbackScope call_scope(isolate, callback_address); |
8782 callback(info); | 8782 callback(info); |
8783 } | 8783 } |
8784 | 8784 |
8785 | 8785 |
8786 } // namespace internal | 8786 } // namespace internal |
8787 } // namespace v8 | 8787 } // namespace v8 |
OLD | NEW |