Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: src/profile-generator.cc

Issue 919953002: CPUProfiler: Push deopt reason further to ProfileNode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 777be3fbd143a38844d6c13452b60c17e06d9b08..490cb83d75209943e09e0f65c13574181c63cd79 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -8,6 +8,7 @@
#include "src/compiler.h"
#include "src/debug.h"
+#include "src/deoptimizer.h"
#include "src/global-handles.h"
#include "src/sampler.h"
#include "src/scopeinfo.h"
@@ -158,7 +159,9 @@ int JITLineInfoTable::GetSourceLineNumber(int pc_offset) const {
const char* const CodeEntry::kEmptyNamePrefix = "";
const char* const CodeEntry::kEmptyResourceName = "";
-const char* const CodeEntry::kEmptyBailoutReason = "";
+const char* const CodeEntry::kEmptyBailoutReason =
+ GetBailoutReason(BailoutReason::kNoReason);
+const char* const CodeEntry::kNoDeoptReason = "";
CodeEntry::~CodeEntry() {
@@ -212,6 +215,12 @@ int CodeEntry::GetSourceLine(int pc_offset) const {
}
+void ProfileNode::CollectDeoptInfo(CodeEntry* entry) {
+ deopt_infos_.Add(DeoptInfo(entry->deopt_reason(), entry->deopt_location()));
+ entry->clear_deopt_info();
+}
+
+
ProfileNode* ProfileNode::FindChild(CodeEntry* entry) {
HashMap::Entry* map_entry =
children_.Lookup(entry, CodeEntryHash(entry), false);
@@ -223,13 +232,15 @@ ProfileNode* ProfileNode::FindChild(CodeEntry* entry) {
ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) {
HashMap::Entry* map_entry =
children_.Lookup(entry, CodeEntryHash(entry), true);
- if (map_entry->value == NULL) {
+ ProfileNode* node = reinterpret_cast<ProfileNode*>(map_entry->value);
+ if (node == NULL) {
// New node added.
- ProfileNode* new_node = new ProfileNode(tree_, entry);
- map_entry->value = new_node;
- children_list_.Add(new_node);
+ node = new ProfileNode(tree_, entry);
+ map_entry->value = node;
+ children_list_.Add(node);
}
- return reinterpret_cast<ProfileNode*>(map_entry->value);
+ if (entry->has_deopt_info()) node->CollectDeoptInfo(entry);
alph 2015/02/12 13:19:46 how to you ensure the deopt info goes into the rig
loislo 2015/02/12 15:20:01 Done.
alph 2015/02/12 15:49:43 Cool! thanks
+ return node;
}
@@ -268,12 +279,21 @@ bool ProfileNode::GetLineTicks(v8::CpuProfileNode::LineTick* entries,
void ProfileNode::Print(int indent) {
- base::OS::Print("%5u %*s %s%s %d #%d %s", self_ticks_, indent, "",
+ base::OS::Print("%5u %*s %s%s %d #%d", self_ticks_, indent, "",
entry_->name_prefix(), entry_->name(), entry_->script_id(),
- id(), entry_->bailout_reason());
+ id());
if (entry_->resource_name()[0] != '\0')
base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number());
base::OS::Print("\n");
+ for (auto info : deopt_infos_) {
+ base::OS::Print("%*s deopted at %d with reason '%s'\n", indent + 10, "",
+ info.deopt_location, info.deopt_reason);
+ }
+ const char* bailout_reason = entry_->bailout_reason();
+ if (bailout_reason != GetBailoutReason(BailoutReason::kNoReason)) {
+ base::OS::Print("%*s bailed out due to '%s'\n", indent + 10, "",
+ bailout_reason);
+ }
for (HashMap::Entry* p = children_.Start();
p != NULL;
p = children_.Next(p)) {

Powered by Google App Engine
This is Rietveld 408576698