Skip to content

Instantly share code, notes, and snippets.

@jimblandy
Created March 26, 2019 22:59
Show Gist options
  • Save jimblandy/4f55bf19082981e7c05430e4efb4bfb0 to your computer and use it in GitHub Desktop.
Save jimblandy/4f55bf19082981e7c05430e4efb4bfb0 to your computer and use it in GitHub Desktop.
diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -24,17 +24,17 @@
* write barrier should be invoked whenever a write can cause the set of things
* traced through by the GC to change. This includes:
* - writes to object properties
* - writes to array slots
* - writes to fields like JSObject::shape_ that we trace through
* - writes to fields in private data
* - writes to non-markable fields like JSObject::private that point to
* markable data
- * The last category is the trickiest. Even though the private pointers does not
+ * The last category is the trickiest. Even though the private pointer does not
* point to a GC thing, changing the private pointer may change the set of
* objects that are traced by the GC. Therefore it needs a write barrier.
*
* Every barriered write should have the following form:
* <pre-barrier>
* obj->field = value; // do the actual write
* <post-barrier>
* The pre-barrier is used for incremental GC and the post-barrier is for
@@ -114,19 +114,19 @@
* minor collection. Part of the way this is achieved is to only mark the
* nursery itself; tenured things, which may form the majority of the heap, are
* not traced through or marked. This leads to the problem of what to do about
* tenured objects that have pointers into the nursery: if such things are not
* marked, they may be discarded while there are still live objects which
* reference them. The solution is to maintain information about these pointers,
* and mark their targets when we start a minor collection.
*
- * The pointers can be thought of as edges in object graph, and the set of edges
- * from the tenured generation into the nursery is know as the remembered set.
- * Post barriers are used to track this remembered set.
+ * The pointers can be thought of as edges in an object graph, and the set of
+ * edges from the tenured generation into the nursery is known as the remembered
+ * set. Post barriers are used to track this remembered set.
*
* Whenever a slot which could contain such a pointer is written, we check
* whether the pointed-to thing is in the nursery (if storeBuffer() returns a
* buffer). If so we add the cell into the store buffer, which is the
* collector's representation of the remembered set. This means that when we
* come to do a minor collection we can examine the contents of the store buffer
* and mark any edge targets that are in the nursery.
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment