Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: src/api.cc

Issue 1922703005: Allow CpuProfiler::SetIdle to be called while executing JS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8336 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
8356 v8::StateTag state = isolate->current_vm_state(); 8356 v8::StateTag state = isolate->current_vm_state();
8357 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); 8357 DCHECK(state == v8::JS || state == v8::EXTERNAL || state == v8::IDLE);
8358 if (isolate->js_entry_sp() != NULL) return; 8358 if (isolate->js_entry_sp() != NULL) return;
8359 if (is_idle) { 8359 if (is_idle) {
8360 isolate->set_current_vm_state(v8::IDLE); 8360 isolate->set_current_vm_state(v8::IDLE);
8361 } else if (state == v8::IDLE) { 8361 } else if (state == v8::IDLE) {
8362 isolate->set_current_vm_state(v8::EXTERNAL); 8362 isolate->set_current_vm_state(v8::EXTERNAL);
8363 } 8363 }
8364 } 8364 }
8365 8365
8366 8366
8367 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 8367 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
8838 Address callback_address = 8838 Address callback_address =
8839 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8839 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8840 VMState<EXTERNAL> state(isolate); 8840 VMState<EXTERNAL> state(isolate);
8841 ExternalCallbackScope call_scope(isolate, callback_address); 8841 ExternalCallbackScope call_scope(isolate, callback_address);
8842 callback(info); 8842 callback(info);
8843 } 8843 }
8844 8844
8845 8845
8846 } // namespace internal 8846 } // namespace internal
8847 } // namespace v8 8847 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698