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

Side by Side Diff: src/api.cc

Issue 13460002: Isolatify CPU profiler public API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/v8-profiler.h ('k') | src/log.h » ('j') | 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5788 matching lines...) Expand 10 before | Expand all | Expand 10 after
5799 } 5799 }
5800 5800
5801 5801
5802 HeapProfiler* Isolate::GetHeapProfiler() { 5802 HeapProfiler* Isolate::GetHeapProfiler() {
5803 i::HeapProfiler* heap_profiler = 5803 i::HeapProfiler* heap_profiler =
5804 reinterpret_cast<i::Isolate*>(this)->heap_profiler(); 5804 reinterpret_cast<i::Isolate*>(this)->heap_profiler();
5805 return reinterpret_cast<HeapProfiler*>(heap_profiler); 5805 return reinterpret_cast<HeapProfiler*>(heap_profiler);
5806 } 5806 }
5807 5807
5808 5808
5809 CpuProfiler* Isolate::GetCpuProfiler() {
5810 i::CpuProfiler* cpu_profiler =
5811 reinterpret_cast<i::Isolate*>(this)->cpu_profiler();
5812 return reinterpret_cast<CpuProfiler*>(cpu_profiler);
5813 }
5814
5815
5809 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { 5816 void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
5810 i::Isolate* isolate = i::Isolate::Current(); 5817 i::Isolate* isolate = i::Isolate::Current();
5811 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return; 5818 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return;
5812 isolate->heap()->SetGlobalGCPrologueCallback(callback); 5819 isolate->heap()->SetGlobalGCPrologueCallback(callback);
5813 } 5820 }
5814 5821
5815 5822
5816 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { 5823 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) {
5817 i::Isolate* isolate = i::Isolate::Current(); 5824 i::Isolate* isolate = i::Isolate::Current();
5818 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return; 5825 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return;
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
6532 6539
6533 int CpuProfiler::GetProfilesCount() { 6540 int CpuProfiler::GetProfilesCount() {
6534 i::Isolate* isolate = i::Isolate::Current(); 6541 i::Isolate* isolate = i::Isolate::Current();
6535 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); 6542 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
6536 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6543 i::CpuProfiler* profiler = isolate->cpu_profiler();
6537 ASSERT(profiler != NULL); 6544 ASSERT(profiler != NULL);
6538 return profiler->GetProfilesCount(); 6545 return profiler->GetProfilesCount();
6539 } 6546 }
6540 6547
6541 6548
6549 int CpuProfiler::GetProfileCount() {
6550 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount();
6551 }
6552
6553
6542 const CpuProfile* CpuProfiler::GetProfile(int index, 6554 const CpuProfile* CpuProfiler::GetProfile(int index,
6543 Handle<Value> security_token) { 6555 Handle<Value> security_token) {
6544 i::Isolate* isolate = i::Isolate::Current(); 6556 i::Isolate* isolate = i::Isolate::Current();
6545 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); 6557 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
6546 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6558 i::CpuProfiler* profiler = isolate->cpu_profiler();
6547 ASSERT(profiler != NULL); 6559 ASSERT(profiler != NULL);
6548 return reinterpret_cast<const CpuProfile*>( 6560 return reinterpret_cast<const CpuProfile*>(
6549 profiler->GetProfile( 6561 profiler->GetProfile(
6550 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6562 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6551 index)); 6563 index));
6552 } 6564 }
6553 6565
6554 6566
6567 const CpuProfile* CpuProfiler::GetCpuProfile(int index,
6568 Handle<Value> security_token) {
6569 return reinterpret_cast<const CpuProfile*>(
6570 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(
6571 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6572 index));
6573 }
6574
6575
6555 const CpuProfile* CpuProfiler::FindProfile(unsigned uid, 6576 const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
6556 Handle<Value> security_token) { 6577 Handle<Value> security_token) {
6557 i::Isolate* isolate = i::Isolate::Current(); 6578 i::Isolate* isolate = i::Isolate::Current();
6558 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); 6579 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
6559 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6580 i::CpuProfiler* profiler = isolate->cpu_profiler();
6560 ASSERT(profiler != NULL); 6581 ASSERT(profiler != NULL);
6561 return reinterpret_cast<const CpuProfile*>( 6582 return reinterpret_cast<const CpuProfile*>(
6562 profiler->FindProfile( 6583 profiler->FindProfile(
6563 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6584 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6564 uid)); 6585 uid));
6565 } 6586 }
6566 6587
6567 6588
6589 const CpuProfile* CpuProfiler::FindCpuProfile(unsigned uid,
6590 Handle<Value> security_token) {
6591 return reinterpret_cast<const CpuProfile*>(
6592 reinterpret_cast<i::CpuProfiler*>(this)->FindProfile(
6593 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6594 uid));
6595 }
6596
6597
6568 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) { 6598 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) {
6569 i::Isolate* isolate = i::Isolate::Current(); 6599 i::Isolate* isolate = i::Isolate::Current();
6570 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); 6600 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
6571 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6601 i::CpuProfiler* profiler = isolate->cpu_profiler();
6572 ASSERT(profiler != NULL); 6602 ASSERT(profiler != NULL);
6573 profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples); 6603 profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples);
6574 } 6604 }
6575 6605
6576 6606
6607 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) {
6608 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
6609 *Utils::OpenHandle(*title), record_samples);
6610 }
6611
6612
6577 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, 6613 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
6578 Handle<Value> security_token) { 6614 Handle<Value> security_token) {
6579 i::Isolate* isolate = i::Isolate::Current(); 6615 i::Isolate* isolate = i::Isolate::Current();
6580 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); 6616 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
6581 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6617 i::CpuProfiler* profiler = isolate->cpu_profiler();
6582 ASSERT(profiler != NULL); 6618 ASSERT(profiler != NULL);
6583 return reinterpret_cast<const CpuProfile*>( 6619 return reinterpret_cast<const CpuProfile*>(
6584 profiler->StopProfiling( 6620 profiler->StopProfiling(
6585 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6621 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6586 *Utils::OpenHandle(*title))); 6622 *Utils::OpenHandle(*title)));
6587 } 6623 }
6588 6624
6589 6625
6626 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title,
6627 Handle<Value> security_token) {
6628 return reinterpret_cast<const CpuProfile*>(
6629 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
6630 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6631 *Utils::OpenHandle(*title)));
6632 }
6633
6634
6590 void CpuProfiler::DeleteAllProfiles() { 6635 void CpuProfiler::DeleteAllProfiles() {
6591 i::Isolate* isolate = i::Isolate::Current(); 6636 i::Isolate* isolate = i::Isolate::Current();
6592 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); 6637 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
6593 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6638 i::CpuProfiler* profiler = isolate->cpu_profiler();
6594 ASSERT(profiler != NULL); 6639 ASSERT(profiler != NULL);
6595 profiler->DeleteAllProfiles(); 6640 profiler->DeleteAllProfiles();
6596 } 6641 }
6597 6642
6598 6643
6644 void CpuProfiler::DeleteAllCpuProfiles() {
6645 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles();
6646 }
6647
6648
6599 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 6649 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
6600 return const_cast<i::HeapGraphEdge*>( 6650 return const_cast<i::HeapGraphEdge*>(
6601 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 6651 reinterpret_cast<const i::HeapGraphEdge*>(edge));
6602 } 6652 }
6603 6653
6604 6654
6605 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 6655 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
6606 i::Isolate* isolate = i::Isolate::Current(); 6656 i::Isolate* isolate = i::Isolate::Current();
6607 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); 6657 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
6608 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); 6658 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
7163 7213
7164 v->VisitPointers(blocks_.first(), first_block_limit_); 7214 v->VisitPointers(blocks_.first(), first_block_limit_);
7165 7215
7166 for (int i = 1; i < blocks_.length(); i++) { 7216 for (int i = 1; i < blocks_.length(); i++) {
7167 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7217 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7168 } 7218 }
7169 } 7219 }
7170 7220
7171 7221
7172 } } // namespace v8::internal 7222 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | src/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698