Commit 05ec5921 authored by danno@chromium.org's avatar danno@chromium.org

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 <mcilroy@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15748 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c86ad363
......@@ -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);
}
......
......@@ -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++) {
......
......@@ -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)
......
......@@ -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
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment