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 7484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7495 base::TimeDelta::FromMicroseconds(us)); | 7495 base::TimeDelta::FromMicroseconds(us)); |
7496 } | 7496 } |
7497 | 7497 |
7498 | 7498 |
7499 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) { | 7499 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) { |
7500 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( | 7500 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( |
7501 *Utils::OpenHandle(*title), record_samples); | 7501 *Utils::OpenHandle(*title), record_samples); |
7502 } | 7502 } |
7503 | 7503 |
7504 | 7504 |
7505 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { | |
7506 StartProfiling(title, record_samples); | |
7507 } | |
7508 | |
7509 | |
7510 CpuProfile* CpuProfiler::StopProfiling(Handle<String> title) { | 7505 CpuProfile* CpuProfiler::StopProfiling(Handle<String> title) { |
7511 return reinterpret_cast<CpuProfile*>( | 7506 return reinterpret_cast<CpuProfile*>( |
7512 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | 7507 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( |
7513 *Utils::OpenHandle(*title))); | 7508 *Utils::OpenHandle(*title))); |
7514 } | 7509 } |
7515 | 7510 |
7516 | 7511 |
7517 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { | |
7518 return StopProfiling(title); | |
7519 } | |
7520 | |
7521 | |
7522 void CpuProfiler::SetIdle(bool is_idle) { | 7512 void CpuProfiler::SetIdle(bool is_idle) { |
7523 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); | 7513 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); |
7524 v8::StateTag state = isolate->current_vm_state(); | 7514 v8::StateTag state = isolate->current_vm_state(); |
7525 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); | 7515 DCHECK(state == v8::EXTERNAL || state == v8::IDLE); |
7526 if (isolate->js_entry_sp() != NULL) return; | 7516 if (isolate->js_entry_sp() != NULL) return; |
7527 if (is_idle) { | 7517 if (is_idle) { |
7528 isolate->set_current_vm_state(v8::IDLE); | 7518 isolate->set_current_vm_state(v8::IDLE); |
7529 } else if (state == v8::IDLE) { | 7519 } else if (state == v8::IDLE) { |
7530 isolate->set_current_vm_state(v8::EXTERNAL); | 7520 isolate->set_current_vm_state(v8::EXTERNAL); |
7531 } | 7521 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7592 return ToApiHandle<String>( | 7582 return ToApiHandle<String>( |
7593 isolate->factory()->InternalizeUtf8String(ToInternal(this)->name())); | 7583 isolate->factory()->InternalizeUtf8String(ToInternal(this)->name())); |
7594 } | 7584 } |
7595 | 7585 |
7596 | 7586 |
7597 SnapshotObjectId HeapGraphNode::GetId() const { | 7587 SnapshotObjectId HeapGraphNode::GetId() const { |
7598 return ToInternal(this)->id(); | 7588 return ToInternal(this)->id(); |
7599 } | 7589 } |
7600 | 7590 |
7601 | 7591 |
7602 int HeapGraphNode::GetSelfSize() const { | |
7603 size_t size = ToInternal(this)->self_size(); | |
7604 CHECK(size <= static_cast<size_t>(internal::kMaxInt)); | |
7605 return static_cast<int>(size); | |
7606 } | |
7607 | |
7608 | |
7609 size_t HeapGraphNode::GetShallowSize() const { | 7592 size_t HeapGraphNode::GetShallowSize() const { |
7610 return ToInternal(this)->self_size(); | 7593 return ToInternal(this)->self_size(); |
7611 } | 7594 } |
7612 | 7595 |
7613 | 7596 |
7614 int HeapGraphNode::GetChildrenCount() const { | 7597 int HeapGraphNode::GetChildrenCount() const { |
7615 return ToInternal(this)->children().length(); | 7598 return ToInternal(this)->children().length(); |
7616 } | 7599 } |
7617 | 7600 |
7618 | 7601 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8008 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7991 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8009 Address callback_address = | 7992 Address callback_address = |
8010 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7993 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8011 VMState<EXTERNAL> state(isolate); | 7994 VMState<EXTERNAL> state(isolate); |
8012 ExternalCallbackScope call_scope(isolate, callback_address); | 7995 ExternalCallbackScope call_scope(isolate, callback_address); |
8013 callback(info); | 7996 callback(info); |
8014 } | 7997 } |
8015 | 7998 |
8016 | 7999 |
8017 } } // namespace v8::internal | 8000 } } // namespace v8::internal |
OLD | NEW |