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 8315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8326 | 8326 |
8327 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { | 8327 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { |
8328 return reinterpret_cast<CpuProfile*>( | 8328 return reinterpret_cast<CpuProfile*>( |
8329 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | 8329 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( |
8330 *Utils::OpenHandle(*title))); | 8330 *Utils::OpenHandle(*title))); |
8331 } | 8331 } |
8332 | 8332 |
8333 | 8333 |
8334 void CpuProfiler::SetIdle(bool is_idle) { | 8334 void CpuProfiler::SetIdle(bool is_idle) { |
8335 i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this); | 8335 i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this); |
8336 if (!profiler->is_profiling()) return; | |
8337 i::Isolate* isolate = profiler->isolate(); | 8336 i::Isolate* isolate = profiler->isolate(); |
| 8337 if (!isolate->is_profiling()) return; |
8338 v8::StateTag state = isolate->current_vm_state(); | 8338 v8::StateTag state = isolate->current_vm_state(); |
8339 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); | 8339 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); |
8340 if (isolate->js_entry_sp() != NULL) return; | 8340 if (isolate->js_entry_sp() != NULL) return; |
8341 if (is_idle) { | 8341 if (is_idle) { |
8342 isolate->set_current_vm_state(v8::IDLE); | 8342 isolate->set_current_vm_state(v8::IDLE); |
8343 } else if (state == v8::IDLE) { | 8343 } else if (state == v8::IDLE) { |
8344 isolate->set_current_vm_state(v8::EXTERNAL); | 8344 isolate->set_current_vm_state(v8::EXTERNAL); |
8345 } | 8345 } |
8346 } | 8346 } |
8347 | 8347 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8824 Address callback_address = | 8824 Address callback_address = |
8825 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8825 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8826 VMState<EXTERNAL> state(isolate); | 8826 VMState<EXTERNAL> state(isolate); |
8827 ExternalCallbackScope call_scope(isolate, callback_address); | 8827 ExternalCallbackScope call_scope(isolate, callback_address); |
8828 callback(info); | 8828 callback(info); |
8829 } | 8829 } |
8830 | 8830 |
8831 | 8831 |
8832 } // namespace internal | 8832 } // namespace internal |
8833 } // namespace v8 | 8833 } // namespace v8 |
OLD | NEW |