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

Unified Diff: src/profile-generator.cc

Issue 6551011: Fix CPU profiling for Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 06ee333b90170adb5eca3abdb732493263ad472e..2a3472ccf38f10aafb2ca263d0129b02e82e1df0 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -156,13 +156,18 @@ void CodeEntry::CopyData(const CodeEntry& source) {
uint32_t CodeEntry::GetCallUid() const {
uint32_t hash = ComputeIntegerHash(tag_);
- hash ^= ComputeIntegerHash(
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_prefix_)));
- hash ^= ComputeIntegerHash(
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_)));
- hash ^= ComputeIntegerHash(
- static_cast<uint32_t>(reinterpret_cast<uintptr_t>(resource_name_)));
- hash ^= ComputeIntegerHash(line_number_);
+ if (shared_id_ != 0) {
+ hash ^= ComputeIntegerHash(
+ static_cast<uint32_t>(shared_id_));
+ } else {
+ hash ^= ComputeIntegerHash(
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_prefix_)));
+ hash ^= ComputeIntegerHash(
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_)));
+ hash ^= ComputeIntegerHash(
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(resource_name_)));
+ hash ^= ComputeIntegerHash(line_number_);
+ }
return hash;
}
@@ -170,10 +175,12 @@ uint32_t CodeEntry::GetCallUid() const {
bool CodeEntry::IsSameAs(CodeEntry* entry) const {
return this == entry
|| (tag_ == entry->tag_
- && name_prefix_ == entry->name_prefix_
- && name_ == entry->name_
- && resource_name_ == entry->resource_name_
- && line_number_ == entry->line_number_);
+ && shared_id_ == entry->shared_id_
+ && (shared_id_ != 0
+ || (name_prefix_ == entry->name_prefix_
+ && name_ == entry->name_
+ && resource_name_ == entry->resource_name_
+ && line_number_ == entry->line_number_)));
}
@@ -458,23 +465,12 @@ void CpuProfile::Print() {
}
+const CodeEntry* CodeMap::kSfiCodeEntry = NULL;
const CodeMap::CodeTreeConfig::Key CodeMap::CodeTreeConfig::kNoKey = NULL;
const CodeMap::CodeTreeConfig::Value CodeMap::CodeTreeConfig::kNoValue =
CodeMap::CodeEntryInfo(NULL, 0);
-void CodeMap::AddAlias(Address start, CodeEntry* entry, Address code_start) {
- CodeTree::Locator locator;
- if (tree_.Find(code_start, &locator)) {
- const CodeEntryInfo& code_info = locator.value();
- if (tree_.Insert(start, &locator)) {
- entry->CopyData(*code_info.entry);
- locator.set_value(CodeEntryInfo(entry, code_info.size));
- }
- }
-}
-
-
CodeEntry* CodeMap::FindEntry(Address addr) {
CodeTree::Locator locator;
if (tree_.FindGreatestLessThan(addr, &locator)) {
@@ -487,6 +483,23 @@ CodeEntry* CodeMap::FindEntry(Address addr) {
}
+int CodeMap::GetSFITag(Address addr) {
+ CodeTree::Locator locator;
+ // For SFI entries, 'size' field is used to store their IDs.
+ if (tree_.Find(addr, &locator)) {
+ const CodeEntryInfo& entry = locator.value();
+ ASSERT(entry.entry == kSfiCodeEntry);
+ return entry.size;
+ } else {
+ tree_.Insert(addr, &locator);
+ int tag = next_sfi_tag_++;
+ locator.set_value(
+ CodeEntryInfo(const_cast<CodeEntry*>(kSfiCodeEntry), tag));
+ return tag;
+ }
+}
+
+
void CodeMap::CodeTreePrinter::Call(
const Address& key, const CodeMap::CodeEntryInfo& value) {
OS::Print("%p %5d %s\n", key, value.size, value.entry->name());
@@ -715,13 +728,6 @@ CodeEntry* CpuProfilesCollection::NewCodeEntry(Logger::LogEventsAndTags tag,
}
-CodeEntry* CpuProfilesCollection::NewCodeEntry(int security_token_id) {
- CodeEntry* entry = new CodeEntry(security_token_id);
- code_entries_.Add(entry);
- return entry;
-}
-
-
void CpuProfilesCollection::AddPathToCurrentProfiles(
const Vector<CodeEntry*>& path) {
// As starting / stopping profiles is rare relatively to this
@@ -788,15 +794,6 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) {
*entry = code_map_.FindEntry(sample.function);
if (*entry != NULL && !(*entry)->is_js_function()) {
*entry = NULL;
- } else {
- CodeEntry* pc_entry = *entries.start();
- if (pc_entry == NULL) {
- *entry = NULL;
- } else if (pc_entry->is_js_function()) {
- // Use function entry in favor of pc entry, as function
- // entry has security token.
- *entries.start() = NULL;
- }
}
entry++;
}

Powered by Google App Engine
This is Rietveld 408576698