From: danno@chromium.org Date: Thu, 18 Jul 2013 13:00:40 +0000 (+0000) Subject: Fix --track_gc_object_stats option. X-Git-Tag: upstream/4.7.83~13309 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=05ec5921be06eda6678f1784f3816e12c3dc3718;p=platform%2Fupstream%2Fv8.git 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 R=danno@chromium.org, hpayer@chromium.org Review URL: https://codereview.chromium.org/19257002 Patch from Ross McIlroy . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15748 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/mark-compact.cc b/src/mark-compact.cc index df39a8a..5c91dbf 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -1634,11 +1634,18 @@ class MarkCompactMarkingVisitor::ObjectStatsTracker< 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); } diff --git a/src/objects-inl.h b/src/objects-inl.h index ea21460..0a5215c 100644 --- a/src/objects-inl.h +++ b/src/objects-inl.h @@ -3617,6 +3617,11 @@ bool Map::is_frozen() { } +bool Map::has_code_cache() { + return code_cache() != GetIsolate()->heap()->empty_fixed_array(); +} + + bool Map::CanBeDeprecated() { int descriptor = LastAdded(); for (int i = 0; i <= descriptor; i++) { diff --git a/src/objects.h b/src/objects.h index 5d5945e..6bcd412 100644 --- a/src/objects.h +++ b/src/objects.h @@ -5344,6 +5344,9 @@ class Map: public HeapObject { 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) diff --git a/src/v8-counters.cc b/src/v8-counters.cc index b3e15bb..905e178 100644 --- a/src/v8-counters.cc +++ b/src/v8-counters.cc @@ -73,7 +73,7 @@ Counters::Counters(Isolate* isolate) { 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 }