Bug 1408673 - Update EnvironmentObject comments for Gecko
MozReview-Commit-ID: AIt3eQ33k7m
--- a/js/src/vm/EnvironmentObject.h
+++ b/js/src/vm/EnvironmentObject.h
@@ -173,67 +173,83 @@ EnvironmentCoordinateFunctionScript(JSSc
* Does not hold 'var' bindings.
*
* The embedding (Gecko) uses non-syntactic envs for various things, some of
* which are detailed below. All env chain listings below are, from top to
* bottom, outermost to innermost.
*
* A. Component loading
*
- * Components may be loaded in "reuse loader global" mode, where to save on
- * memory, all JSMs and JS-implemented XPCOM modules are loaded into a single
- * global. Each individual JSMs are compiled as functions with their own
- * FakeBackstagePass. They have the following env chain:
+ * Components may be loaded in a shared global mode where most JSMs share a
+ * single global in order to save on memory and avoid CCWs. To support this, a
+ * NonSyntacticVariablesObject is used for each JSM to provide a basic form of
+ * isolation. They have the following env chain:
*
* BackstagePass global
* |
- * Global lexical scope
+ * LexicalEnvironmentObject[this=global]
* |
- * WithEnvironmentObject wrapping FakeBackstagePass
+ * NonSyntacticVariablesObject
* |
- * LexicalEnvironmentObject
+ * LexicalEnvironmentObject[this=nsvo]
*
- * B. Subscript loading
+ * B.1 Subscript loading
*
- * Subscripts may be loaded into a target object. They have the following
- * env chain:
+ * Subscripts may be loaded into a target object and it's associated global.
+ * They have the following env chain:
*
- * Loader global
+ * Target object's global
* |
- * Global lexical scope
+ * LexicalEnvironmentObject[this=global]
* |
* WithEnvironmentObject wrapping target
* |
- * LexicalEnvironmentObject
+ * LexicalEnvironmentObject[this=target]
+ *
+ * B.2 Subscript loading (Shared-global JSM)
+ *
+ * The target object of a subscript load may be in a JSM with a shared global,
+ * in which case we will also have the NonSyntacticVariablesObject on the
+ * chain.
*
- * C. Frame scripts
+ * Target object's global
+ * |
+ * LexicalEnvironmentObject[this=global]
+ * |
+ * NonSyntacticVariablesObject
+ * |
+ * LexicalEnvironmentObject[this=nsvo]
+ * |
+ * WithEnvironmentObject wrapping target
+ * |
+ * LexicalEnvironmentObject[this=target]
+ *
+ * D. Frame scripts
*
* XUL frame scripts are always loaded with a NonSyntacticVariablesObject as a
* "polluting global". This is done exclusively in
* js::ExecuteInGlobalAndReturnScope.
*
* Loader global
* |
- * Global lexical scope
+ * LexicalEnvironmentObject[this=global]
* |
* NonSyntacticVariablesObject
* |
- * LexicalEnvironmentObject
+ * LexicalEnvironmentObject[this=global]
*
* D. XBL and DOM event handlers
*
* XBL methods are compiled as functions with XUL elements on the env chain,
* and DOM event handlers are compiled as functions with HTML elements on the
- * env chain. For a chain of elements e0,...,eN:
+ * env chain. For a chain of elements e0,e1,...:
*
* ...
* |
- * WithEnvironmentObject wrapping eN
- * |
- * ...
+ * WithEnvironmentObject wrapping e1
* |
* WithEnvironmentObject wrapping e0
* |
* LexicalEnvironmentObject
*
*/
class EnvironmentObject : public NativeObject