Bug 650161 - Update help text for shrinking zeal mode r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Mon, 20 Oct 2014 09:07:42 +0100
changeset 235514 554d8083b8c6d0f454033b030192823ed5b92575
parent 235513 ce272484b1dd447955f8649d1f238ff74d575f47
child 235515 275d7eee096e5c64ecb013e63fd44c2bc6b14576
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs650161
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 650161 - Update help text for shrinking zeal mode r=terrence
js/src/builtin/TestingFunctions.cpp
js/src/gc/GCRuntime.h
js/src/jsgc.cpp
js/src/jsgc.h
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -2152,34 +2152,18 @@ static const JSFunctionSpecWithHelp Test
 "  each time an object returned by the makeFinalizeObserver is finalized."),
 
     JS_FN_HELP("gcPreserveCode", GCPreserveCode, 0, 0,
 "gcPreserveCode()",
 "  Preserve JIT code during garbage collections."),
 
 #ifdef JS_GC_ZEAL
     JS_FN_HELP("gczeal", GCZeal, 2, 0,
-"gczeal(level, [period])",
-"  Specifies how zealous the garbage collector should be. Values for level:\n"
-"    0: Normal amount of collection\n"
-"    1: Collect when roots are added or removed\n"
-"    2: Collect when memory is allocated\n"
-"    3: Collect when the window paints (browser only)\n"
-"    4: Verify pre write barriers between instructions\n"
-"    5: Verify pre write barriers between paints\n"
-"    6: Verify stack rooting\n"
-"    7: Collect the nursery every N nursery allocations\n"
-"    8: Incremental GC in two slices: 1) mark roots 2) finish collection\n"
-"    9: Incremental GC in two slices: 1) mark all 2) new marking and finish\n"
-"   10: Incremental GC in multiple slices\n"
-"   11: Verify post write barriers between instructions\n"
-"   12: Verify post write barriers between paints\n"
-"   13: Check internal hashtables on minor GC\n"
-"   14: Always compact arenas after GC\n"
-"  Period specifies that collection happens every n allocations.\n"),
+"gczeal(level, [N])",
+gc::ZealModeHelpText),
 
     JS_FN_HELP("schedulegc", ScheduleGC, 1, 0,
 "schedulegc(num | obj)",
 "  If num is given, schedule a GC after num allocations.\n"
 "  If obj is given, schedule a GC of obj's compartment."),
 
     JS_FN_HELP("selectforgc", SelectForGC, 0, 0,
 "selectforgc(obj1, obj2, ...)",
--- a/js/src/gc/GCRuntime.h
+++ b/js/src/gc/GCRuntime.h
@@ -758,28 +758,30 @@ class GCRuntime
      * nextScheduled is decremented. When it reaches zero, we do either a full
      * or a compartmental GC, based on debugCompartmentGC.
      *
      * At this point, if zeal_ is one of the types that trigger periodic
      * collection, then nextScheduled is reset to the value of zealFrequency.
      * Otherwise, no additional GCs take place.
      *
      * You can control these values in several ways:
-     *   - Pass the -Z flag to the shell (see the usage info for details)
-     *   - Call   zeal() or schedulegc() from inside shell-executed JS code
+     *   - Set the JS_GC_ZEAL environment variable
+     *   - Call zeal() or schedulegc() from inside shell-executed JS code
      *     (see the help for details)
      *
      * If gzZeal_ == 1 then we perform GCs in select places (during MaybeGC and
      * whenever a GC poke happens). This option is mainly useful to embedders.
      *
      * We use zeal_ == 4 to enable write barrier verification. See the comment
      * in jsgc.cpp for more information about this.
      *
      * zeal_ values from 8 to 10 periodically run different types of
      * incremental GC.
+     *
+     * zeal_ value 14 performs periodic shrinking collections.
      */
 #ifdef JS_GC_ZEAL
     int                   zealMode;
     int                   zealFrequency;
     int                   nextScheduled;
     bool                  deterministicOnly;
     int                   incrementalLimit;
 
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1236,16 +1236,34 @@ GCRuntime::GCRuntime(JSRuntime *rt) :
     lockOwner(nullptr),
     helperState(rt)
 {
     setGCMode(JSGC_MODE_GLOBAL);
 }
 
 #ifdef JS_GC_ZEAL
 
+const char *gc::ZealModeHelpText =
+    "  Specifies how zealous the garbage collector should be. Values for level:\n"
+    "    0: Normal amount of collection\n"
+    "    1: Collect when roots are added or removed\n"
+    "    2: Collect when every N allocations (default: 100)\n"
+    "    3: Collect when the window paints (browser only)\n"
+    "    4: Verify pre write barriers between instructions\n"
+    "    5: Verify pre write barriers between paints\n"
+    "    6: Verify stack rooting\n"
+    "    7: Collect the nursery every N nursery allocations\n"
+    "    8: Incremental GC in two slices: 1) mark roots 2) finish collection\n"
+    "    9: Incremental GC in two slices: 1) mark all 2) new marking and finish\n"
+    "   10: Incremental GC in multiple slices\n"
+    "   11: Verify post write barriers between instructions\n"
+    "   12: Verify post write barriers between paints\n"
+    "   13: Check internal hashtables on minor GC\n"
+    "   14: Perform a shrinking collection every N allocations\n";
+
 void
 GCRuntime::setZeal(uint8_t zeal, uint32_t frequency)
 {
     if (verifyPreData)
         VerifyBarriers(rt, PreBarrierVerifier);
     if (verifyPostData)
         VerifyBarriers(rt, PostBarrierVerifier);
 
@@ -1283,33 +1301,18 @@ GCRuntime::initZeal()
     if (strcmp(env, "help") != 0) {
         zeal = atoi(env);
         const char *p = strchr(env, ',');
         if (p)
             frequency = atoi(p + 1);
     }
 
     if (zeal < 0 || zeal > ZealLimit || frequency < 0) {
-        fprintf(stderr,
-                "Format: JS_GC_ZEAL=N[,F]\n"
-                "N indicates \"zealousness\":\n"
-                "  0: no additional GCs\n"
-                "  1: additional GCs at common danger points\n"
-                "  2: GC every F allocations (default: 100)\n"
-                "  3: GC when the window paints (browser only)\n"
-                "  4: Verify pre write barriers between instructions\n"
-                "  5: Verify pre write barriers between paints\n"
-                "  6: Verify stack rooting\n"
-                "  7: Collect the nursery every N nursery allocations\n"
-                "  8: Incremental GC in two slices: 1) mark roots 2) finish collection\n"
-                "  9: Incremental GC in two slices: 1) mark all 2) new marking and finish\n"
-                " 10: Incremental GC in multiple slices\n"
-                " 11: Verify post write barriers between instructions\n"
-                " 12: Verify post write barriers between paints\n"
-                " 13: Purge analysis state every F allocations (default: 100)\n");
+        fprintf(stderr, "Format: JS_GC_ZEAL=level[,N]\n");
+        fputs(ZealModeHelpText, stderr);
         return false;
     }
 
     setZeal(zeal, frequency);
     return true;
 }
 
 #endif
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -1359,16 +1359,18 @@ const int ZealIncrementalRootsThenFinish
 const int ZealIncrementalMarkAllThenFinish = 9;
 const int ZealIncrementalMultipleSlices = 10;
 const int ZealVerifierPostValue = 11;
 const int ZealFrameVerifierPostValue = 12;
 const int ZealCheckHashTablesOnMinorGC = 13;
 const int ZealCompactValue = 14;
 const int ZealLimit = 14;
 
+extern const char *ZealModeHelpText;
+
 enum VerifierType {
     PreBarrierVerifier,
     PostBarrierVerifier
 };
 
 #ifdef JS_GC_ZEAL
 
 /* Check that write barriers have been used correctly. See jsgc.cpp. */