OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 | 1318 |
1319 size_t NewSpaceAllocationCounter() { | 1319 size_t NewSpaceAllocationCounter() { |
1320 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); | 1320 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); |
1321 } | 1321 } |
1322 | 1322 |
1323 // This should be used only for testing. | 1323 // This should be used only for testing. |
1324 void set_new_space_allocation_counter(size_t new_value) { | 1324 void set_new_space_allocation_counter(size_t new_value) { |
1325 new_space_allocation_counter_ = new_value; | 1325 new_space_allocation_counter_ = new_value; |
1326 } | 1326 } |
1327 | 1327 |
| 1328 void UpdateOldGenerationAllocationCounter() { |
| 1329 old_generation_allocation_counter_ = OldGenerationAllocationCounter(); |
| 1330 } |
| 1331 |
| 1332 size_t OldGenerationAllocationCounter() { |
| 1333 return old_generation_allocation_counter_ + PromotedSinceLastGC(); |
| 1334 } |
| 1335 |
| 1336 // This should be used only for testing. |
| 1337 void set_old_generation_allocation_counter(size_t new_value) { |
| 1338 old_generation_allocation_counter_ = new_value; |
| 1339 } |
| 1340 |
| 1341 size_t PromotedSinceLastGC() { |
| 1342 return PromotedSpaceSizeOfObjects() - old_generation_size_at_last_gc_; |
| 1343 } |
| 1344 |
1328 // Update GC statistics that are tracked on the Heap. | 1345 // Update GC statistics that are tracked on the Heap. |
1329 void UpdateCumulativeGCStatistics(double duration, double spent_in_mutator, | 1346 void UpdateCumulativeGCStatistics(double duration, double spent_in_mutator, |
1330 double marking_time); | 1347 double marking_time); |
1331 | 1348 |
1332 // Returns maximum GC pause. | 1349 // Returns maximum GC pause. |
1333 double get_max_gc_pause() { return max_gc_pause_; } | 1350 double get_max_gc_pause() { return max_gc_pause_; } |
1334 | 1351 |
1335 // Returns maximum size of objects alive after GC. | 1352 // Returns maximum size of objects alive after GC. |
1336 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } | 1353 intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } |
1337 | 1354 |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2197 | 2214 |
2198 // These two counters are monotomically increasing and never reset. | 2215 // These two counters are monotomically increasing and never reset. |
2199 size_t full_codegen_bytes_generated_; | 2216 size_t full_codegen_bytes_generated_; |
2200 size_t crankshaft_codegen_bytes_generated_; | 2217 size_t crankshaft_codegen_bytes_generated_; |
2201 | 2218 |
2202 // This counter is increased before each GC and never reset. | 2219 // This counter is increased before each GC and never reset. |
2203 // To account for the bytes allocated since the last GC, use the | 2220 // To account for the bytes allocated since the last GC, use the |
2204 // NewSpaceAllocationCounter() function. | 2221 // NewSpaceAllocationCounter() function. |
2205 size_t new_space_allocation_counter_; | 2222 size_t new_space_allocation_counter_; |
2206 | 2223 |
| 2224 // This counter is increased before each GC and never reset. To |
| 2225 // account for the bytes allocated since the last GC, use the |
| 2226 // OldGenerationAllocationCounter() function. |
| 2227 size_t old_generation_allocation_counter_; |
| 2228 |
| 2229 // The size of objects in old generation after the last MarkCompact GC. |
| 2230 size_t old_generation_size_at_last_gc_; |
| 2231 |
2207 // If the --deopt_every_n_garbage_collections flag is set to a positive value, | 2232 // If the --deopt_every_n_garbage_collections flag is set to a positive value, |
2208 // this variable holds the number of garbage collections since the last | 2233 // this variable holds the number of garbage collections since the last |
2209 // deoptimization triggered by garbage collection. | 2234 // deoptimization triggered by garbage collection. |
2210 int gcs_since_last_deopt_; | 2235 int gcs_since_last_deopt_; |
2211 | 2236 |
2212 static const int kAllocationSiteScratchpadSize = 256; | 2237 static const int kAllocationSiteScratchpadSize = 256; |
2213 int allocation_sites_scratchpad_length_; | 2238 int allocation_sites_scratchpad_length_; |
2214 | 2239 |
2215 static const int kMaxMarkCompactsInIdleRound = 7; | 2240 static const int kMaxMarkCompactsInIdleRound = 7; |
2216 static const int kIdleScavengeThreshold = 5; | 2241 static const int kIdleScavengeThreshold = 5; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2696 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2721 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2697 | 2722 |
2698 private: | 2723 private: |
2699 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2724 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2700 }; | 2725 }; |
2701 #endif // DEBUG | 2726 #endif // DEBUG |
2702 } | 2727 } |
2703 } // namespace v8::internal | 2728 } // namespace v8::internal |
2704 | 2729 |
2705 #endif // V8_HEAP_HEAP_H_ | 2730 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |