OLD | NEW |
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 7419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7430 return reinterpret_cast<const CpuProfileNode*>(child); | 7430 return reinterpret_cast<const CpuProfileNode*>(child); |
7431 } | 7431 } |
7432 | 7432 |
7433 | 7433 |
7434 void CpuProfile::Delete() { | 7434 void CpuProfile::Delete() { |
7435 i::Isolate* isolate = i::Isolate::Current(); | 7435 i::Isolate* isolate = i::Isolate::Current(); |
7436 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); | 7436 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); |
7437 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7437 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
7438 ASSERT(profiler != NULL); | 7438 ASSERT(profiler != NULL); |
7439 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); | 7439 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); |
7440 if (profiler->GetProfilesCount() == 0 && !profiler->HasDetachedProfiles()) { | 7440 if (profiler->GetProfilesCount() == 0) { |
7441 // If this was the last profile, clean up all accessory data as well. | 7441 // If this was the last profile, clean up all accessory data as well. |
7442 profiler->DeleteAllProfiles(); | 7442 profiler->DeleteAllProfiles(); |
7443 } | 7443 } |
7444 } | 7444 } |
7445 | 7445 |
7446 | 7446 |
7447 unsigned CpuProfile::GetUid() const { | 7447 unsigned CpuProfile::GetUid() const { |
7448 i::Isolate* isolate = i::Isolate::Current(); | 7448 i::Isolate* isolate = i::Isolate::Current(); |
7449 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); | 7449 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); |
7450 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); | 7450 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); |
(...skipping 26 matching lines...) Expand all Loading... |
7477 int CpuProfile::GetSamplesCount() const { | 7477 int CpuProfile::GetSamplesCount() const { |
7478 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); | 7478 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); |
7479 } | 7479 } |
7480 | 7480 |
7481 | 7481 |
7482 int CpuProfiler::GetProfileCount() { | 7482 int CpuProfiler::GetProfileCount() { |
7483 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount(); | 7483 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount(); |
7484 } | 7484 } |
7485 | 7485 |
7486 | 7486 |
7487 const CpuProfile* CpuProfiler::GetCpuProfile(int index, | |
7488 Handle<Value> security_token) { | |
7489 return reinterpret_cast<const CpuProfile*>( | |
7490 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile( | |
7491 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), | |
7492 index)); | |
7493 } | |
7494 | |
7495 | |
7496 const CpuProfile* CpuProfiler::GetCpuProfile(int index) { | 7487 const CpuProfile* CpuProfiler::GetCpuProfile(int index) { |
7497 return reinterpret_cast<const CpuProfile*>( | 7488 return reinterpret_cast<const CpuProfile*>( |
7498 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(NULL, index)); | 7489 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(index)); |
7499 } | 7490 } |
7500 | 7491 |
7501 | 7492 |
7502 const CpuProfile* CpuProfiler::FindCpuProfile(unsigned uid, | |
7503 Handle<Value> security_token) { | |
7504 return reinterpret_cast<const CpuProfile*>( | |
7505 reinterpret_cast<i::CpuProfiler*>(this)->FindProfile( | |
7506 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), | |
7507 uid)); | |
7508 } | |
7509 | |
7510 | |
7511 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { | 7493 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { |
7512 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( | 7494 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( |
7513 *Utils::OpenHandle(*title), record_samples); | 7495 *Utils::OpenHandle(*title), record_samples); |
7514 } | 7496 } |
7515 | 7497 |
7516 | 7498 |
7517 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title, | |
7518 Handle<Value> security_token) { | |
7519 return reinterpret_cast<const CpuProfile*>( | |
7520 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | |
7521 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), | |
7522 *Utils::OpenHandle(*title))); | |
7523 } | |
7524 | |
7525 | |
7526 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { | 7499 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { |
7527 return reinterpret_cast<const CpuProfile*>( | 7500 return reinterpret_cast<const CpuProfile*>( |
7528 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | 7501 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( |
7529 NULL, | |
7530 *Utils::OpenHandle(*title))); | 7502 *Utils::OpenHandle(*title))); |
7531 } | 7503 } |
7532 | 7504 |
7533 | 7505 |
7534 void CpuProfiler::DeleteAllCpuProfiles() { | 7506 void CpuProfiler::DeleteAllCpuProfiles() { |
7535 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles(); | 7507 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles(); |
7536 } | 7508 } |
7537 | 7509 |
7538 | 7510 |
7539 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { | 7511 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8057 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8029 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8058 Address callback_address = | 8030 Address callback_address = |
8059 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8031 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8060 VMState<EXTERNAL> state(isolate); | 8032 VMState<EXTERNAL> state(isolate); |
8061 ExternalCallbackScope call_scope(isolate, callback_address); | 8033 ExternalCallbackScope call_scope(isolate, callback_address); |
8062 return callback(info); | 8034 return callback(info); |
8063 } | 8035 } |
8064 | 8036 |
8065 | 8037 |
8066 } } // namespace v8::internal | 8038 } } // namespace v8::internal |
OLD | NEW |