Chromium Code Reviews| 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"); | |
|
loislo
2013/08/08 11:04:47
why did you remove that lines?
Sven Panne
2013/08/08 11:51:57
That's OK, the whole idea of IsDeadCheck is fundam
yurys
2013/08/08 12:33:10
They make no sense, if v8 is dead then the code sh
| |
| 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 |
| 7510 | 7506 |
| 7511 double CpuProfileNode::GetSelfTime() const { | 7507 double CpuProfileNode::GetSelfTime() const { |
| 7512 i::Isolate* isolate = i::Isolate::Current(); | 7508 i::Isolate* isolate = i::Isolate::Current(); |
| 7513 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime"); | 7509 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime"); |
| 7514 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis(); | 7510 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis(); |
| 7515 } | 7511 } |
| 7516 | 7512 |
| 7517 | 7513 |
| 7518 double CpuProfileNode::GetTotalSamplesCount() const { | 7514 double CpuProfileNode::GetTotalSamplesCount() const { |
| 7519 i::Isolate* isolate = i::Isolate::Current(); | 7515 i::Isolate* isolate = i::Isolate::Current(); |
| 7520 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount"); | 7516 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount"); |
| 7521 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks(); | 7517 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks(); |
| 7522 } | 7518 } |
| 7523 | 7519 |
| 7524 | 7520 |
| 7525 double CpuProfileNode::GetSelfSamplesCount() const { | 7521 unsigned 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 |
| 7532 unsigned CpuProfileNode::GetCallUid() const { | 7528 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(); | 7529 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); |
| 7536 } | 7530 } |
| 7537 | 7531 |
| 7538 | 7532 |
| 7539 unsigned CpuProfileNode::GetNodeId() const { | 7533 unsigned CpuProfileNode::GetNodeId() const { |
| 7540 return reinterpret_cast<const i::ProfileNode*>(this)->id(); | 7534 return reinterpret_cast<const i::ProfileNode*>(this)->id(); |
| 7541 } | 7535 } |
| 7542 | 7536 |
| 7543 | 7537 |
| 7544 int CpuProfileNode::GetChildrenCount() const { | 7538 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(); | 7539 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); |
| 7548 } | 7540 } |
| 7549 | 7541 |
| 7550 | 7542 |
| 7551 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { | 7543 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 = | 7544 const i::ProfileNode* child = |
| 7555 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); | 7545 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); |
| 7556 return reinterpret_cast<const CpuProfileNode*>(child); | 7546 return reinterpret_cast<const CpuProfileNode*>(child); |
| 7557 } | 7547 } |
| 7558 | 7548 |
| 7559 | 7549 |
| 7560 void CpuProfile::Delete() { | 7550 void CpuProfile::Delete() { |
| 7561 i::Isolate* isolate = i::Isolate::Current(); | 7551 i::Isolate* isolate = i::Isolate::Current(); |
| 7562 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); | 7552 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); |
| 7563 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7553 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
| 7564 ASSERT(profiler != NULL); | 7554 ASSERT(profiler != NULL); |
| 7565 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); | 7555 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); |
| 7566 if (profiler->GetProfilesCount() == 0) { | 7556 if (profiler->GetProfilesCount() == 0) { |
| 7567 // If this was the last profile, clean up all accessory data as well. | 7557 // If this was the last profile, clean up all accessory data as well. |
| 7568 profiler->DeleteAllProfiles(); | 7558 profiler->DeleteAllProfiles(); |
| 7569 } | 7559 } |
| 7570 } | 7560 } |
| 7571 | 7561 |
| 7572 | 7562 |
| 7573 unsigned CpuProfile::GetUid() const { | 7563 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(); | 7564 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); |
| 7577 } | 7565 } |
| 7578 | 7566 |
| 7579 | 7567 |
| 7580 Handle<String> CpuProfile::GetTitle() const { | 7568 Handle<String> CpuProfile::GetTitle() const { |
| 7581 i::Isolate* isolate = i::Isolate::Current(); | 7569 i::Isolate* isolate = i::Isolate::Current(); |
| 7582 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); | 7570 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); |
| 7583 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7571 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
| 7584 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( | 7572 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
| 7585 profile->title())); | 7573 profile->title())); |
| 7586 } | 7574 } |
| 7587 | 7575 |
| 7588 | 7576 |
| 7589 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { | 7577 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); | 7578 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
| 7593 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); | 7579 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); |
| 7594 } | 7580 } |
| 7595 | 7581 |
| 7596 | 7582 |
| 7597 const CpuProfileNode* CpuProfile::GetSample(int index) const { | 7583 const CpuProfileNode* CpuProfile::GetSample(int index) const { |
| 7598 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7584 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
| 7599 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index)); | 7585 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index)); |
| 7600 } | 7586 } |
| 7601 | 7587 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8182 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 8168 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 8183 Address callback_address = | 8169 Address callback_address = |
| 8184 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8170 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8185 VMState<EXTERNAL> state(isolate); | 8171 VMState<EXTERNAL> state(isolate); |
| 8186 ExternalCallbackScope call_scope(isolate, callback_address); | 8172 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8187 return callback(info); | 8173 return callback(info); |
| 8188 } | 8174 } |
| 8189 | 8175 |
| 8190 | 8176 |
| 8191 } } // namespace v8::internal | 8177 } } // namespace v8::internal |
| OLD | NEW |