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 8334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8345 | 8345 |
8346 | 8346 |
8347 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { | 8347 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { |
8348 return reinterpret_cast<CpuProfile*>( | 8348 return reinterpret_cast<CpuProfile*>( |
8349 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | 8349 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( |
8350 *Utils::OpenHandle(*title))); | 8350 *Utils::OpenHandle(*title))); |
8351 } | 8351 } |
8352 | 8352 |
8353 | 8353 |
8354 void CpuProfiler::SetIdle(bool is_idle) { | 8354 void CpuProfiler::SetIdle(bool is_idle) { |
8355 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); | 8355 i::CpuProfiler* profiler = reinterpret_cast<i::CpuProfiler*>(this); |
8356 if (!profiler->is_profiling()) return; | |
alph
2016/04/30 00:03:08
Sorry, didn't get how it helps. If we're not profi
dgozman
2016/04/30 00:10:39
This does not happen, since compilation cannot tri
alph
2016/04/30 00:29:20
Looks more robust to me. The problem is that when
| |
8357 i::Isolate* isolate = profiler->isolate(); | |
8356 v8::StateTag state = isolate->current_vm_state(); | 8358 v8::StateTag state = isolate->current_vm_state(); |
8357 DCHECK(state == v8::JS || state == v8::EXTERNAL || state == v8::IDLE); | 8359 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); |
8358 if (isolate->js_entry_sp() != NULL) return; | 8360 if (isolate->js_entry_sp() != NULL) return; |
8359 if (is_idle) { | 8361 if (is_idle) { |
8360 isolate->set_current_vm_state(v8::IDLE); | 8362 isolate->set_current_vm_state(v8::IDLE); |
8361 } else if (state == v8::IDLE) { | 8363 } else if (state == v8::IDLE) { |
8362 isolate->set_current_vm_state(v8::EXTERNAL); | 8364 isolate->set_current_vm_state(v8::EXTERNAL); |
8363 } | 8365 } |
8364 } | 8366 } |
8365 | 8367 |
8366 | 8368 |
8367 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { | 8369 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8838 Address callback_address = | 8840 Address callback_address = |
8839 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8841 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8840 VMState<EXTERNAL> state(isolate); | 8842 VMState<EXTERNAL> state(isolate); |
8841 ExternalCallbackScope call_scope(isolate, callback_address); | 8843 ExternalCallbackScope call_scope(isolate, callback_address); |
8842 callback(info); | 8844 callback(info); |
8843 } | 8845 } |
8844 | 8846 |
8845 | 8847 |
8846 } // namespace internal | 8848 } // namespace internal |
8847 } // namespace v8 | 8849 } // namespace v8 |
OLD | NEW |