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

Side by Side Diff: src/api.cc

Issue 12706020: Isolatify CPU profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 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 | « no previous file | src/codegen.cc » ('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 6460 matching lines...) Expand 10 before | Expand all | Expand 10 after
6471 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); 6471 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild");
6472 const i::ProfileNode* child = 6472 const i::ProfileNode* child =
6473 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); 6473 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index);
6474 return reinterpret_cast<const CpuProfileNode*>(child); 6474 return reinterpret_cast<const CpuProfileNode*>(child);
6475 } 6475 }
6476 6476
6477 6477
6478 void CpuProfile::Delete() { 6478 void CpuProfile::Delete() {
6479 i::Isolate* isolate = i::Isolate::Current(); 6479 i::Isolate* isolate = i::Isolate::Current();
6480 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); 6480 IsDeadCheck(isolate, "v8::CpuProfile::Delete");
6481 i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); 6481 i::CpuProfiler* profiler = isolate->cpu_profiler();
6482 if (i::CpuProfiler::GetProfilesCount() == 0 && 6482 ASSERT(profiler != NULL);
6483 !i::CpuProfiler::HasDetachedProfiles()) { 6483 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
6484 if (profiler->GetProfilesCount() == 0 && !profiler->HasDetachedProfiles()) {
6484 // If this was the last profile, clean up all accessory data as well. 6485 // If this was the last profile, clean up all accessory data as well.
6485 i::CpuProfiler::DeleteAllProfiles(); 6486 profiler->DeleteAllProfiles();
6486 } 6487 }
6487 } 6488 }
6488 6489
6489 6490
6490 unsigned CpuProfile::GetUid() const { 6491 unsigned CpuProfile::GetUid() const {
6491 i::Isolate* isolate = i::Isolate::Current(); 6492 i::Isolate* isolate = i::Isolate::Current();
6492 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); 6493 IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
6493 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); 6494 return reinterpret_cast<const i::CpuProfile*>(this)->uid();
6494 } 6495 }
6495 6496
(...skipping 22 matching lines...) Expand all
6518 6519
6519 6520
6520 int CpuProfile::GetSamplesCount() const { 6521 int CpuProfile::GetSamplesCount() const {
6521 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); 6522 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count();
6522 } 6523 }
6523 6524
6524 6525
6525 int CpuProfiler::GetProfilesCount() { 6526 int CpuProfiler::GetProfilesCount() {
6526 i::Isolate* isolate = i::Isolate::Current(); 6527 i::Isolate* isolate = i::Isolate::Current();
6527 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); 6528 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
6528 return i::CpuProfiler::GetProfilesCount(); 6529 i::CpuProfiler* profiler = isolate->cpu_profiler();
6530 ASSERT(profiler != NULL);
6531 return profiler->GetProfilesCount();
6529 } 6532 }
6530 6533
6531 6534
6532 const CpuProfile* CpuProfiler::GetProfile(int index, 6535 const CpuProfile* CpuProfiler::GetProfile(int index,
6533 Handle<Value> security_token) { 6536 Handle<Value> security_token) {
6534 i::Isolate* isolate = i::Isolate::Current(); 6537 i::Isolate* isolate = i::Isolate::Current();
6535 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); 6538 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
6539 i::CpuProfiler* profiler = isolate->cpu_profiler();
6540 ASSERT(profiler != NULL);
6536 return reinterpret_cast<const CpuProfile*>( 6541 return reinterpret_cast<const CpuProfile*>(
6537 i::CpuProfiler::GetProfile( 6542 profiler->GetProfile(
6538 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6543 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6539 index)); 6544 index));
6540 } 6545 }
6541 6546
6542 6547
6543 const CpuProfile* CpuProfiler::FindProfile(unsigned uid, 6548 const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
6544 Handle<Value> security_token) { 6549 Handle<Value> security_token) {
6545 i::Isolate* isolate = i::Isolate::Current(); 6550 i::Isolate* isolate = i::Isolate::Current();
6546 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); 6551 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
6552 i::CpuProfiler* profiler = isolate->cpu_profiler();
6553 ASSERT(profiler != NULL);
6547 return reinterpret_cast<const CpuProfile*>( 6554 return reinterpret_cast<const CpuProfile*>(
6548 i::CpuProfiler::FindProfile( 6555 profiler->FindProfile(
6549 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6556 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6550 uid)); 6557 uid));
6551 } 6558 }
6552 6559
6553 6560
6554 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) { 6561 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) {
6555 i::Isolate* isolate = i::Isolate::Current(); 6562 i::Isolate* isolate = i::Isolate::Current();
6556 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); 6563 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
6557 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title), record_samples); 6564 i::CpuProfiler* profiler = isolate->cpu_profiler();
6565 ASSERT(profiler != NULL);
6566 profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples);
6558 } 6567 }
6559 6568
6560 6569
6561 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, 6570 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
6562 Handle<Value> security_token) { 6571 Handle<Value> security_token) {
6563 i::Isolate* isolate = i::Isolate::Current(); 6572 i::Isolate* isolate = i::Isolate::Current();
6564 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); 6573 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
6574 i::CpuProfiler* profiler = isolate->cpu_profiler();
6575 ASSERT(profiler != NULL);
6565 return reinterpret_cast<const CpuProfile*>( 6576 return reinterpret_cast<const CpuProfile*>(
6566 i::CpuProfiler::StopProfiling( 6577 profiler->StopProfiling(
6567 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6578 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6568 *Utils::OpenHandle(*title))); 6579 *Utils::OpenHandle(*title)));
6569 } 6580 }
6570 6581
6571 6582
6572 void CpuProfiler::DeleteAllProfiles() { 6583 void CpuProfiler::DeleteAllProfiles() {
6573 i::Isolate* isolate = i::Isolate::Current(); 6584 i::Isolate* isolate = i::Isolate::Current();
6574 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); 6585 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
6575 i::CpuProfiler::DeleteAllProfiles(); 6586 i::CpuProfiler* profiler = isolate->cpu_profiler();
6587 ASSERT(profiler != NULL);
6588 profiler->DeleteAllProfiles();
6576 } 6589 }
6577 6590
6578 6591
6579 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 6592 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
6580 return const_cast<i::HeapGraphEdge*>( 6593 return const_cast<i::HeapGraphEdge*>(
6581 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 6594 reinterpret_cast<const i::HeapGraphEdge*>(edge));
6582 } 6595 }
6583 6596
6584 6597
6585 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 6598 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
7085 7098
7086 v->VisitPointers(blocks_.first(), first_block_limit_); 7099 v->VisitPointers(blocks_.first(), first_block_limit_);
7087 7100
7088 for (int i = 1; i < blocks_.length(); i++) { 7101 for (int i = 1; i < blocks_.length(); i++) {
7089 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7102 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7090 } 7103 }
7091 } 7104 }
7092 7105
7093 7106
7094 } } // namespace v8::internal 7107 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698