Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: src/heap.h

Issue 10702168: Add counters that automatically track object sizes and counts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Whitespace change Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 // Global inline caching age: it is incremented on some GCs after context 1593 // Global inline caching age: it is incremented on some GCs after context
1594 // disposal. We use it to flush inline caches. 1594 // disposal. We use it to flush inline caches.
1595 int global_ic_age() { 1595 int global_ic_age() {
1596 return global_ic_age_; 1596 return global_ic_age_;
1597 } 1597 }
1598 1598
1599 void AgeInlineCaches() { 1599 void AgeInlineCaches() {
1600 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; 1600 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax;
1601 } 1601 }
1602 1602
1603 void RecordObjectStats(InstanceType type, size_t size) {
1604 ASSERT(type <= LAST_TYPE);
1605 object_counts_[type]++;
1606 object_sizes_[type] += size;
1607 }
1608
1609 void CheckpointObjectStats();
1610
1603 private: 1611 private:
1604 Heap(); 1612 Heap();
1605 1613
1606 // This can be calculated directly from a pointer to the heap; however, it is 1614 // This can be calculated directly from a pointer to the heap; however, it is
1607 // more expedient to get at the isolate directly from within Heap methods. 1615 // more expedient to get at the isolate directly from within Heap methods.
1608 Isolate* isolate_; 1616 Isolate* isolate_;
1609 1617
1610 Object* roots_[kRootListLength]; 1618 Object* roots_[kRootListLength];
1611 1619
1612 intptr_t code_range_size_; 1620 intptr_t code_range_size_;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 1994
1987 int heap_size_mb = static_cast<int>(SizeOfObjects() / MB); 1995 int heap_size_mb = static_cast<int>(SizeOfObjects() / MB);
1988 return heap_size_mb / kMbPerMs; 1996 return heap_size_mb / kMbPerMs;
1989 } 1997 }
1990 1998
1991 // Returns true if no more GC work is left. 1999 // Returns true if no more GC work is left.
1992 bool IdleGlobalGC(); 2000 bool IdleGlobalGC();
1993 2001
1994 void AdvanceIdleIncrementalMarking(intptr_t step_size); 2002 void AdvanceIdleIncrementalMarking(intptr_t step_size);
1995 2003
2004 void ClearObjectStats(bool clear_last_time_stats = false);
1996 2005
1997 static const int kInitialSymbolTableSize = 2048; 2006 static const int kInitialSymbolTableSize = 2048;
1998 static const int kInitialEvalCacheSize = 64; 2007 static const int kInitialEvalCacheSize = 64;
1999 static const int kInitialNumberStringCacheSize = 256; 2008 static const int kInitialNumberStringCacheSize = 256;
2000 2009
2010 // Object counts and used memory by InstanceType
2011 size_t object_counts_[LAST_TYPE + 1];
2012 size_t object_counts_last_time_[LAST_TYPE + 1];
2013 size_t object_sizes_[LAST_TYPE + 1];
2014 size_t object_sizes_last_time_[LAST_TYPE + 1];
2015
2001 // Maximum GC pause. 2016 // Maximum GC pause.
2002 int max_gc_pause_; 2017 int max_gc_pause_;
2003 2018
2004 // Maximum size of objects alive after GC. 2019 // Maximum size of objects alive after GC.
2005 intptr_t max_alive_after_gc_; 2020 intptr_t max_alive_after_gc_;
2006 2021
2007 // Minimal interval between two subsequent collections. 2022 // Minimal interval between two subsequent collections.
2008 int min_in_mutator_; 2023 int min_in_mutator_;
2009 2024
2010 // Size of objects alive after last GC. 2025 // Size of objects alive after last GC.
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 AssertNoAllocation no_alloc; // i.e. no gc allowed. 2716 AssertNoAllocation no_alloc; // i.e. no gc allowed.
2702 2717
2703 private: 2718 private:
2704 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2719 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2705 }; 2720 };
2706 #endif // DEBUG || LIVE_OBJECT_LIST 2721 #endif // DEBUG || LIVE_OBJECT_LIST
2707 2722
2708 } } // namespace v8::internal 2723 } } // namespace v8::internal
2709 2724
2710 #endif // V8_HEAP_H_ 2725 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698