Revision: 5217
Author: [email protected]
Date: Mon Aug  9 07:57:13 2010
Log: A follow-up to r5211: fix a couple of issues detected on Windows.

 - storage of enums in bit fields;
 - removing dead entries from address -> id map in HeapObjectsMap;
- layout of HeapEntry, to avoid class size increase on ia32 due to alignment;

Review URL: http://codereview.chromium.org/3096008
http://code.google.com/p/v8/source/detail?r=5217

Modified:
 /branches/bleeding_edge/src/profile-generator.cc
 /branches/bleeding_edge/src/profile-generator.h

=======================================
--- /branches/bleeding_edge/src/profile-generator.cc Mon Aug 9 04:37:24 2010 +++ /branches/bleeding_edge/src/profile-generator.cc Mon Aug 9 07:57:13 2010
@@ -1465,6 +1465,7 @@

 void HeapObjectsMap::RemoveDeadEntries() {
   List<EntryInfo>* new_entries = new List<EntryInfo>();
+  List<void*> dead_entries;
   for (HashMap::Entry* entry = entries_map_.Start();
        entry != NULL;
        entry = entries_map_.Next(entry)) {
@@ -1474,8 +1475,15 @@
     if (entry_info.accessed) {
       entry->value = reinterpret_cast<void*>(new_entries->length());
       new_entries->Add(EntryInfo(entry_info.id, false));
+    } else {
+      dead_entries.Add(entry->key);
     }
   }
+  for (int i = 0; i < dead_entries.length(); ++i) {
+    void* raw_entry = dead_entries[i];
+    entries_map_.Remove(
+        raw_entry, AddressHash(reinterpret_cast<Address>(raw_entry)));
+  }
   delete entries_;
   entries_ = new_entries;
 }
=======================================
--- /branches/bleeding_edge/src/profile-generator.h     Mon Aug  9 04:37:24 2010
+++ /branches/bleeding_edge/src/profile-generator.h     Mon Aug  9 07:57:13 2010
@@ -438,7 +438,7 @@
   void Init(int child_index, Type type, const char* name, HeapEntry* to);
   void Init(int child_index, int index, HeapEntry* to);

-  Type type() { return type_; }
+  Type type() { return static_cast<Type>(type_); }
   int index() {
     ASSERT(type_ == kElement);
     return index_;
@@ -455,7 +455,7 @@

  private:
   int child_index_ : 30;
-  Type type_ : 2;
+  unsigned type_ : 2;
   union {
     int index_;
     const char* name_;
@@ -511,7 +511,7 @@
             int retainers_count);

   HeapSnapshot* snapshot() { return snapshot_; }
-  Type type() { return type_; }
+  Type type() { return static_cast<Type>(type_); }
   const char* name() { return name_; }
   uint64_t id() { return id_; }
   int self_size() { return self_size_; }
@@ -566,17 +566,17 @@
   }
   const char* TypeAsString();

-  HeapSnapshot* snapshot_;
   unsigned painted_: 2;
-  Type type_: 3;
+  unsigned type_: 3;
// The calculated data is stored in HeapSnapshot in HeapEntryCalculatedData
   // entries. See AddCalculatedData and GetCalculatedData.
   int calculated_data_index_: 27;
-  const char* name_;
-  uint64_t id_;
   int self_size_;
   int children_count_;
   int retainers_count_;
+  HeapSnapshot* snapshot_;
+  const char* name_;
+  uint64_t id_;

   static const unsigned kUnpainted = 0;
   static const unsigned kPainted = 1;

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to