Reviewers: Jakob, loislo, alph,

Description:
Fix segmentation fault in CodeMap::Print

CodeEntry* is always NULL for SharedFunctionInfo entries in the CodeMap. Take
this into account when printing the map.

Drive-by: removed  CodeEntry::shared_id() which is never called.

BUG=None

Please review this at https://codereview.chromium.org/14387004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/profile-generator.h
  M src/profile-generator.cc


Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 837faa0c84cdcc938354c15892ae63d71a46c07e..b8d22b449d6a434bf6741ade65b28f3293bcc09f 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -571,7 +571,11 @@ void CodeMap::MoveCode(Address from, Address to) {

 void CodeMap::CodeTreePrinter::Call(
     const Address& key, const CodeMap::CodeEntryInfo& value) {
-  OS::Print("%p %5d %s\n", key, value.size, value.entry->name());
+  // For shared function entries, 'size' field is used to store their IDs.
+  if (value.entry == kSharedFunctionCodeEntry)
+    OS::Print("%p SharedFunctionInfo %d\n", key, value.size);
+  else
+    OS::Print("%p %5d %s\n", key, value.size, value.entry->name());
 }


Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index 4ddb75337e62435dd3b65a1e304b85af49b410b3..0ed5a0c15b7a0a48132c02475940506daf39798e 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -107,7 +107,6 @@ class CodeEntry {
   INLINE(const char* name() const) { return name_; }
   INLINE(const char* resource_name() const) { return resource_name_; }
   INLINE(int line_number() const) { return line_number_; }
-  INLINE(int shared_id() const) { return shared_id_; }
   INLINE(void set_shared_id(int shared_id)) { shared_id_ = shared_id; }
   INLINE(int security_token_id() const) { return security_token_id_; }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to