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 7459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7470 isolate->factory()->InternalizeUtf8String(entry->name())); | 7470 isolate->factory()->InternalizeUtf8String(entry->name())); |
7471 } else { | 7471 } else { |
7472 return ToApiHandle<String>(isolate->factory()->NewConsString( | 7472 return ToApiHandle<String>(isolate->factory()->NewConsString( |
7473 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), | 7473 isolate->factory()->InternalizeUtf8String(entry->name_prefix()), |
7474 isolate->factory()->InternalizeUtf8String(entry->name()))); | 7474 isolate->factory()->InternalizeUtf8String(entry->name()))); |
7475 } | 7475 } |
7476 } | 7476 } |
7477 | 7477 |
7478 | 7478 |
7479 int CpuProfileNode::GetScriptId() const { | 7479 int CpuProfileNode::GetScriptId() const { |
7480 i::Isolate* isolate = i::Isolate::Current(); | |
7481 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptId"); | |
7482 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 7480 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
7483 const i::CodeEntry* entry = node->entry(); | 7481 const i::CodeEntry* entry = node->entry(); |
7484 return entry->script_id(); | 7482 return entry->script_id(); |
7485 } | 7483 } |
7486 | 7484 |
7487 | 7485 |
7488 Handle<String> CpuProfileNode::GetScriptResourceName() const { | 7486 Handle<String> CpuProfileNode::GetScriptResourceName() const { |
7489 i::Isolate* isolate = i::Isolate::Current(); | 7487 i::Isolate* isolate = i::Isolate::Current(); |
7490 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); | 7488 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); |
7491 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 7489 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
7492 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( | 7490 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
7493 node->entry()->resource_name())); | 7491 node->entry()->resource_name())); |
7494 } | 7492 } |
7495 | 7493 |
7496 | 7494 |
7497 int CpuProfileNode::GetLineNumber() const { | 7495 int CpuProfileNode::GetLineNumber() const { |
7498 i::Isolate* isolate = i::Isolate::Current(); | |
7499 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); | |
7500 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); | 7496 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); |
7501 } | 7497 } |
7502 | 7498 |
7503 | 7499 |
7504 double CpuProfileNode::GetTotalTime() const { | 7500 double CpuProfileNode::GetTotalTime() const { |
7505 i::Isolate* isolate = i::Isolate::Current(); | 7501 i::Isolate* isolate = i::Isolate::Current(); |
7506 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime"); | 7502 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime"); |
7507 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis(); | 7503 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis(); |
7508 } | 7504 } |
7509 | 7505 |
(...skipping 12 matching lines...) Expand all Loading... |
7522 } | 7518 } |
7523 | 7519 |
7524 | 7520 |
7525 double CpuProfileNode::GetSelfSamplesCount() const { | 7521 double CpuProfileNode::GetSelfSamplesCount() const { |
7526 i::Isolate* isolate = i::Isolate::Current(); | 7522 i::Isolate* isolate = i::Isolate::Current(); |
7527 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount"); | 7523 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount"); |
7528 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); | 7524 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); |
7529 } | 7525 } |
7530 | 7526 |
7531 | 7527 |
| 7528 unsigned CpuProfileNode::GetHitCount() const { |
| 7529 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); |
| 7530 } |
| 7531 |
| 7532 |
7532 unsigned CpuProfileNode::GetCallUid() const { | 7533 unsigned CpuProfileNode::GetCallUid() const { |
7533 i::Isolate* isolate = i::Isolate::Current(); | |
7534 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); | |
7535 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); | 7534 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); |
7536 } | 7535 } |
7537 | 7536 |
7538 | 7537 |
7539 unsigned CpuProfileNode::GetNodeId() const { | 7538 unsigned CpuProfileNode::GetNodeId() const { |
7540 return reinterpret_cast<const i::ProfileNode*>(this)->id(); | 7539 return reinterpret_cast<const i::ProfileNode*>(this)->id(); |
7541 } | 7540 } |
7542 | 7541 |
7543 | 7542 |
7544 int CpuProfileNode::GetChildrenCount() const { | 7543 int CpuProfileNode::GetChildrenCount() const { |
7545 i::Isolate* isolate = i::Isolate::Current(); | |
7546 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); | |
7547 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); | 7544 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); |
7548 } | 7545 } |
7549 | 7546 |
7550 | 7547 |
7551 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { | 7548 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { |
7552 i::Isolate* isolate = i::Isolate::Current(); | |
7553 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); | |
7554 const i::ProfileNode* child = | 7549 const i::ProfileNode* child = |
7555 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); | 7550 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); |
7556 return reinterpret_cast<const CpuProfileNode*>(child); | 7551 return reinterpret_cast<const CpuProfileNode*>(child); |
7557 } | 7552 } |
7558 | 7553 |
7559 | 7554 |
7560 void CpuProfile::Delete() { | 7555 void CpuProfile::Delete() { |
7561 i::Isolate* isolate = i::Isolate::Current(); | 7556 i::Isolate* isolate = i::Isolate::Current(); |
7562 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); | 7557 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); |
7563 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7558 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
7564 ASSERT(profiler != NULL); | 7559 ASSERT(profiler != NULL); |
7565 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); | 7560 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); |
7566 if (profiler->GetProfilesCount() == 0) { | 7561 if (profiler->GetProfilesCount() == 0) { |
7567 // If this was the last profile, clean up all accessory data as well. | 7562 // If this was the last profile, clean up all accessory data as well. |
7568 profiler->DeleteAllProfiles(); | 7563 profiler->DeleteAllProfiles(); |
7569 } | 7564 } |
7570 } | 7565 } |
7571 | 7566 |
7572 | 7567 |
7573 unsigned CpuProfile::GetUid() const { | 7568 unsigned CpuProfile::GetUid() const { |
7574 i::Isolate* isolate = i::Isolate::Current(); | |
7575 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); | |
7576 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); | 7569 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); |
7577 } | 7570 } |
7578 | 7571 |
7579 | 7572 |
7580 Handle<String> CpuProfile::GetTitle() const { | 7573 Handle<String> CpuProfile::GetTitle() const { |
7581 i::Isolate* isolate = i::Isolate::Current(); | 7574 i::Isolate* isolate = i::Isolate::Current(); |
7582 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); | 7575 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); |
7583 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7576 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
7584 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( | 7577 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
7585 profile->title())); | 7578 profile->title())); |
7586 } | 7579 } |
7587 | 7580 |
7588 | 7581 |
7589 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { | 7582 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { |
7590 i::Isolate* isolate = i::Isolate::Current(); | |
7591 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); | |
7592 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7583 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
7593 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); | 7584 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); |
7594 } | 7585 } |
7595 | 7586 |
7596 | 7587 |
7597 const CpuProfileNode* CpuProfile::GetSample(int index) const { | 7588 const CpuProfileNode* CpuProfile::GetSample(int index) const { |
7598 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7589 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
7599 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index)); | 7590 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index)); |
7600 } | 7591 } |
7601 | 7592 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8182 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8173 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
8183 Address callback_address = | 8174 Address callback_address = |
8184 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8175 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8185 VMState<EXTERNAL> state(isolate); | 8176 VMState<EXTERNAL> state(isolate); |
8186 ExternalCallbackScope call_scope(isolate, callback_address); | 8177 ExternalCallbackScope call_scope(isolate, callback_address); |
8187 return callback(info); | 8178 return callback(info); |
8188 } | 8179 } |
8189 | 8180 |
8190 | 8181 |
8191 } } // namespace v8::internal | 8182 } } // namespace v8::internal |
OLD | NEW |