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 7188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7199 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); | 7199 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); |
7200 return reinterpret_cast<const CpuProfileNode*>(child); | 7200 return reinterpret_cast<const CpuProfileNode*>(child); |
7201 } | 7201 } |
7202 | 7202 |
7203 | 7203 |
7204 void CpuProfile::Delete() { | 7204 void CpuProfile::Delete() { |
7205 i::Isolate* isolate = i::Isolate::Current(); | 7205 i::Isolate* isolate = i::Isolate::Current(); |
7206 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7206 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
7207 ASSERT(profiler != NULL); | 7207 ASSERT(profiler != NULL); |
7208 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); | 7208 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); |
7209 if (profiler->GetProfilesCount() == 0) { | |
7210 // If this was the last profile, clean up all accessory data as well. | |
7211 profiler->DeleteAllProfiles(); | |
7212 } | |
7213 } | 7209 } |
7214 | 7210 |
7215 | 7211 |
7216 unsigned CpuProfile::GetUid() const { | 7212 unsigned CpuProfile::GetUid() const { |
7217 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); | 7213 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); |
7218 } | 7214 } |
7219 | 7215 |
7220 | 7216 |
7221 Handle<String> CpuProfile::GetTitle() const { | 7217 Handle<String> CpuProfile::GetTitle() const { |
7222 i::Isolate* isolate = i::Isolate::Current(); | 7218 i::Isolate* isolate = i::Isolate::Current(); |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7779 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7775 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7780 Address callback_address = | 7776 Address callback_address = |
7781 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7777 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7782 VMState<EXTERNAL> state(isolate); | 7778 VMState<EXTERNAL> state(isolate); |
7783 ExternalCallbackScope call_scope(isolate, callback_address); | 7779 ExternalCallbackScope call_scope(isolate, callback_address); |
7784 callback(info); | 7780 callback(info); |
7785 } | 7781 } |
7786 | 7782 |
7787 | 7783 |
7788 } } // namespace v8::internal | 7784 } } // namespace v8::internal |
OLD | NEW |