| OLD | NEW |
| 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 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 | 1983 |
| 1984 void FinishIdleRound() { | 1984 void FinishIdleRound() { |
| 1985 mark_sweeps_since_idle_round_started_ = kMaxMarkSweepsInIdleRound; | 1985 mark_sweeps_since_idle_round_started_ = kMaxMarkSweepsInIdleRound; |
| 1986 scavenges_since_last_idle_round_ = 0; | 1986 scavenges_since_last_idle_round_ = 0; |
| 1987 } | 1987 } |
| 1988 | 1988 |
| 1989 bool EnoughGarbageSinceLastIdleRound() { | 1989 bool EnoughGarbageSinceLastIdleRound() { |
| 1990 return (scavenges_since_last_idle_round_ >= kIdleScavengeThreshold); | 1990 return (scavenges_since_last_idle_round_ >= kIdleScavengeThreshold); |
| 1991 } | 1991 } |
| 1992 | 1992 |
| 1993 bool WorthStartingGCWhenIdle() { | |
| 1994 if (contexts_disposed_ > 0) { | |
| 1995 return true; | |
| 1996 } | |
| 1997 return incremental_marking()->WorthActivating(); | |
| 1998 } | |
| 1999 | |
| 2000 // Estimates how many milliseconds a Mark-Sweep would take to complete. | 1993 // Estimates how many milliseconds a Mark-Sweep would take to complete. |
| 2001 // In idle notification handler we assume that this function will return: | 1994 // In idle notification handler we assume that this function will return: |
| 2002 // - a number less than 10 for small heaps, which are less than 8Mb. | 1995 // - a number less than 10 for small heaps, which are less than 8Mb. |
| 2003 // - a number greater than 10 for large heaps, which are greater than 32Mb. | 1996 // - a number greater than 10 for large heaps, which are greater than 32Mb. |
| 2004 int TimeMarkSweepWouldTakeInMs() { | 1997 int TimeMarkSweepWouldTakeInMs() { |
| 2005 // Rough estimate of how many megabytes of heap can be processed in 1 ms. | 1998 // Rough estimate of how many megabytes of heap can be processed in 1 ms. |
| 2006 static const int kMbPerMs = 2; | 1999 static const int kMbPerMs = 2; |
| 2007 | 2000 |
| 2008 int heap_size_mb = static_cast<int>(SizeOfObjects() / MB); | 2001 int heap_size_mb = static_cast<int>(SizeOfObjects() / MB); |
| 2009 return heap_size_mb / kMbPerMs; | 2002 return heap_size_mb / kMbPerMs; |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2722 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2715 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 2723 | 2716 |
| 2724 private: | 2717 private: |
| 2725 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2718 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2726 }; | 2719 }; |
| 2727 #endif // DEBUG || LIVE_OBJECT_LIST | 2720 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2728 | 2721 |
| 2729 } } // namespace v8::internal | 2722 } } // namespace v8::internal |
| 2730 | 2723 |
| 2731 #endif // V8_HEAP_H_ | 2724 #endif // V8_HEAP_H_ |
| OLD | NEW |