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