Revision: 15748
Author:   [email protected]
Date:     Thu Jul 18 06:00:40 2013
Log:      Fix --track_gc_object_stats option.

- Update ObjectStatsVisitTracker::Visit function to check if CodeCache is of
   CodeCache type, and extract the FixedArray from the struct if so
- Fix typo in v8-counters.h where count_of_FIXED_ARRAY_XXX fields weren't being
   initialized.

BUG=v8:2780
[email protected], [email protected]

Review URL: https://codereview.chromium.org/19257002

Patch from Ross McIlroy <[email protected]>.
http://code.google.com/p/v8/source/detail?r=15748

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/v8-counters.cc

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Tue Jul 16 05:14:16 2013
+++ /branches/bleeding_edge/src/mark-compact.cc Thu Jul 18 06:00:40 2013
@@ -1634,11 +1634,18 @@
                               TRANSITION_ARRAY_SUB_TYPE,
                               fixed_array_size);
     }
-    if (map_obj->code_cache() != heap->empty_fixed_array()) {
+    if (map_obj->has_code_cache()) {
+      CodeCache* cache = CodeCache::cast(map_obj->code_cache());
       heap->RecordObjectStats(
           FIXED_ARRAY_TYPE,
           MAP_CODE_CACHE_SUB_TYPE,
-          FixedArray::cast(map_obj->code_cache())->Size());
+          cache->default_cache()->Size());
+      if (!cache->normal_type_cache()->IsUndefined()) {
+        heap->RecordObjectStats(
+            FIXED_ARRAY_TYPE,
+            MAP_CODE_CACHE_SUB_TYPE,
+            FixedArray::cast(cache->normal_type_cache())->Size());
+      }
     }
     ObjectStatsVisitBase(kVisitMap, map, obj);
   }
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Thu Jul 18 01:12:01 2013
+++ /branches/bleeding_edge/src/objects-inl.h   Thu Jul 18 06:00:40 2013
@@ -3615,6 +3615,11 @@
 bool Map::is_frozen() {
   return IsFrozen::decode(bit_field3());
 }
+
+
+bool Map::has_code_cache() {
+  return code_cache() != GetIsolate()->heap()->empty_fixed_array();
+}


 bool Map::CanBeDeprecated() {
=======================================
--- /branches/bleeding_edge/src/objects.h       Thu Jul 18 01:12:01 2013
+++ /branches/bleeding_edge/src/objects.h       Thu Jul 18 06:00:40 2013
@@ -5344,6 +5344,9 @@
   inline void set_is_access_check_needed(bool access_check_needed);
   inline bool is_access_check_needed();

+  // Returns true if map has a non-empty stub code cache.
+  inline bool has_code_cache();
+
   // [prototype]: implicit prototype object.
   DECL_ACCESSORS(prototype, Object)

=======================================
--- /branches/bleeding_edge/src/v8-counters.cc  Fri Jul  5 02:52:11 2013
+++ /branches/bleeding_edge/src/v8-counters.cc  Thu Jul 18 06:00:40 2013
@@ -73,7 +73,7 @@
     count_of_FIXED_ARRAY_##name##_ = \
         StatsCounter("c:" "V8.CountOf_FIXED_ARRAY-" #name); \
     size_of_FIXED_ARRAY_##name##_ = \
-        StatsCounter("c:" "V8.SizeOf_FIXED_ARRAY-" #name); \
+        StatsCounter("c:" "V8.SizeOf_FIXED_ARRAY-" #name);
     FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
 #undef SC
 }

--
--
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