Bug 695549 - Rename almost everything in the JS front end. Part 1, rename types and put them in the js namespace. r=luke.
authorJason Orendorff <jorendorff@mozilla.com>
Wed, 19 Oct 2011 09:35:52 -0500
changeset 80332 318083d40e1c65d0dbd6213c85299cf2774c3f4a
parent 80331 609372752255d36aa3d6205fc04f2acc8c4f091e
child 80333 39cbf5aa4c4c92d60070525e0690e3899d82a191
push id434
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 12:10:54 +0000
treeherdermozilla-beta@bddb6ed8dd47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs695549
milestone10.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 695549 - Rename almost everything in the JS front end. Part 1, rename types and put them in the js namespace. r=luke.
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeCompiler.h
js/src/frontend/BytecodeGenerator.cpp
js/src/frontend/BytecodeGenerator.h
js/src/frontend/FoldConstants.cpp
js/src/frontend/FoldConstants.h
js/src/frontend/ParseMaps-inl.h
js/src/frontend/ParseMaps.cpp
js/src/frontend/ParseMaps.h
js/src/frontend/ParseNode-inl.h
js/src/frontend/ParseNode.cpp
js/src/frontend/ParseNode.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/frontend/TokenStream.cpp
js/src/frontend/TokenStream.h
js/src/jsdbgapi.cpp
js/src/jsprvtd.h
js/src/jsreflect.cpp
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jsxml.cpp
js/src/methodjit/Compiler.cpp
js/src/shell/js.cpp
js/src/vm/Debugger.cpp
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -61,17 +61,17 @@ JSScript *
 Compiler::compileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerFrame,
                         JSPrincipals *principals, uint32 tcflags,
                         const jschar *chars, size_t length,
                         const char *filename, uintN lineno, JSVersion version,
                         JSString *source /* = NULL */,
                         uintN staticLevel /* = 0 */)
 {
     TokenKind tt;
-    JSParseNode *pn;
+    ParseNode *pn;
     JSScript *script;
     bool inDirectivePrologue;
 
     JS_ASSERT(!(tcflags & ~(TCF_COMPILE_N_GO | TCF_NO_SCRIPT_RVAL | TCF_NEED_MUTABLE_SCRIPT |
                             TCF_COMPILE_FOR_EVAL | TCF_NEED_SCRIPT_OBJECT)));
 
     /*
      * The scripted callerFrame can only be given for compile-and-go scripts
@@ -82,18 +82,18 @@ Compiler::compileScript(JSContext *cx, J
 
     Compiler compiler(cx, principals, callerFrame);
     if (!compiler.init(chars, length, filename, lineno, version))
         return NULL;
 
     Parser &parser = compiler.parser;
     TokenStream &tokenStream = parser.tokenStream;
 
-    JSCodeGenerator cg(&parser, tokenStream.getLineno());
-    if (!cg.init(cx, JSTreeContext::USED_AS_TREE_CONTEXT))
+    CodeGenerator cg(&parser, tokenStream.getLineno());
+    if (!cg.init(cx, TreeContext::USED_AS_TREE_CONTEXT))
         return NULL;
 
     Probes::compileScriptBegin(cx, filename, lineno);
 
     MUST_FLOW_THROUGH("out");
 
     // We can specialize a bit for the given scope chain if that scope chain is the global object.
     JSObject *globalObj = scopeChain && scopeChain == scopeChain->getGlobal()
@@ -138,17 +138,17 @@ Compiler::compileScript(JSContext *cx, J
         }
 
         if (callerFrame && callerFrame->isFunctionFrame()) {
             /*
              * An eval script in a caller frame needs to have its enclosing
              * function captured in case it refers to an upvar, and someone
              * wishes to decompile it while it's running.
              */
-            JSObjectBox *funbox = parser.newObjectBox(callerFrame->fun());
+            ObjectBox *funbox = parser.newObjectBox(callerFrame->fun());
             if (!funbox)
                 goto out;
             funbox->emitLink = cg.objectList.lastbox;
             cg.objectList.lastbox = funbox;
             cg.objectList.length++;
 #ifdef DEBUG
             savedCallerFun = true;
 #endif
@@ -184,17 +184,17 @@ Compiler::compileScript(JSContext *cx, J
         pn = parser.statement();
         if (!pn)
             goto out;
         JS_ASSERT(!cg.blockNode);
 
         if (inDirectivePrologue && !parser.recognizeDirectivePrologue(pn, &inDirectivePrologue))
             goto out;
 
-        if (!js_FoldConstants(cx, pn, &cg))
+        if (!FoldConstants(cx, pn, &cg))
             goto out;
 
         if (!parser.analyzeFunctions(&cg))
             goto out;
         cg.functionList = NULL;
 
         if (!js_EmitTree(cx, &cg, pn))
             goto out;
@@ -320,17 +320,17 @@ Compiler::defineGlobals(JSContext *cx, G
         const Shape *shape =
             DefineNativeProperty(cx, globalObj, id, rval, JS_PropertyStub, JS_StrictPropertyStub,
                                  JSPROP_ENUMERATE | JSPROP_PERMANENT, 0, 0, DNP_SKIP_TYPE);
         if (!shape)
             return false;
         def.knownSlot = shape->slot;
     }
 
-    js::Vector<JSScript *, 16> worklist(cx);
+    Vector<JSScript *, 16> worklist(cx);
     if (!worklist.append(script))
         return false;
 
     /*
      * Recursively walk through all scripts we just compiled. For each script,
      * go through all global uses. Each global use indexes into globalScope->defs.
      * Use this information to repoint each use to the correct slot in the global
      * object.
@@ -395,30 +395,30 @@ Compiler::compileFunctionBody(JSContext 
     Compiler compiler(cx, principals);
 
     if (!compiler.init(chars, length, filename, lineno, version))
         return false;
 
     Parser &parser = compiler.parser;
     TokenStream &tokenStream = parser.tokenStream;
 
-    JSCodeGenerator funcg(&parser, tokenStream.getLineno());
-    if (!funcg.init(cx, JSTreeContext::USED_AS_TREE_CONTEXT))
+    CodeGenerator funcg(&parser, tokenStream.getLineno());
+    if (!funcg.init(cx, TreeContext::USED_AS_TREE_CONTEXT))
         return false;
 
     funcg.flags |= TCF_IN_FUNCTION;
     funcg.setFunction(fun);
     funcg.bindings.transfer(cx, bindings);
     fun->setArgCount(funcg.bindings.countArgs());
     if (!GenerateBlockId(&funcg, funcg.bodyid))
         return false;
 
     /* FIXME: make Function format the source for a function definition. */
     tokenStream.mungeCurrentToken(TOK_NAME);
-    JSParseNode *fn = FunctionNode::create(&funcg);
+    ParseNode *fn = FunctionNode::create(&funcg);
     if (fn) {
         fn->pn_body = NULL;
         fn->pn_cookie.makeFree();
 
         uintN nargs = fun->nargs;
         if (nargs) {
             /*
              * NB: do not use AutoLocalNameArray because it will release space
@@ -440,25 +440,25 @@ Compiler::compileFunctionBody(JSContext 
 
     /*
      * Farble the body so that it looks like a block statement to js_EmitTree,
      * which is called from js_EmitFunctionBody (see jsemit.cpp).  After we're
      * done parsing, we must fold constants, analyze any nested functions, and
      * generate code for this function, including a stop opcode at the end.
      */
     tokenStream.mungeCurrentToken(TOK_LC);
-    JSParseNode *pn = fn ? parser.functionBody() : NULL;
+    ParseNode *pn = fn ? parser.functionBody() : NULL;
     if (pn) {
         if (!CheckStrictParameters(cx, &funcg)) {
             pn = NULL;
         } else if (!tokenStream.matchToken(TOK_EOF)) {
             parser.reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
             pn = NULL;
-        } else if (!js_FoldConstants(cx, pn, &funcg)) {
-            /* js_FoldConstants reported the error already. */
+        } else if (!FoldConstants(cx, pn, &funcg)) {
+            /* FoldConstants reported the error already. */
             pn = NULL;
         } else if (!parser.analyzeFunctions(&funcg)) {
             pn = NULL;
         } else {
             if (fn->pn_body) {
                 JS_ASSERT(fn->pn_body->isKind(TOK_ARGSBODY));
                 fn->pn_body->append(pn);
                 fn->pn_body->pn_pos = pn->pn_pos;
--- a/js/src/frontend/BytecodeCompiler.h
+++ b/js/src/frontend/BytecodeCompiler.h
@@ -58,17 +58,17 @@ struct Compiler
 
     bool init(const jschar *base, size_t length, const char *filename, uintN lineno,
               JSVersion version) {
         return parser.init(base, length, filename, lineno, version);
     }
 
     static bool
     compileFunctionBody(JSContext *cx, JSFunction *fun, JSPrincipals *principals,
-                        js::Bindings *bindings, const jschar *chars, size_t length,
+                        Bindings *bindings, const jschar *chars, size_t length,
                         const char *filename, uintN lineno, JSVersion version);
 
     static JSScript *
     compileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerFrame,
                   JSPrincipals *principals, uint32 tcflags,
                   const jschar *chars, size_t length,
                   const char *filename, uintN lineno, JSVersion version,
                   JSString *source = NULL, uintN staticLevel = 0);
--- a/js/src/frontend/BytecodeGenerator.cpp
+++ b/js/src/frontend/BytecodeGenerator.cpp
@@ -84,34 +84,33 @@
 /* Macros to compute byte sizes from typed element counts. */
 #define BYTECODE_SIZE(n)        ((n) * sizeof(jsbytecode))
 #define SRCNOTE_SIZE(n)         ((n) * sizeof(jssrcnote))
 
 using namespace js;
 using namespace js::gc;
 
 static JSBool
-NewTryNote(JSContext *cx, JSCodeGenerator *cg, JSTryNoteKind kind,
-           uintN stackDepth, size_t start, size_t end);
+NewTryNote(JSContext *cx, CodeGenerator *cg, JSTryNoteKind kind, uintN stackDepth,
+           size_t start, size_t end);
 
 static bool
-EmitIndexOp(JSContext *cx, JSOp op, uintN index, JSCodeGenerator *cg,
-            JSOp *psuffix = NULL);
+EmitIndexOp(JSContext *cx, JSOp op, uintN index, CodeGenerator *cg, JSOp *psuffix = NULL);
 
 static JSBool
-EmitLeaveBlock(JSContext *cx, JSCodeGenerator *cg, JSOp op, JSObjectBox *box);
+EmitLeaveBlock(JSContext *cx, CodeGenerator *cg, JSOp op, ObjectBox *box);
 
 void
-JSTreeContext::trace(JSTracer *trc)
+TreeContext::trace(JSTracer *trc)
 {
     bindings.trace(trc);
 }
 
-JSCodeGenerator::JSCodeGenerator(Parser *parser, uintN lineno)
-  : JSTreeContext(parser),
+CodeGenerator::CodeGenerator(Parser *parser, uintN lineno)
+  : TreeContext(parser),
     atomIndices(parser->context),
     stackDepth(0), maxStackDepth(0),
     ntrynotes(0), lastTryNode(NULL),
     spanDeps(NULL), jumpTargets(NULL), jtFreeList(NULL),
     numSpanDeps(0), numJumpTargets(0), spanDepTodo(0),
     arrayCompDepth(0),
     emitLevel(0),
     constMap(parser->context),
@@ -128,38 +127,38 @@ JSCodeGenerator::JSCodeGenerator(Parser 
     flags = TCF_COMPILING;
     memset(&prolog, 0, sizeof prolog);
     memset(&main, 0, sizeof main);
     current = &main;
     firstLine = prolog.currentLine = main.currentLine = lineno;
 }
 
 bool
-JSCodeGenerator::init(JSContext *cx, JSTreeContext::InitBehavior ib)
+CodeGenerator::init(JSContext *cx, TreeContext::InitBehavior ib)
 {
     roLexdeps.init();
-    return JSTreeContext::init(cx, ib) && constMap.init() && atomIndices.ensureMap(cx);
+    return TreeContext::init(cx, ib) && constMap.init() && atomIndices.ensureMap(cx);
 }
 
-JSCodeGenerator::~JSCodeGenerator()
+CodeGenerator::~CodeGenerator()
 {
     JSContext *cx = parser->context;
 
     cx->free_(prolog.base);
     cx->free_(prolog.notes);
     cx->free_(main.base);
     cx->free_(main.notes);
 
     /* NB: non-null only after OOM. */
     if (spanDeps)
         cx->free_(spanDeps);
 }
 
 static ptrdiff_t
-EmitCheck(JSContext *cx, JSCodeGenerator *cg, ptrdiff_t delta)
+EmitCheck(JSContext *cx, CodeGenerator *cg, ptrdiff_t delta)
 {
     jsbytecode *base = CG_BASE(cg);
     jsbytecode *newbase;
     jsbytecode *next = CG_NEXT(cg);
     jsbytecode *limit = CG_LIMIT(cg);
     ptrdiff_t offset = next - base;
     size_t minlength = offset + delta;
 
@@ -186,17 +185,17 @@ EmitCheck(JSContext *cx, JSCodeGenerator
         CG_BASE(cg) = newbase;
         CG_LIMIT(cg) = newbase + newlength;
         CG_NEXT(cg) = newbase + offset;
     }
     return offset;
 }
 
 static void
-UpdateDepth(JSContext *cx, JSCodeGenerator *cg, ptrdiff_t target)
+UpdateDepth(JSContext *cx, CodeGenerator *cg, ptrdiff_t target)
 {
     jsbytecode *pc;
     JSOp op;
     const JSCodeSpec *cs;
     uintN extra, nuses;
     intN ndefs;
 
     pc = CG_CODE(cg, target);
@@ -246,69 +245,69 @@ UpdateDepth(JSContext *cx, JSCodeGenerat
         ndefs = OBJ_BLOCK_COUNT(cx, blockObj);
     }
     cg->stackDepth += ndefs;
     if ((uintN)cg->stackDepth > cg->maxStackDepth)
         cg->maxStackDepth = cg->stackDepth;
 }
 
 static inline void
-UpdateDecomposeLength(JSCodeGenerator *cg, uintN start)
+UpdateDecomposeLength(CodeGenerator *cg, uintN start)
 {
     uintN end = CG_OFFSET(cg);
     JS_ASSERT(uintN(end - start) < 256);
     CG_CODE(cg, start)[-1] = end - start;
 }
 
 ptrdiff_t
-js_Emit1(JSContext *cx, JSCodeGenerator *cg, JSOp op)
+js_Emit1(JSContext *cx, CodeGenerator *cg, JSOp op)
 {
     ptrdiff_t offset = EmitCheck(cx, cg, 1);
 
     if (offset >= 0) {
         *CG_NEXT(cg)++ = (jsbytecode)op;
         UpdateDepth(cx, cg, offset);
     }
     return offset;
 }
 
 ptrdiff_t
-js_Emit2(JSContext *cx, JSCodeGenerator *cg, JSOp op, jsbytecode op1)
+js_Emit2(JSContext *cx, CodeGenerator *cg, JSOp op, jsbytecode op1)
 {
     ptrdiff_t offset = EmitCheck(cx, cg, 2);
 
     if (offset >= 0) {
         jsbytecode *next = CG_NEXT(cg);
         next[0] = (jsbytecode)op;
         next[1] = op1;
         CG_NEXT(cg) = next + 2;
         UpdateDepth(cx, cg, offset);
     }
     return offset;
 }
 
 ptrdiff_t
-js_Emit3(JSContext *cx, JSCodeGenerator *cg, JSOp op, jsbytecode op1,
+js_Emit3(JSContext *cx, CodeGenerator *cg, JSOp op, jsbytecode op1,
          jsbytecode op2)
 {
     ptrdiff_t offset = EmitCheck(cx, cg, 3);
 
     if (offset >= 0) {
         jsbytecode *next = CG_NEXT(cg);
         next[0] = (jsbytecode)op;
         next[1] = op1;
         next[2] = op2;
         CG_NEXT(cg) = next + 3;
         UpdateDepth(cx, cg, offset);
     }
     return offset;
 }
 
 ptrdiff_t
-js_Emit5(JSContext *cx, JSCodeGenerator *cg, JSOp op, uint16 op1, uint16 op2)
+js_Emit5(JSContext *cx, CodeGenerator *cg, JSOp op, uint16 op1, uint16 op2)
 {
     ptrdiff_t offset = EmitCheck(cx, cg, 5);
 
     if (offset >= 0) {
         jsbytecode *next = CG_NEXT(cg);
         next[0] = (jsbytecode)op;
         next[1] = UINT16_HI(op1);
         next[2] = UINT16_LO(op1);
@@ -316,17 +315,17 @@ js_Emit5(JSContext *cx, JSCodeGenerator 
         next[4] = UINT16_LO(op2);
         CG_NEXT(cg) = next + 5;
         UpdateDepth(cx, cg, offset);
     }
     return offset;
 }
 
 ptrdiff_t
-js_EmitN(JSContext *cx, JSCodeGenerator *cg, JSOp op, size_t extra)
+js_EmitN(JSContext *cx, CodeGenerator *cg, JSOp op, size_t extra)
 {
     ptrdiff_t length = 1 + (ptrdiff_t)extra;
     ptrdiff_t offset = EmitCheck(cx, cg, length);
 
     if (offset >= 0) {
         jsbytecode *next = CG_NEXT(cg);
         *next = (jsbytecode)op;
         memset(next + 1, 0, BYTECODE_SIZE(extra));
@@ -363,25 +362,25 @@ static const char *statementName[] = {
     "for loop",              /* FOR_LOOP */
     "for/in loop",           /* FOR_IN_LOOP */
     "while loop",            /* WHILE_LOOP */
 };
 
 JS_STATIC_ASSERT(JS_ARRAY_LENGTH(statementName) == STMT_LIMIT);
 
 static const char *
-StatementName(JSCodeGenerator *cg)
+StatementName(CodeGenerator *cg)
 {
     if (!cg->topStmt)
         return js_script_str;
     return statementName[cg->topStmt->type];
 }
 
 static void
-ReportStatementTooLarge(JSContext *cx, JSCodeGenerator *cg)
+ReportStatementTooLarge(JSContext *cx, CodeGenerator *cg)
 {
     JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NEED_DIET,
                          StatementName(cg));
 }
 
 /**
   Span-dependent instructions in JS bytecode consist of the jump (JOF_JUMP)
   and switch (JOF_LOOKUPSWITCH, JOF_TABLESWITCH) format opcodes, subdivided
@@ -400,29 +399,29 @@ ReportStatementTooLarge(JSContext *cx, J
   of selecting as few long instructions as possible, or about as few -- since
   jumps can span other jumps, extending one jump may cause another to need to
   be extended.
 
   Most JS scripts are short, so need no extended jumps.  We optimize for this
   case by generating short jumps until we know a long jump is needed.  After
   that point, we keep generating short jumps, but each jump's 16-bit immediate
   offset operand is actually an unsigned index into cg->spanDeps, an array of
-  JSSpanDep structs.  Each struct tells the top offset in the script of the
+  js::SpanDep structs.  Each struct tells the top offset in the script of the
   opcode, the "before" offset of the jump (which will be the same as top for
   simplex jumps, but which will index further into the bytecode array for a
   non-initial jump offset in a lookup or table switch), the after "offset"
   adjusted during span-dependent instruction selection (initially the same
   value as the "before" offset), and the jump target (more below).
 
   Since we generate cg->spanDeps lazily, from within js_SetJumpOffset, we must
   ensure that all bytecode generated so far can be inspected to discover where
   the jump offset immediate operands lie within CG_CODE(cg).  But the bonus is
   that we generate span-dependency records sorted by their offsets, so we can
-  binary-search when trying to find a JSSpanDep for a given bytecode offset,
-  or the nearest JSSpanDep at or above a given pc.
+  binary-search when trying to find a SpanDep for a given bytecode offset, or
+  the nearest SpanDep at or above a given pc.
 
   To avoid limiting scripts to 64K jumps, if the cg->spanDeps index overflows
   65534, we store SPANDEP_INDEX_HUGE in the jump's immediate operand.  This
   tells us that we need to binary-search for the cg->spanDeps entry by the
   jump opcode's bytecode offset (sd->before).
 
   Jump targets need to be maintained in a data structure that lets us look
   up an already-known target by its address (jumps may have a common target),
@@ -431,51 +430,51 @@ ReportStatementTooLarge(JSContext *cx, J
   that target needs to be extended).  We use an AVL tree, implemented using
   recursion, but with some tricky optimizations to its height-balancing code
   (see http://www.cmcrossroads.com/bradapp/ftp/src/libs/C++/AvlTrees.html).
 
   A final wrinkle: backpatch chains are linked by jump-to-jump offsets with
   positive sign, even though they link "backward" (i.e., toward lower bytecode
   address).  We don't want to waste space and search time in the AVL tree for
   such temporary backpatch deltas, so we use a single-bit wildcard scheme to
-  tag true JSJumpTarget pointers and encode untagged, signed (positive) deltas
-  in JSSpanDep.target pointers, depending on whether the JSSpanDep has a known
+  tag true JumpTarget pointers and encode untagged, signed (positive) deltas in
+  SpanDep::target pointers, depending on whether the SpanDep has a known
   target, or is still awaiting backpatching.
 
   Note that backpatch chains would present a problem for BuildSpanDepTable,
   which inspects bytecode to build cg->spanDeps on demand, when the first
   short jump offset overflows.  To solve this temporary problem, we emit a
   proxy bytecode (JSOP_BACKPATCH; JSOP_BACKPATCH_POP for branch ops) whose
   nuses/ndefs counts help keep the stack balanced, but whose opcode format
   distinguishes its backpatch delta immediate operand from a normal jump
   offset.
  */
 static int
-BalanceJumpTargets(JSJumpTarget **jtp)
+BalanceJumpTargets(JumpTarget **jtp)
 {
-    JSJumpTarget *jt, *jt2, *root;
-    int dir, otherDir, heightChanged;
+    JumpTarget *jt = *jtp;
+    JS_ASSERT(jt->balance != 0);
+
+    int dir;
     JSBool doubleRotate;
-
-    jt = *jtp;
-    JS_ASSERT(jt->balance != 0);
-
     if (jt->balance < -1) {
         dir = JT_RIGHT;
         doubleRotate = (jt->kids[JT_LEFT]->balance > 0);
     } else if (jt->balance > 1) {
         dir = JT_LEFT;
         doubleRotate = (jt->kids[JT_RIGHT]->balance < 0);
     } else {
         return 0;
     }
 
-    otherDir = JT_OTHER_DIR(dir);
+    int otherDir = JT_OTHER_DIR(dir);
+    JumpTarget *root;
+    int heightChanged;
     if (doubleRotate) {
-        jt2 = jt->kids[otherDir];
+        JumpTarget *jt2 = jt->kids[otherDir];
         *jtp = root = jt2->kids[dir];
 
         jt->kids[otherDir] = root->kids[dir];
         root->kids[dir] = jt;
 
         jt2->kids[dir] = root->kids[otherDir];
         root->kids[otherDir] = jt2;
 
@@ -490,38 +489,35 @@ BalanceJumpTargets(JSJumpTarget **jtp)
 
         heightChanged = (root->balance != 0);
         jt->balance = -((dir == JT_LEFT) ? --root->balance : ++root->balance);
     }
 
     return heightChanged;
 }
 
-typedef struct AddJumpTargetArgs {
+struct AddJumpTargetArgs {
     JSContext           *cx;
-    JSCodeGenerator     *cg;
+    CodeGenerator       *cg;
     ptrdiff_t           offset;
-    JSJumpTarget        *node;
-} AddJumpTargetArgs;
+    JumpTarget          *node;
+};
 
 static int
-AddJumpTarget(AddJumpTargetArgs *args, JSJumpTarget **jtp)
+AddJumpTarget(AddJumpTargetArgs *args, JumpTarget **jtp)
 {
-    JSJumpTarget *jt;
-    int balanceDelta;
-
-    jt = *jtp;
+    JumpTarget *jt = *jtp;
     if (!jt) {
-        JSCodeGenerator *cg = args->cg;
+        CodeGenerator *cg = args->cg;
 
         jt = cg->jtFreeList;
         if (jt) {
             cg->jtFreeList = jt->kids[JT_LEFT];
         } else {
-            jt = args->cx->tempLifoAlloc().new_<JSJumpTarget>();
+            jt = args->cx->tempLifoAlloc().new_<JumpTarget>();
             if (!jt) {
                 js_ReportOutOfMemory(args->cx);
                 return 0;
             }
         }
         jt->offset = args->offset;
         jt->balance = 0;
         jt->kids[JT_LEFT] = jt->kids[JT_RIGHT] = NULL;
@@ -531,46 +527,46 @@ AddJumpTarget(AddJumpTargetArgs *args, J
         return 1;
     }
 
     if (jt->offset == args->offset) {
         args->node = jt;
         return 0;
     }
 
+    int balanceDelta;
     if (args->offset < jt->offset)
         balanceDelta = -AddJumpTarget(args, &jt->kids[JT_LEFT]);
     else
         balanceDelta = AddJumpTarget(args, &jt->kids[JT_RIGHT]);
     if (!args->node)
         return 0;
 
     jt->balance += balanceDelta;
     return (balanceDelta && jt->balance)
            ? 1 - BalanceJumpTargets(jtp)
            : 0;
 }
 
 #ifdef DEBUG_brendan
-static int AVLCheck(JSJumpTarget *jt)
+static int AVLCheck(JumpTarget *jt)
 {
     int lh, rh;
 
     if (!jt) return 0;
     JS_ASSERT(-1 <= jt->balance && jt->balance <= 1);
     lh = AVLCheck(jt->kids[JT_LEFT]);
     rh = AVLCheck(jt->kids[JT_RIGHT]);
     JS_ASSERT(jt->balance == rh - lh);
     return 1 + JS_MAX(lh, rh);
 }
 #endif
 
 static JSBool
-SetSpanDepTarget(JSContext *cx, JSCodeGenerator *cg, JSSpanDep *sd,
-                 ptrdiff_t off)
+SetSpanDepTarget(JSContext *cx, CodeGenerator *cg, SpanDep *sd, ptrdiff_t off)
 {
     AddJumpTargetArgs args;
 
     if (off < JUMPX_OFFSET_MIN || JUMPX_OFFSET_MAX < off) {
         ReportStatementTooLarge(cx, cg);
         return JS_FALSE;
     }
 
@@ -586,44 +582,41 @@ SetSpanDepTarget(JSContext *cx, JSCodeGe
     AVLCheck(cg->jumpTargets);
 #endif
 
     SD_SET_TARGET(sd, args.node);
     return JS_TRUE;
 }
 
 #define SPANDEPS_MIN            256
-#define SPANDEPS_SIZE(n)        ((n) * sizeof(JSSpanDep))
+#define SPANDEPS_SIZE(n)        ((n) * sizeof(js::SpanDep))
 #define SPANDEPS_SIZE_MIN       SPANDEPS_SIZE(SPANDEPS_MIN)
 
 static JSBool
-AddSpanDep(JSContext *cx, JSCodeGenerator *cg, jsbytecode *pc, jsbytecode *pc2,
-           ptrdiff_t off)
+AddSpanDep(JSContext *cx, CodeGenerator *cg, jsbytecode *pc, jsbytecode *pc2, ptrdiff_t off)
 {
-    uintN index;
-    JSSpanDep *sdbase, *sd;
-    size_t size;
-
-    index = cg->numSpanDeps;
+    uintN index = cg->numSpanDeps;
     if (index + 1 == 0) {
         ReportStatementTooLarge(cx, cg);
         return JS_FALSE;
     }
 
+    SpanDep *sdbase;
     if ((index & (index - 1)) == 0 &&
-        (!(sdbase = cg->spanDeps) || index >= SPANDEPS_MIN)) {
-        size = sdbase ? SPANDEPS_SIZE(index) : SPANDEPS_SIZE_MIN / 2;
-        sdbase = (JSSpanDep *) cx->realloc_(sdbase, size + size);
+        (!(sdbase = cg->spanDeps) || index >= SPANDEPS_MIN))
+    {
+        size_t size = sdbase ? SPANDEPS_SIZE(index) : SPANDEPS_SIZE_MIN / 2;
+        sdbase = (SpanDep *) cx->realloc_(sdbase, size + size);
         if (!sdbase)
             return JS_FALSE;
         cg->spanDeps = sdbase;
     }
 
     cg->numSpanDeps = index + 1;
-    sd = cg->spanDeps + index;
+    SpanDep *sd = cg->spanDeps + index;
     sd->top = pc - CG_BASE(cg);
     sd->offset = sd->before = pc2 - CG_BASE(cg);
 
     if (js_CodeSpec[*pc].format & JOF_BACKPATCH) {
         /* Jump offset will be backpatched if off is a non-zero "bpdelta". */
         if (off != 0) {
             JS_ASSERT(off >= 1 + JUMP_OFFSET_LEN);
             if (off > BPDELTA_MAX) {
@@ -643,17 +636,17 @@ AddSpanDep(JSContext *cx, JSCodeGenerato
 
     if (index > SPANDEP_INDEX_MAX)
         index = SPANDEP_INDEX_HUGE;
     SET_SPANDEP_INDEX(pc2, index);
     return JS_TRUE;
 }
 
 static jsbytecode *
-AddSwitchSpanDeps(JSContext *cx, JSCodeGenerator *cg, jsbytecode *pc)
+AddSwitchSpanDeps(JSContext *cx, CodeGenerator *cg, jsbytecode *pc)
 {
     JSOp op;
     jsbytecode *pc2;
     ptrdiff_t off;
     jsint low, high;
     uintN njumps, indexlen;
 
     op = (JSOp) *pc;
@@ -682,17 +675,17 @@ AddSwitchSpanDeps(JSContext *cx, JSCodeG
         if (!AddSpanDep(cx, cg, pc, pc2, off))
             return NULL;
         pc2 += JUMP_OFFSET_LEN;
     }
     return 1 + pc2;
 }
 
 static JSBool
-BuildSpanDepTable(JSContext *cx, JSCodeGenerator *cg)
+BuildSpanDepTable(JSContext *cx, CodeGenerator *cg)
 {
     jsbytecode *pc, *end;
     JSOp op;
     const JSCodeSpec *cs;
     ptrdiff_t off;
 
     pc = CG_BASE(cg) + cg->spanDepTodo;
     end = CG_NEXT(cg);
@@ -718,23 +711,23 @@ BuildSpanDepTable(JSContext *cx, JSCodeG
             pc += cs->length;
             break;
         }
     }
 
     return JS_TRUE;
 }
 
-static JSSpanDep *
-GetSpanDep(JSCodeGenerator *cg, jsbytecode *pc)
+static SpanDep *
+GetSpanDep(CodeGenerator *cg, jsbytecode *pc)
 {
     uintN index;
     ptrdiff_t offset;
     int lo, hi, mid;
-    JSSpanDep *sd;
+    SpanDep *sd;
 
     index = GET_SPANDEP_INDEX(pc);
     if (index != SPANDEP_INDEX_HUGE)
         return cg->spanDeps + index;
 
     offset = pc - CG_BASE(cg);
     lo = 0;
     hi = cg->numSpanDeps - 1;
@@ -749,20 +742,19 @@ GetSpanDep(JSCodeGenerator *cg, jsbyteco
             hi = mid - 1;
     }
 
     JS_ASSERT(0);
     return NULL;
 }
 
 static JSBool
-SetBackPatchDelta(JSContext *cx, JSCodeGenerator *cg, jsbytecode *pc,
-                  ptrdiff_t delta)
+SetBackPatchDelta(JSContext *cx, CodeGenerator *cg, jsbytecode *pc, ptrdiff_t delta)
 {
-    JSSpanDep *sd;
+    SpanDep *sd;
 
     JS_ASSERT(delta >= 1 + JUMP_OFFSET_LEN);
     if (!cg->spanDeps && delta < JUMP_OFFSET_MAX) {
         SET_JUMP_OFFSET(pc, delta);
         return JS_TRUE;
     }
 
     if (delta > BPDELTA_MAX) {
@@ -775,79 +767,75 @@ SetBackPatchDelta(JSContext *cx, JSCodeG
 
     sd = GetSpanDep(cg, pc);
     JS_ASSERT(SD_GET_BPDELTA(sd) == 0);
     SD_SET_BPDELTA(sd, delta);
     return JS_TRUE;
 }
 
 static void
-UpdateJumpTargets(JSJumpTarget *jt, ptrdiff_t pivot, ptrdiff_t delta)
+UpdateJumpTargets(JumpTarget *jt, ptrdiff_t pivot, ptrdiff_t delta)
 {
     if (jt->offset > pivot) {
         jt->offset += delta;
         if (jt->kids[JT_LEFT])
             UpdateJumpTargets(jt->kids[JT_LEFT], pivot, delta);
     }
     if (jt->kids[JT_RIGHT])
         UpdateJumpTargets(jt->kids[JT_RIGHT], pivot, delta);
 }
 
-static JSSpanDep *
-FindNearestSpanDep(JSCodeGenerator *cg, ptrdiff_t offset, int lo,
-                   JSSpanDep *guard)
+static SpanDep *
+FindNearestSpanDep(CodeGenerator *cg, ptrdiff_t offset, int lo, SpanDep *guard)
 {
-    int num, hi, mid;
-    JSSpanDep *sdbase, *sd;
-
-    num = cg->numSpanDeps;
+    int num = cg->numSpanDeps;
     JS_ASSERT(num > 0);
-    hi = num - 1;
-    sdbase = cg->spanDeps;
+    int hi = num - 1;
+    SpanDep *sdbase = cg->spanDeps;
     while (lo <= hi) {
-        mid = (lo + hi) / 2;
-        sd = sdbase + mid;
+        int mid = (lo + hi) / 2;
+        SpanDep *sd = sdbase + mid;
         if (sd->before == offset)
             return sd;
         if (sd->before < offset)
             lo = mid + 1;
         else
             hi = mid - 1;
     }
     if (lo == num)
         return guard;
-    sd = sdbase + lo;
+    SpanDep *sd = sdbase + lo;
     JS_ASSERT(sd->before >= offset && (lo == 0 || sd[-1].before < offset));
     return sd;
 }
 
 static void
-FreeJumpTargets(JSCodeGenerator *cg, JSJumpTarget *jt)
+FreeJumpTargets(CodeGenerator *cg, JumpTarget *jt)
 {
     if (jt->kids[JT_LEFT])
         FreeJumpTargets(cg, jt->kids[JT_LEFT]);
     if (jt->kids[JT_RIGHT])
         FreeJumpTargets(cg, jt->kids[JT_RIGHT]);
     jt->kids[JT_LEFT] = cg->jtFreeList;
     cg->jtFreeList = jt;
 }
 
 static JSBool
-OptimizeSpanDeps(JSContext *cx, JSCodeGenerator *cg)
+OptimizeSpanDeps(JSContext *cx, CodeGenerator *cg)
 {
     jsbytecode *pc, *oldpc, *base, *limit, *next;
-    JSSpanDep *sd, *sd2, *sdbase, *sdlimit, *sdtop, guard;
+    SpanDep *sd, *sd2, *sdbase, *sdlimit, *sdtop, guard;
     ptrdiff_t offset, growth, delta, top, pivot, span, length, target;
     JSBool done;
     JSOp op;
     uint32 type;
     jssrcnote *sn, *snlimit;
     JSSrcNoteSpec *spec;
     uintN i, n, noteIndex;
-    JSTryNode *tryNode;
+    TryNode *tryNode;
     DebugOnly<int> passes = 0;
 
     base = CG_BASE(cg);
     sdbase = cg->spanDeps;
     sdlimit = sdbase + cg->numSpanDeps;
     offset = CG_OFFSET(cg);
     growth = 0;
 
@@ -1225,17 +1213,17 @@ OptimizeSpanDeps(JSContext *cx, JSCodeGe
     FreeJumpTargets(cg, cg->jumpTargets);
     cg->jumpTargets = NULL;
     cg->numSpanDeps = cg->numJumpTargets = 0;
     cg->spanDepTodo = CG_OFFSET(cg);
     return JS_TRUE;
 }
 
 static ptrdiff_t
-EmitJump(JSContext *cx, JSCodeGenerator *cg, JSOp op, ptrdiff_t off)
+EmitJump(JSContext *cx, CodeGenerator *cg, JSOp op, ptrdiff_t off)
 {
     JSBool extend;
     ptrdiff_t jmp;
     jsbytecode *pc;
 
     extend = off < JUMP_OFFSET_MIN || JUMP_OFFSET_MAX < off;
     if (extend && !cg->spanDeps && !BuildSpanDepTable(cx, cg))
         return -1;
@@ -1245,66 +1233,61 @@ EmitJump(JSContext *cx, JSCodeGenerator 
         pc = CG_CODE(cg, jmp);
         if (!AddSpanDep(cx, cg, pc, pc, off))
             return -1;
     }
     return jmp;
 }
 
 static ptrdiff_t
-GetJumpOffset(JSCodeGenerator *cg, jsbytecode *pc)
+GetJumpOffset(CodeGenerator *cg, jsbytecode *pc)
 {
-    JSSpanDep *sd;
-    JSJumpTarget *jt;
-    ptrdiff_t top;
-
     if (!cg->spanDeps)
         return GET_JUMP_OFFSET(pc);
 
-    sd = GetSpanDep(cg, pc);
-    jt = sd->target;
+    SpanDep *sd = GetSpanDep(cg, pc);
+    JumpTarget *jt = sd->target;
     if (!JT_HAS_TAG(jt))
         return JT_TO_BPDELTA(jt);
 
-    top = sd->top;
+    ptrdiff_t top = sd->top;
     while (--sd >= cg->spanDeps && sd->top == top)
         continue;
     sd++;
     return JT_CLR_TAG(jt)->offset - sd->offset;
 }
 
 JSBool
-js_SetJumpOffset(JSContext *cx, JSCodeGenerator *cg, jsbytecode *pc,
-                 ptrdiff_t off)
+js_SetJumpOffset(JSContext *cx, CodeGenerator *cg, jsbytecode *pc, ptrdiff_t off)
 {
     if (!cg->spanDeps) {
         if (JUMP_OFFSET_MIN <= off && off <= JUMP_OFFSET_MAX) {
             SET_JUMP_OFFSET(pc, off);
             return JS_TRUE;
         }
 
         if (!BuildSpanDepTable(cx, cg))
             return JS_FALSE;
     }
 
     return SetSpanDepTarget(cx, cg, GetSpanDep(cg, pc), off);
 }
 
 bool
-JSTreeContext::inStatement(JSStmtType type)
+TreeContext::inStatement(StmtType type)
 {
-    for (JSStmtInfo *stmt = topStmt; stmt; stmt = stmt->down) {
+    for (StmtInfo *stmt = topStmt; stmt; stmt = stmt->down) {
         if (stmt->type == type)
             return true;
     }
     return false;
 }
 
 bool
-JSTreeContext::ensureSharpSlots()
+TreeContext::ensureSharpSlots()
 {
 #if JS_HAS_SHARP_VARS
     JS_STATIC_ASSERT(SHARP_NSLOTS == 2);
 
     if (sharpSlotBase >= 0) {
         JS_ASSERT(flags & TCF_HAS_SHARPS);
         return true;
     }
@@ -1331,63 +1314,62 @@ JSTreeContext::ensureSharpSlots()
         sharpSlotBase = 0;
     }
     flags |= TCF_HAS_SHARPS;
 #endif
     return true;
 }
 
 bool
-JSTreeContext::skipSpansGenerator(unsigned skip)
+TreeContext::skipSpansGenerator(unsigned skip)
 {
-    JSTreeContext *tc = this;
+    TreeContext *tc = this;
     for (unsigned i = 0; i < skip; ++i, tc = tc->parent) {
         if (!tc)
             return false;
         if (tc->flags & TCF_FUN_IS_GENERATOR)
             return true;
     }
     return false;
 }
 
 namespace js {
 
 bool
-SetStaticLevel(JSTreeContext *tc, uintN staticLevel)
+SetStaticLevel(TreeContext *tc, uintN staticLevel)
 {
     /*
      * This is a lot simpler than error-checking every UpvarCookie::set, and
      * practically speaking it leaves more than enough room for upvars.
      */
     if (UpvarCookie::isLevelReserved(staticLevel)) {
         JS_ReportErrorNumber(tc->parser->context, js_GetErrorMessage, NULL,
                              JSMSG_TOO_DEEP, js_function_str);
         return false;
     }
     tc->staticLevel = staticLevel;
     return true;
 }
 
 bool
-GenerateBlockId(JSTreeContext *tc, uint32& blockid)
+GenerateBlockId(TreeContext *tc, uint32& blockid)
 {
     if (tc->blockidGen == JS_BIT(20)) {
         JS_ReportErrorNumber(tc->parser->context, js_GetErrorMessage, NULL,
                              JSMSG_NEED_DIET, "program");
         return false;
     }
     blockid = tc->blockidGen++;
     return true;
 }
 
 } /* namespace js */
 
 void
-js_PushStatement(JSTreeContext *tc, JSStmtInfo *stmt, JSStmtType type,
-                 ptrdiff_t top)
+js_PushStatement(TreeContext *tc, StmtInfo *stmt, StmtType type, ptrdiff_t top)
 {
     stmt->type = type;
     stmt->flags = 0;
     stmt->blockid = tc->blockid();
     SET_STATEMENT_TOP(stmt, top);
     stmt->label = NULL;
     JS_ASSERT(!stmt->blockBox);
     stmt->down = tc->topStmt;
@@ -1396,35 +1378,34 @@ js_PushStatement(JSTreeContext *tc, JSSt
         stmt->downScope = tc->topScopeStmt;
         tc->topScopeStmt = stmt;
     } else {
         stmt->downScope = NULL;
     }
 }
 
 void
-js_PushBlockScope(JSTreeContext *tc, JSStmtInfo *stmt, JSObjectBox *blockBox,
-                  ptrdiff_t top)
+js_PushBlockScope(TreeContext *tc, StmtInfo *stmt, ObjectBox *blockBox, ptrdiff_t top)
 {
     js_PushStatement(tc, stmt, STMT_BLOCK, top);
     stmt->flags |= SIF_SCOPE;
     blockBox->parent = tc->blockChainBox;
     blockBox->object->setParent(tc->blockChain());
     stmt->downScope = tc->topScopeStmt;
     tc->topScopeStmt = stmt;
     tc->blockChainBox = blockBox;
     stmt->blockBox = blockBox;
 }
 
 /*
  * Emit a backpatch op with offset pointing to the previous jump of this type,
  * so that we can walk back up the chain fixing up the op and jump offset.
  */
 static ptrdiff_t
-EmitBackPatchOp(JSContext *cx, JSCodeGenerator *cg, JSOp op, ptrdiff_t *lastp)
+EmitBackPatchOp(JSContext *cx, CodeGenerator *cg, JSOp op, ptrdiff_t *lastp)
 {
     ptrdiff_t offset, delta;
 
     offset = CG_OFFSET(cg);
     delta = offset - *lastp;
     *lastp = offset;
     JS_ASSERT(delta > 0);
     return EmitJump(cx, cg, op, delta);
@@ -1457,24 +1438,24 @@ EmitBackPatchOp(JSContext *cx, JSCodeGen
                         return JS_FALSE;                                      \
                 } while (--delta_ != 0);                                      \
             }                                                                 \
         }                                                                     \
     JS_END_MACRO
 
 /* A function, so that we avoid macro-bloating all the other callsites. */
 static JSBool
-UpdateLineNumberNotes(JSContext *cx, JSCodeGenerator *cg, uintN line)
+UpdateLineNumberNotes(JSContext *cx, CodeGenerator *cg, uintN line)
 {
     UPDATE_LINE_NUMBER_NOTES(cx, cg, line);
     return JS_TRUE;
 }
 
 static ptrdiff_t
-EmitTraceOp(JSContext *cx, JSCodeGenerator *cg, JSParseNode *nextpn)
+EmitTraceOp(JSContext *cx, CodeGenerator *cg, ParseNode *nextpn)
 {
     if (nextpn) {
         /*
          * Try to give the JSOP_TRACE the same line number as the next
          * instruction. nextpn is often a block, in which case the next
          * instruction typically comes from the first statement inside.
          */
         if (nextpn->isKind(TOK_LC) && nextpn->isArity(PN_LIST) && nextpn->pn_head)
@@ -1489,17 +1470,17 @@ EmitTraceOp(JSContext *cx, JSCodeGenerat
     return js_Emit3(cx, cg, JSOP_TRACE, UINT16_HI(index), UINT16_LO(index));
 }
 
 /*
  * If op is JOF_TYPESET (see the type barriers comment in jsinfer.h), reserve
  * a type set to store its result.
  */
 static inline void
-CheckTypeSet(JSContext *cx, JSCodeGenerator *cg, JSOp op)
+CheckTypeSet(JSContext *cx, CodeGenerator *cg, JSOp op)
 {
     if (js_CodeSpec[op].format & JOF_TYPESET) {
         if (cg->typesetCount < UINT16_MAX)
             cg->typesetCount++;
     }
 }
 
 /*
@@ -1529,47 +1510,44 @@ CheckTypeSet(JSContext *cx, JSCodeGenera
 #define EMIT_UINT16_IN_PLACE(offset, op, i)                                   \
     JS_BEGIN_MACRO                                                            \
         CG_CODE(cg, offset)[0] = op;                                          \
         CG_CODE(cg, offset)[1] = UINT16_HI(i);                                \
         CG_CODE(cg, offset)[2] = UINT16_LO(i);                                \
     JS_END_MACRO
 
 static JSBool
-FlushPops(JSContext *cx, JSCodeGenerator *cg, intN *npops)
+FlushPops(JSContext *cx, CodeGenerator *cg, intN *npops)
 {
     JS_ASSERT(*npops != 0);
     if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0)
         return JS_FALSE;
     EMIT_UINT16_IMM_OP(JSOP_POPN, *npops);
     *npops = 0;
     return JS_TRUE;
 }
 
 /*
  * Emit additional bytecode(s) for non-local jumps.
  */
 static JSBool
-EmitNonLocalJumpFixup(JSContext *cx, JSCodeGenerator *cg, JSStmtInfo *toStmt)
+EmitNonLocalJumpFixup(JSContext *cx, CodeGenerator *cg, StmtInfo *toStmt)
 {
-    intN depth, npops;
-    JSStmtInfo *stmt;
-
     /*
      * The non-local jump fixup we emit will unbalance cg->stackDepth, because
      * the fixup replicates balanced code such as JSOP_LEAVEWITH emitted at the
      * end of a with statement, so we save cg->stackDepth here and restore it
      * just before a successful return.
      */
-    depth = cg->stackDepth;
-    npops = 0;
+    intN depth = cg->stackDepth;
+    intN npops = 0;
 
 #define FLUSH_POPS() if (npops && !FlushPops(cx, cg, &npops)) return JS_FALSE
 
-    for (stmt = cg->topStmt; stmt != toStmt; stmt = stmt->down) {
+    for (StmtInfo *stmt = cg->topStmt; stmt != toStmt; stmt = stmt->down) {
         switch (stmt->type) {
           case STMT_FINALLY:
             FLUSH_POPS();
             if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0)
                 return JS_FALSE;
             if (EmitBackPatchOp(cx, cg, JSOP_BACKPATCH, &GOSUBS(*stmt)) < 0)
                 return JS_FALSE;
             break;
@@ -1618,34 +1596,34 @@ EmitNonLocalJumpFixup(JSContext *cx, JSC
     FLUSH_POPS();
     cg->stackDepth = depth;
     return JS_TRUE;
 
 #undef FLUSH_POPS
 }
 
 static JSBool
-EmitKnownBlockChain(JSContext *cx, JSCodeGenerator *cg, JSObjectBox *box)
+EmitKnownBlockChain(JSContext *cx, CodeGenerator *cg, ObjectBox *box)
 {
     if (box)
         return EmitIndexOp(cx, JSOP_BLOCKCHAIN, box->index, cg);
     return js_Emit1(cx, cg, JSOP_NULLBLOCKCHAIN) >= 0;
 }
 
 static JSBool
-EmitBlockChain(JSContext *cx, JSCodeGenerator *cg)
+EmitBlockChain(JSContext *cx, CodeGenerator *cg)
 {
     return EmitKnownBlockChain(cx, cg, cg->blockChainBox);
 }
 
 static const jsatomid INVALID_ATOMID = -1;
 
 static ptrdiff_t
-EmitGoto(JSContext *cx, JSCodeGenerator *cg, JSStmtInfo *toStmt,
-         ptrdiff_t *lastp, jsatomid labelIndex = INVALID_ATOMID, JSSrcNoteType noteType = SRC_NULL)
+EmitGoto(JSContext *cx, CodeGenerator *cg, StmtInfo *toStmt, ptrdiff_t *lastp,
+         jsatomid labelIndex = INVALID_ATOMID, SrcNoteType noteType = SRC_NULL)
 {
     intN index;
 
     if (!EmitNonLocalJumpFixup(cx, cg, toStmt))
         return -1;
 
     if (labelIndex != INVALID_ATOMID)
         index = js_NewSrcNote2(cx, cg, noteType, ptrdiff_t(labelIndex));
@@ -1662,18 +1640,17 @@ EmitGoto(JSContext *cx, JSCodeGenerator 
 
     if (!EmitBlockChain(cx, cg))
         return -1;
 
     return result;
 }
 
 static JSBool
-BackPatch(JSContext *cx, JSCodeGenerator *cg, ptrdiff_t last,
-          jsbytecode *target, jsbytecode op)
+BackPatch(JSContext *cx, CodeGenerator *cg, ptrdiff_t last, jsbytecode *target, jsbytecode op)
 {
     jsbytecode *pc, *stop;
     ptrdiff_t delta, span;
 
     pc = CG_CODE(cg, last);
     stop = CG_CODE(cg, -1);
     while (pc != stop) {
         delta = GetJumpOffset(cg, pc);
@@ -1687,60 +1664,55 @@ BackPatch(JSContext *cx, JSCodeGenerator
          */
         *pc = op;
         pc -= delta;
     }
     return JS_TRUE;
 }
 
 void
-js_PopStatement(JSTreeContext *tc)
+js_PopStatement(TreeContext *tc)
 {
-    JSStmtInfo *stmt;
-
-    stmt = tc->topStmt;
+    StmtInfo *stmt = tc->topStmt;
     tc->topStmt = stmt->down;
     if (STMT_LINKS_SCOPE(stmt)) {
         tc->topScopeStmt = stmt->downScope;
         if (stmt->flags & SIF_SCOPE) {
             tc->blockChainBox = stmt->blockBox->parent;
         }
     }
 }
 
 JSBool
-js_PopStatementCG(JSContext *cx, JSCodeGenerator *cg)
+js_PopStatementCG(JSContext *cx, CodeGenerator *cg)
 {
-    JSStmtInfo *stmt;
-
-    stmt = cg->topStmt;
+    StmtInfo *stmt = cg->topStmt;
     if (!STMT_IS_TRYING(stmt) &&
         (!BackPatch(cx, cg, stmt->breaks, CG_NEXT(cg), JSOP_GOTO) ||
          !BackPatch(cx, cg, stmt->continues, CG_CODE(cg, stmt->update),
                     JSOP_GOTO))) {
         return JS_FALSE;
     }
     js_PopStatement(cg);
     return JS_TRUE;
 }
 
 JSBool
-js_DefineCompileTimeConstant(JSContext *cx, JSCodeGenerator *cg, JSAtom *atom,
-                             JSParseNode *pn)
+js_DefineCompileTimeConstant(JSContext *cx, CodeGenerator *cg, JSAtom *atom, ParseNode *pn)
 {
     /* XXX just do numbers for now */
     if (pn->isKind(TOK_NUMBER)) {
         if (!cg->constMap.put(atom, NumberValue(pn->pn_dval)))
             return JS_FALSE;
     }
     return JS_TRUE;
 }
 
-JSStmtInfo *
-js_LexicalLookup(JSTreeContext *tc, JSAtom *atom, jsint *slotp, JSStmtInfo *stmt)
+StmtInfo *
+js_LexicalLookup(TreeContext *tc, JSAtom *atom, jsint *slotp, StmtInfo *stmt)
 {
     if (!stmt)
         stmt = tc->topScopeStmt;
     for (; stmt; stmt = stmt->downScope) {
         if (stmt->type == STMT_WITH)
             break;
 
         /* Skip "maybe scope" statements that don't contain let bindings. */
@@ -1767,36 +1739,32 @@ js_LexicalLookup(JSTreeContext *tc, JSAt
     return stmt;
 }
 
 /*
  * The function sets vp to NO_CONSTANT when the atom does not corresponds to a
  * name defining a constant.
  */
 static JSBool
-LookupCompileTimeConstant(JSContext *cx, JSCodeGenerator *cg, JSAtom *atom,
-                          Value *constp)
+LookupCompileTimeConstant(JSContext *cx, CodeGenerator *cg, JSAtom *atom, Value *constp)
 {
-    JSStmtInfo *stmt;
-    JSObject *obj;
-
     /*
      * Chase down the cg stack, but only until we reach the outermost cg.
      * This enables propagating consts from top-level into switch cases in a
      * function compiled along with the top-level script.
      */
     constp->setMagic(JS_NO_CONSTANT);
     do {
         if (cg->inFunction() || cg->compileAndGo()) {
             /* XXX this will need revising if 'const' becomes block-scoped. */
-            stmt = js_LexicalLookup(cg, atom, NULL);
+            StmtInfo *stmt = js_LexicalLookup(cg, atom, NULL);
             if (stmt)
                 return JS_TRUE;
 
-            if (JSCodeGenerator::ConstMap::Ptr p = cg->constMap.lookup(atom)) {
+            if (CodeGenerator::ConstMap::Ptr p = cg->constMap.lookup(atom)) {
                 JS_ASSERT(!p->value.isMagic(JS_NO_CONSTANT));
                 *constp = p->value;
                 return JS_TRUE;
             }
 
             /*
              * Try looking in the variable object for a direct property that
              * is readonly and permanent.  We know such a property can't be
@@ -1804,17 +1772,17 @@ LookupCompileTimeConstant(JSContext *cx,
              * with object or catch variable; nor can prop's value be changed,
              * nor can prop be deleted.
              */
             if (cg->inFunction()) {
                 if (cg->bindings.hasBinding(cx, atom))
                     break;
             } else {
                 JS_ASSERT(cg->compileAndGo());
-                obj = cg->scopeChain();
+                JSObject *obj = cg->scopeChain();
 
                 const Shape *shape = obj->nativeLookup(cx, ATOM_TO_JSID(atom));
                 if (shape) {
                     /*
                      * We're compiling code that will be executed immediately,
                      * not re-executed against a different scope chain and/or
                      * variable object.  Therefore we can get constant values
                      * from our variable object here.
@@ -1841,17 +1809,17 @@ FitsWithoutBigIndex(uintN index)
 
 /*
  * Return JSOP_NOP to indicate that index fits 2 bytes and no index segment
  * reset instruction is necessary, JSOP_FALSE to indicate an error or either
  * JSOP_RESETBASE0 or JSOP_RESETBASE1 to indicate the reset bytecode to issue
  * after the main bytecode sequence.
  */
 static JSOp
-EmitBigIndexPrefix(JSContext *cx, JSCodeGenerator *cg, uintN index)
+EmitBigIndexPrefix(JSContext *cx, CodeGenerator *cg, uintN index)
 {
     uintN indexBase;
 
     /*
      * We have max 3 bytes for indexes and check for INDEX_LIMIT overflow only
      * for big indexes.
      */
     JS_STATIC_ASSERT(INDEX_LIMIT <= JS_BIT(24));
@@ -1884,17 +1852,17 @@ EmitBigIndexPrefix(JSContext *cx, JSCode
  * operand effectively extends the 16-bit immediate of the prefixed opcode,
  * by changing index "segment" (see jsinterp.c). We optimize segments 1-3
  * with single-byte JSOP_INDEXBASE[123] codes.
  *
  * Such prefixing currently requires a suffix to restore the "zero segment"
  * register setting, but this could be optimized further.
  */
 static bool
-EmitIndexOp(JSContext *cx, JSOp op, uintN index, JSCodeGenerator *cg, JSOp *psuffix)
+EmitIndexOp(JSContext *cx, JSOp op, uintN index, CodeGenerator *cg, JSOp *psuffix)
 {
     JSOp bigSuffix;
 
     bigSuffix = EmitBigIndexPrefix(cx, cg, index);
     if (bigSuffix == JSOP_FALSE)
         return false;
     EMIT_UINT16_IMM_OP(op, index);
 
@@ -1918,18 +1886,17 @@ EmitIndexOp(JSContext *cx, JSOp op, uint
  */
 #define EMIT_INDEX_OP(op, index)                                              \
     JS_BEGIN_MACRO                                                            \
         if (!EmitIndexOp(cx, op, index, cg))                                  \
             return JS_FALSE;                                                  \
     JS_END_MACRO
 
 static bool
-EmitAtomOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg,
-           JSOp *psuffix = NULL)
+EmitAtomOp(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg, JSOp *psuffix = NULL)
 {
     JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);
 
     if (op == JSOP_GETPROP &&
         pn->pn_atom == cx->runtime->atomState.lengthAtom) {
         /* Specialize length accesses for the interpreter. */
         op = JSOP_LENGTH;
     }
@@ -1937,36 +1904,34 @@ EmitAtomOp(JSContext *cx, JSParseNode *p
     jsatomid index;
     if (!cg->makeAtomIndex(pn->pn_atom, &index))
         return false;
 
     return EmitIndexOp(cx, op, index, cg, psuffix);
 }
 
 static JSBool
-EmitObjectOp(JSContext *cx, JSObjectBox *objbox, JSOp op,
-             JSCodeGenerator *cg)
+EmitObjectOp(JSContext *cx, ObjectBox *objbox, JSOp op, CodeGenerator *cg)
 {
     JS_ASSERT(JOF_OPTYPE(op) == JOF_OBJECT);
     return EmitIndexOp(cx, op, cg->objectList.index(objbox), cg);
 }
 
 /*
  * What good are ARGNO_LEN and SLOTNO_LEN, you ask?  The answer is that, apart
  * from EmitSlotIndexOp, they abstract out the detail that both are 2, and in
  * other parts of the code there's no necessary relationship between the two.
  * The abstraction cracks here in order to share EmitSlotIndexOp code among
  * the JSOP_DEFLOCALFUN and JSOP_GET{ARG,VAR,LOCAL}PROP cases.
  */
 JS_STATIC_ASSERT(ARGNO_LEN == 2);
 JS_STATIC_ASSERT(SLOTNO_LEN == 2);
 
 static JSBool
-EmitSlotIndexOp(JSContext *cx, JSOp op, uintN slot, uintN index,
-                JSCodeGenerator *cg)
+EmitSlotIndexOp(JSContext *cx, JSOp op, uintN slot, uintN index, CodeGenerator *cg)
 {
     JSOp bigSuffix;
     ptrdiff_t off;
     jsbytecode *pc;
 
     JS_ASSERT(JOF_OPTYPE(op) == JOF_SLOTATOM ||
               JOF_OPTYPE(op) == JOF_SLOTOBJECT);
     bigSuffix = EmitBigIndexPrefix(cx, cg, index);
@@ -1980,45 +1945,45 @@ EmitSlotIndexOp(JSContext *cx, JSOp op, 
     pc = CG_CODE(cg, off);
     SET_UINT16(pc, slot);
     pc += 2;
     SET_INDEX(pc, index);
     return bigSuffix == JSOP_NOP || js_Emit1(cx, cg, bigSuffix) >= 0;
 }
 
 bool
-JSCodeGenerator::shouldNoteClosedName(JSParseNode *pn)
+CodeGenerator::shouldNoteClosedName(ParseNode *pn)
 {
     return !callsEval() && pn->isDefn() && pn->isClosed();
 }
 
 /*
  * Adjust the slot for a block local to account for the number of variables
  * that share the same index space with locals. Due to the incremental code
  * generation for top-level script, we do the adjustment via code patching in
  * Compiler::compileScript; see comments there.
  *
  * The function returns -1 on failures.
  */
 static jsint
-AdjustBlockSlot(JSContext *cx, JSCodeGenerator *cg, jsint slot)
+AdjustBlockSlot(JSContext *cx, CodeGenerator *cg, jsint slot)
 {
     JS_ASSERT((jsuint) slot < cg->maxStackDepth);
     if (cg->inFunction()) {
         slot += cg->bindings.countVars();
         if ((uintN) slot >= SLOTNO_LIMIT) {
             ReportCompileErrorNumber(cx, CG_TS(cg), NULL, JSREPORT_ERROR, JSMSG_TOO_MANY_LOCALS);
             slot = -1;
         }
     }
     return slot;
 }
 
 static bool
-EmitEnterBlock(JSContext *cx, JSParseNode *pn, JSCodeGenerator *cg)
+EmitEnterBlock(JSContext *cx, ParseNode *pn, CodeGenerator *cg)
 {
     JS_ASSERT(pn->isKind(TOK_LEXICALSCOPE));
     if (!EmitObjectOp(cx, pn->pn_objbox, JSOP_ENTERBLOCK, cg))
         return false;
 
     JSObject *blockObj = pn->pn_objbox->object;
     jsint depth = AdjustBlockSlot(cx, cg, OBJ_BLOCK_DEPTH(cx, blockObj));
     if (depth < 0)
@@ -2029,52 +1994,51 @@ EmitEnterBlock(JSContext *cx, JSParseNod
         const Value &v = blockObj->getSlot(slot);
 
         /* Beware the empty destructuring dummy. */
         if (v.isUndefined()) {
             JS_ASSERT(slot + 1 <= limit);
             continue;
         }
 
-        JSDefinition *dn = (JSDefinition *) v.toPrivate();
+        Definition *dn = (Definition *) v.toPrivate();
         JS_ASSERT(dn->isDefn());
         JS_ASSERT(uintN(dn->frameSlot() + depth) < JS_BIT(16));
         dn->pn_cookie.set(dn->pn_cookie.level(), uint16(dn->frameSlot() + depth));
 #ifdef DEBUG
-        for (JSParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
+        for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
             JS_ASSERT(pnu->pn_lexdef == dn);
             JS_ASSERT(!(pnu->pn_dflags & PND_BOUND));
             JS_ASSERT(pnu->pn_cookie.isFree());
         }
 #endif
 
         /*
          * If this variable is closed over, and |eval| is not present, then
          * then set a bit in dslots so the Method JIT can deoptimize this
          * slot.
          */
         bool isClosed = cg->shouldNoteClosedName(dn);
         blockObj->setSlot(slot, BooleanValue(isClosed));
     }
 
     /*
-     * If clones of this block will have any extensible parents, then the clones
-     * must get unique shapes; see the comments for js::Bindings::
-     * extensibleParents.
+     * If clones of this block will have any extensible parents, then the
+     * clones must get unique shapes; see the comments for
+     * js::Bindings::extensibleParents.
      */
     if ((cg->flags & TCF_FUN_EXTENSIBLE_SCOPE) ||
         cg->bindings.extensibleParents())
         blockObj->setBlockOwnShape(cx);
 
     return true;
 }
 
 static JSBool
-EmitLeaveBlock(JSContext *cx, JSCodeGenerator *cg, JSOp op,
-               JSObjectBox *box)
+EmitLeaveBlock(JSContext *cx, CodeGenerator *cg, JSOp op, ObjectBox *box)
 {
     JSOp bigSuffix;
     uintN count = OBJ_BLOCK_COUNT(cx, box->object);
     
     bigSuffix = EmitBigIndexPrefix(cx, cg, box->index);
     if (bigSuffix == JSOP_FALSE)
         return JS_FALSE;
     if (js_Emit5(cx, cg, op, count, box->index) < 0)
@@ -2099,17 +2063,17 @@ EmitLeaveBlock(JSContext *cx, JSCodeGene
  *   "use strict";
  *   function foo()
  *   {
  *     undeclared = 17; // throws ReferenceError
  *   }
  *   foo();
  */
 static bool
-TryConvertToGname(JSCodeGenerator *cg, JSParseNode *pn, JSOp *op)
+TryConvertToGname(CodeGenerator *cg, ParseNode *pn, JSOp *op)
 {
     if (cg->compileAndGo() && 
         cg->compiler()->globalScope->globalObj &&
         !cg->mightAliasLocals() &&
         !pn->isDeoptimized() &&
         !(cg->flags & TCF_STRICT_MODE_CODE)) { 
         switch (*op) {
           case JSOP_NAME:     *op = JSOP_GETGNAME; break;
@@ -2128,17 +2092,17 @@ TryConvertToGname(JSCodeGenerator *cg, J
     }
     return false;
 }
 
 // Binds a global, given a |dn| that is known to have the PND_GVAR bit, and a pn
 // that is |dn| or whose definition is |dn|. |pn->pn_cookie| is an outparam
 // that will be free (meaning no binding), or a slot number.
 static bool
-BindKnownGlobal(JSContext *cx, JSCodeGenerator *cg, JSParseNode *dn, JSParseNode *pn, JSAtom *atom)
+BindKnownGlobal(JSContext *cx, CodeGenerator *cg, ParseNode *dn, ParseNode *pn, JSAtom *atom)
 {
     // Cookie is an outparam; make sure caller knew to clear it.
     JS_ASSERT(pn->pn_cookie.isFree());
 
     if (cg->mightAliasLocals())
         return true;
 
     GlobalScope *globalScope = cg->compiler()->globalScope;
@@ -2146,17 +2110,17 @@ BindKnownGlobal(JSContext *cx, JSCodeGen
     jsatomid index;
     if (dn->pn_cookie.isFree()) {
         // The definition wasn't bound, so find its atom's index in the
         // mapping of defined globals.
         AtomIndexPtr p = globalScope->names.lookup(atom);
         JS_ASSERT(!!p);
         index = p.value();
     } else {
-        JSCodeGenerator *globalcg = globalScope->cg;
+        CodeGenerator *globalcg = globalScope->cg;
 
         // If the definition is bound, and we're in the same cg, we can re-use
         // its cookie.
         if (globalcg == cg) {
             pn->pn_cookie = dn->pn_cookie;
             pn->pn_dflags |= PND_BOUND;
             return true;
         }
@@ -2172,27 +2136,27 @@ BindKnownGlobal(JSContext *cx, JSCodeGen
     if (!pn->pn_cookie.isFree())
         pn->pn_dflags |= PND_BOUND;
 
     return true;
 }
 
 // See BindKnownGlobal()'s comment.
 static bool
-BindGlobal(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn, JSAtom *atom)
+BindGlobal(JSContext *cx, CodeGenerator *cg, ParseNode *pn, JSAtom *atom)
 {
     pn->pn_cookie.makeFree();
 
-    JSDefinition *dn;
+    Definition *dn;
     if (pn->isUsed()) {
         dn = pn->pn_lexdef;
     } else {
         if (!pn->isDefn())
             return true;
-        dn = (JSDefinition *)pn;
+        dn = (Definition *)pn;
     }
 
     // Only optimize for defined globals.
     if (!dn->isGlobal())
         return true;
 
     return BindKnownGlobal(cx, cg, dn, pn, atom);
 }
@@ -2210,22 +2174,22 @@ BindGlobal(JSContext *cx, JSCodeGenerato
  * name, PND_CONST will be set in pn_dflags for read-only properties after a
  * successful return.
  *
  * NB: if you add more opcodes specialized from JSOP_NAME, etc., don't forget
  * to update the TOK_FOR (for-in) and TOK_ASSIGN (op=, e.g. +=) special cases
  * in js_EmitTree.
  */
 static JSBool
-BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+BindNameToSlot(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
-    JSDefinition *dn;
+    Definition *dn;
     JSOp op;
     JSAtom *atom;
-    JSDefinition::Kind dn_kind;
+    Definition::Kind dn_kind;
 
     JS_ASSERT(pn->isKind(TOK_NAME));
 
     /* Idempotency tests come first, since we may be called more than once. */
     if (pn->pn_dflags & PND_BOUND)
         return JS_TRUE;
 
     /* No cookie initialized for these two, they're pre-bound by definition. */
@@ -2240,17 +2204,17 @@ BindNameToSlot(JSContext *cx, JSCodeGene
         dn = pn->pn_lexdef;
         JS_ASSERT(dn->isDefn());
         if (pn->isDeoptimized())
             return JS_TRUE;
         pn->pn_dflags |= (dn->pn_dflags & PND_CONST);
     } else {
         if (!pn->isDefn())
             return JS_TRUE;
-        dn = (JSDefinition *) pn;
+        dn = (Definition *) pn;
     }
 
     op = pn->getOp();
     if (op == JSOP_NOP)
         return JS_TRUE;
 
     JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM);
     atom = pn->pn_atom;
@@ -2266,17 +2230,17 @@ BindNameToSlot(JSContext *cx, JSCodeGene
      * bindings visible to the compiler are permanent in JS unless the
      * declaration originates at top level in eval code.
      */
     switch (op) {
       case JSOP_NAME:
       case JSOP_SETCONST:
         break;
       case JSOP_DELNAME:
-        if (dn_kind != JSDefinition::UNKNOWN) {
+        if (dn_kind != Definition::UNKNOWN) {
             if (cg->parser->callerFrame && dn->isTopLevel())
                 JS_ASSERT(cg->compileAndGo());
             else
                 pn->setOp(JSOP_FALSE);
             pn->pn_dflags |= PND_BOUND;
             return JS_TRUE;
         }
         break;
@@ -2419,18 +2383,18 @@ BindNameToSlot(JSContext *cx, JSCodeGene
                         return JS_FALSE;
                     upvarMap.replaceRawBuffer(static_cast<UpvarCookie *>(buf), lexdepCount);
                 }
                 for (size_t i = 0; i < lexdepCount; ++i)
                     upvarMap[i] = UpvarCookie();
             }
 
             uintN slot = cookie.slot();
-            if (slot != UpvarCookie::CALLEE_SLOT && dn_kind != JSDefinition::ARG) {
-                JSTreeContext *tc = cg;
+            if (slot != UpvarCookie::CALLEE_SLOT && dn_kind != Definition::ARG) {
+                TreeContext *tc = cg;
                 do {
                     tc = tc->parent;
                 } while (tc->staticLevel != level);
                 if (tc->inFunction())
                     slot += tc->fun()->nargs;
             }
 
             JS_ASSERT(index < upvarMap.length());
@@ -2445,45 +2409,45 @@ BindNameToSlot(JSContext *cx, JSCodeGene
     }
 
     /*
      * We are compiling a function body and may be able to optimize name
      * to stack slot. Look for an argument or variable in the function and
      * rewrite pn_op and update pn accordingly.
      */
     switch (dn_kind) {
-      case JSDefinition::UNKNOWN:
+      case Definition::UNKNOWN:
         return JS_TRUE;
 
-      case JSDefinition::LET:
+      case Definition::LET:
         switch (op) {
           case JSOP_NAME:     op = JSOP_GETLOCAL; break;
           case JSOP_SETNAME:  op = JSOP_SETLOCAL; break;
           case JSOP_INCNAME:  op = JSOP_INCLOCAL; break;
           case JSOP_NAMEINC:  op = JSOP_LOCALINC; break;
           case JSOP_DECNAME:  op = JSOP_DECLOCAL; break;
           case JSOP_NAMEDEC:  op = JSOP_LOCALDEC; break;
           default: JS_NOT_REACHED("let");
         }
         break;
 
-      case JSDefinition::ARG:
+      case Definition::ARG:
         switch (op) {
           case JSOP_NAME:     op = JSOP_GETARG; break;
           case JSOP_SETNAME:  op = JSOP_SETARG; break;
           case JSOP_INCNAME:  op = JSOP_INCARG; break;
           case JSOP_NAMEINC:  op = JSOP_ARGINC; break;
           case JSOP_DECNAME:  op = JSOP_DECARG; break;
           case JSOP_NAMEDEC:  op = JSOP_ARGDEC; break;
           default: JS_NOT_REACHED("arg");
         }
         JS_ASSERT(!pn->isConst());
         break;
 
-      case JSDefinition::VAR:
+      case Definition::VAR:
         if (dn->isOp(JSOP_CALLEE)) {
             JS_ASSERT(op != JSOP_CALLEE);
             JS_ASSERT((cg->fun()->flags & JSFUN_LAMBDA) && atom == cg->fun()->atom);
 
             /*
              * Leave pn->isOp(JSOP_NAME) if cg->fun is heavyweight to
              * address two cases: a new binding introduced by eval, and
              * assignment to the name in strict mode.
@@ -2515,42 +2479,42 @@ BindNameToSlot(JSContext *cx, JSCodeGene
 
             pn->setOp(op);
             pn->pn_dflags |= PND_BOUND;
             return JS_TRUE;
         }
         /* FALL THROUGH */
 
       default:
-        JS_ASSERT_IF(dn_kind != JSDefinition::FUNCTION,
-                     dn_kind == JSDefinition::VAR ||
-                     dn_kind == JSDefinition::CONST);
+        JS_ASSERT_IF(dn_kind != Definition::FUNCTION,
+                     dn_kind == Definition::VAR ||
+                     dn_kind == Definition::CONST);
         switch (op) {
           case JSOP_NAME:     op = JSOP_GETLOCAL; break;
           case JSOP_SETNAME:  op = JSOP_SETLOCAL; break;
           case JSOP_SETCONST: op = JSOP_SETLOCAL; break;
           case JSOP_INCNAME:  op = JSOP_INCLOCAL; break;
           case JSOP_NAMEINC:  op = JSOP_LOCALINC; break;
           case JSOP_DECNAME:  op = JSOP_DECLOCAL; break;
           case JSOP_NAMEDEC:  op = JSOP_LOCALDEC; break;
           default: JS_NOT_REACHED("local");
         }
-        JS_ASSERT_IF(dn_kind == JSDefinition::CONST, pn->pn_dflags & PND_CONST);
+        JS_ASSERT_IF(dn_kind == Definition::CONST, pn->pn_dflags & PND_CONST);
         break;
     }
 
     JS_ASSERT(!pn->isOp(op));
     pn->setOp(op);
     pn->pn_cookie.set(0, cookie.slot());
     pn->pn_dflags |= PND_BOUND;
     return JS_TRUE;
 }
 
 bool
-JSCodeGenerator::addGlobalUse(JSAtom *atom, uint32 slot, UpvarCookie *cookie)
+CodeGenerator::addGlobalUse(JSAtom *atom, uint32 slot, UpvarCookie *cookie)
 {
     if (!globalMap.ensureMap(context()))
         return false;
 
     AtomIndexAddPtr p = globalMap->lookupForAdd(atom);
     if (p) {
         jsatomid index = p.value();
         cookie->set(0, index);
@@ -2586,21 +2550,20 @@ JSCodeGenerator::addGlobalUse(JSAtom *at
  * The caller should initialize *answer to false and invoke this function on
  * an expression statement or similar subtree to decide whether the tree could
  * produce code that has any side effects.  For an expression statement, we
  * define useless code as code with no side effects, because the main effect,
  * the value left on the stack after the code executes, will be discarded by a
  * pop bytecode.
  */
 static JSBool
-CheckSideEffects(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
-                 JSBool *answer)
+CheckSideEffects(JSContext *cx, CodeGenerator *cg, ParseNode *pn, JSBool *answer)
 {
     JSBool ok;
-    JSParseNode *pn2;
+    ParseNode *pn2;
 
     ok = JS_TRUE;
     if (!pn || *answer)
         return ok;
 
     switch (pn->getArity()) {
       case PN_FUNC:
         /*
@@ -2781,18 +2744,17 @@ CheckSideEffects(JSContext *cx, JSCodeGe
         if (pn->isKind(TOK_DEBUGGER))
             *answer = JS_TRUE;
         break;
     }
     return ok;
 }
 
 static JSBool
-EmitNameOp(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
-           JSBool callContext)
+EmitNameOp(JSContext *cx, CodeGenerator *cg, ParseNode *pn, JSBool callContext)
 {
     JSOp op;
 
     if (!BindNameToSlot(cx, cg, pn))
         return JS_FALSE;
     op = pn->getOp();
 
     if (callContext) {
@@ -2832,19 +2794,19 @@ EmitNameOp(JSContext *cx, JSCodeGenerato
         }
     }
 
     return JS_TRUE;
 }
 
 #if JS_HAS_XML_SUPPORT
 static JSBool
-EmitXMLName(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
+EmitXMLName(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg)
 {
-    JSParseNode *pn2;
+    ParseNode *pn2;
     uintN oldflags;
 
     JS_ASSERT(pn->isKind(TOK_UNARYOP));
     JS_ASSERT(pn->isOp(JSOP_XMLNAME));
     JS_ASSERT(op == JSOP_XMLNAME || op == JSOP_CALLXMLNAME);
 
     pn2 = pn->pn_kid;
     oldflags = cg->flags;
@@ -2857,45 +2819,45 @@ EmitXMLName(JSContext *cx, JSParseNode *
         return JS_FALSE;
     }
 
     return js_Emit1(cx, cg, op) >= 0;
 }
 #endif
 
 static inline bool
-EmitElemOpBase(JSContext *cx, JSCodeGenerator *cg, JSOp op)
+EmitElemOpBase(JSContext *cx, CodeGenerator *cg, JSOp op)
 {
     if (js_Emit1(cx, cg, op) < 0)
         return false;
     CheckTypeSet(cx, cg, op);
     return true;
 }
 
 static bool
-EmitSpecialPropOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
+EmitSpecialPropOp(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg)
 {
     /*
      * Special case for obj.__proto__ to deoptimize away from fast paths in the
      * interpreter and trace recorder, which skip dense array instances by
      * going up to Array.prototype before looking up the property name.
      */
     jsatomid index;
     if (!cg->makeAtomIndex(pn->pn_atom, &index))
         return false;
     if (!EmitIndexOp(cx, JSOP_QNAMEPART, index, cg))
         return false;
     return EmitElemOpBase(cx, cg, op);
 }
 
 static JSBool
-EmitPropOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg,
+EmitPropOp(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg,
            JSBool callContext, JSOp *psuffix = NULL)
 {
-    JSParseNode *pn2, *pndot, *pnup, *pndown;
+    ParseNode *pn2, *pndot, *pnup, *pndown;
     ptrdiff_t top;
 
     JS_ASSERT(pn->isArity(PN_NAME));
     pn2 = pn->maybeExpr();
 
     /* Special case deoptimization for __proto__. */
     if ((op == JSOP_GETPROP || op == JSOP_CALLPROP) &&
         pn->pn_atom == cx->runtime->atomState.protoAtom) {
@@ -2978,17 +2940,17 @@ EmitPropOp(JSContext *cx, JSParseNode *p
                        CG_OFFSET(cg) - pn2->pn_offset) < 0) {
         return JS_FALSE;
     }
 
     return EmitAtomOp(cx, pn, op, cg, psuffix);
 }
 
 static bool
-EmitPropIncDec(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
+EmitPropIncDec(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg)
 {
     JSOp suffix = JSOP_NOP;
     if (!EmitPropOp(cx, pn, op, cg, false, &suffix))
         return false;
     if (js_Emit1(cx, cg, JSOP_NOP) < 0)
         return false;
 
     /*
@@ -3037,17 +2999,17 @@ EmitPropIncDec(JSContext *cx, JSParseNod
 
     if (suffix != JSOP_NOP && js_Emit1(cx, cg, suffix) < 0)
         return false;
 
     return true;
 }
 
 static bool
-EmitNameIncDec(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
+EmitNameIncDec(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg)
 {
     JSOp suffix = JSOP_NOP;
     if (!EmitAtomOp(cx, pn, op, cg, &suffix))
         return false;
     if (js_Emit1(cx, cg, JSOP_NOP) < 0)
         return false;
 
     /* Remove the result to restore the stack depth before the INCNAME. */
@@ -3095,20 +3057,20 @@ EmitNameIncDec(JSContext *cx, JSParseNod
 
     if (suffix != JSOP_NOP && js_Emit1(cx, cg, suffix) < 0)
         return false;
 
     return true;
 }
 
 static JSBool
-EmitElemOp(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
+EmitElemOp(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg)
 {
     ptrdiff_t top;
-    JSParseNode *left, *right, *next, ltmp, rtmp;
+    ParseNode *left, *right, *next, ltmp, rtmp;
     int32_t slot;
 
     top = CG_OFFSET(cg);
     if (pn->isArity(PN_LIST)) {
         /* Left-associative operator chain to avoid too much recursion. */
         JS_ASSERT(pn->isOp(JSOP_GETELEM));
         JS_ASSERT(pn->pn_count >= 3);
         left = pn->pn_head;
@@ -3224,17 +3186,17 @@ EmitElemOp(JSContext *cx, JSParseNode *p
     if (!js_EmitTree(cx, cg, right))
         return JS_FALSE;
     if (js_NewSrcNote2(cx, cg, SRC_PCBASE, CG_OFFSET(cg) - top) < 0)
         return JS_FALSE;
     return EmitElemOpBase(cx, cg, op);
 }
 
 static bool
-EmitElemIncDec(JSContext *cx, JSParseNode *pn, JSOp op, JSCodeGenerator *cg)
+EmitElemIncDec(JSContext *cx, ParseNode *pn, JSOp op, CodeGenerator *cg)
 {
     if (pn) {
         if (!EmitElemOp(cx, pn, op, cg))
             return false;
     } else {
         if (!EmitElemOpBase(cx, cg, op))
             return false;
     }
@@ -3288,17 +3250,17 @@ EmitElemIncDec(JSContext *cx, JSParseNod
         return false;
 
     UpdateDecomposeLength(cg, start);
 
     return true;
 }
 
 static JSBool
-EmitNumberOp(JSContext *cx, jsdouble dval, JSCodeGenerator *cg)
+EmitNumberOp(JSContext *cx, jsdouble dval, CodeGenerator *cg)
 {
     int32_t ival;
     uint32 u;
     ptrdiff_t off;
     jsbytecode *pc;
 
     if (JSDOUBLE_IS_INT32(dval, &ival)) {
         if (ival == 0)
@@ -3350,29 +3312,29 @@ AllocateSwitchConstant(JSContext *cx)
 /*
  * Sometimes, let-slots are pushed to the JS stack before we logically enter
  * the let scope. For example,
  *     let (x = EXPR) BODY
  * compiles to roughly {enterblock; EXPR; setlocal x; BODY; leaveblock} even
  * though EXPR is evaluated in the enclosing scope; it does not see x.
  *
  * In those cases we use TempPopScope around the code to emit EXPR. It
- * temporarily removes the let-scope from the JSCodeGenerator's scope stack and
+ * temporarily removes the let-scope from the CodeGenerator's scope stack and
  * emits extra bytecode to ensure that js::GetBlockChain also finds the correct
  * scope at run time.
  */
 class TempPopScope {
-    JSStmtInfo *savedStmt;
-    JSStmtInfo *savedScopeStmt;
-    JSObjectBox *savedBlockBox;
+    StmtInfo *savedStmt;
+    StmtInfo *savedScopeStmt;
+    ObjectBox *savedBlockBox;
 
   public:
     TempPopScope() : savedStmt(NULL), savedScopeStmt(NULL), savedBlockBox(NULL) {}
 
-    bool popBlock(JSContext *cx, JSCodeGenerator *cg) {
+    bool popBlock(JSContext *cx, CodeGenerator *cg) {
         savedStmt = cg->topStmt;
         savedScopeStmt = cg->topScopeStmt;
         savedBlockBox = cg->blockChainBox;
 
         if (cg->topStmt->type == STMT_FOR_LOOP || cg->topStmt->type == STMT_FOR_IN_LOOP)
             js_PopStatement(cg);
         JS_ASSERT(STMT_LINKS_SCOPE(cg->topStmt));
         JS_ASSERT(cg->topStmt->flags & SIF_SCOPE);
@@ -3383,42 +3345,42 @@ class TempPopScope {
          * the change for the benefit of dynamic GetScopeChain callers such as
          * the debugger.
          *
          * FIXME bug 671360 - The JSOP_NOP instruction should not be necessary.
          */
         return js_Emit1(cx, cg, JSOP_NOP) >= 0 && EmitBlockChain(cx, cg);
     }
 
-    bool repushBlock(JSContext *cx, JSCodeGenerator *cg) {
+    bool repushBlock(JSContext *cx, CodeGenerator *cg) {
         JS_ASSERT(savedStmt);
         cg->topStmt = savedStmt;
         cg->topScopeStmt = savedScopeStmt;
         cg->blockChainBox = savedBlockBox;
         return js_Emit1(cx, cg, JSOP_NOP) >= 0 && EmitBlockChain(cx, cg);
     }
 };
 
 static JSBool
-EmitSwitch(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitSwitch(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     JSOp switchOp;
     JSBool ok, hasDefault, constPropagated;
     ptrdiff_t top, off, defaultOffset;
-    JSParseNode *pn2, *pn3, *pn4;
+    ParseNode *pn2, *pn3, *pn4;
     uint32 caseCount, tableLength;
-    JSParseNode **table;
+    ParseNode **table;
     int32_t i, low, high;
     intN noteIndex;
     size_t switchSize, tableSize;
     jsbytecode *pc, *savepc;
 #if JS_HAS_BLOCK_SCOPE
-    JSObjectBox *box;
+    ObjectBox *box;
 #endif
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
 
     /* Try for most optimal, fall back if not dense ints, and per ECMAv2. */
     switchOp = JSOP_TABLESWITCH;
     ok = JS_TRUE;
     hasDefault = constPropagated = JS_FALSE;
     defaultOffset = -1;
 
     /*
@@ -3766,17 +3728,17 @@ EmitSwitch(JSContext *cx, JSCodeGenerato
 
             /*
              * Use malloc to avoid arena bloat for programs with many switches.
              * We free table if non-null at label out, so all control flow must
              * exit this function through goto out or goto bad.
              */
             if (tableLength != 0) {
                 tableSize = (size_t)tableLength * sizeof *table;
-                table = (JSParseNode **) cx->malloc_(tableSize);
+                table = (ParseNode **) cx->malloc_(tableSize);
                 if (!table)
                     return JS_FALSE;
                 memset(table, 0, tableSize);
                 for (pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) {
                     if (pn3->isKind(TOK_DEFAULT))
                         continue;
                     i = pn3->pn_pval->toInt32();
                     i -= low;
@@ -3944,17 +3906,17 @@ out:
     return ok;
 
 bad:
     ok = JS_FALSE;
     goto out;
 }
 
 JSBool
-js_EmitFunctionScript(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body)
+js_EmitFunctionScript(JSContext *cx, CodeGenerator *cg, ParseNode *body)
 {
     /*
      * The decompiler has assumptions about what may occur immediately after
      * script->main (e.g., in the case of destructuring params). Thus, put the
      * following ops into the range [script->code, script->main). Note:
      * execution starts from script->code, so this has no semantic effect.
      */
 
@@ -3989,18 +3951,18 @@ js_EmitFunctionScript(JSContext *cx, JSC
     }
 
     return js_EmitTree(cx, cg, body) &&
            js_Emit1(cx, cg, JSOP_STOP) >= 0 &&
            JSScript::NewScriptFromCG(cx, cg);
 }
 
 static bool
-MaybeEmitVarDecl(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                 JSParseNode *pn, jsatomid *result)
+MaybeEmitVarDecl(JSContext *cx, CodeGenerator *cg, JSOp prologOp,
+                 ParseNode *pn, jsatomid *result)
 {
     jsatomid atomIndex;
 
     if (!pn->pn_cookie.isFree()) {
         atomIndex = pn->pn_cookie.slot();
     } else {
         if (!cg->makeAtomIndex(pn->pn_atom, &atomIndex))
             return false;
@@ -4029,36 +3991,33 @@ MaybeEmitVarDecl(JSContext *cx, JSCodeGe
     if (result)
         *result = atomIndex;
     return true;
 }
 
 #if JS_HAS_DESTRUCTURING
 
 typedef JSBool
-(*DestructuringDeclEmitter)(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                            JSParseNode *pn);
+(*DestructuringDeclEmitter)(JSContext *cx, CodeGenerator *cg, JSOp prologOp, ParseNode *pn);
 
 static JSBool
-EmitDestructuringDecl(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                      JSParseNode *pn)
+EmitDestructuringDecl(JSContext *cx, CodeGenerator *cg, JSOp prologOp, ParseNode *pn)
 {
     JS_ASSERT(pn->isKind(TOK_NAME));
     if (!BindNameToSlot(cx, cg, pn))
         return JS_FALSE;
 
     JS_ASSERT(!pn->isOp(JSOP_ARGUMENTS) && !pn->isOp(JSOP_CALLEE));
     return MaybeEmitVarDecl(cx, cg, prologOp, pn, NULL);
 }
 
 static JSBool
-EmitDestructuringDecls(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                       JSParseNode *pn)
+EmitDestructuringDecls(JSContext *cx, CodeGenerator *cg, JSOp prologOp, ParseNode *pn)
 {
-    JSParseNode *pn2, *pn3;
+    ParseNode *pn2, *pn3;
     DestructuringDeclEmitter emitter;
 
     if (pn->isKind(TOK_RB)) {
         for (pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
             if (pn2->isKind(TOK_COMMA))
                 continue;
             emitter = (pn2->isKind(TOK_NAME))
                       ? EmitDestructuringDecl
@@ -4074,20 +4033,20 @@ EmitDestructuringDecls(JSContext *cx, JS
             if (!emitter(cx, cg, prologOp, pn3))
                 return JS_FALSE;
         }
     }
     return JS_TRUE;
 }
 
 static JSBool
-EmitDestructuringOpsHelper(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn);
+EmitDestructuringOpsHelper(JSContext *cx, CodeGenerator *cg, ParseNode *pn);
 
 static JSBool
-EmitDestructuringLHS(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitDestructuringLHS(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     /*
      * Now emit the lvalue opcode sequence.  If the lvalue is a nested
      * destructuring initialiser-form, call ourselves to handle it, then
      * pop the matched value.  Otherwise emit an lvalue bytecode sequence
      * ending with a JSOP_ENUMELEM or equivalent op.
      */
     if (pn->isKind(TOK_RB) || pn->isKind(TOK_RC)) {
@@ -4161,20 +4120,20 @@ EmitDestructuringLHS(JSContext *cx, JSCo
 /*
  * Recursive helper for EmitDestructuringOps.
  *
  * Given a value to destructure on the stack, walk over an object or array
  * initialiser at pn, emitting bytecodes to match property values and store
  * them in the lvalues identified by the matched property names.
  */
 static JSBool
-EmitDestructuringOpsHelper(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitDestructuringOpsHelper(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     jsuint index;
-    JSParseNode *pn2, *pn3;
+    ParseNode *pn2, *pn3;
     JSBool doElemOp;
 
 #ifdef DEBUG
     intN stackDepth = cg->stackDepth;
     JS_ASSERT(stackDepth != 0);
     JS_ASSERT(pn->isArity(PN_LIST));
     JS_ASSERT(pn->isKind(TOK_RB) || pn->isKind(TOK_RC));
 #endif
@@ -4270,18 +4229,17 @@ OpToDeclType(JSOp op)
       case JSOP_DEFVAR:
         return SRC_DECL_VAR;
       default:
         return SRC_DECL_NONE;
     }
 }
 
 static JSBool
-EmitDestructuringOps(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                     JSParseNode *pn)
+EmitDestructuringOps(JSContext *cx, CodeGenerator *cg, JSOp prologOp, ParseNode *pn)
 {
     /*
      * If we're called from a variable declaration, help the decompiler by
      * annotating the first JSOP_DUP that EmitDestructuringOpsHelper emits.
      * If the destructuring initialiser is empty, our helper will emit a
      * JSOP_DUP followed by a JSOP_POP for the decompiler.
      */
     if (js_NewSrcNote2(cx, cg, SRC_DESTRUCT, OpToDeclType(prologOp)) < 0)
@@ -4290,21 +4248,21 @@ EmitDestructuringOps(JSContext *cx, JSCo
     /*
      * Call our recursive helper to emit the destructuring assignments and
      * related stack manipulations.
      */
     return EmitDestructuringOpsHelper(cx, cg, pn);
 }
 
 static JSBool
-EmitGroupAssignment(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                    JSParseNode *lhs, JSParseNode *rhs)
+EmitGroupAssignment(JSContext *cx, CodeGenerator *cg, JSOp prologOp,
+                    ParseNode *lhs, ParseNode *rhs)
 {
     jsuint depth, limit, i, nslots;
-    JSParseNode *pn;
+    ParseNode *pn;
 
     depth = limit = (uintN) cg->stackDepth;
     for (pn = rhs->pn_head; pn; pn = pn->pn_next) {
         if (limit == JS_BIT(16)) {
             ReportCompileErrorNumber(cx, CG_TS(cg), rhs, JSREPORT_ERROR, JSMSG_ARRAY_INIT_TOO_BIG);
             return JS_FALSE;
         }
 
@@ -4343,20 +4301,19 @@ EmitGroupAssignment(JSContext *cx, JSCod
 }
 
 /*
  * Helper called with pop out param initialized to a JSOP_POP* opcode.  If we
  * can emit a group assignment sequence, which results in 0 stack depth delta,
  * we set *pop to JSOP_NOP so callers can veto emitting pn followed by a pop.
  */
 static JSBool
-MaybeEmitGroupAssignment(JSContext *cx, JSCodeGenerator *cg, JSOp prologOp,
-                         JSParseNode *pn, JSOp *pop)
+MaybeEmitGroupAssignment(JSContext *cx, CodeGenerator *cg, JSOp prologOp, ParseNode *pn, JSOp *pop)
 {
-    JSParseNode *lhs, *rhs;
+    ParseNode *lhs, *rhs;
 
     JS_ASSERT(pn->isKind(TOK_ASSIGN));
     JS_ASSERT(*pop == JSOP_POP || *pop == JSOP_POPV);
     lhs = pn->pn_left;
     rhs = pn->pn_right;
     if (lhs->isKind(TOK_RB) && rhs->isKind(TOK_RB) &&
         !(rhs->pn_xflags & PNX_HOLEY) &&
         lhs->pn_count <= rhs->pn_count) {
@@ -4365,22 +4322,22 @@ MaybeEmitGroupAssignment(JSContext *cx, 
         *pop = JSOP_NOP;
     }
     return JS_TRUE;
 }
 
 #endif /* JS_HAS_DESTRUCTURING */
 
 static JSBool
-EmitVariables(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
-              JSBool inLetHead, ptrdiff_t *headNoteIndex)
+EmitVariables(JSContext *cx, CodeGenerator *cg, ParseNode *pn, JSBool inLetHead,
+              ptrdiff_t *headNoteIndex)
 {
     bool forInVar, first;
     ptrdiff_t off, noteIndex, tmp;
-    JSParseNode *pn2, *pn3, *next;
+    ParseNode *pn2, *pn3, *next;
     JSOp op;
     jsatomid atomIndex;
     uintN oldflags;
 
     /* Default in case of JS_HAS_BLOCK_SCOPE early return, below. */
     *headNoteIndex = -1;
 
     /*
@@ -4595,17 +4552,17 @@ EmitVariables(JSContext *cx, JSCodeGener
         if (!(pn->pn_xflags & PNX_POPVAR))
             return js_Emit1(cx, cg, JSOP_NOP) >= 0;
     }
 
     return !(pn->pn_xflags & PNX_POPVAR) || js_Emit1(cx, cg, JSOP_POP) >= 0;
 }
 
 static bool
-EmitAssignment(JSContext *cx, JSCodeGenerator *cg, JSParseNode *lhs, JSOp op, JSParseNode *rhs)
+EmitAssignment(JSContext *cx, CodeGenerator *cg, ParseNode *lhs, JSOp op, ParseNode *rhs)
 {
     ptrdiff_t top = CG_OFFSET(cg);
 
     /*
      * Check left operand type and generate specialized code for it.
      * Specialize to avoid ECMA "reference type" values on the operand
      * stack, which impose pervasive runtime "GetValue" costs.
      */
@@ -4788,17 +4745,17 @@ EmitAssignment(JSContext *cx, JSCodeGene
       default:
         JS_ASSERT(0);
     }
     return true;
 }
 
 #if defined DEBUG_brendan || defined DEBUG_mrbkap
 static JSBool
-GettableNoteForNextOp(JSCodeGenerator *cg)
+GettableNoteForNextOp(CodeGenerator *cg)
 {
     ptrdiff_t offset, target;
     jssrcnote *sn, *end;
 
     offset = 0;
     target = CG_OFFSET(cg);
     for (sn = CG_NOTES(cg), end = sn + CG_NOTE_COUNT(cg); sn < end;
          sn = SN_NEXT(sn)) {
@@ -4807,24 +4764,24 @@ GettableNoteForNextOp(JSCodeGenerator *c
         offset += SN_DELTA(sn);
     }
     return JS_FALSE;
 }
 #endif
 
 /* Top-level named functions need a nop for decompilation. */
 static JSBool
-EmitFunctionDefNop(JSContext *cx, JSCodeGenerator *cg, uintN index)
+EmitFunctionDefNop(JSContext *cx, CodeGenerator *cg, uintN index)
 {
     return js_NewSrcNote2(cx, cg, SRC_FUNCDEF, (ptrdiff_t)index) >= 0 &&
            js_Emit1(cx, cg, JSOP_NOP) >= 0;
 }
 
 static bool
-EmitNewInit(JSContext *cx, JSCodeGenerator *cg, JSProtoKey key, JSParseNode *pn, int sharpnum)
+EmitNewInit(JSContext *cx, CodeGenerator *cg, JSProtoKey key, ParseNode *pn, int sharpnum)
 {
     if (js_Emit3(cx, cg, JSOP_NEWINIT, (jsbytecode) key, 0) < 0)
         return false;
 #if JS_HAS_SHARP_VARS
     if (cg->hasSharps()) {
         if (pn->pn_count != 0)
             EMIT_UINT16_IMM_OP(JSOP_SHARPINIT, cg->sharpSlotBase);
         if (sharpnum >= 0)
@@ -4832,28 +4789,28 @@ EmitNewInit(JSContext *cx, JSCodeGenerat
     } else {
         JS_ASSERT(sharpnum < 0);
     }
 #endif
     return true;
 }
 
 static bool
-EmitEndInit(JSContext *cx, JSCodeGenerator *cg, uint32 count)
+EmitEndInit(JSContext *cx, CodeGenerator *cg, uint32 count)
 {
 #if JS_HAS_SHARP_VARS
     /* Emit an op for sharp array cleanup and decompilation. */
     if (cg->hasSharps() && count != 0)
         EMIT_UINT16_IMM_OP(JSOP_SHARPINIT, cg->sharpSlotBase);
 #endif
     return js_Emit1(cx, cg, JSOP_ENDINIT) >= 0;
 }
 
 bool
-JSParseNode::getConstantValue(JSContext *cx, bool strictChecks, Value *vp)
+ParseNode::getConstantValue(JSContext *cx, bool strictChecks, Value *vp)
 {
     switch (getKind()) {
       case TOK_NUMBER:
         vp->setNumber(pn_dval);
         return true;
       case TOK_STRING:
         vp->setString(pn_atom);
         return true;
@@ -4875,17 +4832,17 @@ JSParseNode::getConstantValue(JSContext 
       case TOK_RB: {
         JS_ASSERT(isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST));
  
         JSObject *obj = NewDenseAllocatedArray(cx, pn_count);
         if (!obj)
             return false;
 
         unsigned idx = 0;
-        for (JSParseNode *pn = pn_head; pn; idx++, pn = pn->pn_next) {
+        for (ParseNode *pn = pn_head; pn; idx++, pn = pn->pn_next) {
             Value value;
             if (!pn->getConstantValue(cx, strictChecks, &value))
                 return false;
             if (!obj->defineGeneric(cx, INT_TO_JSID(idx), value, NULL, NULL, JSPROP_ENUMERATE))
                 return false;
         }
         JS_ASSERT(idx == pn_count);
 
@@ -4896,22 +4853,22 @@ JSParseNode::getConstantValue(JSContext 
       case TOK_RC: {
         JS_ASSERT(isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST));
 
         gc::AllocKind kind = GuessObjectGCKind(pn_count, false);
         JSObject *obj = NewBuiltinClassInstance(cx, &ObjectClass, kind);
         if (!obj)
             return false;
 
-        for (JSParseNode *pn = pn_head; pn; pn = pn->pn_next) {
+        for (ParseNode *pn = pn_head; pn; pn = pn->pn_next) {
             Value value;
             if (!pn->pn_right->getConstantValue(cx, strictChecks, &value))
                 return false;
 
-            JSParseNode *pnid = pn->pn_left;
+            ParseNode *pnid = pn->pn_left;
             if (pnid->isKind(TOK_NUMBER)) {
                 Value idvalue = NumberValue(pnid->pn_dval);
                 jsid id;
                 if (idvalue.isInt32() && INT_FITS_IN_JSID(idvalue.toInt32()))
                     id = INT_TO_JSID(idvalue.toInt32());
                 else if (!js_InternNonIntElementId(cx, obj, idvalue, &id))
                     return false;
                 if (!obj->defineGeneric(cx, id, value, NULL, NULL, JSPROP_ENUMERATE))
@@ -4934,55 +4891,52 @@ JSParseNode::getConstantValue(JSContext 
       }
       default:
         JS_NOT_REACHED("Unexpected node");
     }
     return false;
 }
 
 static bool
-EmitSingletonInitialiser(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitSingletonInitialiser(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     Value value;
     if (!pn->getConstantValue(cx, cg->needStrictChecks(), &value))
         return false;
 
     JS_ASSERT(value.isObject());
-    JSObjectBox *objbox = cg->parser->newObjectBox(&value.toObject());
+    ObjectBox *objbox = cg->parser->newObjectBox(&value.toObject());
     if (!objbox)
         return false;
 
     return EmitObjectOp(cx, objbox, JSOP_OBJECT, cg);
 }
 
 /* See the SRC_FOR source note offsetBias comments later in this file. */
 JS_STATIC_ASSERT(JSOP_NOP_LENGTH == 1);
 JS_STATIC_ASSERT(JSOP_POP_LENGTH == 1);
 
 class EmitLevelManager
 {
-private:
-    JSCodeGenerator *cg;
-    
-public:
-    EmitLevelManager(JSCodeGenerator *cg) : cg(cg) { cg->emitLevel++; }
-
+    CodeGenerator *cg;
+  public:
+    EmitLevelManager(CodeGenerator *cg) : cg(cg) { cg->emitLevel++; }
     ~EmitLevelManager() { cg->emitLevel--; }
 };
 
 static bool
-EmitCatch(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitCatch(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     ptrdiff_t catchStart, guardJump;
 
     /*
      * Morph STMT_BLOCK to STMT_CATCH, note the block entry code offset,
      * and save the block object atom.
      */
-    JSStmtInfo *stmt = cg->topStmt;
+    StmtInfo *stmt = cg->topStmt;
     JS_ASSERT(stmt->type == STMT_BLOCK && (stmt->flags & SIF_SCOPE));
     stmt->type = STMT_CATCH;
     catchStart = stmt->update;
 
     /* Go up one statement info record to the TRY or FINALLY record. */
     stmt = stmt->down;
     JS_ASSERT(stmt->type == STMT_TRY || stmt->type == STMT_FINALLY);
 
@@ -4992,17 +4946,17 @@ EmitCatch(JSContext *cx, JSCodeGenerator
 
     /*
      * Dup the exception object if there is a guard for rethrowing to use
      * it later when rethrowing or in other catches.
      */
     if (pn->pn_kid2 && js_Emit1(cx, cg, JSOP_DUP) < 0)
         return false;
 
-    JSParseNode *pn2 = pn->pn_kid1;
+    ParseNode *pn2 = pn->pn_kid1;
     switch (pn2->getKind()) {
 #if JS_HAS_DESTRUCTURING
       case TOK_RB:
       case TOK_RC:
         if (!EmitDestructuringOps(cx, cg, JSOP_NOP, pn2))
             return false;
         if (js_Emit1(cx, cg, JSOP_POP) < 0)
             return false;
@@ -5048,19 +5002,19 @@ EmitCatch(JSContext *cx, JSCodeGenerator
      */
     ptrdiff_t off = cg->stackDepth;
     if (js_NewSrcNote2(cx, cg, SRC_CATCH, off) < 0)
         return false;
     return true;
 }
 
 static bool
-EmitTry(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitTry(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     ptrdiff_t catchJump = -1;
 
     /*
      * Push stmtInfo to track jumps-over-catches and gosubs-to-finally
      * for later fixup.
      *
      * When a finally block is active (STMT_FINALLY in our tree context),
      * non-local jumps (including jumps-over-catches) result in a GOSUB
@@ -5099,20 +5053,20 @@ EmitTry(JSContext *cx, JSCodeGenerator *
     /* Emit (hidden) jump over catch and/or finally. */
     if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0)
         return false;
     if (EmitBackPatchOp(cx, cg, JSOP_BACKPATCH, &catchJump) < 0)
         return false;
 
     ptrdiff_t tryEnd = CG_OFFSET(cg);
 
-    JSObjectBox *prevBox = NULL;
+    ObjectBox *prevBox = NULL;
     /* If this try has a catch block, emit it. */
-    JSParseNode *lastCatch = NULL;
-    if (JSParseNode *pn2 = pn->pn_kid2) {
+    ParseNode *lastCatch = NULL;
+    if (ParseNode *pn2 = pn->pn_kid2) {
         uintN count = 0;    /* previous catch block's population */
         
         /*
          * The emitted code for a catch block looks like:
          *
          * blockchain
          * [throwing]                          only if 2nd+ catch block
          * [leaveblock]                        only if 2nd+ catch block
@@ -5128,17 +5082,17 @@ EmitTry(JSContext *cx, JSCodeGenerator *
          * goto <end of catch blocks>          non-local; finally applies
          *
          * If there's no catch block without a catchguard, the last
          * <offset to next catch block> points to rethrow code.  This
          * code will [gosub] to the finally code if appropriate, and is
          * also used for the catch-all trynote for capturing exceptions
          * thrown from catch{} blocks.
          */
-        for (JSParseNode *pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) {
+        for (ParseNode *pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) {
             ptrdiff_t guardJump, catchNote;
 
             JS_ASSERT(cg->stackDepth == depth);
             guardJump = GUARDJUMP(stmtInfo);
             if (guardJump != -1) {
                 if (EmitKnownBlockChain(cx, cg, prevBox) < 0)
                     return false;
             
@@ -5294,19 +5248,19 @@ EmitTry(JSContext *cx, JSCodeGenerator *
      */
     if (pn->pn_kid3 && !NewTryNote(cx, cg, JSTRY_FINALLY, depth, tryStart, finallyStart))
         return false;
 
     return true;
 }
 
 static bool
-EmitIf(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitIf(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
 
     /* Initialize so we can detect else-if chains and avoid recursion. */
     stmtInfo.type = STMT_IF;
     ptrdiff_t beq = -1;
     ptrdiff_t jmp = -1;
     ptrdiff_t noteIndex = -1;
 
   if_again:
@@ -5331,17 +5285,17 @@ EmitIf(JSContext *cx, JSCodeGenerator *c
         stmtInfo.update = top;
         if (!js_SetSrcNoteOffset(cx, cg, noteIndex, 0, jmp - beq))
             return JS_FALSE;
         if (!js_SetSrcNoteOffset(cx, cg, noteIndex, 1, top - beq))
             return JS_FALSE;
     }
 
     /* Emit an annotated branch-if-false around the then part. */
-    JSParseNode *pn3 = pn->pn_kid3;
+    ParseNode *pn3 = pn->pn_kid3;
     noteIndex = js_NewSrcNote(cx, cg, pn3 ? SRC_IF_ELSE : SRC_IF);
     if (noteIndex < 0)
         return JS_FALSE;
     beq = EmitJump(cx, cg, JSOP_IFEQ, 0);
     if (beq < 0)
         return JS_FALSE;
 
     /* Emit code for the then and optional else parts. */
@@ -5384,30 +5338,30 @@ EmitIf(JSContext *cx, JSCodeGenerator *c
         /* No else part, fixup the branch-if-false to come here. */
         CHECK_AND_SET_JUMP_OFFSET_AT(cx, cg, beq);
     }
     return js_PopStatementCG(cx, cg);
 }
 
 #if JS_HAS_BLOCK_SCOPE
 static bool
-EmitLet(JSContext *cx, JSCodeGenerator *cg, JSParseNode *&pn)
+EmitLet(JSContext *cx, CodeGenerator *cg, ParseNode *&pn)
 {
     /*
      * pn represents one of these syntactic constructs:
      *   let-expression:                        (let (x = y) EXPR)
      *   let-statement:                         let (x = y) { ... }
      *   let-declaration in statement context:  let x = y;
      *   let-declaration in for-loop head:      for (let ...) ...
      *
      * Let-expressions and let-statements are represented as binary nodes
      * with their variable declarations on the left and the body on the
      * right.
      */
-    JSParseNode *pn2;
+    ParseNode *pn2;
     if (pn->isArity(PN_BINARY)) {
         pn2 = pn->pn_right;
         pn = pn->pn_left;
     } else {
         pn2 = NULL;
     }
 
     /*
@@ -5439,32 +5393,32 @@ EmitLet(JSContext *cx, JSCodeGenerator *
         return false;
 
     return true;
 }
 #endif
 
 #if JS_HAS_XML_SUPPORT
 static bool
-EmitXMLTag(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitXMLTag(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     if (js_Emit1(cx, cg, JSOP_STARTXML) < 0)
         return false;
 
     {
         jsatomid index;
         JSAtom *tmp = (pn->isKind(TOK_XMLETAGO)) ? cx->runtime->atomState.etagoAtom
                                                  : cx->runtime->atomState.stagoAtom;
         if (!cg->makeAtomIndex(tmp, &index))
             return false;
         EMIT_INDEX_OP(JSOP_STRING, index);
     }
 
     JS_ASSERT(pn->pn_count != 0);
-    JSParseNode *pn2 = pn->pn_head;
+    ParseNode *pn2 = pn->pn_head;
     if (pn2->isKind(TOK_LC) && js_Emit1(cx, cg, JSOP_STARTXMLEXPR) < 0)
         return false;
     if (!js_EmitTree(cx, cg, pn2))
         return false;
     if (js_Emit1(cx, cg, JSOP_ADD) < 0)
         return false;
 
     uint32 i;
@@ -5498,35 +5452,35 @@ EmitXMLTag(JSContext *cx, JSCodeGenerato
 
     if ((pn->pn_xflags & PNX_XMLROOT) && js_Emit1(cx, cg, pn->getOp()) < 0)
         return false;
 
     return true;
 }
 
 static bool
-EmitXMLProcessingInstruction(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+EmitXMLProcessingInstruction(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     jsatomid index;
     if (!cg->makeAtomIndex(pn->pn_pidata, &index))
         return false;
     if (!EmitIndexOp(cx, JSOP_QNAMEPART, index, cg))
         return false;
     if (!EmitAtomOp(cx, pn, JSOP_XMLPI, cg))
         return false;
     return true;
 }
 #endif
 
 static bool
-EmitLexicalScope(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn, JSBool &ok)
+EmitLexicalScope(JSContext *cx, CodeGenerator *cg, ParseNode *pn, JSBool &ok)
 {
-    JSStmtInfo stmtInfo;
-    JSStmtInfo *stmt;
-    JSObjectBox *objbox = pn->pn_objbox;
+    StmtInfo stmtInfo;
+    StmtInfo *stmt;
+    ObjectBox *objbox = pn->pn_objbox;
     js_PushBlockScope(cg, &stmtInfo, objbox, CG_OFFSET(cg));
 
     /*
      * If this lexical scope is not for a catch block, let block or let
      * expression, or any kind of for loop (where the scope starts in the
      * head after the first part if for (;;), else in the body if for-in);
      * and if our container is top-level but not a function body, or else
      * a block statement; then emit a SRC_BRACE note.  All other container
@@ -5572,19 +5526,19 @@ EmitLexicalScope(JSContext *cx, JSCodeGe
     if (!EmitLeaveBlock(cx, cg, op, objbox))
         return false;
 
     ok = js_PopStatementCG(cx, cg);
     return true;
 }
 
 static bool
-EmitWith(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn, JSBool &ok)
+EmitWith(JSContext *cx, CodeGenerator *cg, ParseNode *pn, JSBool &ok)
 {
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     if (!js_EmitTree(cx, cg, pn->pn_left))
         return false;
     js_PushStatement(cg, &stmtInfo, STMT_WITH, CG_OFFSET(cg));
     if (js_Emit1(cx, cg, JSOP_ENTERWITH) < 0)
         return false;
 
     /* Make blockChain determination quicker. */
     if (EmitBlockChain(cx, cg) < 0)
@@ -5593,28 +5547,28 @@ EmitWith(JSContext *cx, JSCodeGenerator 
         return false;
     if (js_Emit1(cx, cg, JSOP_LEAVEWITH) < 0)
         return false;
     ok = js_PopStatementCG(cx, cg);
     return true;
 }
 
 JSBool
-js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
+js_EmitTree(JSContext *cx, CodeGenerator *cg, ParseNode *pn)
 {
     JSBool useful, wantval;
-    JSStmtInfo stmtInfo;
-    JSStmtInfo *stmt;
+    StmtInfo stmtInfo;
+    StmtInfo *stmt;
     ptrdiff_t top, off, tmp, beq, jmp, tmp2, tmp3;
-    JSParseNode *pn2, *pn3;
+    ParseNode *pn2, *pn3;
     JSAtom *atom;
     jsatomid atomIndex;
     uintN index;
     ptrdiff_t noteIndex, noteIndex2;
-    JSSrcNoteType noteType;
+    SrcNoteType noteType;
     jsbytecode *pc;
     JSOp op;
     uint32 argc;
     EmitLevelManager elm(cg);
 #if JS_HAS_SHARP_VARS
     jsint sharpnum;
 #endif
 
@@ -5654,17 +5608,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
                 return JS_FALSE;
             break;
         }
 
         JS_ASSERT_IF(pn->pn_funbox->tcflags & TCF_FUN_HEAVYWEIGHT,
                      fun->kind() == JSFUN_INTERPRETED);
 
         /* Generate code for the function's body. */
-        JSCodeGenerator *cg2 = cx->new_<JSCodeGenerator>(cg->parser, pn->pn_pos.begin.lineno);
+        CodeGenerator *cg2 = cx->new_<CodeGenerator>(cg->parser, pn->pn_pos.begin.lineno);
         if (!cg2) {
             js_ReportOutOfMemory(cx);
             return JS_FALSE;
         }
         if (!cg2->init(cx))
             return JS_FALSE;
 
         cg2->flags = pn->pn_funbox->tcflags | TCF_COMPILING | TCF_IN_FUNCTION |
@@ -5761,18 +5715,18 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
             if (EmitBlockChain(cx, cg) < 0)
                 return JS_FALSE;
         }
         break;
       }
 
       case TOK_ARGSBODY:
       {
-        JSParseNode *pnlast = pn->last();
-        for (JSParseNode *pn2 = pn->pn_head; pn2 != pnlast; pn2 = pn2->pn_next) {
+        ParseNode *pnlast = pn->last();
+        for (ParseNode *pn2 = pn->pn_head; pn2 != pnlast; pn2 = pn2->pn_next) {
             if (!pn2->isDefn())
                 continue;
             if (!BindNameToSlot(cx, cg, pn2))
                 return JS_FALSE;
             if (JOF_OPTYPE(pn2->getOp()) == JOF_QARG && cg->shouldNoteClosedName(pn2)) {
                 if (!cg->closedArgs.append(pn2->pn_cookie.slot()))
                     return JS_FALSE;
             }
@@ -5807,17 +5761,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
          *  =    ===============                 ==================
          *  0    ifeq-pass                       goto; ifne-fail
          *  1    ifeq-fail; goto; ifne-pass      goto; ifne-pass; ifne-fail
          *  2    2*(ifeq-fail; goto); ifeq-pass  goto; 2*ifne-pass; ifne-fail
          *  . . .
          *  N    N*(ifeq-fail; goto); ifeq-pass  goto; N*ifne-pass; ifne-fail
          *
          * SpiderMonkey, pre-mozilla.org, emitted while parsing and so used
-         * test at the top. When JSParseNode trees were added during the ES3
+         * test at the top. When ParseNode trees were added during the ES3
          * work (1998-9), the code generation scheme was not optimized, and
          * the decompiler continued to take advantage of the branch and jump
          * that bracketed the body. But given the SRC_WHILE note, it is easy
          * to support the more efficient scheme.
          */
         js_PushStatement(cg, &stmtInfo, STMT_WHILE_LOOP, top);
         noteIndex = js_NewSrcNote(cx, cg, SRC_WHILE);
         if (noteIndex < 0)
@@ -5911,17 +5865,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
             /*
              * If the left part is 'var x', emit code to define x if necessary
              * using a prolog opcode, but do not emit a pop. If the left part
              * was originally 'var x = i', the parser will have rewritten it;
              * see Parser::forStatement. 'for (let x = i in o)' is mercifully
              * banned.
              */
             bool forLet = false;
-            if (JSParseNode *decl = pn2->pn_kid1) {
+            if (ParseNode *decl = pn2->pn_kid1) {
                 JS_ASSERT(TokenKindIsDecl(decl->getKind()));
                 forLet = decl->isKind(TOK_LET);
                 cg->flags |= TCF_IN_FOR_INIT;
                 if (!js_EmitTree(cx, cg, decl))
                     return JS_FALSE;
                 cg->flags &= ~TCF_IN_FOR_INIT;
             }
 
@@ -6208,17 +6162,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
 
       case TOK_CONTINUE: {
         stmt = cg->topStmt;
         atom = pn->pn_atom;
 
         jsatomid labelIndex;
         if (atom) {
             /* Find the loop statement enclosed by the matching label. */
-            JSStmtInfo *loop = NULL;
+            StmtInfo *loop = NULL;
             if (!cg->makeAtomIndex(atom, &labelIndex))
                 return JS_FALSE;
             while (stmt->type != STMT_LABEL || stmt->label != atom) {
                 if (STMT_IS_LOOP(stmt))
                     loop = stmt;
                 stmt = stmt->down;
             }
             stmt = loop;
@@ -6327,17 +6281,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
         if (pn->pn_xflags & PNX_NEEDBRACES) {
             noteIndex = js_NewSrcNote2(cx, cg, SRC_BRACE, 0);
             if (noteIndex < 0 || js_Emit1(cx, cg, JSOP_NOP) < 0)
                 return JS_FALSE;
         }
 
         js_PushStatement(cg, &stmtInfo, STMT_BLOCK, top);
 
-        JSParseNode *pnchild = pn->pn_head;
+        ParseNode *pnchild = pn->pn_head;
         if (pn->pn_xflags & PNX_FUNCDEFS) {
             /*
              * This block contains top-level function definitions. To ensure
              * that we emit the bytecode defining them before the rest of code
              * in the block we use a separate pass over functions. During the
              * main pass later the emitter will add JSOP_NOP with source notes
              * for the function to preserve the original functions position
              * when decompiling.
@@ -7217,17 +7171,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
             } else {
                 JS_ASSERT(pn3->isKind(TOK_NAME) ||
                           pn3->isKind(TOK_STRING));
                 jsatomid index;
                 if (!cg->makeAtomIndex(pn3->pn_atom, &index))
                     return JS_FALSE;
 
                 /* Check whether we can optimize to JSOP_INITMETHOD. */
-                JSParseNode *init = pn2->pn_right;
+                ParseNode *init = pn2->pn_right;
                 bool lambda = init->isOp(JSOP_LAMBDA);
                 if (lambda)
                     ++methodInits;
                 if (op == JSOP_INITPROP && lambda && init->pn_funbox->joinable()) {
                     obj = NULL;
                     op = JSOP_INITMETHOD;
                     pn2->setOp(op);
                 } else {
@@ -7265,17 +7219,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerat
         if (!EmitEndInit(cx, cg, pn->pn_count))
             return JS_FALSE;
 
         if (obj) {
             /*
              * The object survived and has a predictable shape.  Update the original bytecode,
              * as long as we can do so without using a big index prefix/suffix.
              */
-            JSObjectBox *objbox = cg->parser->newObjectBox(obj);
+            ObjectBox *objbox = cg->parser->newObjectBox(obj);
             if (!objbox)
                 return JS_FALSE;
             unsigned index = cg->objectList.index(objbox);
             if (FitsWithoutBigIndex(index))
                 EMIT_UINT16_IN_PLACE(offset, JSOP_NEWOBJECT, uint16(index));
         }
 
         break;
@@ -7473,17 +7427,17 @@ JS_FRIEND_DATA(JSSrcNoteSpec) js_SrcNote
     {"catch",           1,      0,      1},
     {"extended",       -1,      0,      0},
     {"newline",         0,      0,      0},
     {"setline",         1,      0,      0},
     {"xdelta",          0,      0,      0},
 };
 
 static intN
-AllocSrcNote(JSContext *cx, JSCodeGenerator *cg)
+AllocSrcNote(JSContext *cx, CodeGenerator *cg)
 {
     jssrcnote *notes = CG_NOTES(cg);
     jssrcnote *newnotes;
     uintN index = CG_NOTE_COUNT(cg);
     uintN max = CG_NOTE_LIMIT(cg);
 
     if (index == max) {
         size_t newlength;
@@ -7504,17 +7458,17 @@ AllocSrcNote(JSContext *cx, JSCodeGenera
         CG_NOTE_LIMIT(cg) = newlength;
     }
 
     CG_NOTE_COUNT(cg) = index + 1;
     return (intN)index;
 }
 
 intN
-js_NewSrcNote(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type)
+js_NewSrcNote(JSContext *cx, CodeGenerator *cg, SrcNoteType type)
 {
     intN index, n;
     jssrcnote *sn;
     ptrdiff_t offset, delta, xdelta;
 
     /*
      * Claim a note slot in CG_NOTES(cg) by growing it if necessary and then
      * incrementing CG_NOTE_COUNT(cg).
@@ -7552,62 +7506,60 @@ js_NewSrcNote(JSContext *cx, JSCodeGener
     for (n = (intN)js_SrcNoteSpec[type].arity; n > 0; n--) {
         if (js_NewSrcNote(cx, cg, SRC_NULL) < 0)
             return -1;
     }
     return index;
 }
 
 intN
-js_NewSrcNote2(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type,
-               ptrdiff_t offset)
+js_NewSrcNote2(JSContext *cx, CodeGenerator *cg, SrcNoteType type, ptrdiff_t offset)
 {
     intN index;
 
     index = js_NewSrcNote(cx, cg, type);
     if (index >= 0) {
         if (!js_SetSrcNoteOffset(cx, cg, index, 0, offset))
             return -1;
     }
     return index;
 }
 
 intN
-js_NewSrcNote3(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type,
-               ptrdiff_t offset1, ptrdiff_t offset2)
+js_NewSrcNote3(JSContext *cx, CodeGenerator *cg, SrcNoteType type, ptrdiff_t offset1,
+               ptrdiff_t offset2)
 {
     intN index;
 
     index = js_NewSrcNote(cx, cg, type);
     if (index >= 0) {
         if (!js_SetSrcNoteOffset(cx, cg, index, 0, offset1))
             return -1;
         if (!js_SetSrcNoteOffset(cx, cg, index, 1, offset2))
             return -1;
     }
     return index;
 }
 
 static JSBool
-GrowSrcNotes(JSContext *cx, JSCodeGenerator *cg)
+GrowSrcNotes(JSContext *cx, CodeGenerator *cg)
 {
     size_t newlength = CG_NOTE_LIMIT(cg) * 2;
     jssrcnote *newnotes = (jssrcnote *) cx->realloc_(CG_NOTES(cg), newlength);
     if (!newnotes) {
         js_ReportOutOfMemory(cx);
         return JS_FALSE;
     }
     CG_NOTES(cg) = newnotes;
     CG_NOTE_LIMIT(cg) = newlength;
     return JS_TRUE;
 }
 
 jssrcnote *
-js_AddToSrcNoteDelta(JSContext *cx, JSCodeGenerator *cg, jssrcnote *sn,
-                     ptrdiff_t delta)
+js_AddToSrcNoteDelta(JSContext *cx, CodeGenerator *cg, jssrcnote *sn, ptrdiff_t delta)
 {
     ptrdiff_t base, limit, newdelta, diff;
     intN index;
 
     /*
      * Called only from OptimizeSpanDeps and js_FinishTakingSrcNotes to add to
      * main script note deltas, and only by a small positive amount.
      */
@@ -7663,18 +7615,17 @@ js_GetSrcNoteOffset(jssrcnote *sn, uintN
         return (ptrdiff_t)(((uint32)(sn[0] & SN_3BYTE_OFFSET_MASK) << 16)
                            | (sn[1] << 8)
                            | sn[2]);
     }
     return (ptrdiff_t)*sn;
 }
 
 JSBool
-js_SetSrcNoteOffset(JSContext *cx, JSCodeGenerator *cg, uintN index,
-                    uintN which, ptrdiff_t offset)
+js_SetSrcNoteOffset(JSContext *cx, CodeGenerator *cg, uintN index, uintN which, ptrdiff_t offset)
 {
     jssrcnote *sn;
     ptrdiff_t diff;
 
     if ((jsuword)offset >= (jsuword)((ptrdiff_t)SN_3BYTE_OFFSET_FLAG << 16)) {
         ReportStatementTooLarge(cx, cg);
         return JS_FALSE;
     }
@@ -7751,17 +7702,17 @@ void DumpSrcNoteSizeHist()
 
 /*
  * Fill in the storage at notes with prolog and main srcnotes; the space at
  * notes was allocated using the CG_COUNT_FINAL_SRCNOTES macro from jsemit.h.
  * SO DON'T CHANGE THIS FUNCTION WITHOUT AT LEAST CHECKING WHETHER jsemit.h's
  * CG_COUNT_FINAL_SRCNOTES MACRO NEEDS CORRESPONDING CHANGES!
  */
 JSBool
-js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg, jssrcnote *notes)
+js_FinishTakingSrcNotes(JSContext *cx, CodeGenerator *cg, jssrcnote *notes)
 {
     uintN prologCount, mainCount, totalCount;
     ptrdiff_t offset, delta;
     jssrcnote *sn;
 
     JS_ASSERT(cg->current == &cg->main);
 
     prologCount = cg->prolog.noteCount;
@@ -7807,44 +7758,44 @@ js_FinishTakingSrcNotes(JSContext *cx, J
         memcpy(notes, cg->prolog.notes, SRCNOTE_SIZE(prologCount));
     memcpy(notes + prologCount, cg->main.notes, SRCNOTE_SIZE(mainCount));
     SN_MAKE_TERMINATOR(&notes[totalCount]);
 
     return JS_TRUE;
 }
 
 static JSBool
-NewTryNote(JSContext *cx, JSCodeGenerator *cg, JSTryNoteKind kind,
-           uintN stackDepth, size_t start, size_t end)
+NewTryNote(JSContext *cx, CodeGenerator *cg, JSTryNoteKind kind, uintN stackDepth, size_t start,
+           size_t end)
 {
     JS_ASSERT((uintN)(uint16)stackDepth == stackDepth);
     JS_ASSERT(start <= end);
     JS_ASSERT((size_t)(uint32)start == start);
     JS_ASSERT((size_t)(uint32)end == end);
 
-    JSTryNode *tryNode = cx->tempLifoAlloc().new_<JSTryNode>();
+    TryNode *tryNode = cx->tempLifoAlloc().new_<TryNode>();
     if (!tryNode) {
         js_ReportOutOfMemory(cx);
         return JS_FALSE;
     }
 
     tryNode->note.kind = kind;
     tryNode->note.stackDepth = (uint16)stackDepth;
     tryNode->note.start = (uint32)start;
     tryNode->note.length = (uint32)(end - start);
     tryNode->prev = cg->lastTryNode;
     cg->lastTryNode = tryNode;
     cg->ntrynotes++;
     return JS_TRUE;
 }
 
 void
-js_FinishTakingTryNotes(JSCodeGenerator *cg, JSTryNoteArray *array)
+js_FinishTakingTryNotes(CodeGenerator *cg, JSTryNoteArray *array)
 {
-    JSTryNode *tryNode;
+    TryNode *tryNode;
     JSTryNote *tn;
 
     JS_ASSERT(array->length > 0 && array->length == cg->ntrynotes);
     tn = array->vector + array->length;
     tryNode = cg->lastTryNode;
     do {
         *--tn = tryNode->note;
     } while ((tryNode = tryNode->prev) != NULL);
@@ -7852,25 +7803,25 @@ js_FinishTakingTryNotes(JSCodeGenerator 
 }
 
 /*
  * Find the index of the given object for code generator.
  *
  * Since the emitter refers to each parsed object only once, for the index we
  * use the number of already indexes objects. We also add the object to a list
  * to convert the list to a fixed-size array when we complete code generation,
- * see JSCGObjectList::finish below.
+ * see js::CGObjectList::finish below.
  *
- * Most of the objects go to JSCodeGenerator.objectList but for regexp we use a
- * separated JSCodeGenerator.regexpList. In this way the emitted index can be
+ * Most of the objects go to CodeGenerator::objectList but for regexp we use a
+ * separated CodeGenerator::regexpList. In this way the emitted index can be
  * directly used to store and fetch a reference to a cloned RegExp object that
  * shares the same JSRegExp private data created for the object literal in
- * objbox. We need a cloned object to hold lastIndex and other direct properties
- * that should not be shared among threads sharing a precompiled function or
- * script.
+ * objbox. We need a cloned object to hold lastIndex and other direct
+ * properties that should not be shared among threads sharing a precompiled
+ * function or script.
  *
  * If the code being compiled is function code, allocate a reserved slot in
  * the cloned function object that shares its precompiled script with other
  * cloned function objects and with the compiler-created clone-parent. There
  * are nregexps = script->regexps()->length such reserved slots in each
  * function object cloned from fun->object. NB: during compilation, a funobj
  * slots element must never be allocated, because JSObject::allocSlot could
  * hand out one of the slots that should be given to a regexp clone.
@@ -7889,45 +7840,42 @@ js_FinishTakingTryNotes(JSCodeGenerator 
  * threads, or using multiple global objects, or both, for efficiency.
  *
  * In such cases, naively following ECMA leads to wrongful sharing of RegExp
  * objects, which makes for collisions on the lastIndex property (especially
  * for global regexps) and on any ad-hoc properties.  Also, __proto__ refers to
  * the pre-compilation prototype, a pigeon-hole problem for instanceof tests.
  */
 uintN
-JSCGObjectList::index(JSObjectBox *objbox)
+CGObjectList::index(ObjectBox *objbox)
 {
     JS_ASSERT(!objbox->emitLink);
     objbox->emitLink = lastbox;
     lastbox = objbox;
     objbox->index = length++;
     return objbox->index;
 }
 
 void
-JSCGObjectList::finish(JSObjectArray *array)
+CGObjectList::finish(JSObjectArray *array)
 {
-    JSObject **cursor;
-    JSObjectBox *objbox;
-
     JS_ASSERT(length <= INDEX_LIMIT);
     JS_ASSERT(length == array->length);
 
-    cursor = array->vector + array->length;
-    objbox = lastbox;
+    JSObject **cursor = array->vector + array->length;
+    ObjectBox *objbox = lastbox;
     do {
         --cursor;
         JS_ASSERT(!*cursor);
         *cursor = objbox->object;
     } while ((objbox = objbox->emitLink) != NULL);
     JS_ASSERT(cursor == array->vector);
 }
 
 void
-JSGCConstList::finish(JSConstArray *array)
+GCConstList::finish(JSConstArray *array)
 {
     JS_ASSERT(array->length == list.length());
     Value *src = list.begin(), *srcend = list.end();
     Value *dst = array->vector;
     for (; src != srcend; ++src, ++dst)
         *dst = *src;
 }
--- a/js/src/frontend/BytecodeGenerator.h
+++ b/js/src/frontend/BytecodeGenerator.h
@@ -51,57 +51,57 @@
 #include "jsprvtd.h"
 #include "jspubtd.h"
 
 #include "frontend/Parser.h"
 #include "frontend/ParseMaps.h"
 
 #include "jsatominlines.h"
 
-JS_BEGIN_EXTERN_C
+namespace js {
 
 /*
  * NB: If you add enumerators for scope statements, add them between STMT_WITH
  * and STMT_CATCH, or you will break the STMT_TYPE_IS_SCOPE macro. If you add
  * non-looping statement enumerators, add them before STMT_DO_LOOP or you will
  * break the STMT_TYPE_IS_LOOP macro.
  *
  * Also remember to keep the statementName array in jsemit.c in sync.
  */
-typedef enum JSStmtType {
+enum StmtType {
     STMT_LABEL,                 /* labeled statement:  L: s */
     STMT_IF,                    /* if (then) statement */
     STMT_ELSE,                  /* else clause of if statement */
     STMT_SEQ,                   /* synthetic sequence of statements */
     STMT_BLOCK,                 /* compound statement: { s1[;... sN] } */
     STMT_SWITCH,                /* switch statement */
     STMT_WITH,                  /* with statement */
     STMT_CATCH,                 /* catch block */
     STMT_TRY,                   /* try block */
     STMT_FINALLY,               /* finally block */
     STMT_SUBROUTINE,            /* gosub-target subroutine body */
     STMT_DO_LOOP,               /* do/while loop statement */
     STMT_FOR_LOOP,              /* for loop statement */
     STMT_FOR_IN_LOOP,           /* for/in loop statement */
     STMT_WHILE_LOOP,            /* while loop statement */
     STMT_LIMIT
-} JSStmtType;
+};
 
 #define STMT_TYPE_IN_RANGE(t,b,e) ((uint)((t) - (b)) <= (uintN)((e) - (b)))
 
 /*
- * A comment on the encoding of the JSStmtType enum and type-testing macros:
+ * A comment on the encoding of the js::StmtType enum and type-testing macros:
  *
  * STMT_TYPE_MAYBE_SCOPE tells whether a statement type is always, or may
  * become, a lexical scope.  It therefore includes block and switch (the two
  * low-numbered "maybe" scope types) and excludes with (with has dynamic scope
  * pending the "reformed with" in ES4/JS2).  It includes all try-catch-finally
  * types, which are high-numbered maybe-scope types.
  *
- * STMT_TYPE_LINKS_SCOPE tells whether a JSStmtInfo of the given type eagerly
+ * STMT_TYPE_LINKS_SCOPE tells whether a js::StmtInfo of the given type eagerly
  * links to other scoping statement info records.  It excludes the two early
  * "maybe" types, block and switch, as well as the try and both finally types,
  * since try and the other trailing maybe-scope types don't need block scope
  * unless they contain let declarations.
  *
  * We treat WITH as a static scope because it prevents lexical binding from
  * continuing further up the static scope chain. With the lost "reformed with"
  * proposal for ES4, we would be able to model it statically, too.
@@ -119,53 +119,51 @@ typedef enum JSStmtType {
 #define STMT_TYPE_IS_LOOP(type) ((type) >= STMT_DO_LOOP)
 
 #define STMT_MAYBE_SCOPE(stmt)  STMT_TYPE_MAYBE_SCOPE((stmt)->type)
 #define STMT_LINKS_SCOPE(stmt)  (STMT_TYPE_LINKS_SCOPE((stmt)->type) ||       \
                                  ((stmt)->flags & SIF_SCOPE))
 #define STMT_IS_TRYING(stmt)    STMT_TYPE_IS_TRYING((stmt)->type)
 #define STMT_IS_LOOP(stmt)      STMT_TYPE_IS_LOOP((stmt)->type)
 
-typedef struct JSStmtInfo JSStmtInfo;
-
-struct JSStmtInfo {
+struct StmtInfo {
     uint16          type;           /* statement type */
     uint16          flags;          /* flags, see below */
     uint32          blockid;        /* for simplified dominance computation */
     ptrdiff_t       update;         /* loop update offset (top if none) */
     ptrdiff_t       breaks;         /* offset of last break in loop */
     ptrdiff_t       continues;      /* offset of last continue in loop */
     union {
         JSAtom      *label;         /* name of LABEL */
-        JSObjectBox *blockBox;      /* block scope object */
+        ObjectBox   *blockBox;      /* block scope object */
     };
-    JSStmtInfo      *down;          /* info for enclosing statement */
-    JSStmtInfo      *downScope;     /* next enclosing lexical scope */
+    StmtInfo        *down;          /* info for enclosing statement */
+    StmtInfo        *downScope;     /* next enclosing lexical scope */
 };
 
 #define SIF_SCOPE        0x0001     /* statement has its own lexical scope */
 #define SIF_BODY_BLOCK   0x0002     /* STMT_BLOCK type is a function body */
 #define SIF_FOR_BLOCK    0x0004     /* for (let ...) induced block scope */
 
 /*
- * To reuse space in JSStmtInfo, rename breaks and continues for use during
+ * To reuse space in StmtInfo, rename breaks and continues for use during
  * try/catch/finally code generation and backpatching. To match most common
  * use cases, the macro argument is a struct, not a struct pointer. Only a
  * loop, switch, or label statement info record can have breaks and continues,
  * and only a for loop has an update backpatch chain, so it's safe to overlay
- * these for the "trying" JSStmtTypes.
+ * these for the "trying" StmtTypes.
  */
 #define CATCHNOTE(stmt)  ((stmt).update)
 #define GOSUBS(stmt)     ((stmt).breaks)
 #define GUARDJUMP(stmt)  ((stmt).continues)
 
 #define SET_STATEMENT_TOP(stmt, top)                                          \
     ((stmt)->update = (top), (stmt)->breaks = (stmt)->continues = (-1))
 
-#define TCF_COMPILING           0x01 /* JSTreeContext is JSCodeGenerator */
+#define TCF_COMPILING           0x01 /* TreeContext is CodeGenerator */
 #define TCF_IN_FUNCTION         0x02 /* parsing inside function body */
 #define TCF_RETURN_EXPR         0x04 /* function has 'return expr;' */
 #define TCF_RETURN_VOID         0x08 /* function has 'return;' */
 #define TCF_IN_FOR_INIT         0x10 /* parsing init expr of for; exclude 'in' */
 #define TCF_FUN_SETS_OUTER_NAME 0x20 /* function set outer name (lexical or free) */
 #define TCF_FUN_PARAM_ARGUMENTS 0x40 /* function has parameter named arguments */
 #define TCF_FUN_USES_ARGUMENTS  0x80 /* function uses arguments except as a
                                         parameter name */
@@ -192,17 +190,17 @@ struct JSStmtInfo {
  * The comments atop CheckDestructuring explain the distinction
  * between assignment-like and declaration-like destructuring
  * patterns, and why they need to be treated differently.
  */
 #define TCF_DECL_DESTRUCTURING  0x10000
 
 /*
  * A request flag passed to Compiler::compileScript and then down via
- * JSCodeGenerator to js_NewScriptFromCG, from script_compile_sub and any
+ * CodeGenerator to js_NewScriptFromCG, from script_compile_sub and any
  * kindred functions that need to make mutable scripts (even empty ones;
  * i.e., they can't share the const JSScript::emptyScript() singleton).
  */
 #define TCF_NEED_MUTABLE_SCRIPT 0x20000
 
 /*
  * This function/global/eval code body contained a Use Strict Directive. Treat
  * certain strict warnings as errors, and forbid the use of 'with'. See also
@@ -294,39 +292,41 @@ struct JSStmtInfo {
                                  TCF_FUN_USES_OWN_NAME   |                    \
                                  TCF_HAS_SHARPS          |                    \
                                  TCF_FUN_CALLS_EVAL      |                    \
                                  TCF_FUN_MIGHT_ALIAS_LOCALS |                 \
                                  TCF_FUN_MUTATES_PARAMETER |                  \
                                  TCF_STRICT_MODE_CODE    |                    \
                                  TCF_FUN_EXTENSIBLE_SCOPE)
 
-struct JSTreeContext {              /* tree context for semantic checks */
+struct CodeGenerator;
+
+struct TreeContext {                /* tree context for semantic checks */
     uint32          flags;          /* statement state flags, see above */
     uint32          bodyid;         /* block number of program/function body */
     uint32          blockidGen;     /* preincremented block number generator */
     uint32          parenDepth;     /* nesting depth of parens that might turn out
                                        to be generator expressions */
     uint32          yieldCount;     /* number of |yield| tokens encountered at
                                        non-zero depth in current paren tree */
     uint32          argumentsCount; /* number of |arguments| references encountered
                                        at non-zero depth in current paren tree */
-    JSStmtInfo      *topStmt;       /* top of statement info stack */
-    JSStmtInfo      *topScopeStmt;  /* top lexical scope statement */
-    JSObjectBox     *blockChainBox; /* compile time block scope chain (NB: one
+    StmtInfo        *topStmt;       /* top of statement info stack */
+    StmtInfo        *topScopeStmt;  /* top lexical scope statement */
+    ObjectBox       *blockChainBox; /* compile time block scope chain (NB: one
                                        deeper than the topScopeStmt/downScope
                                        chain when in head of let block/expr) */
-    JSParseNode     *blockNode;     /* parse node for a block with let declarations
+    ParseNode       *blockNode;     /* parse node for a block with let declarations
                                        (block with its own lexical scope)  */
-    js::AtomDecls   decls;          /* function, const, and var declarations */
-    js::Parser      *parser;        /* ptr to common parsing and lexing data */
-    JSParseNode     *yieldNode;     /* parse node for a yield expression that might
+    AtomDecls       decls;          /* function, const, and var declarations */
+    Parser          *parser;        /* ptr to common parsing and lexing data */
+    ParseNode       *yieldNode;     /* parse node for a yield expression that might
                                        be an error if we turn out to be inside a
                                        generator expression */
-    JSParseNode     *argumentsNode; /* parse node for an arguments variable that
+    ParseNode       *argumentsNode; /* parse node for an arguments variable that
                                        might be an error if we turn out to be
                                        inside a generator expression */
 
   private:
     union {
         JSFunction  *fun_;          /* function to store argument and variable
                                        names when flags & TCF_IN_FUNCTION */
         JSObject    *scopeChain_;   /* scope chain object for the script */
@@ -345,55 +345,55 @@ struct JSTreeContext {              /* t
         JS_ASSERT(!inFunction());
         return scopeChain_;
     }
     void setScopeChain(JSObject *scopeChain) {
         JS_ASSERT(!inFunction());
         scopeChain_ = scopeChain;
     }
 
-    js::OwnedAtomDefnMapPtr lexdeps;/* unresolved lexical name dependencies */
-    JSTreeContext   *parent;        /* enclosing function or global context */
+    OwnedAtomDefnMapPtr lexdeps;    /* unresolved lexical name dependencies */
+    TreeContext     *parent;        /* enclosing function or global context */
     uintN           staticLevel;    /* static compilation unit nesting level */
 
-    JSFunctionBox   *funbox;        /* null or box for function we're compiling
+    FunctionBox     *funbox;        /* null or box for function we're compiling
                                        if (flags & TCF_IN_FUNCTION) and not in
                                        Compiler::compileFunctionBody */
-    JSFunctionBox   *functionList;
+    FunctionBox     *functionList;
 
-    JSParseNode     *innermostWith; /* innermost WITH parse node */
+    ParseNode       *innermostWith; /* innermost WITH parse node */
 
-    js::Bindings    bindings;       /* bindings in this code, including
+    Bindings        bindings;       /* bindings in this code, including
                                        arguments if we're compiling a function */
 
     void trace(JSTracer *trc);
 
-    JSTreeContext(js::Parser *prs)
+    TreeContext(Parser *prs)
       : flags(0), bodyid(0), blockidGen(0), parenDepth(0), yieldCount(0), argumentsCount(0),
         topStmt(NULL), topScopeStmt(NULL), blockChainBox(NULL), blockNode(NULL),
         decls(prs->context), parser(prs), yieldNode(NULL), argumentsNode(NULL), scopeChain_(NULL),
         lexdeps(prs->context), parent(prs->tc), staticLevel(0), funbox(NULL), functionList(NULL),
         innermostWith(NULL), bindings(prs->context), sharpSlotBase(-1)
     {
         prs->tc = this;
     }
 
     /*
      * For functions the tree context is constructed and destructed a second
      * time during code generation. To avoid a redundant stats update in such
      * cases, we store uint16(-1) in maxScopeDepth.
      */
-    ~JSTreeContext() {
+    ~TreeContext() {
         parser->tc = this->parent;
     }
 
     /*
-     * JSCodeGenerator derives from JSTreeContext; however, only the top-level
-     * JSCodeGenerators are actually used as full-fledged tree contexts (to
-     * hold decls and lexdeps). We can avoid allocation overhead by making
+     * js::CodeGenerator derives from js::TreeContext; however, only the
+     * top-level CodeGenerators are actually used as full-fledged tree contexts
+     * (to hold decls and lexdeps). We can avoid allocation overhead by making
      * this distinction explicit.
      */
     enum InitBehavior {
         USED_AS_TREE_CONTEXT,
         USED_AS_CODE_GENERATOR
     };
 
     bool init(JSContext *cx, InitBehavior ib = USED_AS_TREE_CONTEXT) {
@@ -414,43 +414,43 @@ struct JSTreeContext {              /* t
      * body level, but we would not encounter f3 or f4 at body level:
      *
      *   function f1() { function f2() { } }
      *   if (cond) { function f3() { if (cond) { function f4() { } } } }
      */
     bool atBodyLevel() { return !topStmt || (topStmt->flags & SIF_BODY_BLOCK); }
 
     /* Test whether we're in a statement of given type. */
-    bool inStatement(JSStmtType type);
+    bool inStatement(StmtType type);
 
     bool inStrictMode() const {
         return flags & TCF_STRICT_MODE_CODE;
     }
 
     inline bool needStrictChecks();
 
     /*
      * sharpSlotBase is -1 or first slot of pair for [sharpArray, sharpDepth].
      * The parser calls ensureSharpSlots to allocate these two stack locals.
      */
     int sharpSlotBase;
     bool ensureSharpSlots();
 
-    js::Compiler *compiler() { return (js::Compiler *)parser; }
+    Compiler *compiler() { return (js::Compiler *)parser; }
 
     // Return true there is a generator function within |skip| lexical scopes
     // (going upward) from this context's lexical scope. Always return true if
     // this context is itself a generator.
     bool skipSpansGenerator(unsigned skip);
 
     bool compileAndGo() const { return flags & TCF_COMPILE_N_GO; }
     bool inFunction() const { return flags & TCF_IN_FUNCTION; }
 
     bool compiling() const { return flags & TCF_COMPILING; }
-    inline JSCodeGenerator *asCodeGenerator();
+    inline CodeGenerator *asCodeGenerator();
 
     bool usesArguments() const {
         return flags & TCF_FUN_USES_ARGUMENTS;
     }
 
     void noteCallsEval() {
         flags |= TCF_FUN_CALLS_EVAL;
     }
@@ -472,25 +472,25 @@ struct JSTreeContext {              /* t
         flags |= TCF_FUN_MUTATES_PARAMETER;
     }
 
     bool mutatesParameter() const {
         JS_ASSERT(inFunction());
         return flags & TCF_FUN_MUTATES_PARAMETER;
     }
 
-    void noteArgumentsUse(JSParseNode *pn) {
+    void noteArgumentsUse(ParseNode *pn) {
         JS_ASSERT(inFunction());
         countArgumentsUse(pn);
         flags |= TCF_FUN_USES_ARGUMENTS;
         if (funbox)
             funbox->node->pn_dflags |= PND_FUNARG;
     }
 
-    void countArgumentsUse(JSParseNode *pn) {
+    void countArgumentsUse(ParseNode *pn) {
         JS_ASSERT(pn->pn_atom == parser->context->runtime->atomState.argumentsAtom);
         argumentsCount++;
         argumentsNode = pn;
     }
 
     bool needsEagerArguments() const {
         return inStrictMode() && ((usesArguments() && mutatesParameter()) || callsEval());
     }
@@ -503,208 +503,200 @@ struct JSTreeContext {              /* t
         return flags & TCF_FUN_EXTENSIBLE_SCOPE;
     }
 };
 
 /*
  * Return true if we need to check for conditions that elicit
  * JSOPTION_STRICT warnings or strict mode errors.
  */
-inline bool JSTreeContext::needStrictChecks() {
+inline bool TreeContext::needStrictChecks() {
     return parser->context->hasStrictOption() || inStrictMode();
 }
 
-namespace js {
+bool
+SetStaticLevel(TreeContext *tc, uintN staticLevel);
 
 bool
-SetStaticLevel(JSTreeContext *tc, uintN staticLevel);
+GenerateBlockId(TreeContext *tc, uint32& blockid);
 
-bool
-GenerateBlockId(JSTreeContext *tc, uint32& blockid);
-
-} /* namespace js */
+struct JumpTarget;
 
 /*
  * Span-dependent instructions are jumps whose span (from the jump bytecode to
  * the jump target) may require 2 or 4 bytes of immediate operand.
  */
-typedef struct JSSpanDep    JSSpanDep;
-typedef struct JSJumpTarget JSJumpTarget;
-
-struct JSSpanDep {
+struct SpanDep {
     ptrdiff_t       top;        /* offset of first bytecode in an opcode */
     ptrdiff_t       offset;     /* offset - 1 within opcode of jump operand */
     ptrdiff_t       before;     /* original offset - 1 of jump operand */
-    JSJumpTarget    *target;    /* tagged target pointer or backpatch delta */
+    JumpTarget      *target;    /* tagged target pointer or backpatch delta */
 };
 
 /*
  * Jump targets are stored in an AVL tree, for O(log(n)) lookup with targets
  * sorted by offset from left to right, so that targets after a span-dependent
  * instruction whose jump offset operand must be extended can be found quickly
  * and adjusted upward (toward higher offsets).
  */
-struct JSJumpTarget {
+struct JumpTarget {
     ptrdiff_t       offset;     /* offset of span-dependent jump target */
     int             balance;    /* AVL tree balance number */
-    JSJumpTarget    *kids[2];   /* left and right AVL tree child pointers */
+    JumpTarget      *kids[2];   /* left and right AVL tree child pointers */
 };
 
 #define JT_LEFT                 0
 #define JT_RIGHT                1
 #define JT_OTHER_DIR(dir)       (1 - (dir))
 #define JT_IMBALANCE(dir)       (((dir) << 1) - 1)
 #define JT_DIR(imbalance)       (((imbalance) + 1) >> 1)
 
 /*
- * Backpatch deltas are encoded in JSSpanDep.target if JT_TAG_BIT is clear,
+ * Backpatch deltas are encoded in js::SpanDep::target if JT_TAG_BIT is clear,
  * so we can maintain backpatch chains when using span dependency records to
  * hold jump offsets that overflow 16 bits.
  */
 #define JT_TAG_BIT              ((jsword) 1)
 #define JT_UNTAG_SHIFT          1
-#define JT_SET_TAG(jt)          ((JSJumpTarget *)((jsword)(jt) | JT_TAG_BIT))
-#define JT_CLR_TAG(jt)          ((JSJumpTarget *)((jsword)(jt) & ~JT_TAG_BIT))
+#define JT_SET_TAG(jt)          ((JumpTarget *)((jsword)(jt) | JT_TAG_BIT))
+#define JT_CLR_TAG(jt)          ((JumpTarget *)((jsword)(jt) & ~JT_TAG_BIT))
 #define JT_HAS_TAG(jt)          ((jsword)(jt) & JT_TAG_BIT)
 
 #define BITS_PER_PTRDIFF        (sizeof(ptrdiff_t) * JS_BITS_PER_BYTE)
 #define BITS_PER_BPDELTA        (BITS_PER_PTRDIFF - 1 - JT_UNTAG_SHIFT)
 #define BPDELTA_MAX             (((ptrdiff_t)1 << BITS_PER_BPDELTA) - 1)
-#define BPDELTA_TO_JT(bp)       ((JSJumpTarget *)((bp) << JT_UNTAG_SHIFT))
+#define BPDELTA_TO_JT(bp)       ((JumpTarget *)((bp) << JT_UNTAG_SHIFT))
 #define JT_TO_BPDELTA(jt)       ((ptrdiff_t)((jsword)(jt) >> JT_UNTAG_SHIFT))
 
 #define SD_SET_TARGET(sd,jt)    ((sd)->target = JT_SET_TAG(jt))
 #define SD_GET_TARGET(sd)       (JS_ASSERT(JT_HAS_TAG((sd)->target)),         \
                                  JT_CLR_TAG((sd)->target))
 #define SD_SET_BPDELTA(sd,bp)   ((sd)->target = BPDELTA_TO_JT(bp))
 #define SD_GET_BPDELTA(sd)      (JS_ASSERT(!JT_HAS_TAG((sd)->target)),        \
                                  JT_TO_BPDELTA((sd)->target))
 
 /* Avoid asserting twice by expanding SD_GET_TARGET in the "then" clause. */
 #define SD_SPAN(sd,pivot)       (SD_GET_TARGET(sd)                            \
                                  ? JT_CLR_TAG((sd)->target)->offset - (pivot) \
                                  : 0)
 
-typedef struct JSTryNode JSTryNode;
-
-struct JSTryNode {
+struct TryNode {
     JSTryNote       note;
-    JSTryNode       *prev;
+    TryNode       *prev;
 };
 
-struct JSCGObjectList {
+struct CGObjectList {
     uint32              length;     /* number of emitted so far objects */
-    JSObjectBox         *lastbox;   /* last emitted object */
+    ObjectBox           *lastbox;   /* last emitted object */
 
-    JSCGObjectList() : length(0), lastbox(NULL) {}
+    CGObjectList() : length(0), lastbox(NULL) {}
 
-    uintN index(JSObjectBox *objbox);
+    uintN index(ObjectBox *objbox);
     void finish(JSObjectArray *array);
 };
 
-class JSGCConstList {
-    js::Vector<js::Value> list;
+class GCConstList {
+    Vector<Value> list;
   public:
-    JSGCConstList(JSContext *cx) : list(cx) {}
-    bool append(js::Value v) { return list.append(v); }
+    GCConstList(JSContext *cx) : list(cx) {}
+    bool append(Value v) { return list.append(v); }
     size_t length() const { return list.length(); }
     void finish(JSConstArray *array);
-
 };
 
-struct JSCodeGenerator : public JSTreeContext
+struct CodeGenerator : public TreeContext
 {
     struct {
         jsbytecode  *base;          /* base of JS bytecode vector */
         jsbytecode  *limit;         /* one byte beyond end of bytecode */
         jsbytecode  *next;          /* pointer to next free bytecode */
         jssrcnote   *notes;         /* source notes, see below */
         uintN       noteCount;      /* number of source notes so far */
         uintN       noteLimit;      /* limit number for source notes in notePool */
         ptrdiff_t   lastNoteOffset; /* code offset for last source note */
         uintN       currentLine;    /* line number for tree-based srcnote gen */
     } prolog, main, *current;
 
-    js::OwnedAtomIndexMapPtr atomIndices; /* literals indexed for mapping */
-    js::AtomDefnMapPtr roLexdeps;
+    OwnedAtomIndexMapPtr atomIndices; /* literals indexed for mapping */
+    AtomDefnMapPtr  roLexdeps;
     uintN           firstLine;      /* first line, for js_NewScriptFromCG */
 
     intN            stackDepth;     /* current stack depth in script frame */
     uintN           maxStackDepth;  /* maximum stack depth so far */
 
     uintN           ntrynotes;      /* number of allocated so far try notes */
-    JSTryNode       *lastTryNode;   /* the last allocated try node */
+    TryNode         *lastTryNode;   /* the last allocated try node */
 
-    JSSpanDep       *spanDeps;      /* span dependent instruction records */
-    JSJumpTarget    *jumpTargets;   /* AVL tree of jump target offsets */
-    JSJumpTarget    *jtFreeList;    /* JT_LEFT-linked list of free structs */
+    SpanDep         *spanDeps;      /* span dependent instruction records */
+    JumpTarget      *jumpTargets;   /* AVL tree of jump target offsets */
+    JumpTarget      *jtFreeList;    /* JT_LEFT-linked list of free structs */
     uintN           numSpanDeps;    /* number of span dependencies */
     uintN           numJumpTargets; /* number of jump targets */
     ptrdiff_t       spanDepTodo;    /* offset from main.base of potentially
                                        unoptimized spandeps */
 
     uintN           arrayCompDepth; /* stack depth of array in comprehension */
 
     uintN           emitLevel;      /* js_EmitTree recursion level */
 
-    typedef js::HashMap<JSAtom *, js::Value> ConstMap;
+    typedef HashMap<JSAtom *, Value> ConstMap;
     ConstMap        constMap;       /* compile time constants */
 
-    JSGCConstList   constList;      /* constants to be included with the script */
+    GCConstList     constList;      /* constants to be included with the script */
 
-    JSCGObjectList  objectList;     /* list of emitted objects */
-    JSCGObjectList  regexpList;     /* list of emitted regexp that will be
+    CGObjectList    objectList;     /* list of emitted objects */
+    CGObjectList    regexpList;     /* list of emitted regexp that will be
                                        cloned during execution */
 
-    js::OwnedAtomIndexMapPtr upvarIndices; /* map of atoms to upvar indexes */
+    OwnedAtomIndexMapPtr upvarIndices; /* map of atoms to upvar indexes */
 
-    js::UpvarCookies upvarMap;      /* indexed upvar slot locations */
+    UpvarCookies    upvarMap;       /* indexed upvar slot locations */
 
-    typedef js::Vector<js::GlobalSlotArray::Entry, 16> GlobalUseVector;
+    typedef Vector<GlobalSlotArray::Entry, 16> GlobalUseVector;
 
     GlobalUseVector globalUses;     /* per-script global uses */
-    js::OwnedAtomIndexMapPtr globalMap; /* per-script map of global name to globalUses vector */
+    OwnedAtomIndexMapPtr globalMap; /* per-script map of global name to globalUses vector */
 
     /* Vectors of pn_cookie slot values. */
-    typedef js::Vector<uint32, 8> SlotVector;
+    typedef Vector<uint32, 8> SlotVector;
     SlotVector      closedArgs;
     SlotVector      closedVars;
 
     uint16          traceIndex;     /* index for the next JSOP_TRACE instruction */
     uint16          typesetCount;   /* Number of JOF_TYPESET opcodes generated */
 
-    JSCodeGenerator(js::Parser *parser, uintN lineno);
-    bool init(JSContext *cx, JSTreeContext::InitBehavior ib = USED_AS_CODE_GENERATOR);
+    CodeGenerator(Parser *parser, uintN lineno);
+    bool init(JSContext *cx, TreeContext::InitBehavior ib = USED_AS_CODE_GENERATOR);
 
     JSContext *context() {
         return parser->context;
     }
 
     /*
      * Note that cgs are magic: they own the arena "top-of-stack" space above
      * their tempMark points. This means that you cannot alloc from tempPool
-     * and save the pointer beyond the next JSCodeGenerator destructor call.
+     * and save the pointer beyond the next CodeGenerator destructor call.
      */
-    ~JSCodeGenerator();
+    ~CodeGenerator();
 
     /*
      * Adds a use of a variable that is statically known to exist on the
      * global object.
      *
      * The actual slot of the variable on the global object is not known
      * until after compilation. Properties must be resolved before being
      * added, to avoid aliasing properties that should be resolved. This makes
      * slot prediction based on the global object's free slot impossible. So,
      * we use the slot to index into cg->globalScope->defs, and perform a
      * fixup of the script at the very end of compilation.
      *
      * If the global use can be cached, |cookie| will be set to |slot|.
      * Otherwise, |cookie| is set to the free cookie value.
      */
-    bool addGlobalUse(JSAtom *atom, uint32 slot, js::UpvarCookie *cookie);
+    bool addGlobalUse(JSAtom *atom, uint32 slot, UpvarCookie *cookie);
 
     bool hasUpvarIndices() const {
         return upvarIndices.hasMap() && !upvarIndices->empty();
     }
 
     bool hasSharps() const {
         bool rv = !!(flags & TCF_HAS_SHARPS);
         JS_ASSERT((sharpSlotBase >= 0) == rv);
@@ -713,38 +705,38 @@ struct JSCodeGenerator : public JSTreeCo
 
     uintN sharpSlots() const {
         return hasSharps() ? SHARP_NSLOTS : 0;
     }
 
     bool compilingForEval() const { return !!(flags & TCF_COMPILE_FOR_EVAL); }
     JSVersion version() const { return parser->versionWithFlags(); }
 
-    bool shouldNoteClosedName(JSParseNode *pn);
+    bool shouldNoteClosedName(ParseNode *pn);
 
     JS_ALWAYS_INLINE
     bool makeAtomIndex(JSAtom *atom, jsatomid *indexp) {
-        js::AtomIndexAddPtr p = atomIndices->lookupForAdd(atom);
+        AtomIndexAddPtr p = atomIndices->lookupForAdd(atom);
         if (p) {
             *indexp = p.value();
             return true;
         }
 
         jsatomid index = atomIndices->count();
         if (!atomIndices->add(p, atom, index))
             return false;
 
         *indexp = index;
         return true;
     }
 
     bool checkSingletonContext() {
         if (!compileAndGo() || inFunction())
             return false;
-        for (JSStmtInfo *stmt = topStmt; stmt; stmt = stmt->down) {
+        for (StmtInfo *stmt = topStmt; stmt; stmt = stmt->down) {
             if (STMT_IS_LOOP(stmt))
                 return false;
         }
         flags |= TCF_HAS_SINGLETONS;
         return true;
     }
 };
 
@@ -766,54 +758,56 @@ struct JSCodeGenerator : public JSTreeCo
 #define CG_PROLOG_LIMIT(cg)     ((cg)->prolog.limit)
 #define CG_PROLOG_NEXT(cg)      ((cg)->prolog.next)
 #define CG_PROLOG_CODE(cg,poff) (CG_PROLOG_BASE(cg) + (poff))
 #define CG_PROLOG_OFFSET(cg)    (CG_PROLOG_NEXT(cg) - CG_PROLOG_BASE(cg))
 
 #define CG_SWITCH_TO_MAIN(cg)   ((cg)->current = &(cg)->main)
 #define CG_SWITCH_TO_PROLOG(cg) ((cg)->current = &(cg)->prolog)
 
-inline JSCodeGenerator *
-JSTreeContext::asCodeGenerator()
+inline CodeGenerator *
+TreeContext::asCodeGenerator()
 {
     JS_ASSERT(compiling());
-    return static_cast<JSCodeGenerator *>(this);
+    return static_cast<CodeGenerator *>(this);
 }
 
+} /* namespace js */
+
 /*
  * Emit one bytecode.
  */
-extern ptrdiff_t
-js_Emit1(JSContext *cx, JSCodeGenerator *cg, JSOp op);
+ptrdiff_t
+js_Emit1(JSContext *cx, js::CodeGenerator *cg, JSOp op);
 
 /*
  * Emit two bytecodes, an opcode (op) with a byte of immediate operand (op1).
  */
-extern ptrdiff_t
-js_Emit2(JSContext *cx, JSCodeGenerator *cg, JSOp op, jsbytecode op1);
+ptrdiff_t
+js_Emit2(JSContext *cx, js::CodeGenerator *cg, JSOp op, jsbytecode op1);
 
 /*
  * Emit three bytecodes, an opcode with two bytes of immediate operands.
  */
-extern ptrdiff_t
-js_Emit3(JSContext *cx, JSCodeGenerator *cg, JSOp op, jsbytecode op1,
+ptrdiff_t
+js_Emit3(JSContext *cx, js::CodeGenerator *cg, JSOp op, jsbytecode op1,
          jsbytecode op2);
 
 /*
  * Emit five bytecodes, an opcode with two 16-bit immediates.
  */
-extern ptrdiff_t
-js_Emit5(JSContext *cx, JSCodeGenerator *cg, JSOp op, uint16 op1,
+ptrdiff_t
+js_Emit5(JSContext *cx, js::CodeGenerator *cg, JSOp op, uint16 op1,
          uint16 op2);
 
 /*
  * Emit (1 + extra) bytecodes, for N bytes of op and its immediate operand.
  */
-extern ptrdiff_t
-js_EmitN(JSContext *cx, JSCodeGenerator *cg, JSOp op, size_t extra);
+ptrdiff_t
+js_EmitN(JSContext *cx, js::CodeGenerator *cg, JSOp op, size_t extra);
 
 /*
  * Unsafe macro to call js_SetJumpOffset and return false if it does.
  */
 #define CHECK_AND_SET_JUMP_OFFSET_CUSTOM(cx,cg,pc,off,BAD_EXIT)               \
     JS_BEGIN_MACRO                                                            \
         if (!js_SetJumpOffset(cx, cg, pc, off)) {                             \
             BAD_EXIT;                                                         \
@@ -825,96 +819,94 @@ js_EmitN(JSContext *cx, JSCodeGenerator 
 
 #define CHECK_AND_SET_JUMP_OFFSET_AT_CUSTOM(cx,cg,off,BAD_EXIT)               \
     CHECK_AND_SET_JUMP_OFFSET_CUSTOM(cx, cg, CG_CODE(cg,off),                 \
                                      CG_OFFSET(cg) - (off), BAD_EXIT)
 
 #define CHECK_AND_SET_JUMP_OFFSET_AT(cx,cg,off)                               \
     CHECK_AND_SET_JUMP_OFFSET_AT_CUSTOM(cx, cg, off, return JS_FALSE)
 
-extern JSBool
-js_SetJumpOffset(JSContext *cx, JSCodeGenerator *cg, jsbytecode *pc,
-                 ptrdiff_t off);
+JSBool
+js_SetJumpOffset(JSContext *cx, js::CodeGenerator *cg, jsbytecode *pc, ptrdiff_t off);
 
 /*
  * Push the C-stack-allocated struct at stmt onto the stmtInfo stack.
  */
-extern void
-js_PushStatement(JSTreeContext *tc, JSStmtInfo *stmt, JSStmtType type,
-                 ptrdiff_t top);
+void
+js_PushStatement(js::TreeContext *tc, js::StmtInfo *stmt, js::StmtType type, ptrdiff_t top);
 
 /*
  * Push a block scope statement and link blockObj into tc->blockChain. To pop
  * this statement info record, use js_PopStatement as usual, or if appropriate
  * (if generating code), js_PopStatementCG.
  */
-extern void
-js_PushBlockScope(JSTreeContext *tc, JSStmtInfo *stmt, JSObjectBox *blockBox,
-                  ptrdiff_t top);
+void
+js_PushBlockScope(js::TreeContext *tc, js::StmtInfo *stmt, js::ObjectBox *blockBox, ptrdiff_t top);
 
 /*
- * Pop tc->topStmt. If the top JSStmtInfo struct is not stack-allocated, it
+ * Pop tc->topStmt. If the top StmtInfo struct is not stack-allocated, it
  * is up to the caller to free it.
  */
-extern void
-js_PopStatement(JSTreeContext *tc);
+void
+js_PopStatement(js::TreeContext *tc);
 
 /*
  * Like js_PopStatement(cg), also patch breaks and continues unless the top
  * statement info record represents a try-catch-finally suite. May fail if a
  * jump offset overflows.
  */
-extern JSBool
-js_PopStatementCG(JSContext *cx, JSCodeGenerator *cg);
+JSBool
+js_PopStatementCG(JSContext *cx, js::CodeGenerator *cg);
 
 /*
  * Define and lookup a primitive jsval associated with the const named by atom.
  * js_DefineCompileTimeConstant analyzes the constant-folded initializer at pn
  * and saves the const's value in cg->constList, if it can be used at compile
  * time. It returns true unless an error occurred.
  *
  * If the initializer's value could not be saved, js_DefineCompileTimeConstant
  * calls will return the undefined value. js_DefineCompileTimeConstant tries
  * to find a const value memorized for atom, returning true with *vp set to a
  * value other than undefined if the constant was found, true with *vp set to
  * JSVAL_VOID if not found, and false on error.
  */
-extern JSBool
-js_DefineCompileTimeConstant(JSContext *cx, JSCodeGenerator *cg, JSAtom *atom,
-                             JSParseNode *pn);
+JSBool
+js_DefineCompileTimeConstant(JSContext *cx, js::CodeGenerator *cg, JSAtom *atom,
+                             js::ParseNode *pn);
 
 /*
  * Find a lexically scoped variable (one declared by let, catch, or an array
  * comprehension) named by atom, looking in tc's compile-time scopes.
  *
  * If a WITH statement is reached along the scope stack, return its statement
  * info record, so callers can tell that atom is ambiguous. If slotp is not
  * null, then if atom is found, set *slotp to its stack slot, otherwise to -1.
  * This means that if slotp is not null, all the block objects on the lexical
  * scope chain must have had their depth slots computed by the code generator,
  * so the caller must be under js_EmitTree.
  *
  * In any event, directly return the statement info record in which atom was
  * found. Otherwise return null.
  */
-extern JSStmtInfo *
-js_LexicalLookup(JSTreeContext *tc, JSAtom *atom, jsint *slotp,
-                 JSStmtInfo *stmt = NULL);
+js::StmtInfo *
+js_LexicalLookup(js::TreeContext *tc, JSAtom *atom, jsint *slotp, js::StmtInfo *stmt = NULL);
 
 /*
  * Emit code into cg for the tree rooted at pn.
  */
-extern JSBool
-js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn);
+JSBool
+js_EmitTree(JSContext *cx, js::CodeGenerator *cg, js::ParseNode *pn);
 
 /*
  * Emit function code using cg for the tree rooted at body.
  */
-extern JSBool
-js_EmitFunctionScript(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body);
+JSBool
+js_EmitFunctionScript(JSContext *cx, js::CodeGenerator *cg, js::ParseNode *body);
+
+namespace js {
 
 /*
  * Source notes generated along with bytecode for decompiling and debugging.
  * A source note is a uint8 with 5 bits of type and 3 of offset from the pc of
  * the previous note. If 3 bits of offset aren't enough, extended delta notes
  * (SRC_XDELTA) consisting of 2 set high order bits followed by 6 offset bits
  * are emitted before the next note. Some notes have operand offsets encoded
  * immediately after them, in note bytes or byte-triples.
@@ -936,17 +928,17 @@ js_EmitFunctionScript(JSContext *cx, JSC
  * arity, offsetBias, and isSpanDep initializers in js_SrcNoteSpec. This is
  * why SRC_IF and SRC_INITPROP have the same value below. For bad historical
  * reasons, some bytecodes below that could be overlayed have not been, but
  * before using SRC_EXTENDED, consider compressing the existing note types.
  *
  * Don't forget to update JSXDR_BYTECODE_VERSION in jsxdrapi.h for all such
  * incompatible source note or other bytecode changes.
  */
-typedef enum JSSrcNoteType {
+enum SrcNoteType {
     SRC_NULL        = 0,        /* terminates a note vector */
     SRC_IF          = 1,        /* JSOP_IFEQ bytecode is from an if-then */
     SRC_BREAK       = 1,        /* JSOP_GOTO is a break */
     SRC_INITPROP    = 1,        /* disjoint meaning applied to JSOP_INITELEM or
                                    to an index label in a regular (structuring)
                                    or a destructuring object initialiser */
     SRC_GENEXP      = 1,        /* JSOP_LAMBDA from generator expression */
     SRC_IF_ELSE     = 2,        /* JSOP_IFEQ bytecode is from an if-then-else */
@@ -985,17 +977,19 @@ typedef enum JSSrcNoteType {
                                    2nd off to first JSOP_CASE if condswitch */
     SRC_SWITCHBREAK = 18,       /* JSOP_GOTO is a break in a switch */
     SRC_FUNCDEF     = 19,       /* JSOP_NOP for function f() with atomid */
     SRC_CATCH       = 20,       /* catch block has guard */
     SRC_EXTENDED    = 21,       /* extended source note, 32-159, in next byte */
     SRC_NEWLINE     = 22,       /* bytecode follows a source newline */
     SRC_SETLINE     = 23,       /* a file-absolute source line number note */
     SRC_XDELTA      = 24        /* 24-31 are for extended delta notes */
-} JSSrcNoteType;
+};
+
+} /* namespace js */
 
 /*
  * Constants for the SRC_DECL source note. Note that span-dependent bytecode
  * selection means that any SRC_DECL offset greater than SRC_DECL_LET may need
  * to be adjusted, but these "offsets" are too small to span a span-dependent
  * instruction, so can be used to denote distinct declaration syntaxes to the
  * decompiler.
  *
@@ -1017,19 +1011,19 @@ typedef enum JSSrcNoteType {
 #define SN_MAKE_NOTE(sn,t,d)    (*(sn) = (jssrcnote)                          \
                                           (((t) << SN_DELTA_BITS)             \
                                            | ((d) & SN_DELTA_MASK)))
 #define SN_MAKE_XDELTA(sn,d)    (*(sn) = (jssrcnote)                          \
                                           ((SRC_XDELTA << SN_DELTA_BITS)      \
                                            | ((d) & SN_XDELTA_MASK)))
 
 #define SN_IS_XDELTA(sn)        ((*(sn) >> SN_DELTA_BITS) >= SRC_XDELTA)
-#define SN_TYPE(sn)             ((JSSrcNoteType)(SN_IS_XDELTA(sn)             \
-                                                 ? SRC_XDELTA                 \
-                                                 : *(sn) >> SN_DELTA_BITS))
+#define SN_TYPE(sn)             ((js::SrcNoteType)(SN_IS_XDELTA(sn)           \
+                                                   ? SRC_XDELTA               \
+                                                   : *(sn) >> SN_DELTA_BITS))
 #define SN_SET_TYPE(sn,type)    SN_MAKE_NOTE(sn, type, SN_DELTA(sn))
 #define SN_IS_GETTABLE(sn)      (SN_TYPE(sn) < SRC_NEWLINE)
 
 #define SN_DELTA(sn)            ((ptrdiff_t)(SN_IS_XDELTA(sn)                 \
                                              ? *(sn) & SN_XDELTA_MASK         \
                                              : *(sn) & SN_DELTA_MASK))
 #define SN_SET_DELTA(sn,delta)  (SN_IS_XDELTA(sn)                             \
                                  ? SN_MAKE_XDELTA(sn, delta)                  \
@@ -1066,43 +1060,41 @@ extern JS_FRIEND_API(uintN)          js_
 #define SN_IS_TERMINATOR(sn)    (*(sn) == SRC_NULL)
 
 /*
  * Append a new source note of the given type (and therefore size) to cg's
  * notes dynamic array, updating cg->noteCount. Return the new note's index
  * within the array pointed at by cg->current->notes. Return -1 if out of
  * memory.
  */
-extern intN
-js_NewSrcNote(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type);
+intN
+js_NewSrcNote(JSContext *cx, js::CodeGenerator *cg, js::SrcNoteType type);
 
-extern intN
-js_NewSrcNote2(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type,
-               ptrdiff_t offset);
+intN
+js_NewSrcNote2(JSContext *cx, js::CodeGenerator *cg, js::SrcNoteType type, ptrdiff_t offset);
 
-extern intN
-js_NewSrcNote3(JSContext *cx, JSCodeGenerator *cg, JSSrcNoteType type,
-               ptrdiff_t offset1, ptrdiff_t offset2);
+intN
+js_NewSrcNote3(JSContext *cx, js::CodeGenerator *cg, js::SrcNoteType type, ptrdiff_t offset1,
+               ptrdiff_t offset2);
 
 /*
  * NB: this function can add at most one extra extended delta note.
  */
-extern jssrcnote *
-js_AddToSrcNoteDelta(JSContext *cx, JSCodeGenerator *cg, jssrcnote *sn,
-                     ptrdiff_t delta);
+jssrcnote *
+js_AddToSrcNoteDelta(JSContext *cx, js::CodeGenerator *cg, jssrcnote *sn, ptrdiff_t delta);
 
 /*
  * Get and set the offset operand identified by which (0 for the first, etc.).
  */
 extern JS_FRIEND_API(ptrdiff_t)
 js_GetSrcNoteOffset(jssrcnote *sn, uintN which);
 
-extern JSBool
-js_SetSrcNoteOffset(JSContext *cx, JSCodeGenerator *cg, uintN index,
-                    uintN which, ptrdiff_t offset);
+JSBool
+js_SetSrcNoteOffset(JSContext *cx, js::CodeGenerator *cg, uintN index, uintN which,
+                    ptrdiff_t offset);
 
 /*
  * Finish taking source notes in cx's notePool, copying final notes to the new
  * stable store allocated by the caller and passed in via notes. Return false
  * on malloc failure, which means this function reported an error.
  *
  * To compute the number of jssrcnotes to allocate and pass in via notes, use
  * the CG_COUNT_FINAL_SRCNOTES macro. This macro knows a lot about details of
@@ -1125,17 +1117,15 @@ js_SetSrcNoteOffset(JSContext *cx, JSCod
                          ? SN_XDELTA_MASK - (*sn_ & SN_XDELTA_MASK)           \
                          : SN_DELTA_MASK - (*sn_ & SN_DELTA_MASK);            \
             }                                                                 \
             if (diff_ > 0)                                                    \
                 cnt += JS_HOWMANY(diff_, SN_XDELTA_MASK);                     \
         }                                                                     \
     JS_END_MACRO
 
-extern JSBool
-js_FinishTakingSrcNotes(JSContext *cx, JSCodeGenerator *cg, jssrcnote *notes);
+JSBool
+js_FinishTakingSrcNotes(JSContext *cx, js::CodeGenerator *cg, jssrcnote *notes);
 
-extern void
-js_FinishTakingTryNotes(JSCodeGenerator *cg, JSTryNoteArray *array);
-
-JS_END_EXTERN_C
+void
+js_FinishTakingTryNotes(js::CodeGenerator *cg, JSTryNoteArray *array);
 
 #endif /* BytecodeGenerator_h__ */
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -46,20 +46,20 @@
 #include "frontend/ParseNode.h"
 
 #if JS_HAS_XML_SUPPORT
 #include "jsxml.h"
 #endif
 
 using namespace js;
 
-static JSParseNode *
-ContainsStmt(JSParseNode *pn, TokenKind tt)
+static ParseNode *
+ContainsStmt(ParseNode *pn, TokenKind tt)
 {
-    JSParseNode *pn2, *pnt;
+    ParseNode *pn2, *pnt;
 
     if (!pn)
         return NULL;
     if (pn->isKind(tt))
         return pn;
     switch (pn->getArity()) {
       case PN_LIST:
         for (pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
@@ -100,17 +100,17 @@ ContainsStmt(JSParseNode *pn, TokenKind 
     return NULL;
 }
 
 /*
  * Fold from one constant type to another.
  * XXX handles only strings and numbers for now
  */
 static JSBool
-FoldType(JSContext *cx, JSParseNode *pn, TokenKind type)
+FoldType(JSContext *cx, ParseNode *pn, TokenKind type)
 {
     if (!pn->isKind(type)) {
         switch (type) {
           case TOK_NUMBER:
             if (pn->isKind(TOK_STRING)) {
                 jsdouble d;
                 if (!ToNumber(cx, StringValue(pn->pn_atom), &d))
                     return JS_FALSE;
@@ -140,18 +140,18 @@ FoldType(JSContext *cx, JSParseNode *pn,
 }
 
 /*
  * Fold two numeric constants.  Beware that pn1 and pn2 are recycled, unless
  * one of them aliases pn, so you can't safely fetch pn2->pn_next, e.g., after
  * a successful call to this function.
  */
 static JSBool
-FoldBinaryNumeric(JSContext *cx, JSOp op, JSParseNode *pn1, JSParseNode *pn2,
-                  JSParseNode *pn, JSTreeContext *tc)
+FoldBinaryNumeric(JSContext *cx, JSOp op, ParseNode *pn1, ParseNode *pn2,
+                  ParseNode *pn, TreeContext *tc)
 {
     jsdouble d, d2;
     int32 i, j;
 
     JS_ASSERT(pn1->isKind(TOK_NUMBER) && pn2->isKind(TOK_NUMBER));
     d = pn1->pn_dval;
     d2 = pn2->pn_dval;
     switch (op) {
@@ -221,20 +221,20 @@ FoldBinaryNumeric(JSContext *cx, JSOp op
     pn->setArity(PN_NULLARY);
     pn->pn_dval = d;
     return JS_TRUE;
 }
 
 #if JS_HAS_XML_SUPPORT
 
 static JSBool
-FoldXMLConstants(JSContext *cx, JSParseNode *pn, JSTreeContext *tc)
+FoldXMLConstants(JSContext *cx, ParseNode *pn, TreeContext *tc)
 {
     TokenKind tt;
-    JSParseNode **pnp, *pn1, *pn2;
+    ParseNode **pnp, *pn1, *pn2;
     JSString *accum, *str;
     uint32 i, j;
 
     JS_ASSERT(pn->isArity(PN_LIST));
     tt = pn->getKind();
     pnp = &pn->pn_head;
     pn1 = *pnp;
     accum = NULL;
@@ -387,17 +387,17 @@ FoldXMLConstants(JSContext *cx, JSParseN
     return JS_TRUE;
 }
 
 #endif /* JS_HAS_XML_SUPPORT */
 
 enum Truthiness { Truthy, Falsy, Unknown };
 
 static Truthiness
-Boolish(JSParseNode *pn)
+Boolish(ParseNode *pn)
 {
     switch (pn->getOp()) {
       case JSOP_DOUBLE:
         return (pn->pn_dval != 0 && !JSDOUBLE_IS_NaN(pn->pn_dval)) ? Truthy : Falsy;
 
       case JSOP_STRING:
         return (pn->pn_atom->length() > 0) ? Truthy : Falsy;
 
@@ -406,17 +406,17 @@ Boolish(JSParseNode *pn)
       {
         /*
          * A generator expression as an if or loop condition has no effects, it
          * simply results in a truthy object reference. This condition folding
          * is needed for the decompiler. See bug 442342 and bug 443074.
          */
         if (pn->pn_count != 1)
             return Unknown;
-        JSParseNode *pn2 = pn->pn_head;
+        ParseNode *pn2 = pn->pn_head;
         if (!pn2->isKind(TOK_FUNCTION))
             return Unknown;
         if (!(pn2->pn_funbox->tcflags & TCF_GENEXP_LAMBDA))
             return Unknown;
         return Truthy;
       }
 #endif
 
@@ -429,33 +429,35 @@ Boolish(JSParseNode *pn)
       case JSOP_FALSE:
         return Falsy;
 
       default:
         return Unknown;
     }
 }
 
-JSBool
-js_FoldConstants(JSContext *cx, JSParseNode *pn, JSTreeContext *tc, bool inCond)
+namespace js {
+
+bool
+FoldConstants(JSContext *cx, ParseNode *pn, TreeContext *tc, bool inCond)
 {
-    JSParseNode *pn1 = NULL, *pn2 = NULL, *pn3 = NULL;
+    ParseNode *pn1 = NULL, *pn2 = NULL, *pn3 = NULL;
 
-    JS_CHECK_RECURSION(cx, return JS_FALSE);
+    JS_CHECK_RECURSION(cx, return false);
 
     switch (pn->getArity()) {
       case PN_FUNC:
       {
         uint32 oldflags = tc->flags;
-        JSFunctionBox *oldlist = tc->functionList;
+        FunctionBox *oldlist = tc->functionList;
 
         tc->flags = pn->pn_funbox->tcflags;
         tc->functionList = pn->pn_funbox->kids;
-        if (!js_FoldConstants(cx, pn->pn_body, tc))
-            return JS_FALSE;
+        if (!FoldConstants(cx, pn->pn_body, tc))
+            return false;
         pn->pn_funbox->kids = tc->functionList;
         tc->flags = oldflags;
         tc->functionList = oldlist;
         break;
       }
 
       case PN_LIST:
       {
@@ -464,59 +466,59 @@ js_FoldConstants(JSContext *cx, JSParseN
 
         /* Don't fold a parenthesized call expression. See bug 537673. */
         pn1 = pn2 = pn->pn_head;
         if ((pn->isKind(TOK_LP) || pn->isKind(TOK_NEW)) && pn2->isInParens())
             pn2 = pn2->pn_next;
 
         /* Save the list head in pn1 for later use. */
         for (; pn2; pn2 = pn2->pn_next) {
-            if (!js_FoldConstants(cx, pn2, tc, cond))
-                return JS_FALSE;
+            if (!FoldConstants(cx, pn2, tc, cond))
+                return false;
         }
         break;
       }
 
       case PN_TERNARY:
         /* Any kid may be null (e.g. for (;;)). */
         pn1 = pn->pn_kid1;
         pn2 = pn->pn_kid2;
         pn3 = pn->pn_kid3;
-        if (pn1 && !js_FoldConstants(cx, pn1, tc, pn->isKind(TOK_IF)))
-            return JS_FALSE;
+        if (pn1 && !FoldConstants(cx, pn1, tc, pn->isKind(TOK_IF)))
+            return false;
         if (pn2) {
-            if (!js_FoldConstants(cx, pn2, tc, pn->isKind(TOK_FORHEAD)))
-                return JS_FALSE;
+            if (!FoldConstants(cx, pn2, tc, pn->isKind(TOK_FORHEAD)))
+                return false;
             if (pn->isKind(TOK_FORHEAD) && pn2->isOp(JSOP_TRUE)) {
                 RecycleTree(pn2, tc);
                 pn->pn_kid2 = NULL;
             }
         }
-        if (pn3 && !js_FoldConstants(cx, pn3, tc))
-            return JS_FALSE;
+        if (pn3 && !FoldConstants(cx, pn3, tc))
+            return false;
         break;
 
       case PN_BINARY:
         pn1 = pn->pn_left;
         pn2 = pn->pn_right;
 
         /* Propagate inCond through logical connectives. */
         if (pn->isKind(TOK_OR) || pn->isKind(TOK_AND)) {
-            if (!js_FoldConstants(cx, pn1, tc, inCond))
-                return JS_FALSE;
-            if (!js_FoldConstants(cx, pn2, tc, inCond))
-                return JS_FALSE;
+            if (!FoldConstants(cx, pn1, tc, inCond))
+                return false;
+            if (!FoldConstants(cx, pn2, tc, inCond))
+                return false;
             break;
         }
 
         /* First kid may be null (for default case in switch). */
-        if (pn1 && !js_FoldConstants(cx, pn1, tc, pn->isKind(TOK_WHILE)))
-            return JS_FALSE;
-        if (!js_FoldConstants(cx, pn2, tc, pn->isKind(TOK_DO)))
-            return JS_FALSE;
+        if (pn1 && !FoldConstants(cx, pn1, tc, pn->isKind(TOK_WHILE)))
+            return false;
+        if (!FoldConstants(cx, pn2, tc, pn->isKind(TOK_DO)))
+            return false;
         break;
 
       case PN_UNARY:
         pn1 = pn->pn_kid;
 
         /*
          * Kludge to deal with typeof expressions: because constant folding
          * can turn an expression into a name node, we have to check here,
@@ -524,40 +526,40 @@ js_FoldConstants(JSContext *cx, JSParseN
          *
          * NB: We know that if pn->pn_op is JSOP_TYPEOF, pn1 will not be
          * null. This assumption does not hold true for other unary
          * expressions.
          */
         if (pn->isOp(JSOP_TYPEOF) && !pn1->isKind(TOK_NAME))
             pn->setOp(JSOP_TYPEOFEXPR);
 
-        if (pn1 && !js_FoldConstants(cx, pn1, tc, pn->isOp(JSOP_NOT)))
-            return JS_FALSE;
+        if (pn1 && !FoldConstants(cx, pn1, tc, pn->isOp(JSOP_NOT)))
+            return false;
         break;
 
       case PN_NAME:
         /*
          * Skip pn1 down along a chain of dotted member expressions to avoid
          * excessive recursion.  Our only goal here is to fold constants (if
          * any) in the primary expression operand to the left of the first
          * dot in the chain.
          */
         if (!pn->isUsed()) {
             pn1 = pn->pn_expr;
             while (pn1 && pn1->isArity(PN_NAME) && !pn1->isUsed())
                 pn1 = pn1->pn_expr;
-            if (pn1 && !js_FoldConstants(cx, pn1, tc))
-                return JS_FALSE;
+            if (pn1 && !FoldConstants(cx, pn1, tc))
+                return false;
         }
         break;
 
       case PN_NAMESET:
         pn1 = pn->pn_tree;
-        if (!js_FoldConstants(cx, pn1, tc))
-            return JS_FALSE;
+        if (!FoldConstants(cx, pn1, tc))
+            return false;
         break;
 
       case PN_NULLARY:
         break;
     }
 
     switch (pn->getKind()) {
       case TOK_IF:
@@ -581,17 +583,17 @@ js_FoldConstants(JSContext *cx, JSParseN
                 break;
             if (pn1->isOp(JSOP_FALSE) || pn1->isOp(JSOP_NULL)) {
                 pn2 = pn3;
                 break;
             }
             /* FALL THROUGH */
           default:
             /* Early return to dodge common code that copies pn2 to pn. */
-            return JS_TRUE;
+            return true;
         }
 
 #if JS_HAS_GENERATOR_EXPRS
         /* Don't fold a trailing |if (0)| in a generator expression. */
         if (!pn2 && (tc->flags & TCF_GENEXP_LAMBDA))
             break;
 #endif
 
@@ -613,17 +615,17 @@ js_FoldConstants(JSContext *cx, JSParseN
         if (pn3 && pn3 != pn2)
             RecycleTree(pn3, tc);
         break;
 
       case TOK_OR:
       case TOK_AND:
         if (inCond) {
             if (pn->isArity(PN_LIST)) {
-                JSParseNode **pnp = &pn->pn_head;
+                ParseNode **pnp = &pn->pn_head;
                 JS_ASSERT(*pnp == pn1);
                 do {
                     Truthiness t = Boolish(pn1);
                     if (t == Unknown) {
                         pnp = &pn1->pn_next;
                         continue;
                     }
                     if ((t == Truthy) == pn->isKind(TOK_OR)) {
@@ -689,78 +691,78 @@ js_FoldConstants(JSContext *cx, JSParseN
         if (pn->isArity(PN_LIST)) {
             /*
              * Any string literal term with all others number or string means
              * this is a concatenation.  If any term is not a string or number
              * literal, we can't fold.
              */
             JS_ASSERT(pn->pn_count > 2);
             if (pn->pn_xflags & PNX_CANTFOLD)
-                return JS_TRUE;
+                return true;
             if (pn->pn_xflags != PNX_STRCAT)
                 goto do_binary_op;
 
             /* Ok, we're concatenating: convert non-string constant operands. */
             size_t length = 0;
             for (pn2 = pn1; pn2; pn2 = pn2->pn_next) {
                 if (!FoldType(cx, pn2, TOK_STRING))
-                    return JS_FALSE;
+                    return false;
                 /* XXX fold only if all operands convert to string */
                 if (!pn2->isKind(TOK_STRING))
-                    return JS_TRUE;
+                    return true;
                 length += pn2->pn_atom->length();
             }
 
             /* Allocate a new buffer and string descriptor for the result. */
             jschar *chars = (jschar *) cx->malloc_((length + 1) * sizeof(jschar));
             if (!chars)
-                return JS_FALSE;
+                return false;
             chars[length] = 0;
             JSString *str = js_NewString(cx, chars, length);
             if (!str) {
                 cx->free_(chars);
-                return JS_FALSE;
+                return false;
             }
 
             /* Fill the buffer, advancing chars and recycling kids as we go. */
             for (pn2 = pn1; pn2; pn2 = RecycleTree(pn2, tc)) {
                 JSAtom *atom = pn2->pn_atom;
                 size_t length2 = atom->length();
                 js_strncpy(chars, atom->chars(), length2);
                 chars += length2;
             }
             JS_ASSERT(*chars == 0);
 
             /* Atomize the result string and mutate pn to refer to it. */
             pn->pn_atom = js_AtomizeString(cx, str);
             if (!pn->pn_atom)
-                return JS_FALSE;
+                return false;
             pn->setKind(TOK_STRING);
             pn->setOp(JSOP_STRING);
             pn->setArity(PN_NULLARY);
             break;
         }
 
         /* Handle a binary string concatenation. */
         JS_ASSERT(pn->isArity(PN_BINARY));
         if (pn1->isKind(TOK_STRING) || pn2->isKind(TOK_STRING)) {
             JSString *left, *right, *str;
 
             if (!FoldType(cx, !pn1->isKind(TOK_STRING) ? pn1 : pn2, TOK_STRING))
-                return JS_FALSE;
+                return false;
             if (!pn1->isKind(TOK_STRING) || !pn2->isKind(TOK_STRING))
-                return JS_TRUE;
+                return true;
             left = pn1->pn_atom;
             right = pn2->pn_atom;
             str = js_ConcatStrings(cx, left, right);
             if (!str)
-                return JS_FALSE;
+                return false;
             pn->pn_atom = js_AtomizeString(cx, str);
             if (!pn->pn_atom)
-                return JS_FALSE;
+                return false;
             pn->setKind(TOK_STRING);
             pn->setOp(JSOP_STRING);
             pn->setArity(PN_NULLARY);
             RecycleTree(pn1, tc);
             RecycleTree(pn2, tc);
             break;
         }
 
@@ -771,45 +773,45 @@ js_FoldConstants(JSContext *cx, JSParseN
       case TOK_SHOP:
       case TOK_MINUS:
       case TOK_DIVOP:
       do_binary_op:
         if (pn->isArity(PN_LIST)) {
             JS_ASSERT(pn->pn_count > 2);
             for (pn2 = pn1; pn2; pn2 = pn2->pn_next) {
                 if (!FoldType(cx, pn2, TOK_NUMBER))
-                    return JS_FALSE;
+                    return false;
             }
             for (pn2 = pn1; pn2; pn2 = pn2->pn_next) {
                 /* XXX fold only if all operands convert to number */
                 if (!pn2->isKind(TOK_NUMBER))
                     break;
             }
             if (!pn2) {
                 JSOp op = pn->getOp();
 
                 pn2 = pn1->pn_next;
                 pn3 = pn2->pn_next;
                 if (!FoldBinaryNumeric(cx, op, pn1, pn2, pn, tc))
-                    return JS_FALSE;
+                    return false;
                 while ((pn2 = pn3) != NULL) {
                     pn3 = pn2->pn_next;
                     if (!FoldBinaryNumeric(cx, op, pn, pn2, pn, tc))
-                        return JS_FALSE;
+                        return false;
                 }
             }
         } else {
             JS_ASSERT(pn->isArity(PN_BINARY));
             if (!FoldType(cx, pn1, TOK_NUMBER) ||
                 !FoldType(cx, pn2, TOK_NUMBER)) {
-                return JS_FALSE;
+                return false;
             }
             if (pn1->isKind(TOK_NUMBER) && pn2->isKind(TOK_NUMBER)) {
                 if (!FoldBinaryNumeric(cx, pn->getOp(), pn1, pn2, pn, tc))
-                    return JS_FALSE;
+                    return false;
             }
         }
         break;
 
       case TOK_UNARYOP:
         if (pn1->isKind(TOK_NUMBER)) {
             jsdouble d;
 
@@ -830,17 +832,17 @@ js_FoldConstants(JSContext *cx, JSParseN
               case JSOP_NOT:
                 pn->setKind(TOK_PRIMARY);
                 pn->setOp((d == 0 || JSDOUBLE_IS_NaN(d)) ? JSOP_TRUE : JSOP_FALSE);
                 pn->setArity(PN_NULLARY);
                 /* FALL THROUGH */
 
               default:
                 /* Return early to dodge the common TOK_NUMBER code. */
-                return JS_TRUE;
+                return true;
             }
             pn->setKind(TOK_NUMBER);
             pn->setOp(JSOP_DOUBLE);
             pn->setArity(PN_NULLARY);
             pn->pn_dval = d;
             RecycleTree(pn1, tc);
         } else if (pn1->isKind(TOK_PRIMARY)) {
             if (pn->isOp(JSOP_NOT) && (pn1->isOp(JSOP_TRUE) || pn1->isOp(JSOP_FALSE))) {
@@ -856,32 +858,30 @@ js_FoldConstants(JSContext *cx, JSParseN
       case TOK_XMLLIST:
       case TOK_XMLPTAGC:
       case TOK_XMLSTAGO:
       case TOK_XMLETAGO:
       case TOK_XMLNAME:
         if (pn->isArity(PN_LIST)) {
             JS_ASSERT(pn->isKind(TOK_XMLLIST) || pn->pn_count != 0);
             if (!FoldXMLConstants(cx, pn, tc))
-                return JS_FALSE;
+                return false;
         }
         break;
 
       case TOK_AT:
         if (pn1->isKind(TOK_XMLNAME)) {
-            JSObjectBox *xmlbox;
-
             Value v = StringValue(pn1->pn_atom);
             if (!js_ToAttributeName(cx, &v))
-                return JS_FALSE;
+                return false;
             JS_ASSERT(v.isObject());
 
-            xmlbox = tc->parser->newObjectBox(&v.toObject());
+            ObjectBox *xmlbox = tc->parser->newObjectBox(&v.toObject());
             if (!xmlbox)
-                return JS_FALSE;
+                return false;
 
             pn->setKind(TOK_XMLNAME);
             pn->setOp(JSOP_OBJECT);
             pn->setArity(PN_NULLARY);
             pn->pn_objbox = xmlbox;
             RecycleTree(pn1, tc);
         }
         break;
@@ -901,10 +901,12 @@ js_FoldConstants(JSContext *cx, JSParseN
              */
             PrepareNodeForMutation(pn, tc);
             pn->setKind(TOK_PRIMARY);
             pn->setOp(t == Truthy ? JSOP_TRUE : JSOP_FALSE);
             pn->setArity(PN_NULLARY);
         }
     }
 
-    return JS_TRUE;
+    return true;
 }
+
+} /* namespace js */
--- a/js/src/frontend/FoldConstants.h
+++ b/js/src/frontend/FoldConstants.h
@@ -38,17 +38,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef FoldConstants_h__
 #define FoldConstants_h__
 
 #include "jsprvtd.h"
 
-JS_BEGIN_EXTERN_C
+namespace js {
 
-extern JSBool
-js_FoldConstants(JSContext *cx, JSParseNode *pn, JSTreeContext *tc,
-                 bool inCond = false);
+bool
+FoldConstants(JSContext *cx, ParseNode *pn, TreeContext *tc, bool inCond = false);
 
-JS_END_EXTERN_C
+} /* namespace js */
 
 #endif /* FoldConstants_h__ */
--- a/js/src/frontend/ParseMaps-inl.h
+++ b/js/src/frontend/ParseMaps-inl.h
@@ -38,17 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef ParseMapPool_inl_h__
 #define ParseMapPool_inl_h__
 
 #include "jscntxt.h"
 
-#include "frontend/ParseNode.h" /* Need sizeof(JSDefinition). */
+#include "frontend/ParseNode.h" /* Need sizeof(js::Definition). */
 
 #include "ParseMaps.h"
 
 namespace js {
 
 template <>
 inline AtomDefnMap *
 ParseMapPool::acquire<AtomDefnMap>()
@@ -76,17 +76,17 @@ ParseMapPool::allocate()
     if (recyclable.empty())
         return allocateFresh();
 
     void *map = recyclable.popCopy();
     asAtomMap(map)->clear();
     return map;
 }
 
-inline JSDefinition *
+inline Definition *
 AtomDecls::lookupFirst(JSAtom *atom)
 {
     JS_ASSERT(map);
     AtomDOHPtr p = map->lookup(atom);
     if (!p)
         return NULL;
     if (p.value().isHeader()) {
         /* Just return the head defn. */
@@ -96,26 +96,26 @@ AtomDecls::lookupFirst(JSAtom *atom)
 }
 
 inline MultiDeclRange
 AtomDecls::lookupMulti(JSAtom *atom)
 {
     JS_ASSERT(map);
     AtomDOHPtr p = map->lookup(atom);
     if (!p)
-        return MultiDeclRange((JSDefinition *) NULL);
+        return MultiDeclRange((Definition *) NULL);
 
     DefnOrHeader &doh = p.value();
     if (doh.isHeader())
         return MultiDeclRange(doh.header());
     return MultiDeclRange(doh.defn());
 }
 
 inline bool
-AtomDecls::addUnique(JSAtom *atom, JSDefinition *defn)
+AtomDecls::addUnique(JSAtom *atom, Definition *defn)
 {
     JS_ASSERT(map);
     AtomDOHAddPtr p = map->lookupForAdd(atom);
     if (p) {
         JS_ASSERT(!p.value().isHeader());
         p.value() = DefnOrHeader(defn);
         return true;
     }
--- a/js/src/frontend/ParseMaps.cpp
+++ b/js/src/frontend/ParseMaps.cpp
@@ -45,18 +45,18 @@ using namespace js;
 
 void
 ParseMapPool::checkInvariants()
 {
     /*
      * Having all values be of the same size permits us to easily reuse the
      * allocated space for each of the map types.
      */
-    JS_STATIC_ASSERT(sizeof(JSDefinition *) == sizeof(jsatomid));
-    JS_STATIC_ASSERT(sizeof(JSDefinition *) == sizeof(DefnOrHeader));
+    JS_STATIC_ASSERT(sizeof(Definition *) == sizeof(jsatomid));
+    JS_STATIC_ASSERT(sizeof(Definition *) == sizeof(DefnOrHeader));
     JS_STATIC_ASSERT(sizeof(AtomDefnMap::Entry) == sizeof(AtomIndexMap::Entry));
     JS_STATIC_ASSERT(sizeof(AtomDefnMap::Entry) == sizeof(AtomDOHMap::Entry));
     JS_STATIC_ASSERT(sizeof(AtomMapT::Entry) == sizeof(AtomDOHMap::Entry));
     /* Ensure that the HasTable::clear goes quickly via memset. */
     JS_STATIC_ASSERT(tl::IsPodType<AtomIndexMap::WordMap::Entry>::result);
     JS_STATIC_ASSERT(tl::IsPodType<AtomDOHMap::WordMap::Entry>::result);
     JS_STATIC_ASSERT(tl::IsPodType<AtomDefnMap::WordMap::Entry>::result);
 }
@@ -119,28 +119,28 @@ DumpAtomDefnMap(const AtomDefnMapPtr &ma
         fprintf(stderr, "atom: ");
         js_DumpAtom(r.front().key());
         fprintf(stderr, "defn: %p\n", (void *) r.front().value());
     }
 }
 #endif
 
 AtomDeclNode *
-AtomDecls::allocNode(JSDefinition *defn)
+AtomDecls::allocNode(Definition *defn)
 {
     AtomDeclNode *p = cx->tempLifoAlloc().new_<AtomDeclNode>(defn);
     if (!p) {
         js_ReportOutOfMemory(cx);
         return NULL;
     }
     return p;
 }
 
 bool
-AtomDecls::addShadow(JSAtom *atom, JSDefinition *defn)
+AtomDecls::addShadow(JSAtom *atom, Definition *defn)
 {
     AtomDeclNode *node = allocNode(defn);
     if (!node)
         return false;
 
     AtomDOHAddPtr p = map->lookupForAdd(atom);
     if (!p)
         return map->add(p, atom, DefnOrHeader(node));
@@ -172,17 +172,17 @@ AtomDecls::lastAsNode(DefnOrHeader *doh)
     AtomDeclNode *node = allocNode(doh->defn());
     if (!node)
         return NULL;
     *doh = DefnOrHeader(node);
     return node;
 }
 
 bool
-AtomDecls::addHoist(JSAtom *atom, JSDefinition *defn)
+AtomDecls::addHoist(JSAtom *atom, Definition *defn)
 {
     AtomDeclNode *node = allocNode(defn);
     if (!node)
         return false;
 
     AtomDOHAddPtr p = map->lookupForAdd(atom);
     if (p) {
         AtomDeclNode *last = lastAsNode(&p.value());
--- a/js/src/frontend/ParseMaps.h
+++ b/js/src/frontend/ParseMaps.h
@@ -42,16 +42,18 @@
 #define ParseMaps_h__
 
 #include "ds/InlineMap.h"
 #include "js/HashTable.h"
 #include "js/Vector.h"
 
 namespace js {
 
+struct Definition;
+
 /*
  * A pool that permits the reuse of the backing storage for the defn, index, or
  * defn-or-header (multi) maps.
  *
  * The pool owns all the maps that are given out, and is responsible for
  * relinquishing all resources when |purgeAll| is triggered.
  */
 class ParseMapPool
@@ -121,17 +123,17 @@ class ParseMapPool
     }
 
     void release(AtomDOHMap *map) {
         recycle((void *) map);
     }
 }; /* ParseMapPool */
 
 /*
- * N.B. This is a POD-type so that it can be included in the JSParseNode union.
+ * N.B. This is a POD-type so that it can be included in the ParseNode union.
  * If possible, use the corresponding |OwnedAtomThingMapPtr| variant.
  */
 template <class Map>
 struct AtomThingMapPtr
 {
     Map *map_;
 
     void init() { clearMap(); }
@@ -147,17 +149,17 @@ struct AtomThingMapPtr
     Map *operator->() { return map_; }
     const Map *operator->() const { return map_; }
     Map &operator*() const { return *map_; }
 };
 
 struct AtomDefnMapPtr : public AtomThingMapPtr<AtomDefnMap>
 {
     JS_ALWAYS_INLINE
-    JSDefinition *lookupDefn(JSAtom *atom) {
+    Definition *lookupDefn(JSAtom *atom) {
         AtomDefnMap::Ptr p = map_->lookup(atom);
         return p ? p.value() : NULL;
     }
 };
 
 typedef AtomThingMapPtr<AtomIndexMap> AtomIndexMapPtr;
 
 /*
@@ -180,57 +182,57 @@ class OwnedAtomThingMapPtr : public Atom
 };
 
 typedef OwnedAtomThingMapPtr<AtomDefnMapPtr> OwnedAtomDefnMapPtr;
 typedef OwnedAtomThingMapPtr<AtomIndexMapPtr> OwnedAtomIndexMapPtr;
 
 /* Node structure for chaining in AtomDecls. */
 struct AtomDeclNode
 {
-    JSDefinition *defn;
+    Definition *defn;
     AtomDeclNode *next;
 
-    explicit AtomDeclNode(JSDefinition *defn)
+    explicit AtomDeclNode(Definition *defn)
       : defn(defn), next(NULL)
     {}
 };
 
 /*
- * Tagged union of a JSDefinition and an AtomDeclNode, for use in AtomDecl's
+ * Tagged union of a Definition and an AtomDeclNode, for use in AtomDecl's
  * internal map.
  */
 class DefnOrHeader
 {
     union {
-        JSDefinition    *defn;
+        Definition    *defn;
         AtomDeclNode    *head;
         uintptr_t       bits;
     } u;
 
   public:
     DefnOrHeader() {
         u.bits = 0;
     }
 
-    explicit DefnOrHeader(JSDefinition *defn) {
+    explicit DefnOrHeader(Definition *defn) {
         u.defn = defn;
         JS_ASSERT(!isHeader());
     }
 
     explicit DefnOrHeader(AtomDeclNode *node) {
         u.head = node;
         u.bits |= 0x1;
         JS_ASSERT(isHeader());
     }
 
     bool isHeader() const {
         return u.bits & 0x1;
     }
 
-    JSDefinition *defn() const {
+    Definition *defn() const {
         JS_ASSERT(!isHeader());
         return u.defn;
     }
 
     AtomDeclNode *header() const {
         JS_ASSERT(isHeader());
         return (AtomDeclNode *) (u.bits & ~0x1);
     }
@@ -263,17 +265,17 @@ class AtomDecls
     friend class AtomDeclsIter;
 
     JSContext   *cx;
     AtomDOHMap  *map;
 
     AtomDecls(const AtomDecls &other);
     void operator=(const AtomDecls &other);
 
-    AtomDeclNode *allocNode(JSDefinition *defn);
+    AtomDeclNode *allocNode(Definition *defn);
 
     /*
      * Fallibly return the value in |doh| as a node.
      * Update the defn currently occupying |doh| to a node if necessary.
      */
     AtomDeclNode *lastAsNode(DefnOrHeader *doh);
 
   public:
@@ -285,28 +287,28 @@ class AtomDecls
 
     bool init();
 
     void clear() {
         map->clear();
     }
 
     /* Return the definition at the head of the chain for |atom|. */
-    inline JSDefinition *lookupFirst(JSAtom *atom);
+    inline Definition *lookupFirst(JSAtom *atom);
 
     /* Perform a lookup that can iterate over the definitions associated with |atom|. */
     inline MultiDeclRange lookupMulti(JSAtom *atom);
 
     /* Add-or-update a known-unique definition for |atom|. */
-    inline bool addUnique(JSAtom *atom, JSDefinition *defn);
-    bool addShadow(JSAtom *atom, JSDefinition *defn);
-    bool addHoist(JSAtom *atom, JSDefinition *defn);
+    inline bool addUnique(JSAtom *atom, Definition *defn);
+    bool addShadow(JSAtom *atom, Definition *defn);
+    bool addHoist(JSAtom *atom, Definition *defn);
 
     /* Updating the definition for an entry that is known to exist is infallible. */
-    void updateFirst(JSAtom *atom, JSDefinition *defn) {
+    void updateFirst(JSAtom *atom, Definition *defn) {
         JS_ASSERT(map);
         AtomDOHMap::Ptr p = map->lookup(atom);
         JS_ASSERT(p);
         if (p.value().isHeader())
             p.value().header()->defn = defn;
         else
             p.value() = DefnOrHeader(defn);
     }
@@ -347,33 +349,33 @@ class AtomDecls
  * multiple definitions associated with a single atom. This occurs due to block
  * scoping.
  */
 class MultiDeclRange
 {
     friend class AtomDecls;
 
     AtomDeclNode *node;
-    JSDefinition *defn;
+    Definition *defn;
 
-    explicit MultiDeclRange(JSDefinition *defn) : node(NULL), defn(defn) {}
+    explicit MultiDeclRange(Definition *defn) : node(NULL), defn(defn) {}
     explicit MultiDeclRange(AtomDeclNode *node) : node(node), defn(node->defn) {}
 
   public:
     void popFront() {
         JS_ASSERT(!empty());
         if (!node) {
             defn = NULL;
             return;
         }
         node = node->next;
         defn = node ? node->defn : NULL;
     }
 
-    JSDefinition *front() {
+    Definition *front() {
         JS_ASSERT(!empty());
         return defn;
     }
 
     bool empty() const {
         JS_ASSERT_IF(!defn, !node);
         return !defn;
     }
@@ -383,20 +385,20 @@ class MultiDeclRange
 class AtomDeclsIter
 {
     AtomDOHMap::Range   r;     /* Range over the map. */
     AtomDeclNode        *link; /* Optional next node in the current atom's chain. */
 
   public:
     explicit AtomDeclsIter(AtomDecls *decls) : r(decls->all()), link(NULL) {}
 
-    JSDefinition *operator()() {
+    Definition *operator()() {
         if (link) {
             JS_ASSERT(link != link->next);
-            JSDefinition *result = link->defn;
+            Definition *result = link->defn;
             link = link->next;
             JS_ASSERT(result);
             return result;
         }
 
         if (r.empty())
             return NULL;
 
--- a/js/src/frontend/ParseNode-inl.h
+++ b/js/src/frontend/ParseNode-inl.h
@@ -39,21 +39,21 @@
 
 #ifndef ParseNode_inl_h__
 #define ParseNode_inl_h__
 
 #include "frontend/ParseNode.h"
 #include "frontend/BytecodeGenerator.h"
 #include "frontend/TokenStream.h"
 
+namespace js {
+
 inline bool
-JSParseNode::isConstant()
+ParseNode::isConstant()
 {
-    using namespace js;
-
     switch (pn_type) {
       case TOK_NUMBER:
       case TOK_STRING:
         return true;
       case TOK_PRIMARY:
         switch (pn_op) {
           case JSOP_NULL:
           case JSOP_FALSE:
@@ -65,20 +65,18 @@ JSParseNode::isConstant()
       case TOK_RB:
       case TOK_RC:
         return isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST);
       default:
         return false;
     }
 }
 
-namespace js {
-
 inline void
-NameNode::initCommon(JSTreeContext *tc)
+NameNode::initCommon(TreeContext *tc)
 {
     pn_expr = NULL;
     pn_cookie.makeFree();
     pn_dflags = (!tc->topStmt || tc->topStmt->type == STMT_BLOCK)
                 ? PND_BLOCKCHILD
                 : 0;
     pn_blockid = tc->blockid();
 }
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -48,31 +48,31 @@
 #include "frontend/ParseMaps-inl.h"
 #include "frontend/ParseNode-inl.h"
 
 using namespace js;
 
 /*
  * Asserts to verify assumptions behind pn_ macros.
  */
-#define pn_offsetof(m)  offsetof(JSParseNode, m)
+#define pn_offsetof(m)  offsetof(ParseNode, m)
 
 JS_STATIC_ASSERT(pn_offsetof(pn_link) == pn_offsetof(dn_uses));
 
 #undef pn_offsetof
 
 void
-JSParseNode::become(JSParseNode *pn2)
+ParseNode::become(ParseNode *pn2)
 {
     JS_ASSERT(!pn_defn);
     JS_ASSERT(!pn2->isDefn());
 
     JS_ASSERT(!pn_used);
     if (pn2->isUsed()) {
-        JSParseNode **pnup = &pn2->pn_lexdef->dn_uses;
+        ParseNode **pnup = &pn2->pn_lexdef->dn_uses;
         while (*pnup != pn2)
             pnup = &(*pnup)->pn_link;
         *pnup = this;
         pn_link = pn2->pn_link;
         pn_used = true;
         pn2->pn_link = NULL;
         pn2->pn_used = false;
     }
@@ -97,70 +97,70 @@ JSParseNode::become(JSParseNode *pn2)
         JS_ASSERT(pn_tail == &pn2->pn_head);
         pn_tail = &pn_head;
     }
 
     pn2->clear();
 }
 
 void
-JSParseNode::clear()
+ParseNode::clear()
 {
     pn_type = TOK_EOF;
     setOp(JSOP_NOP);
     pn_used = pn_defn = false;
     pn_arity = PN_NULLARY;
     pn_parens = false;
 }
 
 
 bool
-JSFunctionBox::joinable() const
+FunctionBox::joinable() const
 {
     return function()->isNullClosure() &&
            (tcflags & (TCF_FUN_USES_ARGUMENTS |
                        TCF_FUN_USES_OWN_NAME |
                        TCF_COMPILE_N_GO)) == TCF_COMPILE_N_GO;
 }
 
 bool
-JSFunctionBox::inAnyDynamicScope() const
+FunctionBox::inAnyDynamicScope() const
 {
-    for (const JSFunctionBox *funbox = this; funbox; funbox = funbox->parent) {
+    for (const FunctionBox *funbox = this; funbox; funbox = funbox->parent) {
         if (funbox->tcflags & (TCF_IN_WITH | TCF_FUN_EXTENSIBLE_SCOPE))
             return true;
     }
     return false;
 }
 
 bool
-JSFunctionBox::scopeIsExtensible() const
+FunctionBox::scopeIsExtensible() const
 {
     return tcflags & TCF_FUN_EXTENSIBLE_SCOPE;
 }
 
 bool
-JSFunctionBox::shouldUnbrand(uintN methods, uintN slowMethods) const
+FunctionBox::shouldUnbrand(uintN methods, uintN slowMethods) const
 {
     if (slowMethods != 0) {
-        for (const JSFunctionBox *funbox = this; funbox; funbox = funbox->parent) {
+        for (const FunctionBox *funbox = this; funbox; funbox = funbox->parent) {
             if (!(funbox->tcflags & TCF_FUN_MODULE_PATTERN))
                 return true;
             if (funbox->inLoop)
                 return true;
         }
     }
     return false;
 }
 
 namespace js {
 
 /* Add |node| to |parser|'s free node list. */
 void
-AddNodeToFreeList(JSParseNode *pn, js::Parser *parser)
+AddNodeToFreeList(ParseNode *pn, Parser *parser)
 {
     /* Catch back-to-back dup recycles. */
     JS_ASSERT(pn != parser->nodeList);
 
     /* 
      * It's too hard to clear these nodes from the AtomDefnMaps, etc. that
      * hold references to them, so we never free them. It's our caller's job to
      * recognize and process these, since their children do need to be dealt
@@ -177,96 +177,94 @@ AddNodeToFreeList(JSParseNode *pn, js::P
     memset(pn, 0xab, sizeof(*pn));
 #endif
 
     pn->pn_next = parser->nodeList;
     parser->nodeList = pn;
 }
 
 /*
- * A work pool of JSParseNodes. The work pool is a stack, chained together
+ * A work pool of ParseNodes. The work pool is a stack, chained together
  * by nodes' pn_next fields. We use this to avoid creating deep C++ stacks
  * when recycling deep parse trees.
  *
  * Since parse nodes are probably allocated in something close to the order
  * they appear in a depth-first traversal of the tree, making the work pool
  * a stack should give us pretty good locality.
  */
 class NodeStack {
   public:
     NodeStack() : top(NULL) { }
     bool empty() { return top == NULL; }
-    void push(JSParseNode *pn) {
+    void push(ParseNode *pn) {
         pn->pn_next = top;
         top = pn;
     }
-    void pushUnlessNull(JSParseNode *pn) { if (pn) push(pn); }
+    void pushUnlessNull(ParseNode *pn) { if (pn) push(pn); }
     /* Push the children of the PN_LIST node |pn| on the stack. */
-    void pushList(JSParseNode *pn) {
+    void pushList(ParseNode *pn) {
         /* This clobbers pn->pn_head if the list is empty; should be okay. */
         *pn->pn_tail = top;
         top = pn->pn_head;
     }
-    JSParseNode *pop() {
+    ParseNode *pop() {
         JS_ASSERT(!empty());
-        JSParseNode *hold = top; /* my kingdom for a prog1 */
+        ParseNode *hold = top; /* my kingdom for a prog1 */
         top = top->pn_next;
         return hold;
     }
   private:
-    JSParseNode *top;
+    ParseNode *top;
 };
 
 } /* namespace js */
 
 /*
  * Push the children of |pn| on |stack|. Return true if |pn| itself could be
  * safely recycled, or false if it must be cleaned later (pn_used and pn_defn
  * nodes, and all function nodes; see comments for
  * js::Parser::cleanFunctionList). Some callers want to free |pn|; others
- * (PrepareNodeForMutation) don't care about |pn|, and just need to take care of
- * its children.
+ * (PrepareNodeForMutation) don't care about |pn|, and just need to take care
+ * of its children.
  */
 static bool
-PushNodeChildren(JSParseNode *pn, NodeStack *stack)
+PushNodeChildren(ParseNode *pn, NodeStack *stack)
 {
     switch (pn->getArity()) {
       case PN_FUNC:
         /*
-         * Function nodes are linked into the function box tree, and may
-         * appear on method lists. Both of those lists are singly-linked,
-         * so trying to update them now could result in quadratic behavior
-         * when recycling trees containing many functions; and the lists
-         * can be very long. So we put off cleaning the lists up until just
-         * before function analysis, when we call
-         * js::Parser::cleanFunctionList.
+         * Function nodes are linked into the function box tree, and may appear
+         * on method lists. Both of those lists are singly-linked, so trying to
+         * update them now could result in quadratic behavior when recycling
+         * trees containing many functions; and the lists can be very long. So
+         * we put off cleaning the lists up until just before function
+         * analysis, when we call js::Parser::cleanFunctionList.
          *
-         * In fact, we can't recycle the parse node yet, either: it may
-         * appear on a method list, and reusing the node would corrupt
-         * that. Instead, we clear its pn_funbox pointer to mark it as
-         * deleted; js::Parser::cleanFunctionList recycles it as well.
+         * In fact, we can't recycle the parse node yet, either: it may appear
+         * on a method list, and reusing the node would corrupt that. Instead,
+         * we clear its pn_funbox pointer to mark it as deleted;
+         * js::Parser::cleanFunctionList recycles it as well.
          *
-         * We do recycle the nodes around it, though, so we must clear
-         * pointers to them to avoid leaving dangling references where
-         * someone can find them.
+         * We do recycle the nodes around it, though, so we must clear pointers
+         * to them to avoid leaving dangling references where someone can find
+         * them.
          */
         pn->pn_funbox = NULL;
         stack->pushUnlessNull(pn->pn_body);
         pn->pn_body = NULL;
         return false;
 
       case PN_NAME:
         /*
          * Because used/defn nodes appear in AtomDefnMaps and elsewhere, we
-         * don't recycle them. (We'll recover their storage when we free
-         * the temporary arena.) However, we do recycle the nodes around
-         * them, so clean up the pointers to avoid dangling references. The
-         * top-level decls table carries references to them that later
-         * iterations through the compileScript loop may find, so they need
-         * to be neat.
+         * don't recycle them. (We'll recover their storage when we free the
+         * temporary arena.) However, we do recycle the nodes around them, so
+         * clean up the pointers to avoid dangling references. The top-level
+         * decls table carries references to them that later iterations through
+         * the compileScript loop may find, so they need to be neat.
          *
          * pn_expr and pn_lexdef share storage; the latter isn't an owning
          * reference.
          */
         if (!pn->isUsed()) {
             stack->pushUnlessNull(pn->pn_expr);
             pn->pn_expr = NULL;
         }
@@ -304,17 +302,17 @@ PushNodeChildren(JSParseNode *pn, NodeSt
 namespace js {
 
 /*
  * Prepare |pn| to be mutated in place into a new kind of node. Recycle all
  * |pn|'s recyclable children (but not |pn| itself!), and disconnect it from
  * metadata structures (the function box tree).
  */
 void
-PrepareNodeForMutation(JSParseNode *pn, JSTreeContext *tc)
+PrepareNodeForMutation(ParseNode *pn, TreeContext *tc)
 {
     if (!pn->isArity(PN_NULLARY)) {
         if (pn->isArity(PN_FUNC)) {
             /*
              * Since this node could be turned into anything, we can't
              * ensure it won't be subsequently recycled, so we must
              * disconnect it from the funbox tree entirely.
              *
@@ -350,49 +348,47 @@ PrepareNodeForMutation(JSParseNode *pn, 
  * reallocation.
  *
  * Note that all functions in |pn| that are not enclosed by other functions
  * in |pn| must be direct children of |tc|, because we only clean up |tc|'s
  * function and method lists. You must not reach into a function and
  * recycle some part of it (unless you've updated |tc|->functionList, the
  * way js_FoldConstants does).
  */
-JSParseNode *
-RecycleTree(JSParseNode *pn, JSTreeContext *tc)
+ParseNode *
+RecycleTree(ParseNode *pn, TreeContext *tc)
 {
     if (!pn)
         return NULL;
 
-    JSParseNode *savedNext = pn->pn_next;
+    ParseNode *savedNext = pn->pn_next;
 
     NodeStack stack;
     for (;;) {
         if (PushNodeChildren(pn, &stack))
             AddNodeToFreeList(pn, tc->parser);
         if (stack.empty())
             break;
         pn = stack.pop();
     }
 
     return savedNext;
 }
 
 /*
- * Allocate a JSParseNode from tc's node freelist or, failing that, from
+ * Allocate a ParseNode from tc's node freelist or, failing that, from
  * cx's temporary arena.
  */
-JSParseNode *
-NewOrRecycledNode(JSTreeContext *tc)
+ParseNode *
+NewOrRecycledNode(TreeContext *tc)
 {
-    JSParseNode *pn;
-
-    pn = tc->parser->nodeList;
+    ParseNode *pn = tc->parser->nodeList;
     if (!pn) {
         JSContext *cx = tc->parser->context;
-        pn = cx->tempLifoAlloc().new_<JSParseNode>();
+        pn = cx->tempLifoAlloc().new_<ParseNode>();
         if (!pn)
             js_ReportOutOfMemory(cx);
     } else {
         tc->parser->nodeList = pn->pn_next;
     }
 
     if (pn) {
         pn->setUsed(false);
@@ -402,53 +398,51 @@ NewOrRecycledNode(JSTreeContext *tc)
     }
     return pn;
 }
 
 } /* namespace js */
 
 /* used only by static create methods of subclasses */
 
-JSParseNode *
-JSParseNode::create(JSParseNodeArity arity, JSTreeContext *tc)
+ParseNode *
+ParseNode::create(ParseNodeArity arity, TreeContext *tc)
 {
     const Token &tok = tc->parser->tokenStream.currentToken();
     return create(arity, tok.type, JSOP_NOP, tok.pos, tc);
 }
 
-JSParseNode *
-JSParseNode::create(JSParseNodeArity arity, TokenKind type, JSOp op, const TokenPos &pos,
-                    JSTreeContext *tc)
+ParseNode *
+ParseNode::create(ParseNodeArity arity, TokenKind type, JSOp op, const TokenPos &pos,
+                  TreeContext *tc)
 {
-    JSParseNode *pn = NewOrRecycledNode(tc);
+    ParseNode *pn = NewOrRecycledNode(tc);
     if (!pn)
         return NULL;
     pn->init(type, op, arity);
     pn->pn_pos = pos;
     return pn;
 }
 
-JSParseNode *
-JSParseNode::newBinaryOrAppend(TokenKind tt, JSOp op, JSParseNode *left, JSParseNode *right,
-                               JSTreeContext *tc)
+ParseNode *
+ParseNode::newBinaryOrAppend(TokenKind tt, JSOp op, ParseNode *left, ParseNode *right,
+                             TreeContext *tc)
 {
-    JSParseNode *pn, *pn1, *pn2;
-
     if (!left || !right)
         return NULL;
 
     /*
      * Flatten a left-associative (left-heavy) tree of a given operator into
      * a list, to reduce js_FoldConstants and js_EmitTree recursion.
      */
     if (left->isKind(tt) &&
         left->isOp(op) &&
         (js_CodeSpec[op].format & JOF_LEFTASSOC)) {
         if (left->pn_arity != PN_LIST) {
-            pn1 = left->pn_left, pn2 = left->pn_right;
+            ParseNode *pn1 = left->pn_left, *pn2 = left->pn_right;
             left->setArity(PN_LIST);
             left->pn_parens = false;
             left->initList(pn1);
             left->append(pn2);
             if (tt == TOK_PLUS) {
                 if (pn1->isKind(TOK_STRING))
                     left->pn_xflags |= PNX_STRCAT;
                 else if (!pn1->isKind(TOK_NUMBER))
@@ -482,74 +476,70 @@ JSParseNode::newBinaryOrAppend(TokenKind
         right->isKind(TOK_NUMBER) &&
         tc->parser->foldConstants) {
         left->pn_dval += right->pn_dval;
         left->pn_pos.end = right->pn_pos.end;
         RecycleTree(right, tc);
         return left;
     }
 
-    pn = NewOrRecycledNode(tc);
+    ParseNode *pn = NewOrRecycledNode(tc);
     if (!pn)
         return NULL;
     pn->init(tt, op, PN_BINARY);
     pn->pn_pos.begin = left->pn_pos.begin;
     pn->pn_pos.end = right->pn_pos.end;
     pn->pn_left = left;
     pn->pn_right = right;
     return pn;
 }
 
 namespace js {
 
 NameNode *
-NameNode::create(JSAtom *atom, JSTreeContext *tc)
+NameNode::create(JSAtom *atom, TreeContext *tc)
 {
-    JSParseNode *pn;
-
-    pn = JSParseNode::create(PN_NAME, tc);
+    ParseNode *pn = ParseNode::create(PN_NAME, tc);
     if (pn) {
         pn->pn_atom = atom;
         ((NameNode *)pn)->initCommon(tc);
     }
     return (NameNode *)pn;
 }
 
 } /* namespace js */
 
 const char js_argument_str[] = "argument";
 const char js_variable_str[] = "variable";
 const char js_unknown_str[]  = "unknown";
 
 const char *
-JSDefinition::kindString(Kind kind)
+Definition::kindString(Kind kind)
 {
     static const char *table[] = {
         js_var_str, js_const_str, js_let_str,
         js_function_str, js_argument_str, js_unknown_str
     };
 
     JS_ASSERT(unsigned(kind) <= unsigned(ARG));
     return table[kind];
 }
 
 #if JS_HAS_DESTRUCTURING
 
 /*
  * This function assumes the cloned tree is for use in the same statement and
  * binding context as the original tree.
  */
-static JSParseNode *
-CloneParseTree(JSParseNode *opn, JSTreeContext *tc)
+static ParseNode *
+CloneParseTree(ParseNode *opn, TreeContext *tc)
 {
     JS_CHECK_RECURSION(tc->parser->context, return NULL);
 
-    JSParseNode *pn, *pn2, *opn2;
-
-    pn = NewOrRecycledNode(tc);
+    ParseNode *pn = NewOrRecycledNode(tc);
     if (!pn)
         return NULL;
     pn->setKind(opn->getKind());
     pn->setOp(opn->getOp());
     pn->setUsed(opn->isUsed());
     pn->setDefn(opn->isDefn());
     pn->setArity(opn->getArity());
     pn->setInParens(opn->isInParens());
@@ -564,17 +554,18 @@ CloneParseTree(JSParseNode *opn, JSTreeC
         NULLCHECK(pn->pn_body = CloneParseTree(opn->pn_body, tc));
         pn->pn_cookie = opn->pn_cookie;
         pn->pn_dflags = opn->pn_dflags;
         pn->pn_blockid = opn->pn_blockid;
         break;
 
       case PN_LIST:
         pn->makeEmpty();
-        for (opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) {
+        for (ParseNode *opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) {
+            ParseNode *pn2;
             NULLCHECK(pn2 = CloneParseTree(opn2, tc));
             pn->append(pn2);
         }
         pn->pn_xflags = opn->pn_xflags;
         break;
 
       case PN_TERNARY:
         NULLCHECK(pn->pn_kid1 = CloneParseTree(opn->pn_kid1, tc));
@@ -601,30 +592,30 @@ CloneParseTree(JSParseNode *opn, JSTreeC
       case PN_NAME:
         // PN_NAME could mean several arms in pn_u, so copy the whole thing.
         pn->pn_u = opn->pn_u;
         if (opn->isUsed()) {
             /*
              * The old name is a use of its pn_lexdef. Make the clone also be a
              * use of that definition.
              */
-            JSDefinition *dn = pn->pn_lexdef;
+            Definition *dn = pn->pn_lexdef;
 
             pn->pn_link = dn->dn_uses;
             dn->dn_uses = pn;
         } else if (opn->pn_expr) {
             NULLCHECK(pn->pn_expr = CloneParseTree(opn->pn_expr, tc));
 
             /*
              * If the old name is a definition, the new one has pn_defn set.
              * Make the old name a use of the new node.
              */
             if (opn->isDefn()) {
                 opn->setDefn(false);
-                LinkUseToDef(opn, (JSDefinition *) pn, tc);
+                LinkUseToDef(opn, (Definition *) pn, tc);
             }
         }
         break;
 
       case PN_NAMESET:
         pn->pn_names = opn->pn_names;
         NULLCHECK(pn->pn_tree = CloneParseTree(opn->pn_tree, tc));
         break;
@@ -648,44 +639,44 @@ namespace js {
  *   for (var/const/let TARGET in EXPR)
  *
  * opn must be the pn_head of a node produced by Parser::variables, so its form
  * is known to be LHS = NAME | [LHS] | {id:LHS}.
  *
  * The cloned tree is for use only in the same statement and binding context as
  * the original tree.
  */
-JSParseNode *
-CloneLeftHandSide(JSParseNode *opn, JSTreeContext *tc)
+ParseNode *
+CloneLeftHandSide(ParseNode *opn, TreeContext *tc)
 {
-    JSParseNode *pn = NewOrRecycledNode(tc);
+    ParseNode *pn = NewOrRecycledNode(tc);
     if (!pn)
         return NULL;
     pn->setKind(opn->getKind());
     pn->setOp(opn->getOp());
     pn->setUsed(opn->isUsed());
     pn->setDefn(opn->isDefn());
     pn->setArity(opn->getArity());
     pn->setInParens(opn->isInParens());
     pn->pn_pos = opn->pn_pos;
 
 #if JS_HAS_DESTRUCTURING
     if (opn->isArity(PN_LIST)) {
         JS_ASSERT(opn->isKind(TOK_RB) || opn->isKind(TOK_RC));
         pn->makeEmpty();
-        for (JSParseNode *opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) {
-            JSParseNode *pn2;
+        for (ParseNode *opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) {
+            ParseNode *pn2;
             if (opn->isKind(TOK_RC)) {
                 JS_ASSERT(opn2->isArity(PN_BINARY));
                 JS_ASSERT(opn2->isKind(TOK_COLON));
 
-                JSParseNode *tag = CloneParseTree(opn2->pn_left, tc);
+                ParseNode *tag = CloneParseTree(opn2->pn_left, tc);
                 if (!tag)
                     return NULL;
-                JSParseNode *target = CloneLeftHandSide(opn2->pn_right, tc);
+                ParseNode *target = CloneLeftHandSide(opn2->pn_right, tc);
                 if (!target)
                     return NULL;
                 pn2 = BinaryNode::create(TOK_COLON, JSOP_INITPROP, opn2->pn_pos, tag, target, tc);
             } else if (opn2->isArity(PN_NULLARY)) {
                 JS_ASSERT(opn2->isKind(TOK_COMMA));
                 pn2 = CloneParseTree(opn2, tc);
             } else {
                 pn2 = CloneLeftHandSide(opn2, tc);
@@ -702,27 +693,27 @@ CloneLeftHandSide(JSParseNode *opn, JSTr
 
     JS_ASSERT(opn->isArity(PN_NAME));
     JS_ASSERT(opn->isKind(TOK_NAME));
 
     /* If opn is a definition or use, make pn a use. */
     pn->pn_u.name = opn->pn_u.name;
     pn->setOp(JSOP_SETNAME);
     if (opn->isUsed()) {
-        JSDefinition *dn = pn->pn_lexdef;
+        Definition *dn = pn->pn_lexdef;
 
         pn->pn_link = dn->dn_uses;
         dn->dn_uses = pn;
     } else {
         pn->pn_expr = NULL;
         if (opn->isDefn()) {
             /* We copied some definition-specific state into pn. Clear it out. */
             pn->pn_cookie.makeFree();
             pn->pn_dflags &= ~PND_BOUND;
             pn->setDefn(false);
 
-            LinkUseToDef(pn, (JSDefinition *) opn, tc);
+            LinkUseToDef(pn, (Definition *) opn, tc);
         }
     }
     return pn;
 }
 
 } /* namespace js */
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -41,45 +41,47 @@
 #ifndef ParseNode_h__
 #define ParseNode_h__
 
 #include "jsscript.h"
 
 #include "frontend/ParseMaps.h"
 #include "frontend/TokenStream.h"
 
+namespace js {
+
 /*
  * Parsing builds a tree of nodes that directs code generation.  This tree is
  * not a concrete syntax tree in all respects (for example, || and && are left
  * associative, but (A && B && C) translates into the right-associated tree
  * <A && <B && C>> so that code generation can emit a left-associative branch
  * around <B && C> when A is false).  Nodes are labeled by token type, with a
  * JSOp secondary label when needed:
  *
  * Label        Variant     Members
  * -----        -------     -------
  * <Definitions>
- * TOK_FUNCTION name        pn_funbox: ptr to JSFunctionBox holding function
+ * TOK_FUNCTION name        pn_funbox: ptr to js::FunctionBox holding function
  *                            object containing arg and var properties.  We
  *                            create the function object at parse (not emit)
  *                            time to specialize arg and var bytecodes early.
  *                          pn_body: TOK_UPVARS if the function's source body
  *                                   depends on outer names, else TOK_ARGSBODY
  *                                   if formal parameters, else TOK_LC node for
  *                                   function body statements, else TOK_RETURN
  *                                   for expression closure, else TOK_SEQ for
  *                                   expression closure with destructured
  *                                   formal parameters
  *                          pn_cookie: static level and var index for function
  *                          pn_dflags: PND_* definition/use flags (see below)
  *                          pn_blockid: block id number
  * TOK_ARGSBODY list        list of formal parameters followed by TOK_LC node
  *                            for function body statements as final element
  *                          pn_count: 1 + number of formal parameters
- * TOK_UPVARS   nameset     pn_names: lexical dependencies (JSDefinitions)
+ * TOK_UPVARS   nameset     pn_names: lexical dependencies (js::Definitions)
  *                            defined in enclosing scopes, or ultimately not
  *                            defined (free variables, either global property
  *                            references or reference errors).
  *                          pn_tree: TOK_ARGSBODY or TOK_LC node
  *
  * <Statements>
  * TOK_LC       list        pn_head: list of pn_count statements
  * TOK_IF       ternary     pn_kid1: cond, pn_kid2: then, pn_kid3: else or null.
@@ -276,121 +278,121 @@
  *
  *    ((a x {x}) 'Hi there!' ((b y {y}) 'How are you?') ((answer) {x + y}))
  *
  * <Non-E4X node descriptions, continued>
  *
  * Label              Variant   Members
  * -----              -------   -------
  * TOK_LEXICALSCOPE   name      pn_op: JSOP_LEAVEBLOCK or JSOP_LEAVEBLOCKEXPR
- *                              pn_objbox: block object in JSObjectBox holder
+ *                              pn_objbox: block object in ObjectBox holder
  *                              pn_expr: block body
  * TOK_ARRAYCOMP      list      pn_count: 1
  *                              pn_head: list of 1 element, which is block
  *                                enclosing for loop(s) and optionally
  *                                if-guarded TOK_ARRAYPUSH
  * TOK_ARRAYPUSH      unary     pn_op: JSOP_ARRAYCOMP
  *                              pn_kid: array comprehension expression
  */
-typedef enum JSParseNodeArity {
+enum ParseNodeArity {
     PN_NULLARY,                         /* 0 kids, only pn_atom/pn_dval/etc. */
     PN_UNARY,                           /* one kid, plus a couple of scalars */
     PN_BINARY,                          /* two kids, plus a couple of scalars */
     PN_TERNARY,                         /* three kids */
     PN_FUNC,                            /* function definition node */
     PN_LIST,                            /* generic singly linked list */
     PN_NAME,                            /* name use or definition node */
-    PN_NAMESET                          /* JSAtomDefnMapPtr + JSParseNode ptr */
-} JSParseNodeArity;
+    PN_NAMESET                          /* AtomDefnMapPtr + ParseNode ptr */
+};
 
-struct JSDefinition;
+struct Definition;
 
-struct JSParseNode {
+struct ParseNode {
   private:
     uint32              pn_type   : 16, /* TOK_* type, see frontend/TokenStream.h */
                         pn_op     : 8,  /* see JSOp enum and jsopcode.tbl */
-                        pn_arity  : 5,  /* see JSParseNodeArity enum */
+                        pn_arity  : 5,  /* see ParseNodeArity enum */
                         pn_parens : 1,  /* this expr was enclosed in parens */
                         pn_used   : 1,  /* name node is on a use-chain */
-                        pn_defn   : 1;  /* this node is a JSDefinition */
+                        pn_defn   : 1;  /* this node is a Definition */
 
   public:
     JSOp getOp() const                     { return JSOp(pn_op); }
     void setOp(JSOp op)                    { pn_op = op; }
     bool isOp(JSOp op) const               { return getOp() == op; }
-    js::TokenKind getKind() const          { return js::TokenKind(pn_type); }
-    void setKind(js::TokenKind kind)       { pn_type = kind; }
-    bool isKind(js::TokenKind kind) const  { return getKind() == kind; }
-    JSParseNodeArity getArity() const      { return JSParseNodeArity(pn_arity); }
-    bool isArity(JSParseNodeArity a) const { return getArity() == a; }
-    void setArity(JSParseNodeArity a)      { pn_arity = a; }
+    TokenKind getKind() const              { return TokenKind(pn_type); }
+    void setKind(TokenKind kind)           { pn_type = kind; }
+    bool isKind(TokenKind kind) const      { return getKind() == kind; }
+    ParseNodeArity getArity() const        { return ParseNodeArity(pn_arity); }
+    bool isArity(ParseNodeArity a) const   { return getArity() == a; }
+    void setArity(ParseNodeArity a)        { pn_arity = a; }
     /* Boolean attributes. */
     bool isInParens() const                { return pn_parens; }
     void setInParens(bool enabled)         { pn_parens = enabled; }
     bool isDefn() const                    { return pn_defn; }
     void setDefn(bool enabled)             { pn_defn = enabled; }
     bool isUsed() const                    { return pn_used; }
     void setUsed(bool enabled)             { pn_used = enabled; }
 
-    js::TokenPos        pn_pos;         /* two 16-bit pairs here, for 64 bits */
+    TokenPos            pn_pos;         /* two 16-bit pairs here, for 64 bits */
     int32               pn_offset;      /* first generated bytecode offset */
-    JSParseNode         *pn_next;       /* intrinsic link in parent PN_LIST */
-    JSParseNode         *pn_link;       /* def/use link (alignment freebie);
-                                           also links JSFunctionBox::methods
+    ParseNode           *pn_next;       /* intrinsic link in parent PN_LIST */
+    ParseNode           *pn_link;       /* def/use link (alignment freebie);
+                                           also links FunctionBox::methods
                                            lists of would-be |this| methods */
     union {
         struct {                        /* list of next-linked nodes */
-            JSParseNode *head;          /* first node in list */
-            JSParseNode **tail;         /* ptr to ptr to last node in list */
+            ParseNode   *head;          /* first node in list */
+            ParseNode   **tail;         /* ptr to ptr to last node in list */
             uint32      count;          /* number of nodes in list */
             uint32      xflags:12,      /* extra flags, see below */
                         blockid:20;     /* see name variant below */
         } list;
         struct {                        /* ternary: if, for(;;), ?: */
-            JSParseNode *kid1;          /* condition, discriminant, etc. */
-            JSParseNode *kid2;          /* then-part, case list, etc. */
-            JSParseNode *kid3;          /* else-part, default case, etc. */
+            ParseNode   *kid1;          /* condition, discriminant, etc. */
+            ParseNode   *kid2;          /* then-part, case list, etc. */
+            ParseNode   *kid3;          /* else-part, default case, etc. */
         } ternary;
         struct {                        /* two kids if binary */
-            JSParseNode *left;
-            JSParseNode *right;
-            js::Value   *pval;          /* switch case value */
+            ParseNode   *left;
+            ParseNode   *right;
+            Value       *pval;          /* switch case value */
             uintN       iflags;         /* JSITER_* flags for TOK_FOR node */
         } binary;
         struct {                        /* one kid if unary */
-            JSParseNode *kid;
+            ParseNode   *kid;
             jsint       num;            /* -1 or sharp variable number */
             JSBool      hidden;         /* hidden genexp-induced JSOP_YIELD
                                            or directive prologue member (as
                                            pn_prologue) */
         } unary;
         struct {                        /* name, labeled statement, etc. */
             union {
                 JSAtom        *atom;    /* lexical name or label atom */
-                JSFunctionBox *funbox;  /* function object */
-                JSObjectBox   *objbox;  /* block or regexp object */
+                FunctionBox   *funbox;  /* function object */
+                ObjectBox     *objbox;  /* block or regexp object */
             };
             union {
-                JSParseNode  *expr;     /* function body, var initializer, or
+                ParseNode    *expr;     /* function body, var initializer, or
                                            base object of TOK_DOT */
-                JSDefinition *lexdef;   /* lexical definition for this use */
+                Definition   *lexdef;   /* lexical definition for this use */
             };
-            js::UpvarCookie cookie;     /* upvar cookie with absolute frame
+            UpvarCookie cookie;         /* upvar cookie with absolute frame
                                            level (not relative skip), possibly
                                            in current frame */
             uint32      dflags:12,      /* definition/use flags, see below */
                         blockid:20;     /* block number, for subset dominance
                                            computation */
         } name;
         struct {                        /* lexical dependencies + sub-tree */
-            js::AtomDefnMapPtr  defnMap;
-            JSParseNode         *tree;  /* sub-tree containing name uses */
+            AtomDefnMapPtr   defnMap;
+            ParseNode        *tree;     /* sub-tree containing name uses */
         } nameset;
         struct {                        /* PN_NULLARY variant for E4X XML PI */
-            js::PropertyName *target;   /* target in <?target data?> */
+            PropertyName     *target;   /* target in <?target data?> */
             JSAtom           *data;     /* data (or null) in <?target data?> */
         } xmlpi;
         jsdouble        dval;           /* aligned numeric literal value */
     } pn_u;
 
 #define pn_funbox       pn_u.name.funbox
 #define pn_body         pn_u.name.expr
 #define pn_cookie       pn_u.name.cookie
@@ -418,58 +420,58 @@ struct JSParseNode {
 #define pn_lexdef       pn_u.name.lexdef
 #define pn_names        pn_u.nameset.defnMap
 #define pn_tree         pn_u.nameset.tree
 #define pn_dval         pn_u.dval
 #define pn_pitarget     pn_u.xmlpi.target
 #define pn_pidata       pn_u.xmlpi.data
 
 protected:
-    void init(js::TokenKind type, JSOp op, JSParseNodeArity arity) {
+    void init(TokenKind type, JSOp op, ParseNodeArity arity) {
         pn_type = type;
         pn_op = op;
         pn_arity = arity;
         pn_parens = false;
         JS_ASSERT(!pn_used);
         JS_ASSERT(!pn_defn);
         pn_names.init();
         pn_next = pn_link = NULL;
     }
 
-    static JSParseNode *create(JSParseNodeArity arity, JSTreeContext *tc);
-    static JSParseNode *create(JSParseNodeArity arity, js::TokenKind type, JSOp op,
-                               const js::TokenPos &pos, JSTreeContext *tc);
+    static ParseNode *create(ParseNodeArity arity, TreeContext *tc);
+    static ParseNode *create(ParseNodeArity arity, TokenKind type, JSOp op,
+                             const TokenPos &pos, TreeContext *tc);
 
 public:
-    static JSParseNode *newBinaryOrAppend(js::TokenKind tt, JSOp op, JSParseNode *left,
-                                          JSParseNode *right, JSTreeContext *tc);
+    static ParseNode *newBinaryOrAppend(TokenKind tt, JSOp op, ParseNode *left, ParseNode *right,
+                                        TreeContext *tc);
 
-    static JSParseNode *newTernary(js::TokenKind tt, JSOp op, JSParseNode *kid1, JSParseNode *kid2,
-                                   JSParseNode *kid3, JSTreeContext *tc);
+    static ParseNode *newTernary(TokenKind tt, JSOp op, ParseNode *kid1, ParseNode *kid2,
+                                 ParseNode *kid3, TreeContext *tc);
 
     /*
      * The pn_expr and lexdef members are arms of an unsafe union. Unless you
      * know exactly what you're doing, use only the following methods to access
      * them. For less overhead and assertions for protection, use pn->expr()
      * and pn->lexdef(). Otherwise, use pn->maybeExpr() and pn->maybeLexDef().
      */
-    JSParseNode  *expr() const {
+    ParseNode *expr() const {
         JS_ASSERT(!pn_used);
         JS_ASSERT(pn_arity == PN_NAME || pn_arity == PN_FUNC);
         return pn_expr;
     }
 
-    JSDefinition *lexdef() const {
+    Definition *lexdef() const {
         JS_ASSERT(pn_used || isDeoptimized());
         JS_ASSERT(pn_arity == PN_NAME);
         return pn_lexdef;
     }
 
-    JSParseNode  *maybeExpr()   { return pn_used ? NULL : expr(); }
-    JSDefinition *maybeLexDef() { return pn_used ? lexdef() : NULL; }
+    ParseNode  *maybeExpr()   { return pn_used ? NULL : expr(); }
+    Definition *maybeLexDef() { return pn_used ? lexdef() : NULL; }
 
 /* PN_FUNC and PN_NAME pn_dflags bits. */
 #define PND_LET         0x01            /* let (block-scoped) binding */
 #define PND_CONST       0x02            /* const binding (orthogonal to let) */
 #define PND_INITIALIZED 0x04            /* initialized declaration */
 #define PND_ASSIGNED    0x08            /* set if ever LHS of assignment */
 #define PND_TOPLEVEL    0x10            /* see isTopLevel() below */
 #define PND_BLOCKCHILD  0x20            /* use or def is direct block child */
@@ -538,27 +540,27 @@ public:
      *
      * NB: Function sub-statements found in overall program code and not nested
      *     within other functions are not currently top level, even though (if
      *     executed) they do create top-level bindings; there is no particular
      *     rationale for this behavior.
      */
     bool isTopLevel() const     { return test(PND_TOPLEVEL); }
 
-    /* Defined below, see after struct JSDefinition. */
+    /* Defined below, see after struct Definition. */
     void setFunArg();
 
-    void become(JSParseNode *pn2);
+    void become(ParseNode *pn2);
     void clear();
 
     /* True if pn is a parsenode representing a literal constant. */
     bool isLiteral() const {
-        return isKind(js::TOK_NUMBER) ||
-               isKind(js::TOK_STRING) ||
-               (isKind(js::TOK_PRIMARY) && !isOp(JSOP_THIS));
+        return isKind(TOK_NUMBER) ||
+               isKind(TOK_STRING) ||
+               (isKind(TOK_PRIMARY) && !isOp(JSOP_THIS));
     }
 
     /*
      * True if this statement node could be a member of a Directive Prologue: an
      * expression statement consisting of a single string literal.
      *
      * This considers only the node and its children, not its context. After
      * parsing, check the node's pn_prologue flag to see if it is indeed part of
@@ -567,31 +569,31 @@ public:
      * Note that a Directive Prologue can contain statements that cannot
      * themselves be directives (string literals that include escape sequences
      * or escaped newlines, say). This member function returns true for such
      * nodes; we use it to determine the extent of the prologue.
      * isEscapeFreeStringLiteral, below, checks whether the node itself could be
      * a directive.
      */
     bool isStringExprStatement() const {
-        if (getKind() == js::TOK_SEMI) {
+        if (getKind() == TOK_SEMI) {
             JS_ASSERT(pn_arity == PN_UNARY);
-            JSParseNode *kid = pn_kid;
-            return kid && kid->getKind() == js::TOK_STRING && !kid->pn_parens;
+            ParseNode *kid = pn_kid;
+            return kid && kid->getKind() == TOK_STRING && !kid->pn_parens;
         }
         return false;
     }
 
     /*
      * Return true if this node, known to be a string literal, could be the
      * string of a directive in a Directive Prologue. Directive strings never
      * contain escape sequences or line continuations.
      */
     bool isEscapeFreeStringLiteral() const {
-        JS_ASSERT(pn_type == js::TOK_STRING && !pn_parens);
+        JS_ASSERT(pn_type == TOK_STRING && !pn_parens);
         JSString *str = pn_atom;
 
         /*
          * If the string's length in the source code is its length as a value,
          * accounting for the quotes, then it must not contain any escape
          * sequences or line continuations.
          */
         return (pn_pos.begin.lineno == pn_pos.end.lineno &&
@@ -601,184 +603,180 @@ public:
     /* Return true if this node appears in a Directive Prologue. */
     bool isDirectivePrologueMember() const { return pn_prologue; }
 
 #ifdef JS_HAS_GENERATOR_EXPRS
     /*
      * True if this node is a desugared generator expression.
      */
     bool isGeneratorExpr() const {
-        if (getKind() == js::TOK_LP) {
-            JSParseNode *callee = this->pn_head;
-            if (callee->getKind() == js::TOK_FUNCTION) {
-                JSParseNode *body = (callee->pn_body->getKind() == js::TOK_UPVARS)
-                                    ? callee->pn_body->pn_tree
-                                    : callee->pn_body;
-                if (body->getKind() == js::TOK_LEXICALSCOPE)
+        if (getKind() == TOK_LP) {
+            ParseNode *callee = this->pn_head;
+            if (callee->getKind() == TOK_FUNCTION) {
+                ParseNode *body = (callee->pn_body->getKind() == TOK_UPVARS)
+                                  ? callee->pn_body->pn_tree
+                                  : callee->pn_body;
+                if (body->getKind() == TOK_LEXICALSCOPE)
                     return true;
             }
         }
         return false;
     }
 
-    JSParseNode *generatorExpr() const {
+    ParseNode *generatorExpr() const {
         JS_ASSERT(isGeneratorExpr());
-        JSParseNode *callee = this->pn_head;
-        JSParseNode *body = callee->pn_body->getKind() == js::TOK_UPVARS
-            ? callee->pn_body->pn_tree
-            : callee->pn_body;
-        JS_ASSERT(body->getKind() == js::TOK_LEXICALSCOPE);
+        ParseNode *callee = this->pn_head;
+        ParseNode *body = callee->pn_body->getKind() == TOK_UPVARS
+                          ? callee->pn_body->pn_tree
+                          : callee->pn_body;
+        JS_ASSERT(body->getKind() == TOK_LEXICALSCOPE);
         return body->pn_expr;
     }
 #endif
 
     /*
      * Compute a pointer to the last element in a singly-linked list. NB: list
      * must be non-empty for correct PN_LAST usage -- this is asserted!
      */
-    JSParseNode *last() const {
+    ParseNode *last() const {
         JS_ASSERT(pn_arity == PN_LIST);
         JS_ASSERT(pn_count != 0);
-        return (JSParseNode *)(uintptr_t(pn_tail) - offsetof(JSParseNode, pn_next));
+        return (ParseNode *)(uintptr_t(pn_tail) - offsetof(ParseNode, pn_next));
     }
 
     void makeEmpty() {
         JS_ASSERT(pn_arity == PN_LIST);
         pn_head = NULL;
         pn_tail = &pn_head;
         pn_count = 0;
         pn_xflags = 0;
         pn_blockid = 0;
     }
 
-    void initList(JSParseNode *pn) {
+    void initList(ParseNode *pn) {
         JS_ASSERT(pn_arity == PN_LIST);
         pn_head = pn;
         pn_tail = &pn->pn_next;
         pn_count = 1;
         pn_xflags = 0;
         pn_blockid = 0;
     }
 
-    void append(JSParseNode *pn) {
+    void append(ParseNode *pn) {
         JS_ASSERT(pn_arity == PN_LIST);
         *pn_tail = pn;
         pn_tail = &pn->pn_next;
         pn_count++;
     }
 
-    bool getConstantValue(JSContext *cx, bool strictChecks, js::Value *vp);
+    bool getConstantValue(JSContext *cx, bool strictChecks, Value *vp);
     inline bool isConstant();
 };
 
-namespace js {
-
-struct NullaryNode : public JSParseNode {
-    static inline NullaryNode *create(JSTreeContext *tc) {
-        return (NullaryNode *)JSParseNode::create(PN_NULLARY, tc);
+struct NullaryNode : public ParseNode {
+    static inline NullaryNode *create(TreeContext *tc) {
+        return (NullaryNode *)ParseNode::create(PN_NULLARY, tc);
     }
 };
 
-struct UnaryNode : public JSParseNode {
-    static inline UnaryNode *create(JSTreeContext *tc) {
-        return (UnaryNode *)JSParseNode::create(PN_UNARY, tc);
+struct UnaryNode : public ParseNode {
+    static inline UnaryNode *create(TreeContext *tc) {
+        return (UnaryNode *)ParseNode::create(PN_UNARY, tc);
     }
 };
 
-struct BinaryNode : public JSParseNode {
+struct BinaryNode : public ParseNode {
     static inline BinaryNode *create(TokenKind type, JSOp op, const TokenPos &pos,
-                                     JSParseNode *left, JSParseNode *right,
-                                     JSTreeContext *tc) {
-        BinaryNode *pn = (BinaryNode *) JSParseNode::create(PN_BINARY, type, op, pos, tc);
+                                     ParseNode *left, ParseNode *right,
+                                     TreeContext *tc) {
+        BinaryNode *pn = (BinaryNode *) ParseNode::create(PN_BINARY, type, op, pos, tc);
         if (pn) {
             pn->pn_left = left;
             pn->pn_right = right;
         }
         return pn;
     }
 
-    static inline BinaryNode *create(JSTreeContext *tc) {
-        return (BinaryNode *)JSParseNode::create(PN_BINARY, tc);
+    static inline BinaryNode *create(TreeContext *tc) {
+        return (BinaryNode *)ParseNode::create(PN_BINARY, tc);
     }
 };
 
-struct TernaryNode : public JSParseNode {
+struct TernaryNode : public ParseNode {
     static inline TernaryNode *create(TokenKind type, JSOp op,
-                                      JSParseNode *kid1, JSParseNode *kid2, JSParseNode *kid3,
-                                      JSTreeContext *tc) {
+                                      ParseNode *kid1, ParseNode *kid2, ParseNode *kid3,
+                                      TreeContext *tc) {
         TokenPos pos;
         pos.begin = (kid1 ? kid1 : kid2)->pn_pos.begin;
         pos.end = kid3->pn_pos.end;
-        TernaryNode *pn = (TernaryNode *) JSParseNode::create(PN_TERNARY, type, op, pos, tc);
+        TernaryNode *pn = (TernaryNode *) ParseNode::create(PN_TERNARY, type, op, pos, tc);
         if (pn) {
             pn->pn_kid1 = kid1;
             pn->pn_kid2 = kid2;
             pn->pn_kid3 = kid3;
         }
         return pn;
     }
 
-    static inline TernaryNode *create(JSTreeContext *tc) {
-        return (TernaryNode *)JSParseNode::create(PN_TERNARY, tc);
-    }
-};
-
-struct ListNode : public JSParseNode {
-    static inline ListNode *create(JSTreeContext *tc) {
-        return (ListNode *)JSParseNode::create(PN_LIST, tc);
+    static inline TernaryNode *create(TreeContext *tc) {
+        return (TernaryNode *)ParseNode::create(PN_TERNARY, tc);
     }
 };
 
-struct FunctionNode : public JSParseNode {
-    static inline FunctionNode *create(JSTreeContext *tc) {
-        return (FunctionNode *)JSParseNode::create(PN_FUNC, tc);
+struct ListNode : public ParseNode {
+    static inline ListNode *create(TreeContext *tc) {
+        return (ListNode *)ParseNode::create(PN_LIST, tc);
     }
 };
 
-struct NameNode : public JSParseNode {
-    static NameNode *create(JSAtom *atom, JSTreeContext *tc);
-
-    void inline initCommon(JSTreeContext *tc);
-};
-
-struct NameSetNode : public JSParseNode {
-    static inline NameSetNode *create(JSTreeContext *tc) {
-        return (NameSetNode *)JSParseNode::create(PN_NAMESET, tc);
+struct FunctionNode : public ParseNode {
+    static inline FunctionNode *create(TreeContext *tc) {
+        return (FunctionNode *)ParseNode::create(PN_FUNC, tc);
     }
 };
 
-struct LexicalScopeNode : public JSParseNode {
-    static inline LexicalScopeNode *create(JSTreeContext *tc) {
-        return (LexicalScopeNode *)JSParseNode::create(PN_NAME, tc);
+struct NameNode : public ParseNode {
+    static NameNode *create(JSAtom *atom, TreeContext *tc);
+
+    void inline initCommon(TreeContext *tc);
+};
+
+struct NameSetNode : public ParseNode {
+    static inline NameSetNode *create(TreeContext *tc) {
+        return (NameSetNode *)ParseNode::create(PN_NAMESET, tc);
+    }
+};
+
+struct LexicalScopeNode : public ParseNode {
+    static inline LexicalScopeNode *create(TreeContext *tc) {
+        return (LexicalScopeNode *)ParseNode::create(PN_NAME, tc);
     }
 };
 
-JSParseNode *
-NewOrRecycledNode(JSTreeContext *tc);
+ParseNode *
+NewOrRecycledNode(TreeContext *tc);
 
 void
-AddNodeToFreeList(JSParseNode *pn, Parser *parser);
+AddNodeToFreeList(ParseNode *pn, Parser *parser);
 
 void
-PrepareNodeForMutation(JSParseNode *pn, JSTreeContext *tc);
-
-JSParseNode *
-RecycleTree(JSParseNode *pn, JSTreeContext *tc);
+PrepareNodeForMutation(ParseNode *pn, TreeContext *tc);
 
-JSParseNode *
-CloneLeftHandSide(JSParseNode *opn, JSTreeContext *tc);
+ParseNode *
+RecycleTree(ParseNode *pn, TreeContext *tc);
 
-} /* namespace js */
+ParseNode *
+CloneLeftHandSide(ParseNode *opn, TreeContext *tc);
 
 /*
- * JSDefinition is a degenerate subtype of the PN_FUNC and PN_NAME variants of
- * JSParseNode, allocated only for function, var, const, and let declarations
- * that define truly lexical bindings. This means that a child of a TOK_VAR
- * list may be a JSDefinition instead of a JSParseNode. The pn_defn bit is set
- * for all JSDefinitions, clear otherwise.
+ * js::Definition is a degenerate subtype of the PN_FUNC and PN_NAME variants
+ * of js::ParseNode, allocated only for function, var, const, and let
+ * declarations that define truly lexical bindings. This means that a child of
+ * a TOK_VAR list may be a Definition instead of a ParseNode. The pn_defn
+ * bit is set for all Definitions, clear otherwise.
  *
  * In an upvars list, defn->resolve() is the outermost definition the
  * name may reference. If a with block or a function that calls eval encloses
  * the use, the name may end up referring to something else at runtime.
  *
  * Note that not all var declarations are definitions: JS allows multiple var
  * declarations in a function or script, but only the first creates the hoisted
  * binding. JS programmers do redeclare variables for good refactoring reasons,
@@ -801,48 +799,48 @@ CloneLeftHandSide(JSParseNode *opn, JSTr
  *
  * Only bindings within function code may be treated as lexical, of course with
  * the caveat that hoisting means use before initialization is allowed. We deal
  * with use before declaration in one pass as follows (error checking elided):
  *
  *   for (each use of unqualified name x in parse order) {
  *       if (this use of x is a declaration) {
  *           if (x in tc->decls) {                          // redeclaring
- *               pn = allocate a PN_NAME JSParseNode;
+ *               pn = allocate a PN_NAME ParseNode;
  *           } else {                                       // defining
  *               dn = lookup x in tc->lexdeps;
  *               if (dn)                                    // use before def
  *                   remove x from tc->lexdeps;
  *               else                                       // def before use
- *                   dn = allocate a PN_NAME JSDefinition;
+ *                   dn = allocate a PN_NAME Definition;
  *               map x to dn via tc->decls;
  *               pn = dn;
  *           }
  *           insert pn into its parent TOK_VAR list;
  *       } else {
- *           pn = allocate a JSParseNode for this reference to x;
+ *           pn = allocate a ParseNode for this reference to x;
  *           dn = lookup x in tc's lexical scope chain;
  *           if (!dn) {
  *               dn = lookup x in tc->lexdeps;
  *               if (!dn) {
- *                   dn = pre-allocate a JSDefinition for x;
+ *                   dn = pre-allocate a Definition for x;
  *                   map x to dn in tc->lexdeps;
  *               }
  *           }
  *           append pn to dn's use chain;
  *       }
  *   }
  *
- * See frontend/BytecodeGenerator.h for JSTreeContext and its top*Stmt, decls, and
- * lexdeps members.
+ * See frontend/BytecodeGenerator.h for js::TreeContext and its top*Stmt,
+ * decls, and lexdeps members.
  *
  * Notes:
  *
- *  0. To avoid bloating JSParseNode, we steal a bit from pn_arity for pn_defn
- *     and set it on a JSParseNode instead of allocating a JSDefinition.
+ *  0. To avoid bloating ParseNode, we steal a bit from pn_arity for pn_defn
+ *     and set it on a ParseNode instead of allocating a Definition.
  *
  *  1. Due to hoisting, a definition cannot be eliminated even if its "Variable
  *     statement" (ECMA-262 12.2) can be proven to be dead code. RecycleTree in
  *     ParseNode.cpp will not recycle a node whose pn_defn bit is set.
  *
  *  2. "lookup x in tc's lexical scope chain" gives up on def/use chaining if a
  *     with statement is found along the the scope chain, which includes tc,
  *     tc->parent, etc. Thus we eagerly connect an inner function's use of an
@@ -883,37 +881,37 @@ CloneLeftHandSide(JSParseNode *opn, JSTr
  * We also analyze function uses to flag upward/downward funargs.  If a lambda
  * post-dominates each of its upvars' sole, inevitable (i.e. not hidden behind
  * conditions or within loops or the like) initialization or assignment; then
  * we can optimize the lambda as a flat closure (after Chez Scheme's display
  * closures).
  */
 #define dn_uses         pn_link
 
-struct JSDefinition : public JSParseNode
+struct Definition : public ParseNode
 {
     /*
-     * We store definition pointers in PN_NAMESET JSAtomDefnMapPtrs in the AST,
+     * We store definition pointers in PN_NAMESET AtomDefnMapPtrs in the AST,
      * but due to redefinition these nodes may become uses of other
      * definitions.  This is unusual, so we simply chase the pn_lexdef link to
      * find the final definition node. See methods called from
      * Parser::analyzeFunctions.
      *
      * FIXME: MakeAssignment mutates for want of a parent link...
      */
-    JSDefinition *resolve() {
-        JSParseNode *pn = this;
+    Definition *resolve() {
+        ParseNode *pn = this;
         while (!pn->isDefn()) {
-            if (pn->getKind() == js::TOK_ASSIGN) {
+            if (pn->getKind() == TOK_ASSIGN) {
                 pn = pn->pn_left;
                 continue;
             }
             pn = pn->lexdef();
         }
-        return (JSDefinition *) pn;
+        return (Definition *) pn;
     }
 
     bool isFreeVar() const {
         JS_ASSERT(isDefn());
         return pn_cookie.isFree() || test(PND_GVAR);
     }
 
     bool isGlobal() const {
@@ -923,48 +921,48 @@ struct JSDefinition : public JSParseNode
 
     enum Kind { VAR, CONST, LET, FUNCTION, ARG, UNKNOWN };
 
     bool isBindingForm() { return int(kind()) <= int(LET); }
 
     static const char *kindString(Kind kind);
 
     Kind kind() {
-        if (getKind() == js::TOK_FUNCTION)
+        if (getKind() == TOK_FUNCTION)
             return FUNCTION;
-        JS_ASSERT(getKind() == js::TOK_NAME);
+        JS_ASSERT(getKind() == TOK_NAME);
         if (isOp(JSOP_NOP))
             return UNKNOWN;
         if (isOp(JSOP_GETARG))
             return ARG;
         if (isConst())
             return CONST;
         if (isLet())
             return LET;
         return VAR;
     }
 };
 
 inline bool
-JSParseNode::test(uintN flag) const
+ParseNode::test(uintN flag) const
 {
     JS_ASSERT(pn_defn || pn_arity == PN_FUNC || pn_arity == PN_NAME);
 #ifdef DEBUG
     if ((flag & (PND_ASSIGNED | PND_FUNARG)) && pn_defn && !(pn_dflags & flag)) {
-        for (JSParseNode *pn = ((JSDefinition *) this)->dn_uses; pn; pn = pn->pn_link) {
+        for (ParseNode *pn = ((Definition *) this)->dn_uses; pn; pn = pn->pn_link) {
             JS_ASSERT(!pn->pn_defn);
             JS_ASSERT(!(pn->pn_dflags & flag));
         }
     }
 #endif
     return !!(pn_dflags & flag);
 }
 
 inline void
-JSParseNode::setFunArg()
+ParseNode::setFunArg()
 {
     /*
      * pn_defn NAND pn_used must be true, per this chart:
      *
      *   pn_defn pn_used
      *         0       0        anonymous function used implicitly, e.g. by
      *                          hidden yield in a genexp
      *         0       1        a use of a definition or placeholder
@@ -972,56 +970,52 @@ JSParseNode::setFunArg()
      *         1       1        error: this case must not be possible
      */
     JS_ASSERT(!(pn_defn & pn_used));
     if (pn_used)
         pn_lexdef->pn_dflags |= PND_FUNARG;
     pn_dflags |= PND_FUNARG;
 }
 
-namespace js {
-
 inline void
-LinkUseToDef(JSParseNode *pn, JSDefinition *dn, JSTreeContext *tc)
+LinkUseToDef(ParseNode *pn, Definition *dn, TreeContext *tc)
 {
     JS_ASSERT(!pn->isUsed());
     JS_ASSERT(!pn->isDefn());
     JS_ASSERT(pn != dn->dn_uses);
     pn->pn_link = dn->dn_uses;
     dn->dn_uses = pn;
     dn->pn_dflags |= pn->pn_dflags & PND_USE2DEF_FLAGS;
     pn->setUsed(true);
     pn->pn_lexdef = dn;
 }
 
-} /* namespace js */
-
-struct JSObjectBox {
-    JSObjectBox         *traceLink;
-    JSObjectBox         *emitLink;
+struct ObjectBox {
+    ObjectBox           *traceLink;
+    ObjectBox           *emitLink;
     JSObject            *object;
-    JSObjectBox         *parent;
+    ObjectBox           *parent;
     uintN               index;
     bool                isFunctionBox;
 };
 
 #define JSFB_LEVEL_BITS 14
 
-struct JSFunctionBox : public JSObjectBox
+struct FunctionBox : public ObjectBox
 {
-    JSParseNode         *node;
-    JSFunctionBox       *siblings;
-    JSFunctionBox       *kids;
-    JSFunctionBox       *parent;
-    JSParseNode         *methods;               /* would-be methods set on this;
+    ParseNode           *node;
+    FunctionBox         *siblings;
+    FunctionBox         *kids;
+    FunctionBox         *parent;
+    ParseNode           *methods;               /* would-be methods set on this;
                                                    these nodes are linked via
                                                    pn_link, since lambdas are
                                                    neither definitions nor uses
                                                    of a binding */
-    js::Bindings        bindings;               /* bindings for this function */
+    Bindings            bindings;               /* bindings for this function */
     uint32              queued:1,
                         inLoop:1,               /* in a loop in parent function */
                         level:JSFB_LEVEL_BITS;
     uint32              tcflags;
 
     JSFunction *function() const { return (JSFunction *) object; }
 
     bool joinable() const;
@@ -1046,46 +1040,48 @@ struct JSFunctionBox : public JSObjectBo
      * We despecialize from caching function objects, caching slots or shapes
      * instead, because an unbranded object may still have joined methods (for
      * which shape->isMethod), since PropertyCache::fill gives precedence to
      * joined methods over branded methods.
      */
     bool shouldUnbrand(uintN methods, uintN slowMethods) const;
 };
 
-struct JSFunctionBoxQueue {
-    JSFunctionBox       **vector;
+struct FunctionBoxQueue {
+    FunctionBox         **vector;
     size_t              head, tail;
     size_t              lengthMask;
 
     size_t count()  { return head - tail; }
     size_t length() { return lengthMask + 1; }
 
-    JSFunctionBoxQueue()
+    FunctionBoxQueue()
       : vector(NULL), head(0), tail(0), lengthMask(0) { }
 
     bool init(uint32 count) {
         lengthMask = JS_BITMASK(JS_CEILING_LOG2W(count));
-        vector = (JSFunctionBox **) js::OffTheBooks::malloc_(sizeof(JSFunctionBox) * length());
+        vector = (FunctionBox **) OffTheBooks::malloc_(sizeof(FunctionBox) * length());
         return !!vector;
     }
 
-    ~JSFunctionBoxQueue() { js::UnwantedForeground::free_(vector); }
+    ~FunctionBoxQueue() { UnwantedForeground::free_(vector); }
 
-    void push(JSFunctionBox *funbox) {
+    void push(FunctionBox *funbox) {
         if (!funbox->queued) {
             JS_ASSERT(count() < length());
             vector[head++ & lengthMask] = funbox;
             funbox->queued = true;
         }
     }
 
-    JSFunctionBox *pull() {
+    FunctionBox *pull() {
         if (tail == head)
             return NULL;
         JS_ASSERT(tail < head);
-        JSFunctionBox *funbox = vector[tail++ & lengthMask];
+        FunctionBox *funbox = vector[tail++ & lengthMask];
         funbox->queued = false;
         return funbox;
     }
 };
 
+} /* namespace js */
+
 #endif /* ParseNode_h__ */
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -111,31 +111,31 @@ using namespace js::gc;
         if (tokenStream.getToken((__flags)) != tt) {                                        \
             reportErrorNumber(NULL, JSREPORT_ERROR, errno);                                 \
             return NULL;                                                                    \
         }                                                                                   \
     JS_END_MACRO
 #define MUST_MATCH_TOKEN(tt, errno) MUST_MATCH_TOKEN_WITH_FLAGS(tt, errno, 0)
 
 Parser::Parser(JSContext *cx, JSPrincipals *prin, StackFrame *cfp, bool foldConstants)
-  : js::AutoGCRooter(cx, PARSER),
+  : AutoGCRooter(cx, PARSER),
     context(cx),
     tokenStream(cx),
     principals(NULL),
     callerFrame(cfp),
     callerVarObj(cfp ? &cfp->varObj() : NULL),
     nodeList(NULL),
     functionCount(0),
     traceListHead(NULL),
     tc(NULL),
     keepAtoms(cx->runtime),
     foldConstants(foldConstants)
 {
     cx->activeCompilations++;
-    js::PodArrayZero(tempFreeList);
+    PodArrayZero(tempFreeList);
     setPrincipals(prin);
     JS_ASSERT_IF(cfp, cfp->isScriptFrame());
 }
 
 bool
 Parser::init(const jschar *base, size_t length, const char *filename, uintN lineno,
              JSVersion version)
 {
@@ -164,53 +164,53 @@ void
 Parser::setPrincipals(JSPrincipals *prin)
 {
     JS_ASSERT(!principals);
     if (prin)
         JSPRINCIPALS_HOLD(context, prin);
     principals = prin;
 }
 
-JSObjectBox *
+ObjectBox *
 Parser::newObjectBox(JSObject *obj)
 {
     JS_ASSERT(obj);
 
     /*
      * We use JSContext.tempPool to allocate parsed objects and place them on
      * a list in this Parser to ensure GC safety. Thus the tempPool arenas
      * containing the entries must be alive until we are done with scanning,
      * parsing and code generation for the whole script or top-level function.
      */
-    JSObjectBox *objbox = context->tempLifoAlloc().new_<JSObjectBox>();
+    ObjectBox *objbox = context->tempLifoAlloc().new_<ObjectBox>();
     if (!objbox) {
         js_ReportOutOfMemory(context);
         return NULL;
     }
     objbox->traceLink = traceListHead;
     traceListHead = objbox;
     objbox->emitLink = NULL;
     objbox->object = obj;
     objbox->isFunctionBox = false;
     return objbox;
 }
 
-JSFunctionBox *
-Parser::newFunctionBox(JSObject *obj, JSParseNode *fn, JSTreeContext *tc)
+FunctionBox *
+Parser::newFunctionBox(JSObject *obj, ParseNode *fn, TreeContext *tc)
 {
     JS_ASSERT(obj);
     JS_ASSERT(obj->isFunction());
 
     /*
      * We use JSContext.tempPool to allocate parsed objects and place them on
      * a list in this Parser to ensure GC safety. Thus the tempPool arenas
      * containing the entries must be alive until we are done with scanning,
      * parsing and code generation for the whole script or top-level function.
      */
-    JSFunctionBox *funbox = context->tempLifoAlloc().newPod<JSFunctionBox>();
+    FunctionBox *funbox = context->tempLifoAlloc().newPod<FunctionBox>();
     if (!funbox) {
         js_ReportOutOfMemory(context);
         return NULL;
     }
     funbox->traceLink = traceListHead;
     traceListHead = funbox;
     funbox->emitLink = NULL;
     funbox->object = obj;
@@ -220,41 +220,41 @@ Parser::newFunctionBox(JSObject *obj, JS
     tc->functionList = funbox;
     ++tc->parser->functionCount;
     funbox->kids = NULL;
     funbox->parent = tc->funbox;
     funbox->methods = NULL;
     new (&funbox->bindings) Bindings(context);
     funbox->queued = false;
     funbox->inLoop = false;
-    for (JSStmtInfo *stmt = tc->topStmt; stmt; stmt = stmt->down) {
+    for (StmtInfo *stmt = tc->topStmt; stmt; stmt = stmt->down) {
         if (STMT_IS_LOOP(stmt)) {
             funbox->inLoop = true;
             break;
         }
     }
     funbox->level = tc->staticLevel;
     funbox->tcflags = (TCF_IN_FUNCTION | (tc->flags & (TCF_COMPILE_N_GO | TCF_STRICT_MODE_CODE)));
     if (tc->innermostWith)
         funbox->tcflags |= TCF_IN_WITH;
     return funbox;
 }
 
 void
 Parser::trace(JSTracer *trc)
 {
-    JSObjectBox *objbox = traceListHead;
+    ObjectBox *objbox = traceListHead;
     while (objbox) {
         MarkObject(trc, *objbox->object, "parser.object");
         if (objbox->isFunctionBox)
-            static_cast<JSFunctionBox *>(objbox)->bindings.trace(trc);
+            static_cast<FunctionBox *>(objbox)->bindings.trace(trc);
         objbox = objbox->traceLink;
     }
 
-    for (JSTreeContext *tc = this->tc; tc; tc = tc->parent)
+    for (TreeContext *tc = this->tc; tc; tc = tc->parent)
         tc->trace(trc);
 }
 
 /*
  * Walk the function box list at |*funboxHead|, removing boxes for deleted
  * functions and cleaning up method lists. We do this once, before
  * performing function analysis, to avoid traversing possibly long function
  * lists repeatedly when recycling nodes.
@@ -278,20 +278,20 @@ Parser::trace(JSTracer *trc)
  *   function box tree; it could later be recycled, reallocated, and turned
  *   into anything at all. (Fortunately, method list members never get
  *   mutated, so we don't have to worry about that case.)
  *   PrepareNodeForMutation clears the node's function box's node pointer,
  *   disconnecting it entirely from the function box tree, and marking the
  *   function box to be trimmed out.
  */
 void
-Parser::cleanFunctionList(JSFunctionBox **funboxHead)
+Parser::cleanFunctionList(FunctionBox **funboxHead)
 {
-    JSFunctionBox **link = funboxHead;
-    while (JSFunctionBox *box = *link) {
+    FunctionBox **link = funboxHead;
+    while (FunctionBox *box = *link) {
         if (!box->node) {
             /*
              * This funbox's parse node was mutated into something else. Drop the box,
              * and stay at the same link.
              */
             *link = box->siblings;
         } else if (!box->node->pn_funbox) {
             /*
@@ -300,18 +300,18 @@ Parser::cleanFunctionList(JSFunctionBox 
              */
             *link = box->siblings;
             AddNodeToFreeList(box->node, this);
         } else {
             /* The function is still live. */
 
             /* First, remove nodes for deleted functions from our methods list. */
             {
-                JSParseNode **methodLink = &box->methods;
-                while (JSParseNode *method = *methodLink) {
+                ParseNode **methodLink = &box->methods;
+                while (ParseNode *method = *methodLink) {
                     /* Method nodes are never rewritten in place to be other kinds of nodes. */
                     JS_ASSERT(method->isArity(PN_FUNC));
                     if (!method->pn_funbox) {
                         /* Deleted: drop the node, and stay on this link. */
                         *methodLink = method->pn_link;
                     } else {
                         /* Live: keep the node, and move to the next link. */
                         methodLink = &method->pn_link;
@@ -324,55 +324,55 @@ Parser::cleanFunctionList(JSFunctionBox 
 
             /* Keep the box on the list, and move to the next link. */
             link = &box->siblings;
         }
     }
 }
 
 static bool
-GenerateBlockIdForStmtNode(JSParseNode *pn, JSTreeContext *tc)
+GenerateBlockIdForStmtNode(ParseNode *pn, TreeContext *tc)
 {
     JS_ASSERT(tc->topStmt);
     JS_ASSERT(STMT_MAYBE_SCOPE(tc->topStmt));
     JS_ASSERT(pn->isKind(TOK_LC) || pn->isKind(TOK_LEXICALSCOPE));
     if (!GenerateBlockId(tc, tc->topStmt->blockid))
         return false;
     pn->pn_blockid = tc->topStmt->blockid;
     return true;
 }
 
 /*
  * Parse a top-level JS script.
  */
-JSParseNode *
+ParseNode *
 Parser::parse(JSObject *chain)
 {
     /*
      * Protect atoms from being collected by a GC activation, which might
      * - nest on this thread due to out of memory (the so-called "last ditch"
      *   GC attempted within js_NewGCThing), or
      * - run for any reason on another thread if this thread is suspended on
      *   an object lock before it finishes generating bytecode into a script
      *   protected from the GC by a root or a stack frame reference.
      */
-    JSTreeContext globaltc(this);
+    TreeContext globaltc(this);
     if (!globaltc.init(context))
         return NULL;
     globaltc.setScopeChain(chain);
     if (!GenerateBlockId(&globaltc, globaltc.bodyid))
         return NULL;
 
-    JSParseNode *pn = statements();
+    ParseNode *pn = statements();
     if (pn) {
         if (!tokenStream.matchToken(TOK_EOF)) {
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
             pn = NULL;
         } else if (foldConstants) {
-            if (!js_FoldConstants(context, pn, &globaltc))
+            if (!FoldConstants(context, pn, &globaltc))
                 pn = NULL;
         }
     }
     return pn;
 }
 
 JS_STATIC_ASSERT(UpvarCookie::FREE_LEVEL == JS_BITMASK(JSFB_LEVEL_BITS));
 
@@ -382,19 +382,19 @@ JS_STATIC_ASSERT(UpvarCookie::FREE_LEVEL
  * that contains an early return e1 will get a strict warning.  Similarly for
  * iloops: while (true){...} is treated as though ... returns.
  */
 #define ENDS_IN_OTHER   0
 #define ENDS_IN_RETURN  1
 #define ENDS_IN_BREAK   2
 
 static int
-HasFinalReturn(JSParseNode *pn)
+HasFinalReturn(ParseNode *pn)
 {
-    JSParseNode *pn2, *pn3;
+    ParseNode *pn2, *pn3;
     uintN rv, rv2, hasDefault;
 
     switch (pn->getKind()) {
       case TOK_LC:
         if (!pn->pn_head)
             return ENDS_IN_OTHER;
         return HasFinalReturn(pn->last());
 
@@ -499,44 +499,44 @@ HasFinalReturn(JSParseNode *pn)
         return HasFinalReturn(pn->pn_right);
 
       default:
         return ENDS_IN_OTHER;
     }
 }
 
 static JSBool
-ReportBadReturn(JSContext *cx, JSTreeContext *tc, JSParseNode *pn, uintN flags, uintN errnum,
+ReportBadReturn(JSContext *cx, TreeContext *tc, ParseNode *pn, uintN flags, uintN errnum,
                 uintN anonerrnum)
 {
     JSAutoByteString name;
     if (tc->fun()->atom) {
         if (!js_AtomToPrintableString(cx, tc->fun()->atom, &name))
             return false;
     } else {
         errnum = anonerrnum;
     }
     return ReportCompileErrorNumber(cx, TS(tc->parser), pn, flags, errnum, name.ptr());
 }
 
 static JSBool
-CheckFinalReturn(JSContext *cx, JSTreeContext *tc, JSParseNode *pn)
+CheckFinalReturn(JSContext *cx, TreeContext *tc, ParseNode *pn)
 {
     JS_ASSERT(tc->inFunction());
     return HasFinalReturn(pn) == ENDS_IN_RETURN ||
            ReportBadReturn(cx, tc, pn, JSREPORT_WARNING | JSREPORT_STRICT,
                            JSMSG_NO_RETURN_VALUE, JSMSG_ANON_NO_RETURN_VALUE);
 }
 
 /*
  * Check that it is permitted to assign to lhs.  Strict mode code may not
  * assign to 'eval' or 'arguments'.
  */
 static bool
-CheckStrictAssignment(JSContext *cx, JSTreeContext *tc, JSParseNode *lhs)
+CheckStrictAssignment(JSContext *cx, TreeContext *tc, ParseNode *lhs)
 {
     if (tc->needStrictChecks() && lhs->isKind(TOK_NAME)) {
         JSAtom *atom = lhs->pn_atom;
         JSAtomState *atomState = &cx->runtime->atomState;
         if (atom == atomState->evalAtom || atom == atomState->argumentsAtom) {
             JSAutoByteString name;
             if (!js_AtomToPrintableString(cx, atom, &name) ||
                 !ReportStrictModeError(cx, TS(tc->parser), tc, lhs, JSMSG_DEPRECATED_ASSIGN,
@@ -550,17 +550,17 @@ CheckStrictAssignment(JSContext *cx, JST
 
 /*
  * Check that it is permitted to introduce a binding for atom.  Strict mode
  * forbids introducing new definitions for 'eval', 'arguments', or for any
  * strict mode reserved keyword.  Use pn for reporting error locations, or use
  * tc's token stream if pn is NULL.
  */
 bool
-CheckStrictBinding(JSContext *cx, JSTreeContext *tc, PropertyName *name, JSParseNode *pn)
+CheckStrictBinding(JSContext *cx, TreeContext *tc, PropertyName *name, ParseNode *pn)
 {
     if (!tc->needStrictChecks())
         return true;
 
     JSAtomState *atomState = &cx->runtime->atomState;
     if (name == atomState->evalAtom ||
         name == atomState->argumentsAtom ||
         FindKeyword(name->charsZ(), name->length()))
@@ -570,34 +570,34 @@ CheckStrictBinding(JSContext *cx, JSTree
             return false;
         return ReportStrictModeError(cx, TS(tc->parser), tc, pn, JSMSG_BAD_BINDING, bytes.ptr());
     }
 
     return true;
 }
 
 static bool
-ReportBadParameter(JSContext *cx, JSTreeContext *tc, JSAtom *name, uintN errorNumber)
+ReportBadParameter(JSContext *cx, TreeContext *tc, JSAtom *name, uintN errorNumber)
 {
-    JSDefinition *dn = tc->decls.lookupFirst(name);
+    Definition *dn = tc->decls.lookupFirst(name);
     JSAutoByteString bytes;
     return js_AtomToPrintableString(cx, name, &bytes) &&
            ReportStrictModeError(cx, TS(tc->parser), tc, dn, errorNumber, bytes.ptr());
 }
 
 namespace js {
 
 /*
  * In strict mode code, all parameter names must be distinct, must not be
  * strict mode reserved keywords, and must not be 'eval' or 'arguments'.  We
  * must perform these checks here, and not eagerly during parsing, because a
  * function's body may turn on strict mode for the function head.
  */
 bool
-CheckStrictParameters(JSContext *cx, JSTreeContext *tc)
+CheckStrictParameters(JSContext *cx, TreeContext *tc)
 {
     JS_ASSERT(tc->inFunction());
 
     if (!tc->needStrictChecks() || tc->bindings.countArgs() == 0)
         return true;
 
     JSAtom *argumentsAtom = cx->runtime->atomState.argumentsAtom;
     JSAtom *evalAtom = cx->runtime->atomState.evalAtom;
@@ -643,29 +643,29 @@ CheckStrictParameters(JSContext *cx, JST
         }
     }
 
     return true;
 }
 
 } /* namespace js */
 
-JSParseNode *
+ParseNode *
 Parser::functionBody()
 {
     JS_ASSERT(tc->inFunction());
 
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     js_PushStatement(tc, &stmtInfo, STMT_BLOCK, -1);
     stmtInfo.flags = SIF_BODY_BLOCK;
 
     uintN oldflags = tc->flags;
     tc->flags &= ~(TCF_RETURN_EXPR | TCF_RETURN_VOID);
 
-    JSParseNode *pn;
+    ParseNode *pn;
 #if JS_HAS_EXPR_CLOSURES
     if (tokenStream.currentToken().type == TOK_LC) {
         pn = statements();
     } else {
         pn = UnaryNode::create(tc);
         if (pn) {
             pn->pn_kid = assignExpr();
             if (!pn->pn_kid) {
@@ -698,108 +698,108 @@ Parser::functionBody()
             pn = NULL;
         }
     }
 
     tc->flags = oldflags | (tc->flags & TCF_FUN_FLAGS);
     return pn;
 }
 
-/* Create a placeholder JSDefinition node for |atom|. */
-static JSDefinition *
-MakePlaceholder(JSParseNode *pn, JSTreeContext *tc)
+/* Create a placeholder Definition node for |atom|. */
+static Definition *
+MakePlaceholder(ParseNode *pn, TreeContext *tc)
 {
-    JSDefinition *dn = (JSDefinition *) NameNode::create(pn->pn_atom, tc);
+    Definition *dn = (Definition *) NameNode::create(pn->pn_atom, tc);
     if (!dn)
         return NULL;
 
     dn->setKind(TOK_NAME);
     dn->setOp(JSOP_NOP);
     dn->setDefn(true);
     dn->pn_dflags |= PND_PLACEHOLDER;
     return dn;
 }
 
 static bool
-Define(JSParseNode *pn, JSAtom *atom, JSTreeContext *tc, bool let = false)
+Define(ParseNode *pn, JSAtom *atom, TreeContext *tc, bool let = false)
 {
     JS_ASSERT(!pn->isUsed());
     JS_ASSERT_IF(pn->isDefn(), pn->isPlaceholder());
 
     bool foundLexdep = false;
-    JSDefinition *dn = NULL;
+    Definition *dn = NULL;
 
     if (let)
         dn = tc->decls.lookupFirst(atom);
 
     if (!dn) {
         dn = tc->lexdeps.lookupDefn(atom);
         foundLexdep = !!dn;
     }
 
     if (dn && dn != pn) {
-        JSParseNode **pnup = &dn->dn_uses;
-        JSParseNode *pnu;
+        ParseNode **pnup = &dn->dn_uses;
+        ParseNode *pnu;
         uintN start = let ? pn->pn_blockid : tc->bodyid;
 
         while ((pnu = *pnup) != NULL && pnu->pn_blockid >= start) {
             JS_ASSERT(pnu->isUsed());
-            pnu->pn_lexdef = (JSDefinition *) pn;
+            pnu->pn_lexdef = (Definition *) pn;
             pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
             pnup = &pnu->pn_link;
         }
 
         if (pnu != dn->dn_uses) {
             *pnup = pn->dn_uses;
             pn->dn_uses = dn->dn_uses;
             dn->dn_uses = pnu;
 
             if ((!pnu || pnu->pn_blockid < tc->bodyid) && foundLexdep)
                 tc->lexdeps->remove(atom);
         }
     }
 
-    JSDefinition *toAdd = (JSDefinition *) pn;
+    Definition *toAdd = (Definition *) pn;
     bool ok = let ? tc->decls.addShadow(atom, toAdd) : tc->decls.addUnique(atom, toAdd);
     if (!ok)
         return false;
     pn->setDefn(true);
     pn->pn_dflags &= ~PND_PLACEHOLDER;
     if (!tc->parent)
         pn->pn_dflags |= PND_TOPLEVEL;
     return true;
 }
 
 static void
-ForgetUse(JSParseNode *pn)
+ForgetUse(ParseNode *pn)
 {
     if (!pn->isUsed()) {
         JS_ASSERT(!pn->isDefn());
         return;
     }
 
-    JSParseNode **pnup = &pn->lexdef()->dn_uses;
-    JSParseNode *pnu;
+    ParseNode **pnup = &pn->lexdef()->dn_uses;
+    ParseNode *pnu;
     while ((pnu = *pnup) != pn)
         pnup = &pnu->pn_link;
     *pnup = pn->pn_link;
     pn->setUsed(false);
 }
 
-static JSParseNode *
-MakeAssignment(JSParseNode *pn, JSParseNode *rhs, JSTreeContext *tc)
+static ParseNode *
+MakeAssignment(ParseNode *pn, ParseNode *rhs, TreeContext *tc)
 {
-    JSParseNode *lhs = NewOrRecycledNode(tc);
+    ParseNode *lhs = NewOrRecycledNode(tc);
     if (!lhs)
         return NULL;
     *lhs = *pn;
 
     if (pn->isUsed()) {
-        JSDefinition *dn = pn->pn_lexdef;
-        JSParseNode **pnup = &dn->dn_uses;
+        Definition *dn = pn->pn_lexdef;
+        ParseNode **pnup = &dn->dn_uses;
 
         while (*pnup != pn)
             pnup = &(*pnup)->pn_link;
         *pnup = lhs;
         lhs->pn_link = pn->pn_link;
         pn->pn_link = NULL;
     }
 
@@ -809,71 +809,71 @@ MakeAssignment(JSParseNode *pn, JSParseN
     pn->setInParens(false);
     pn->setUsed(false);
     pn->setDefn(false);
     pn->pn_left = lhs;
     pn->pn_right = rhs;
     return lhs;
 }
 
-static JSParseNode *
-MakeDefIntoUse(JSDefinition *dn, JSParseNode *pn, JSAtom *atom, JSTreeContext *tc)
+static ParseNode *
+MakeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom *atom, TreeContext *tc)
 {
     /*
      * If dn is arg, or in [var, const, let] and has an initializer, then we
      * must rewrite it to be an assignment node, whose freshly allocated
      * left-hand side becomes a use of pn.
      */
     if (dn->isBindingForm()) {
-        JSParseNode *rhs = dn->expr();
+        ParseNode *rhs = dn->expr();
         if (rhs) {
-            JSParseNode *lhs = MakeAssignment(dn, rhs, tc);
+            ParseNode *lhs = MakeAssignment(dn, rhs, tc);
             if (!lhs)
                 return NULL;
             //pn->dn_uses = lhs;
-            dn = (JSDefinition *) lhs;
+            dn = (Definition *) lhs;
         }
 
         dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETNAME : JSOP_NAME);
-    } else if (dn->kind() == JSDefinition::FUNCTION) {
+    } else if (dn->kind() == Definition::FUNCTION) {
         JS_ASSERT(dn->isOp(JSOP_NOP));
         PrepareNodeForMutation(dn, tc);
         dn->setKind(TOK_NAME);
         dn->setArity(PN_NAME);
         dn->pn_atom = atom;
     }
 
     /* Now make dn no longer a definition, rather a use of pn. */
     JS_ASSERT(dn->isKind(TOK_NAME));
     JS_ASSERT(dn->isArity(PN_NAME));
     JS_ASSERT(dn->pn_atom == atom);
 
-    for (JSParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
+    for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
         JS_ASSERT(pnu->isUsed());
         JS_ASSERT(!pnu->isDefn());
-        pnu->pn_lexdef = (JSDefinition *) pn;
+        pnu->pn_lexdef = (Definition *) pn;
         pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
     }
     pn->pn_dflags |= dn->pn_dflags & PND_USE2DEF_FLAGS;
     pn->dn_uses = dn;
 
     dn->setDefn(false);
     dn->setUsed(true);
-    dn->pn_lexdef = (JSDefinition *) pn;
+    dn->pn_lexdef = (Definition *) pn;
     dn->pn_cookie.makeFree();
     dn->pn_dflags &= ~PND_BOUND;
     return dn;
 }
 
 namespace js {
 
 bool
-DefineArg(JSParseNode *pn, JSAtom *atom, uintN i, JSTreeContext *tc)
+DefineArg(ParseNode *pn, JSAtom *atom, uintN i, TreeContext *tc)
 {
-    JSParseNode *argpn, *argsbody;
+    ParseNode *argpn, *argsbody;
 
     /* Flag tc so we don't have to lookup arguments on every use. */
     if (atom == tc->parser->context->runtime->atomState.argumentsAtom)
         tc->flags |= TCF_FUN_PARAM_ARGUMENTS;
 
     /*
      * Make an argument definition node, distinguished by being in tc->decls
      * but having TOK_NAME type and JSOP_NOP op. Insert it in a TOK_ARGSBODY
@@ -912,35 +912,35 @@ DefineArg(JSParseNode *pn, JSAtom *atom,
 /*
  * Parameter block types for the several Binder functions.  We use a common
  * helper function signature in order to share code among destructuring and
  * simple variable declaration parsers.  In the destructuring case, the binder
  * function is called indirectly from the variable declaration parser by way
  * of CheckDestructuring and its friends.
  */
 typedef JSBool
-(*Binder)(JSContext *cx, BindData *data, JSAtom *atom, JSTreeContext *tc);
+(*Binder)(JSContext *cx, BindData *data, JSAtom *atom, TreeContext *tc);
 
 struct BindData {
     BindData() : fresh(true) {}
 
-    JSParseNode     *pn;        /* name node for definition processing and
+    ParseNode       *pn;        /* name node for definition processing and
                                    error source coordinates */
     JSOp            op;         /* prolog bytecode or nop */
     Binder          binder;     /* binder, discriminates u */
     union {
         struct {
             uintN   overflow;
         } let;
     };
     bool fresh;
 };
 
 static bool
-BindLocalVariable(JSContext *cx, JSTreeContext *tc, JSParseNode *pn, BindingKind kind)
+BindLocalVariable(JSContext *cx, TreeContext *tc, ParseNode *pn, BindingKind kind)
 {
     JS_ASSERT(kind == VARIABLE || kind == CONSTANT);
 
     /* 'arguments' can be bound as a local only via a destructuring formal parameter. */
     JS_ASSERT_IF(pn->pn_atom == cx->runtime->atomState.argumentsAtom, kind == VARIABLE);
 
     uintN index = tc->bindings.countVars();
     if (!tc->bindings.add(cx, pn->pn_atom, kind))
@@ -948,17 +948,17 @@ BindLocalVariable(JSContext *cx, JSTreeC
 
     pn->pn_cookie.set(tc->staticLevel, index);
     pn->pn_dflags |= PND_BOUND;
     return true;
 }
 
 #if JS_HAS_DESTRUCTURING
 static JSBool
-BindDestructuringArg(JSContext *cx, BindData *data, JSAtom *atom, JSTreeContext *tc)
+BindDestructuringArg(JSContext *cx, BindData *data, JSAtom *atom, TreeContext *tc)
 {
     /* Flag tc so we don't have to lookup arguments on every use. */
     if (atom == tc->parser->context->runtime->atomState.argumentsAtom)
         tc->flags |= TCF_FUN_PARAM_ARGUMENTS;
 
     JS_ASSERT(tc->inFunction());
 
     /*
@@ -967,17 +967,17 @@ BindDestructuringArg(JSContext *cx, Bind
      *     been parsed.
      */
     if (tc->decls.lookupFirst(atom)) {
         ReportCompileErrorNumber(cx, TS(tc->parser), NULL, JSREPORT_ERROR,
                                  JSMSG_DESTRUCT_DUP_ARG);
         return JS_FALSE;
     }
 
-    JSParseNode *pn = data->pn;
+    ParseNode *pn = data->pn;
 
     /*
      * Distinguish destructured-to binding nodes as vars, not args, by setting
      * pn_op to JSOP_SETLOCAL. Parser::functionDef checks for this pn_op value
      * when processing the destructuring-assignment AST prelude induced by such
      * destructuring args in Parser::functionArguments.
      *
      * We must set the PND_BOUND flag too to prevent pn_op from being reset to
@@ -996,17 +996,17 @@ BindDestructuringArg(JSContext *cx, Bind
     pn->setOp(JSOP_SETLOCAL);
     pn->pn_dflags |= PND_BOUND;
 
     return Define(pn, atom, tc);
 }
 #endif /* JS_HAS_DESTRUCTURING */
 
 JSFunction *
-Parser::newFunction(JSTreeContext *tc, JSAtom *atom, FunctionSyntaxKind kind)
+Parser::newFunction(TreeContext *tc, JSAtom *atom, FunctionSyntaxKind kind)
 {
     JS_ASSERT_IF(kind == Statement, atom != NULL);
 
     /*
      * Find the global compilation context in order to pre-set the newborn
      * function's parent slot to tc->scopeChain. If the global context is a
      * compile-and-go one, we leave the pre-set parent intact; otherwise we
      * clear parent and proto.
@@ -1038,17 +1038,17 @@ MatchOrInsertSemicolon(JSContext *cx, To
         ReportCompileErrorNumber(cx, ts, NULL, JSREPORT_ERROR, JSMSG_SEMI_BEFORE_STMNT);
         return JS_FALSE;
     }
     (void) ts->matchToken(TOK_SEMI);
     return JS_TRUE;
 }
 
 bool
-Parser::analyzeFunctions(JSTreeContext *tc)
+Parser::analyzeFunctions(TreeContext *tc)
 {
     cleanFunctionList(&tc->functionList);
     if (!tc->functionList)
         return true;
     if (!markFunArgs(tc->functionList))
         return false;
     markExtensibleScopeDescendants(tc->functionList, false);
     setFunctionKinds(tc->functionList, &tc->flags);
@@ -1081,22 +1081,22 @@ Parser::analyzeFunctions(JSTreeContext *
  *
  * Return the minimal "skipmin" for funbox and its siblings. This is the delta
  * between the static level of the bodies of funbox and its peers (which must
  * be funbox->level + 1), and the static level of the nearest upvar among all
  * the upvars contained by funbox and its peers. If there are no upvars, return
  * FREE_STATIC_LEVEL. Thus this function never returns 0.
  */
 static uintN
-FindFunArgs(JSFunctionBox *funbox, int level, JSFunctionBoxQueue *queue)
+FindFunArgs(FunctionBox *funbox, int level, FunctionBoxQueue *queue)
 {
     uintN allskipmin = UpvarCookie::FREE_LEVEL;
 
     do {
-        JSParseNode *fn = funbox->node;
+        ParseNode *fn = funbox->node;
         JS_ASSERT(fn->isArity(PN_FUNC));
         JSFunction *fun = funbox->function();
         int fnlevel = level;
 
         /*
          * An eval can leak funbox, functions along its ancestor line, and its
          * immediate kids. Since FindFunArgs uses DFS and the parser propagates
          * TCF_FUN_HEAVYWEIGHT bottom up, funbox's ancestor function nodes have
@@ -1107,35 +1107,35 @@ FindFunArgs(JSFunctionBox *funbox, int l
          * of a generator function doesn't escape, anything defined or referred
          * to inside the generator can escape through a call to the generator.
          * We could imagine doing static analysis to track the calls and see
          * if any iterators or values returned by iterators escape, but that
          * would be hard, so instead we just assume everything might escape.
          */
         if (funbox->tcflags & (TCF_FUN_HEAVYWEIGHT | TCF_FUN_IS_GENERATOR)) {
             fn->setFunArg();
-            for (JSFunctionBox *kid = funbox->kids; kid; kid = kid->siblings)
+            for (FunctionBox *kid = funbox->kids; kid; kid = kid->siblings)
                 kid->node->setFunArg();
         }
 
         /*
          * Compute in skipmin the least distance from fun's static level up to
          * an upvar, whether used directly by fun, or indirectly by a function
          * nested in fun.
          */
         uintN skipmin = UpvarCookie::FREE_LEVEL;
-        JSParseNode *pn = fn->pn_body;
+        ParseNode *pn = fn->pn_body;
 
         if (pn->isKind(TOK_UPVARS)) {
             AtomDefnMapPtr &upvars = pn->pn_names;
             JS_ASSERT(upvars->count() != 0);
 
             for (AtomDefnRange r = upvars->all(); !r.empty(); r.popFront()) {
-                JSDefinition *defn = r.front().value();
-                JSDefinition *lexdep = defn->resolve();
+                Definition *defn = r.front().value();
+                Definition *lexdep = defn->resolve();
 
                 if (!lexdep->isFreeVar()) {
                     uintN upvarLevel = lexdep->frameLevel();
 
                     if (int(upvarLevel) <= fnlevel)
                         fn->setFunArg();
 
                     uintN skip = (funbox->level + 1) - upvarLevel;
@@ -1184,54 +1184,54 @@ FindFunArgs(JSFunctionBox *funbox, int l
                 allskipmin = skipmin;
         }
     } while ((funbox = funbox->siblings) != NULL);
 
     return allskipmin;
 }
 
 bool
-Parser::markFunArgs(JSFunctionBox *funbox)
+Parser::markFunArgs(FunctionBox *funbox)
 {
-    JSFunctionBoxQueue queue;
+    FunctionBoxQueue queue;
     if (!queue.init(functionCount)) {
         js_ReportOutOfMemory(context);
         return false;
     }
 
     FindFunArgs(funbox, -1, &queue);
     while ((funbox = queue.pull()) != NULL) {
-        JSParseNode *fn = funbox->node;
+        ParseNode *fn = funbox->node;
         JS_ASSERT(fn->isFunArg());
 
-        JSParseNode *pn = fn->pn_body;
+        ParseNode *pn = fn->pn_body;
         if (pn->isKind(TOK_UPVARS)) {
             AtomDefnMapPtr upvars = pn->pn_names;
             JS_ASSERT(!upvars->empty());
 
             for (AtomDefnRange r = upvars->all(); !r.empty(); r.popFront()) {
-                JSDefinition *defn = r.front().value();
-                JSDefinition *lexdep = defn->resolve();
+                Definition *defn = r.front().value();
+                Definition *lexdep = defn->resolve();
 
                 if (!lexdep->isFreeVar() &&
                     !lexdep->isFunArg() &&
-                    (lexdep->kind() == JSDefinition::FUNCTION ||
+                    (lexdep->kind() == Definition::FUNCTION ||
                      lexdep->isOp(JSOP_CALLEE))) {
                     /*
                      * Mark this formerly-Algol-like function as an escaping
                      * function (i.e., as a funarg), because it is used from
                      * another funarg.
                      *
                      * Progress is guaranteed because we set the funarg flag
                      * here, which suppresses revisiting this function (thanks
                      * to the !lexdep->isFunArg() test just above).
                      */
                     lexdep->setFunArg();
 
-                    JSFunctionBox *afunbox;
+                    FunctionBox *afunbox;
                     if (lexdep->isOp(JSOP_CALLEE)) {
                         /*
                          * A named function expression will not appear to be a
                          * funarg if it is immediately applied. However, if its
                          * name is used in an escaping function nested within
                          * it, then it must become flagged as a funarg again.
                          * See bug 545980.
                          */
@@ -1259,31 +1259,31 @@ Parser::markFunArgs(JSFunctionBox *funbo
                 }
             }
         }
     }
     return true;
 }
 
 static uint32
-MinBlockId(JSParseNode *fn, uint32 id)
+MinBlockId(ParseNode *fn, uint32 id)
 {
     if (fn->pn_blockid < id)
         return false;
     if (fn->isDefn()) {
-        for (JSParseNode *pn = fn->dn_uses; pn; pn = pn->pn_link) {
+        for (ParseNode *pn = fn->dn_uses; pn; pn = pn->pn_link) {
             if (pn->pn_blockid < id)
                 return false;
         }
     }
     return true;
 }
 
 static inline bool
-CanFlattenUpvar(JSDefinition *dn, JSFunctionBox *funbox, uint32 tcflags)
+CanFlattenUpvar(Definition *dn, FunctionBox *funbox, uint32 tcflags)
 {
     /*
      * Consider the current function (the lambda, innermost below) using a var
      * x defined two static levels up:
      *
      *  function f() {
      *      // z = g();
      *      var x = 42;
@@ -1293,17 +1293,17 @@ CanFlattenUpvar(JSDefinition *dn, JSFunc
      *      return g();
      *  }
      *
      * So long as (1) the initialization in 'var x = 42' dominates all uses of
      * g and (2) x is not reassigned, it is safe to optimize the lambda to a
      * flat closure. Uncommenting the early call to g makes this optimization
      * unsafe (z could name a global setter that calls its argument).
      */
-    JSFunctionBox *afunbox = funbox;
+    FunctionBox *afunbox = funbox;
     uintN dnLevel = dn->frameLevel();
 
     JS_ASSERT(dnLevel <= funbox->level);
     while (afunbox->level != dnLevel) {
         afunbox = afunbox->parent;
 
         /*
          * NB: afunbox can't be null because we are sure to find a function box
@@ -1362,44 +1362,44 @@ CanFlattenUpvar(JSDefinition *dn, JSFunc
     if (!(afun->flags & JSFUN_LAMBDA)) {
         if (dn->isBindingForm() || dn->pn_pos >= afunbox->node->pn_pos)
             return false;
     }
 
     if (!dn->isInitialized())
         return false;
 
-    JSDefinition::Kind dnKind = dn->kind();
-    if (dnKind != JSDefinition::CONST) {
+    Definition::Kind dnKind = dn->kind();
+    if (dnKind != Definition::CONST) {
         if (dn->isAssigned())
             return false;
 
         /*
          * Any formal could be mutated behind our back via the arguments
          * object, so deoptimize if the outer function uses arguments.
          *
          * In a Function constructor call where the final argument -- the body
          * source for the function to create -- contains a nested function
          * definition or expression, afunbox->parent will be null. The body
          * source might use |arguments| outside of any nested functions it may
          * contain, so we have to check the tcflags parameter that was passed
          * in from Compiler::compileFunctionBody.
          */
-        if (dnKind == JSDefinition::ARG &&
+        if (dnKind == Definition::ARG &&
             ((afunbox->parent ? afunbox->parent->tcflags : tcflags) & TCF_FUN_USES_ARGUMENTS)) {
             return false;
         }
     }
 
     /*
      * Check quick-and-dirty dominance relation. Function definitions dominate
      * their uses thanks to hoisting.  Other binding forms hoist as undefined,
      * of course, so check forward-reference and blockid relations.
      */
-    if (dnKind != JSDefinition::FUNCTION) {
+    if (dnKind != Definition::FUNCTION) {
         /*
          * Watch out for code such as
          *
          *   (function () {
          *   ...
          *   var jQuery = ... = function (...) {
          *       return new jQuery.foo.bar(baz);
          *   }
@@ -1414,17 +1414,17 @@ CanFlattenUpvar(JSDefinition *dn, JSFunc
             return false;
         if (!MinBlockId(afunbox->node, dn->pn_blockid))
             return false;
     }
     return true;
 }
 
 static void
-FlagHeavyweights(JSDefinition *dn, JSFunctionBox *funbox, uint32 *tcflags)
+FlagHeavyweights(Definition *dn, FunctionBox *funbox, uint32 *tcflags)
 {
     uintN dnLevel = dn->frameLevel();
 
     while ((funbox = funbox->parent) != NULL) {
         /*
          * Notice that funbox->level is the static level of the definition or
          * expression of the function parsed into funbox, not the static level
          * of its body. Therefore we must add 1 to match dn's level to find the
@@ -1437,78 +1437,78 @@ FlagHeavyweights(JSDefinition *dn, JSFun
         funbox->tcflags |= TCF_FUN_ENTRAINS_SCOPES;
     }
 
     if (!funbox && (*tcflags & TCF_IN_FUNCTION))
         *tcflags |= TCF_FUN_HEAVYWEIGHT;
 }
 
 static bool
-DeoptimizeUsesWithin(JSDefinition *dn, const TokenPos &pos)
+DeoptimizeUsesWithin(Definition *dn, const TokenPos &pos)
 {
     uintN ndeoptimized = 0;
 
-    for (JSParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
+    for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
         JS_ASSERT(pnu->isUsed());
         JS_ASSERT(!pnu->isDefn());
         if (pnu->pn_pos.begin >= pos.begin && pnu->pn_pos.end <= pos.end) {
             pnu->pn_dflags |= PND_DEOPTIMIZED;
             ++ndeoptimized;
         }
     }
 
     return ndeoptimized != 0;
 }
 
 static void
-ConsiderUnbranding(JSFunctionBox *funbox)
+ConsiderUnbranding(FunctionBox *funbox)
 {
     /*
      * We've already recursively set our kids' kinds, which also classifies
      * enclosing functions holding upvars referenced in those descendants'
      * bodies. So now we can check our "methods".
      *
      * Despecialize from branded method-identity-based shape to shape- or
      * slot-based shape if this function smells like a constructor and too many
      * of its methods are *not* joinable null closures (i.e., they have one or
      * more upvars fetched via the display).
      */
     bool returnsExpr = !!(funbox->tcflags & TCF_RETURN_EXPR);
 #if JS_HAS_EXPR_CLOSURES
     {
-        JSParseNode *pn2 = funbox->node->pn_body;
+        ParseNode *pn2 = funbox->node->pn_body;
         if (pn2->isKind(TOK_UPVARS))
             pn2 = pn2->pn_tree;
         if (pn2->isKind(TOK_ARGSBODY))
             pn2 = pn2->last();
         if (!pn2->isKind(TOK_LC))
             returnsExpr = true;
     }
 #endif
     if (!returnsExpr) {
         uintN methodSets = 0, slowMethodSets = 0;
 
-        for (JSParseNode *method = funbox->methods; method; method = method->pn_link) {
+        for (ParseNode *method = funbox->methods; method; method = method->pn_link) {
             JS_ASSERT(method->isOp(JSOP_LAMBDA) || method->isOp(JSOP_LAMBDA_FC));
             ++methodSets;
             if (!method->pn_funbox->joinable())
                 ++slowMethodSets;
         }
 
         if (funbox->shouldUnbrand(methodSets, slowMethodSets))
             funbox->tcflags |= TCF_FUN_UNBRAND_THIS;
     }
 }
 
 void
-Parser::setFunctionKinds(JSFunctionBox *funbox, uint32 *tcflags)
+Parser::setFunctionKinds(FunctionBox *funbox, uint32 *tcflags)
 {
     for (; funbox; funbox = funbox->siblings) {
-        JSParseNode *fn = funbox->node;
-        JSParseNode *pn = fn->pn_body;
+        ParseNode *fn = funbox->node;
+        ParseNode *pn = fn->pn_body;
 
         if (funbox->kids) {
             setFunctionKinds(funbox->kids, tcflags);
             ConsiderUnbranding(funbox);
         }
 
         JSFunction *fun = funbox->function();
 
@@ -1527,18 +1527,18 @@ Parser::setFunctionKinds(JSFunctionBox *
                 JS_ASSERT(!upvars->empty());
 
                 /*
                  * For each lexical dependency from this closure to an outer
                  * binding, analyze whether it is safe to copy the binding's
                  * value into a flat closure slot when the closure is formed.
                  */
                 for (AtomDefnRange r = upvars->all(); !r.empty(); r.popFront()) {
-                    JSDefinition *defn = r.front().value();
-                    JSDefinition *lexdep = defn->resolve();
+                    Definition *defn = r.front().value();
+                    Definition *lexdep = defn->resolve();
 
                     if (!lexdep->isFreeVar()) {
                         hasUpvars = true;
                         if (!CanFlattenUpvar(lexdep, funbox, *tcflags)) {
                             /*
                              * Can't flatten. Enclosing functions holding
                              * variables used by this function will be flagged
                              * heavyweight below. FIXME bug 545759: re-enable
@@ -1582,41 +1582,41 @@ Parser::setFunctionKinds(JSFunctionBox *
              *
              * The emitter must see TCF_FUN_HEAVYWEIGHT accurately before
              * generating any code for a tree of nested functions.
              */
             AtomDefnMapPtr upvars = pn->pn_names;
             JS_ASSERT(!upvars->empty());
 
             for (AtomDefnRange r = upvars->all(); !r.empty(); r.popFront()) {
-                JSDefinition *defn = r.front().value();
-                JSDefinition *lexdep = defn->resolve();
+                Definition *defn = r.front().value();
+                Definition *lexdep = defn->resolve();
                 if (!lexdep->isFreeVar())
                     FlagHeavyweights(lexdep, funbox, tcflags);
             }
         }
 
         if (funbox->joinable())
             fun->setJoinable();
     }
 }
 
 /*
- * Walk the JSFunctionBox tree looking for functions whose call objects may
+ * Walk the FunctionBox tree looking for functions whose call objects may
  * acquire new bindings as they execute: non-strict functions that call eval,
  * and functions that contain function statements (definitions not appearing
  * within the top statement list, which don't take effect unless they are
  * evaluated). Such call objects may acquire bindings that shadow variables
  * defined in enclosing scopes, so any enclosed functions must have their
  * bindings' extensibleParents flags set, and enclosed compiler-created blocks
  * must have their OWN_SHAPE flags set; the comments for
  * js::Bindings::extensibleParents explain why.
  */
 void
-Parser::markExtensibleScopeDescendants(JSFunctionBox *funbox, bool hasExtensibleParent) 
+Parser::markExtensibleScopeDescendants(FunctionBox *funbox, bool hasExtensibleParent) 
 {
     for (; funbox; funbox = funbox->siblings) {
         /*
          * It would be nice to use fun->kind() here to recognize functions
          * that will never consult their parent chains, and thus don't need
          * their 'extensible parents' flag set. Filed as bug 619750. 
          */
 
@@ -1626,27 +1626,27 @@ Parser::markExtensibleScopeDescendants(J
 
         if (funbox->kids) {
             markExtensibleScopeDescendants(funbox->kids,
                                            hasExtensibleParent || funbox->scopeIsExtensible());
         }
     }
 }
 
-static JSFunctionBox *
-EnterFunction(JSParseNode *fn, JSTreeContext *funtc, JSAtom *funAtom = NULL,
+static FunctionBox *
+EnterFunction(ParseNode *fn, TreeContext *funtc, JSAtom *funAtom = NULL,
               FunctionSyntaxKind kind = Expression)
 {
-    JSTreeContext *tc = funtc->parent;
+    TreeContext *tc = funtc->parent;
     JSFunction *fun = tc->parser->newFunction(tc, funAtom, kind);
     if (!fun)
         return NULL;
 
     /* Create box for fun->object early to protect against last-ditch GC. */
-    JSFunctionBox *funbox = tc->parser->newFunctionBox(fun, fn, tc);
+    FunctionBox *funbox = tc->parser->newFunctionBox(fun, fn, tc);
     if (!funbox)
         return NULL;
 
     /* Initialize non-default members of funtc. */
     funtc->flags |= funbox->tcflags;
     funtc->blockidGen = tc->blockidGen;
     if (!GenerateBlockId(funtc, funtc->bodyid))
         return NULL;
@@ -1654,23 +1654,23 @@ EnterFunction(JSParseNode *fn, JSTreeCon
     funtc->funbox = funbox;
     if (!SetStaticLevel(funtc, tc->staticLevel + 1))
         return NULL;
 
     return funbox;
 }
 
 static bool
-LeaveFunction(JSParseNode *fn, JSTreeContext *funtc, PropertyName *funName = NULL,
+LeaveFunction(ParseNode *fn, TreeContext *funtc, PropertyName *funName = NULL,
               FunctionSyntaxKind kind = Expression)
 {
-    JSTreeContext *tc = funtc->parent;
+    TreeContext *tc = funtc->parent;
     tc->blockidGen = funtc->blockidGen;
 
-    JSFunctionBox *funbox = fn->pn_funbox;
+    FunctionBox *funbox = fn->pn_funbox;
     funbox->tcflags |= funtc->flags & (TCF_FUN_FLAGS | TCF_COMPILE_N_GO | TCF_RETURN_EXPR);
 
     fn->pn_dflags |= PND_INITIALIZED;
     if (!tc->topStmt || tc->topStmt->type == STMT_BLOCK)
         fn->pn_dflags |= PND_BLOCKCHILD;
 
     /*
      * Propagate unresolved lexical names up to tc->lexdeps, and save a copy
@@ -1679,17 +1679,17 @@ LeaveFunction(JSParseNode *fn, JSTreeCon
      * satisfied by the function's declarations, to avoid penalizing functions
      * that use only their arguments and other local bindings.
      */
     if (funtc->lexdeps->count()) {
         int foundCallee = 0;
 
         for (AtomDefnRange r = funtc->lexdeps->all(); !r.empty(); r.popFront()) {
             JSAtom *atom = r.front().key();
-            JSDefinition *dn = r.front().value();
+            Definition *dn = r.front().value();
             JS_ASSERT(dn->isPlaceholder());
 
             if (atom == funName && kind == Expression) {
                 dn->setOp(JSOP_CALLEE);
                 dn->pn_cookie.set(funtc->staticLevel, UpvarCookie::CALLEE_SLOT);
                 dn->pn_dflags |= PND_BOUND;
 
                 /*
@@ -1705,25 +1705,25 @@ LeaveFunction(JSParseNode *fn, JSTreeCon
             if (!(funbox->tcflags & TCF_FUN_SETS_OUTER_NAME) &&
                 dn->isAssigned()) {
                 /*
                  * Make sure we do not fail to set TCF_FUN_SETS_OUTER_NAME if
                  * any use of dn in funtc assigns. See NoteLValue for the easy
                  * backward-reference case; this is the hard forward-reference
                  * case where we pay a higher price.
                  */
-                for (JSParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
+                for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) {
                     if (pnu->isAssigned() && pnu->pn_blockid >= funtc->bodyid) {
                         funbox->tcflags |= TCF_FUN_SETS_OUTER_NAME;
                         break;
                     }
                 }
             }
 
-            JSDefinition *outer_dn = tc->decls.lookupFirst(atom);
+            Definition *outer_dn = tc->decls.lookupFirst(atom);
 
             /*
              * Make sure to deoptimize lexical dependencies that are polluted
              * by eval or with, to safely bind globals (see bug 561923).
              */
             if (funtc->callsEval() ||
                 (outer_dn && tc->innermostWith &&
                  outer_dn->pn_pos < tc->innermostWith->pn_pos)) {
@@ -1771,44 +1771,44 @@ LeaveFunction(JSParseNode *fn, JSTreeCon
              * functions, and if different dn's are used we'll merge lists
              * when leaving the inner function.
              *
              * The dn == outer_dn case arises with generator expressions
              * (see CompExprTransplanter::transplant, the PN_FUNC/PN_NAME
              * case), and nowhere else, currently.
              */
             if (dn != outer_dn) {
-                JSParseNode **pnup = &dn->dn_uses;
-                JSParseNode *pnu;
+                ParseNode **pnup = &dn->dn_uses;
+                ParseNode *pnu;
 
                 while ((pnu = *pnup) != NULL) {
                     pnu->pn_lexdef = outer_dn;
                     pnup = &pnu->pn_link;
                 }
 
                 /*
                  * Make dn be a use that redirects to outer_dn, because we
                  * can't replace dn with outer_dn in all the pn_namesets in
                  * the AST where it may be. Instead we make it forward to
-                 * outer_dn. See JSDefinition::resolve.
+                 * outer_dn. See Definition::resolve.
                  */
                 *pnup = outer_dn->dn_uses;
                 outer_dn->dn_uses = dn;
                 outer_dn->pn_dflags |= dn->pn_dflags & ~PND_PLACEHOLDER;
                 dn->setDefn(false);
                 dn->setUsed(true);
                 dn->pn_lexdef = outer_dn;
             }
 
             /* Mark the outer dn as escaping. */
             outer_dn->pn_dflags |= PND_CLOSED;
         }
 
         if (funtc->lexdeps->count() - foundCallee != 0) {
-            JSParseNode *body = fn->pn_body;
+            ParseNode *body = fn->pn_body;
 
             fn->pn_body = NameSetNode::create(tc);
             if (!fn->pn_body)
                 return false;
 
             fn->pn_body->setKind(TOK_UPVARS);
             fn->pn_body->pn_pos = body->pn_pos;
             if (foundCallee)
@@ -1827,53 +1827,53 @@ LeaveFunction(JSParseNode *fn, JSTreeCon
      * Check whether any parameters have been assigned within this function.
      * In strict mode parameters do not alias arguments[i], and to make the
      * arguments object reflect initial parameter values prior to any mutation
      * we create it eagerly whenever parameters are (or might, in the case of
      * calls to eval) be assigned.
      */
     if (funtc->inStrictMode() && funbox->object->getFunctionPrivate()->nargs > 0) {
         AtomDeclsIter iter(&funtc->decls);
-        JSDefinition *dn;
+        Definition *dn;
 
         while ((dn = iter()) != NULL) {
-            if (dn->kind() == JSDefinition::ARG && dn->isAssigned()) {
+            if (dn->kind() == Definition::ARG && dn->isAssigned()) {
                 funbox->tcflags |= TCF_FUN_MUTATES_PARAMETER;
                 break;
             }
         }
     }
 
     funbox->bindings.transfer(funtc->parser->context, &funtc->bindings);
 
     return true;
 }
 
 static bool
-DefineGlobal(JSParseNode *pn, JSCodeGenerator *cg, PropertyName *name);
+DefineGlobal(ParseNode *pn, CodeGenerator *cg, PropertyName *name);
 
 /*
  * FIXME? this Parser method was factored from Parser::functionDef with minimal
  * change, hence the funtc ref param and funbox. It probably should match
  * functionBody, etc., and use tc and tc->funbox instead of taking explicit
  * parameters.
  */
 bool
-Parser::functionArguments(JSTreeContext &funtc, JSFunctionBox *funbox, JSParseNode **listp)
+Parser::functionArguments(TreeContext &funtc, FunctionBox *funbox, ParseNode **listp)
 {
     if (tokenStream.getToken() != TOK_LP) {
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_PAREN_BEFORE_FORMAL);
         return false;
     }
 
     if (!tokenStream.matchToken(TOK_RP)) {
 #if JS_HAS_DESTRUCTURING
         JSAtom *duplicatedArg = NULL;
         bool destructuringArg = false;
-        JSParseNode *list = NULL;
+        ParseNode *list = NULL;
 #endif
 
         do {
             switch (TokenKind tt = tokenStream.getToken()) {
 #if JS_HAS_DESTRUCTURING
               case TOK_LB:
               case TOK_LC:
               {
@@ -1887,43 +1887,43 @@ Parser::functionArguments(JSTreeContext 
                  * local variables initialized from properties of a single
                  * anonymous positional parameter, so here we must tweak our
                  * binder and its data.
                  */
                 BindData data;
                 data.pn = NULL;
                 data.op = JSOP_DEFVAR;
                 data.binder = BindDestructuringArg;
-                JSParseNode *lhs = destructuringExpr(&data, tt);
+                ParseNode *lhs = destructuringExpr(&data, tt);
                 if (!lhs)
                     return false;
 
                 /*
                  * Adjust fun->nargs to count the single anonymous positional
                  * parameter that is to be destructured.
                  */
                 uint16 slot;
                 if (!funtc.bindings.addDestructuring(context, &slot))
                     return false;
 
                 /*
                  * Synthesize a destructuring assignment from the single
                  * anonymous positional parameter into the destructuring
                  * left-hand-side expression and accumulate it in list.
                  */
-                JSParseNode *rhs = NameNode::create(context->runtime->atomState.emptyAtom, &funtc);
+                ParseNode *rhs = NameNode::create(context->runtime->atomState.emptyAtom, &funtc);
                 if (!rhs)
                     return false;
                 rhs->setKind(TOK_NAME);
                 rhs->setOp(JSOP_GETARG);
                 rhs->pn_cookie.set(funtc.staticLevel, slot);
                 rhs->pn_dflags |= PND_BOUND;
 
-                JSParseNode *item =
-                    JSParseNode::newBinaryOrAppend(TOK_ASSIGN, JSOP_NOP, lhs, rhs, &funtc);
+                ParseNode *item =
+                    ParseNode::newBinaryOrAppend(TOK_ASSIGN, JSOP_NOP, lhs, rhs, &funtc);
                 if (!item)
                     return false;
                 if (!list) {
                     list = ListNode::create(&funtc);
                     if (!list)
                         return false;
                     list->setKind(TOK_VAR);
                     list->makeEmpty();
@@ -1973,40 +1973,40 @@ Parser::functionArguments(JSTreeContext 
               default:
                 reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_MISSING_FORMAL);
                 /* FALL THROUGH */
               case TOK_ERROR:
                 return false;
 
 #if JS_HAS_DESTRUCTURING
               report_dup_and_destructuring:
-                JSDefinition *dn = funtc.decls.lookupFirst(duplicatedArg);
+                Definition *dn = funtc.decls.lookupFirst(duplicatedArg);
                 reportErrorNumber(dn, JSREPORT_ERROR, JSMSG_DESTRUCT_DUP_ARG);
                 return false;
 #endif
             }
         } while (tokenStream.matchToken(TOK_COMMA));
 
         if (tokenStream.getToken() != TOK_RP) {
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_PAREN_AFTER_FORMAL);
             return false;
         }
     }
 
     return true;
 }
 
-JSParseNode *
+ParseNode *
 Parser::functionDef(PropertyName *funName, FunctionType type, FunctionSyntaxKind kind)
 {
     JS_ASSERT_IF(kind == Statement, funName);
 
     /* Make a TOK_FUNCTION node. */
     tokenStream.mungeCurrentToken(TOK_FUNCTION, JSOP_NOP);
-    JSParseNode *pn = FunctionNode::create(tc);
+    ParseNode *pn = FunctionNode::create(tc);
     if (!pn)
         return NULL;
     pn->pn_body = NULL;
     pn->pn_cookie.makeFree();
 
     /*
      * If this is a function expression, mark this function as escaping (as a
      * "funarg") unless it is immediately applied (we clear PND_FUNARG if so --
@@ -2019,52 +2019,52 @@ Parser::functionDef(PropertyName *funNam
     bool bodyLevel = tc->atBodyLevel();
     pn->pn_dflags = (kind == Expression || !bodyLevel) ? PND_FUNARG : 0;
 
     /*
      * Record names for function statements in tc->decls so we know when to
      * avoid optimizing variable references that might name a function.
      */
     if (kind == Statement) {
-        if (JSDefinition *dn = tc->decls.lookupFirst(funName)) {
-            JSDefinition::Kind dn_kind = dn->kind();
+        if (Definition *dn = tc->decls.lookupFirst(funName)) {
+            Definition::Kind dn_kind = dn->kind();
 
             JS_ASSERT(!dn->isUsed());
             JS_ASSERT(dn->isDefn());
 
-            if (context->hasStrictOption() || dn_kind == JSDefinition::CONST) {
+            if (context->hasStrictOption() || dn_kind == Definition::CONST) {
                 JSAutoByteString name;
                 if (!js_AtomToPrintableString(context, funName, &name) ||
                     !reportErrorNumber(NULL,
-                                       (dn_kind != JSDefinition::CONST)
+                                       (dn_kind != Definition::CONST)
                                        ? JSREPORT_WARNING | JSREPORT_STRICT
                                        : JSREPORT_ERROR,
                                        JSMSG_REDECLARED_VAR,
-                                       JSDefinition::kindString(dn_kind),
+                                       Definition::kindString(dn_kind),
                                        name.ptr())) {
                     return NULL;
                 }
             }
 
             if (bodyLevel) {
-                tc->decls.updateFirst(funName, (JSDefinition *) pn);
+                tc->decls.updateFirst(funName, (Definition *) pn);
                 pn->setDefn(true);
                 pn->dn_uses = dn; /* dn->dn_uses is now pn_link */
 
                 if (!MakeDefIntoUse(dn, pn, funName, tc))
                     return NULL;
             }
         } else if (bodyLevel) {
             /*
              * If this function was used before it was defined, claim the
              * pre-created definition node for this function that primaryExpr
              * put in tc->lexdeps on first forward reference, and recycle pn.
              */
 
-            if (JSDefinition *fn = tc->lexdeps.lookupDefn(funName)) {
+            if (Definition *fn = tc->lexdeps.lookupDefn(funName)) {
                 JS_ASSERT(fn->isDefn());
                 fn->setKind(TOK_FUNCTION);
                 fn->setArity(PN_FUNC);
                 fn->pn_pos.begin = pn->pn_pos.begin;
 
                 /*
                  * Set fn->pn_pos.end too, in case of error before we parse the
                  * closing brace.  See bug 640075.
@@ -2113,31 +2113,31 @@ Parser::functionDef(PropertyName *funNam
                 pn->pn_dflags |= PND_BOUND;
                 break;
 
               default:;
             }
         }
     }
 
-    JSTreeContext *outertc = tc;
+    TreeContext *outertc = tc;
 
     /* Initialize early for possible flags mutation via destructuringExpr. */
-    JSTreeContext funtc(tc->parser);
+    TreeContext funtc(tc->parser);
     if (!funtc.init(context))
         return NULL;
 
-    JSFunctionBox *funbox = EnterFunction(pn, &funtc, funName, kind);
+    FunctionBox *funbox = EnterFunction(pn, &funtc, funName, kind);
     if (!funbox)
         return NULL;
 
     JSFunction *fun = funbox->function();
 
     /* Now parse formal argument list and compute fun->nargs. */
-    JSParseNode *prelude = NULL;
+    ParseNode *prelude = NULL;
     if (!functionArguments(funtc, funbox, &prelude))
         return NULL;
 
     fun->setArgCount(funtc.bindings.countArgs());
 
 #if JS_HAS_DESTRUCTURING
     /*
      * If there were destructuring formal parameters, bind the destructured-to
@@ -2145,17 +2145,17 @@ Parser::functionDef(PropertyName *funNam
      * formal parameters. Because js::Bindings::add must be called first for
      * all ARGUMENTs, then all VARIABLEs and CONSTANTs, and finally all UPVARs,
      * we can't bind vars induced by formal parameter destructuring until after
      * Parser::functionArguments has returned.
      */
     if (prelude) {
         AtomDeclsIter iter(&funtc.decls);
 
-        while (JSDefinition *apn = iter()) {
+        while (Definition *apn = iter()) {
             /* Filter based on pn_op -- see BindDestructuringArg, above. */
             if (!apn->isOp(JSOP_SETLOCAL))
                 continue;
 
             if (!BindLocalVariable(context, &funtc, apn, VARIABLE))
                 return NULL;
         }
     }
@@ -2177,17 +2177,17 @@ Parser::functionDef(PropertyName *funNam
     if (tt != TOK_LC) {
         tokenStream.ungetToken();
         fun->flags |= JSFUN_EXPR_CLOSURE;
     }
 #else
     MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_BODY);
 #endif
 
-    JSParseNode *body = functionBody();
+    ParseNode *body = functionBody();
     if (!body)
         return NULL;
 
     if (funName && !CheckStrictBinding(context, &funtc, funName, pn))
         return NULL;
 
     if (!CheckStrictParameters(context, &funtc))
         return NULL;
@@ -2222,29 +2222,29 @@ Parser::functionDef(PropertyName *funNam
     /*
      * If there were destructuring formal parameters, prepend the initializing
      * comma expression that we synthesized to body. If the body is a return
      * node, we must make a special TOK_SEQ node, to prepend the destructuring
      * code without bracing the decompilation of the function body.
      */
     if (prelude) {
         if (!body->isArity(PN_LIST)) {
-            JSParseNode *block;
+            ParseNode *block;
 
             block = ListNode::create(outertc);
             if (!block)
                 return NULL;
             block->setKind(TOK_SEQ);
             block->pn_pos = body->pn_pos;
             block->initList(body);
 
             body = block;
         }
 
-        JSParseNode *item = UnaryNode::create(outertc);
+        ParseNode *item = UnaryNode::create(outertc);
         if (!item)
             return NULL;
 
         item->setKind(TOK_SEMI);
         item->pn_pos.begin = item->pn_pos.end = body->pn_pos.begin;
         item->pn_kid = prelude;
         item->pn_next = body->pn_head;
         body->pn_head = item;
@@ -2316,17 +2316,17 @@ Parser::functionDef(PropertyName *funNam
 
     /* If the surrounding function is not strict code, reset the lexer. */
     if (!outertc->inStrictMode())
         tokenStream.setStrictMode(false);
 
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::functionStmt()
 {
     PropertyName *name = NULL;
     if (tokenStream.getToken(TSF_KEYWORD_IS_NAME) == TOK_NAME) {
         name = tokenStream.currentToken().name();
     } else {
         /* Unnamed function expressions are forbidden in statement context. */
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_UNNAMED_FUNCTION_STMT);
@@ -2337,17 +2337,17 @@ Parser::functionStmt()
     if (!tc->atBodyLevel() && tc->inStrictMode()) {
         reportErrorNumber(NULL, JSREPORT_STRICT_MODE_ERROR, JSMSG_STRICT_FUNCTION_STATEMENT);
         return NULL;
     }
 
     return functionDef(name, Normal, Statement);
 }
 
-JSParseNode *
+ParseNode *
 Parser::functionExpr()
 {
     PropertyName *name = NULL;
     if (tokenStream.getToken(TSF_KEYWORD_IS_NAME) == TOK_NAME)
         name = tokenStream.currentToken().name();
     else
         tokenStream.ungetToken();
     return functionDef(name, Normal, Expression);
@@ -2368,23 +2368,23 @@ Parser::functionExpr()
  *   "use strict"
  * }
  *
  * That is, even though "use\x20loose" can never be a directive, now or in the
  * future (because of the hex escape), the Directive Prologue extends through it
  * to the "use strict" statement, which is indeed a directive.
  */
 bool
-Parser::recognizeDirectivePrologue(JSParseNode *pn, bool *isDirectivePrologueMember)
+Parser::recognizeDirectivePrologue(ParseNode *pn, bool *isDirectivePrologueMember)
 {
     *isDirectivePrologueMember = pn->isStringExprStatement();
     if (!*isDirectivePrologueMember)
         return true;
 
-    JSParseNode *kid = pn->pn_kid;
+    ParseNode *kid = pn->pn_kid;
     if (kid->isEscapeFreeStringLiteral()) {
         /*
          * Mark this statement as being a possibly legitimate part of a
          * directive prologue, so the byte code emitter won't warn about it
          * being useless code. (We mustn't just omit the statement entirely yet,
          * as it could be producing the value of an eval or JSScript execution.)
          *
          * Note that even if the string isn't one we recognize as a directive,
@@ -2423,20 +2423,20 @@ Parser::recognizeDirectivePrologue(JSPar
     return true;
 }
 
 /*
  * Parse the statements in a block, creating a TOK_LC node that lists the
  * statements' trees.  If called from block-parsing code, the caller must
  * match { before and } after.
  */
-JSParseNode *
+ParseNode *
 Parser::statements()
 {
-    JSParseNode *pn, *pn2, *saveBlock;
+    ParseNode *pn, *pn2, *saveBlock;
     TokenKind tt;
 
     JS_CHECK_RECURSION(context, return NULL);
 
     pn = ListNode::create(tc);
     if (!pn)
         return NULL;
     pn->setKind(TOK_LC);
@@ -2496,20 +2496,20 @@ Parser::statements()
     if (tc->blockNode != pn)
         pn = tc->blockNode;
     tc->blockNode = saveBlock;
 
     pn->pn_pos.end = tokenStream.currentToken().pos.end;
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::condition()
 {
-    JSParseNode *pn;
+    ParseNode *pn;
 
     MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_COND);
     pn = parenExpr();
     if (!pn)
         return NULL;
     MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_COND);
 
     /* Check for (a = b) and warn about possible (a == b) mistype. */
@@ -2518,17 +2518,17 @@ Parser::condition()
         !pn->isInParens() &&
         !reportErrorNumber(NULL, JSREPORT_WARNING | JSREPORT_STRICT, JSMSG_EQUAL_AS_ASSIGN, "")) {
         return NULL;
     }
     return pn;
 }
 
 static bool
-MatchLabel(JSContext *cx, TokenStream *ts, JSParseNode *pn)
+MatchLabel(JSContext *cx, TokenStream *ts, ParseNode *pn)
 {
     TokenKind tt = ts->peekTokenSameLine(TSF_OPERAND);
     if (tt == TOK_ERROR)
         return false;
     PropertyName *label;
     if (tt == TOK_NAME) {
         (void) ts->getToken();
         label = ts->currentToken().name();
@@ -2544,34 +2544,34 @@ MatchLabel(JSContext *cx, TokenStream *t
  * must already be in such a scope.
  *
  * Throw a SyntaxError if 'atom' is an invalid name. Otherwise create a
  * property for the new variable on the block object, tc->blockChain();
  * populate data->pn->pn_{op,cookie,defn,dflags}; and stash a pointer to
  * data->pn in a slot of the block object.
  */
 static JSBool
-BindLet(JSContext *cx, BindData *data, JSAtom *atom, JSTreeContext *tc)
+BindLet(JSContext *cx, BindData *data, JSAtom *atom, TreeContext *tc)
 {
-    JSParseNode *pn;
+    ParseNode *pn;
     JSObject *blockObj;
     jsint n;
 
     /*
      * Body-level 'let' is the same as 'var' currently -- this may change in a
      * successor standard to ES5 that specifies 'let'.
      */
     JS_ASSERT(!tc->atBodyLevel());
 
     pn = data->pn;
     if (!CheckStrictBinding(cx, tc, atom->asPropertyName(), pn))
         return false;
 
     blockObj = tc->blockChain();
-    JSDefinition *dn = tc->decls.lookupFirst(atom);
+    Definition *dn = tc->decls.lookupFirst(atom);
     if (dn && dn->pn_blockid == tc->blockid()) {
         JSAutoByteString name;
         if (js_AtomToPrintableString(cx, atom, &name)) {
             ReportCompileErrorNumber(cx, TS(tc->parser), pn,
                                      JSREPORT_ERROR, JSMSG_REDECLARED_VAR,
                                      dn->isConst() ? "const" : "variable",
                                      name.ptr());
         }
@@ -2618,19 +2618,19 @@ BindLet(JSContext *cx, BindData *data, J
      * jsemit.cpp:EmitEnterBlock so they don't tie up unused space in the so-
      * called "static" prototype Block.
      */
     blockObj->setSlot(shape->slot, PrivateValue(pn));
     return true;
 }
 
 static void
-PopStatement(JSTreeContext *tc)
+PopStatement(TreeContext *tc)
 {
-    JSStmtInfo *stmt = tc->topStmt;
+    StmtInfo *stmt = tc->topStmt;
 
     if (stmt->flags & SIF_SCOPE) {
         JSObject *obj = stmt->blockBox->object;
         JS_ASSERT(!obj->isClonedBlock());
 
         for (Shape::Range r = obj->lastProperty()->all(); !r.empty(); r.popFront()) {
             JSAtom *atom = JSID_TO_ATOM(r.front().propid);
 
@@ -2639,17 +2639,17 @@ PopStatement(JSTreeContext *tc)
                 continue;
             tc->decls.remove(atom);
         }
     }
     js_PopStatement(tc);
 }
 
 static inline bool
-OuterLet(JSTreeContext *tc, JSStmtInfo *stmt, JSAtom *atom)
+OuterLet(TreeContext *tc, StmtInfo *stmt, JSAtom *atom)
 {
     while (stmt->downScope) {
         stmt = js_LexicalLookup(tc, atom, NULL, stmt->downScope);
         if (!stmt)
             return false;
         if (stmt->type == STMT_BLOCK)
             return true;
     }
@@ -2667,34 +2667,34 @@ OuterLet(JSTreeContext *tc, JSStmtInfo *
  *
  * For now, don't try to lookup eval frame variables at compile time. This is
  * sub-optimal: we could handle eval-called-from-global-code gvars since eval
  * gets its own script and frame. The eval-from-function-code case is harder,
  * since functions do not atomize gvars and then reserve their atom indexes as
  * stack frame slots.
  */
 static bool
-DefineGlobal(JSParseNode *pn, JSCodeGenerator *cg, PropertyName *name)
+DefineGlobal(ParseNode *pn, CodeGenerator *cg, PropertyName *name)
 {
     GlobalScope *globalScope = cg->compiler()->globalScope;
     JSObject *globalObj = globalScope->globalObj;
 
     if (!cg->compileAndGo() || !globalObj || cg->compilingForEval())
         return true;
 
     AtomIndexAddPtr p = globalScope->names.lookupForAdd(name);
     if (!p) {
         JSContext *cx = cg->parser->context;
 
         JSObject *holder;
         JSProperty *prop;
         if (!globalObj->lookupProperty(cx, name, &holder, &prop))
             return false;
 
-        JSFunctionBox *funbox = pn->isKind(TOK_FUNCTION) ? pn->pn_funbox : NULL;
+        FunctionBox *funbox = pn->isKind(TOK_FUNCTION) ? pn->pn_funbox : NULL;
 
         GlobalScope::GlobalDef def;
         if (prop) {
             /*
              * A few cases where we don't bother aggressively caching:
              *   1) Function value changes.
              *   2) Configurable properties.
              *   3) Properties without slots, or with getters/setters.
@@ -2744,17 +2744,17 @@ DefineGlobal(JSParseNode *pn, JSCodeGene
     }
 
     pn->pn_dflags |= PND_GVAR;
 
     return true;
 }
 
 static bool
-BindTopLevelVar(JSContext *cx, BindData *data, JSParseNode *pn, JSTreeContext *tc)
+BindTopLevelVar(JSContext *cx, BindData *data, ParseNode *pn, TreeContext *tc)
 {
     JS_ASSERT(pn->isOp(JSOP_NAME));
     JS_ASSERT(!tc->inFunction());
 
     /* There's no need to optimize bindings if we're not compiling code. */
     if (!tc->compiling())
         return true;
 
@@ -2797,21 +2797,21 @@ BindTopLevelVar(JSContext *cx, BindData 
      * If this is a global variable, we're compile-and-go, and a global object
      * is present, try to bake in either an already available slot or a
      * predicted slot that will be defined after compiling is completed.
      */
     return DefineGlobal(pn, tc->asCodeGenerator(), pn->pn_atom->asPropertyName());
 }
 
 static bool
-BindFunctionLocal(JSContext *cx, BindData *data, MultiDeclRange &mdl, JSTreeContext *tc)
+BindFunctionLocal(JSContext *cx, BindData *data, MultiDeclRange &mdl, TreeContext *tc)
 {
     JS_ASSERT(tc->inFunction());
 
-    JSParseNode *pn = data->pn;
+    ParseNode *pn = data->pn;
     JSAtom *name = pn->pn_atom;
 
     /*
      * Don't create a local variable with the name 'arguments', per ECMA-262.
      * Instead, 'var arguments' always restates that predefined binding of the
      * lexical environment for function activations. Assignments to arguments
      * must be handled specially -- see NoteLValue.
      */
@@ -2835,52 +2835,52 @@ BindFunctionLocal(JSContext *cx, BindDat
         if (!BindLocalVariable(cx, tc, pn, kind))
             return false;
         pn->setOp(JSOP_GETLOCAL);
         return true;
     }
 
     if (kind == ARGUMENT) {
         JS_ASSERT(tc->inFunction());
-        JS_ASSERT(!mdl.empty() && mdl.front()->kind() == JSDefinition::ARG);
+        JS_ASSERT(!mdl.empty() && mdl.front()->kind() == Definition::ARG);
     } else {
         JS_ASSERT(kind == VARIABLE || kind == CONSTANT);
     }
 
     return true;
 }
 
 static JSBool
-BindVarOrConst(JSContext *cx, BindData *data, JSAtom *atom, JSTreeContext *tc)
+BindVarOrConst(JSContext *cx, BindData *data, JSAtom *atom, TreeContext *tc)
 {
-    JSParseNode *pn = data->pn;
+    ParseNode *pn = data->pn;
 
     /* Default best op for pn is JSOP_NAME; we'll try to improve below. */
     pn->setOp(JSOP_NAME);
 
     if (!CheckStrictBinding(cx, tc, atom->asPropertyName(), pn))
         return false;
 
-    JSStmtInfo *stmt = js_LexicalLookup(tc, atom, NULL);
+    StmtInfo *stmt = js_LexicalLookup(tc, atom, NULL);
 
     if (stmt && stmt->type == STMT_WITH) {
         data->fresh = false;
         pn->pn_dflags |= PND_DEOPTIMIZED;
         tc->noteMightAliasLocals();
         return true;
     }
 
     MultiDeclRange mdl = tc->decls.lookupMulti(atom);
     JSOp op = data->op;
 
     if (stmt || !mdl.empty()) {
-        JSDefinition *dn = mdl.empty() ? NULL : mdl.front();
-        JSDefinition::Kind dn_kind = dn ? dn->kind() : JSDefinition::VAR;
-
-        if (dn_kind == JSDefinition::ARG) {
+        Definition *dn = mdl.empty() ? NULL : mdl.front();
+        Definition::Kind dn_kind = dn ? dn->kind() : Definition::VAR;
+
+        if (dn_kind == Definition::ARG) {
             JSAutoByteString name;
             if (!js_AtomToPrintableString(cx, atom, &name))
                 return JS_FALSE;
 
             if (op == JSOP_DEFCONST) {
                 ReportCompileErrorNumber(cx, TS(tc->parser), pn,
                                          JSREPORT_ERROR, JSMSG_REDECLARED_PARAM,
                                          name.ptr());
@@ -2888,31 +2888,31 @@ BindVarOrConst(JSContext *cx, BindData *
             }
             if (!ReportCompileErrorNumber(cx, TS(tc->parser), pn,
                                           JSREPORT_WARNING | JSREPORT_STRICT,
                                           JSMSG_VAR_HIDES_ARG, name.ptr())) {
                 return JS_FALSE;
             }
         } else {
             bool error = (op == JSOP_DEFCONST ||
-                          dn_kind == JSDefinition::CONST ||
-                          (dn_kind == JSDefinition::LET &&
+                          dn_kind == Definition::CONST ||
+                          (dn_kind == Definition::LET &&
                            (stmt->type != STMT_CATCH || OuterLet(tc, stmt, atom))));
 
             if (cx->hasStrictOption()
-                ? op != JSOP_DEFVAR || dn_kind != JSDefinition::VAR
+                ? op != JSOP_DEFVAR || dn_kind != Definition::VAR
                 : error) {
                 JSAutoByteString name;
                 if (!js_AtomToPrintableString(cx, atom, &name) ||
                     !ReportCompileErrorNumber(cx, TS(tc->parser), pn,
                                               !error
                                               ? JSREPORT_WARNING | JSREPORT_STRICT
                                               : JSREPORT_ERROR,
                                               JSMSG_REDECLARED_VAR,
-                                              JSDefinition::kindString(dn_kind),
+                                              Definition::kindString(dn_kind),
                                               name.ptr())) {
                     return JS_FALSE;
                 }
             }
         }
     }
 
     if (mdl.empty()) {
@@ -2925,107 +2925,107 @@ BindVarOrConst(JSContext *cx, BindData *
          * use of |mdl.defn()|, and if we have an initializer for this var or
          * const (typically a const would ;-), then pn must be rewritten into a
          * TOK_ASSIGN node. See Variables, further below.
          *
          * A case such as let (x = 1) { var x = 2; print(x); } is even harder.
          * There the x definition is hoisted but the x = 2 assignment mutates
          * the block-local binding of x.
          */
-        JSDefinition *dn = mdl.front();
+        Definition *dn = mdl.front();
 
         data->fresh = false;
 
         if (!pn->isUsed()) {
             /* Make pnu be a fresh name node that uses dn. */
-            JSParseNode *pnu = pn;
+            ParseNode *pnu = pn;
 
             if (pn->isDefn()) {
                 pnu = NameNode::create(atom, tc);
                 if (!pnu)
                     return JS_FALSE;
             }
 
             LinkUseToDef(pnu, dn, tc);
             pnu->setOp(JSOP_NAME);
         }
 
         /* Find the first non-let binding of this atom. */
-        while (dn->kind() == JSDefinition::LET) {
+        while (dn->kind() == Definition::LET) {
             mdl.popFront();
             if (mdl.empty())
                 break;
             dn = mdl.front();
         }
 
         if (dn) {
             JS_ASSERT_IF(data->op == JSOP_DEFCONST,
-                         dn->kind() == JSDefinition::CONST);
+                         dn->kind() == Definition::CONST);
             return JS_TRUE;
         }
 
         /*
          * A var or const that is shadowed by one or more let bindings of the
          * same name, but that has not been declared until this point, must be
          * hoisted above the let bindings.
          */
         if (!pn->isDefn()) {
             if (tc->lexdeps->lookup(atom)) {
                 tc->lexdeps->remove(atom);
             } else {
-                JSParseNode *pn2 = NameNode::create(atom, tc);
+                ParseNode *pn2 = NameNode::create(atom, tc);
                 if (!pn2)
                     return JS_FALSE;
 
                 /* The token stream may be past the location for pn. */
                 pn2->setKind(TOK_NAME);
                 pn2->pn_pos = pn->pn_pos;
                 pn = pn2;
             }
             pn->setOp(JSOP_NAME);
         }
 
-        if (!tc->decls.addHoist(atom, (JSDefinition *) pn))
+        if (!tc->decls.addHoist(atom, (Definition *) pn))
             return JS_FALSE;
         pn->setDefn(true);
         pn->pn_dflags &= ~PND_PLACEHOLDER;
     }
 
     if (data->op == JSOP_DEFCONST)
         pn->pn_dflags |= PND_CONST;
 
     if (tc->inFunction())
         return BindFunctionLocal(cx, data, mdl, tc);
 
     return BindTopLevelVar(cx, data, pn, tc);
 }
 
 static bool
-MakeSetCall(JSContext *cx, JSParseNode *pn, JSTreeContext *tc, uintN msg)
+MakeSetCall(JSContext *cx, ParseNode *pn, TreeContext *tc, uintN msg)
 {
     JS_ASSERT(pn->isArity(PN_LIST));
     JS_ASSERT(pn->isOp(JSOP_CALL) || pn->isOp(JSOP_EVAL) ||
               pn->isOp(JSOP_FUNCALL) || pn->isOp(JSOP_FUNAPPLY));
     if (!ReportStrictModeError(cx, TS(tc->parser), tc, pn, msg))
         return false;
 
-    JSParseNode *pn2 = pn->pn_head;
+    ParseNode *pn2 = pn->pn_head;
     if (pn2->isKind(TOK_FUNCTION) && (pn2->pn_funbox->tcflags & TCF_GENEXP_LAMBDA)) {
         ReportCompileErrorNumber(cx, TS(tc->parser), pn, JSREPORT_ERROR, msg);
         return false;
     }
     pn->pn_xflags |= PNX_SETCALL;
     return true;
 }
 
 static void
-NoteLValue(JSContext *cx, JSParseNode *pn, JSTreeContext *tc, uintN dflag = PND_ASSIGNED)
+NoteLValue(JSContext *cx, ParseNode *pn, TreeContext *tc, uintN dflag = PND_ASSIGNED)
 {
     if (pn->isUsed()) {
-        JSDefinition *dn = pn->pn_lexdef;
+        Definition *dn = pn->pn_lexdef;
 
         /*
          * Save the win of PND_INITIALIZED if we can prove 'var x;' and 'x = y'
          * occur as direct kids of the same block with no forward refs to x.
          */
         if (!(dn->pn_dflags & (PND_INITIALIZED | PND_CONST | PND_PLACEHOLDER)) &&
             dn->isBlockChild() &&
             pn->isBlockChild() &&
@@ -3059,18 +3059,17 @@ NoteLValue(JSContext *cx, JSParseNode *p
     } else if (tc->inFunction() && lname == tc->fun()->atom) {
         tc->flags |= TCF_FUN_HEAVYWEIGHT;
     }
 }
 
 #if JS_HAS_DESTRUCTURING
 
 static JSBool
-BindDestructuringVar(JSContext *cx, BindData *data, JSParseNode *pn,
-                     JSTreeContext *tc)
+BindDestructuringVar(JSContext *cx, BindData *data, ParseNode *pn, TreeContext *tc)
 {
     JSAtom *atom;
 
     /*
      * Destructuring is a form of assignment, so just as for an initialized
      * simple variable, we must check for assignment to 'arguments' and flag
      * the enclosing function (if any) as heavyweight.
      */
@@ -3115,17 +3114,17 @@ BindDestructuringVar(JSContext *cx, Bind
  *
  *   [rval, lval, xval]
  *
  * and pops all three values, setting lval[xval] = rval.  But we cannot select
  * JSOP_ENUMELEM yet, because the LHS may turn out to be an arg or local var,
  * which can be optimized further.  So we select JSOP_SETNAME.
  */
 static JSBool
-BindDestructuringLHS(JSContext *cx, JSParseNode *pn, JSTreeContext *tc)
+BindDestructuringLHS(JSContext *cx, ParseNode *pn, TreeContext *tc)
 {
     switch (pn->getKind()) {
       case TOK_NAME:
         NoteLValue(cx, pn, tc);
         /* FALL THROUGH */
 
       case TOK_DOT:
       case TOK_LB:
@@ -3197,28 +3196,28 @@ BindDestructuringLHS(JSContext *cx, JSPa
  * context.  For these calls, |data| points to the right sort of
  * BindData.
  *
  * See also UndominateInitializers, immediately below. If you change
  * either of these functions, you might have to change the other to
  * match.
  */
 static bool
-CheckDestructuring(JSContext *cx, BindData *data, JSParseNode *left, JSTreeContext *tc)
+CheckDestructuring(JSContext *cx, BindData *data, ParseNode *left, TreeContext *tc)
 {
     bool ok;
 
     if (left->isKind(TOK_ARRAYCOMP)) {
         ReportCompileErrorNumber(cx, TS(tc->parser), left, JSREPORT_ERROR,
                                  JSMSG_ARRAY_COMP_LEFTSIDE);
         return false;
     }
 
     if (left->isKind(TOK_RB)) {
-        for (JSParseNode *pn = left->pn_head; pn; pn = pn->pn_next) {
+        for (ParseNode *pn = left->pn_head; pn; pn = pn->pn_next) {
             /* Nullary comma is an elision; binary comma is an expression.*/
             if (!pn->isKind(TOK_COMMA) || !pn->isArity(PN_NULLARY)) {
                 if (pn->isKind(TOK_RB) || pn->isKind(TOK_RC)) {
                     ok = CheckDestructuring(cx, data, pn, tc);
                 } else {
                     if (data) {
                         if (!pn->isKind(TOK_NAME)) {
                             ReportCompileErrorNumber(cx, TS(tc->parser), pn, JSREPORT_ERROR,
@@ -3231,19 +3230,19 @@ CheckDestructuring(JSContext *cx, BindDa
                     }
                 }
                 if (!ok)
                     return false;
             }
         }
     } else {
         JS_ASSERT(left->isKind(TOK_RC));
-        for (JSParseNode *pair = left->pn_head; pair; pair = pair->pn_next) {
+        for (ParseNode *pair = left->pn_head; pair; pair = pair->pn_next) {
             JS_ASSERT(pair->isKind(TOK_COLON));
-            JSParseNode *pn = pair->pn_right;
+            ParseNode *pn = pair->pn_right;
 
             if (pn->isKind(TOK_RB) || pn->isKind(TOK_RC)) {
                 ok = CheckDestructuring(cx, data, pn, tc);
             } else if (data) {
                 if (!pn->isKind(TOK_NAME)) {
                     ReportCompileErrorNumber(cx, TS(tc->parser), pn, JSREPORT_ERROR,
                                              JSMSG_NO_VARIABLE_NAME);
                     return false;
@@ -3302,64 +3301,62 @@ CheckDestructuring(JSContext *cx, BindDa
  * very precise. With one-pass SSA construction from structured source code
  * (see "Single-Pass Generation of Static Single Assignment Form for Structured
  * Languages", Brandis and Mössenböck), we could do much better.
  *
  * See CheckDestructuring, immediately above. If you change either of these
  * functions, you might have to change the other to match.
  */
 static void
-UndominateInitializers(JSParseNode *left, const TokenPtr &end, JSTreeContext *tc)
+UndominateInitializers(ParseNode *left, const TokenPtr &end, TreeContext *tc)
 {
     if (left->isKind(TOK_RB)) {
-        for (JSParseNode *pn = left->pn_head; pn; pn = pn->pn_next) {
+        for (ParseNode *pn = left->pn_head; pn; pn = pn->pn_next) {
             /* Nullary comma is an elision; binary comma is an expression.*/
             if (!pn->isKind(TOK_COMMA) || !pn->isArity(PN_NULLARY)) {
                 if (pn->isKind(TOK_RB) || pn->isKind(TOK_RC))
                     UndominateInitializers(pn, end, tc);
                 else
                     pn->pn_pos.end = end;
             }
         }
     } else {
         JS_ASSERT(left->isKind(TOK_RC));
 
-        for (JSParseNode *pair = left->pn_head; pair; pair = pair->pn_next) {
+        for (ParseNode *pair = left->pn_head; pair; pair = pair->pn_next) {
             JS_ASSERT(pair->isKind(TOK_COLON));
-            JSParseNode *pn = pair->pn_right;
+            ParseNode *pn = pair->pn_right;
             if (pn->isKind(TOK_RB) || pn->isKind(TOK_RC))
                 UndominateInitializers(pn, end, tc);
             else
                 pn->pn_pos.end = end;
         }
     }
 }
 
-JSParseNode *
+ParseNode *
 Parser::destructuringExpr(BindData *data, TokenKind tt)
 {
-    JSParseNode *pn;
-
     tc->flags |= TCF_DECL_DESTRUCTURING;
-    pn = primaryExpr(tt, JS_FALSE);
+    ParseNode *pn = primaryExpr(tt, JS_FALSE);
     tc->flags &= ~TCF_DECL_DESTRUCTURING;
     if (!pn)
         return NULL;
     if (!CheckDestructuring(context, data, pn, tc))
         return NULL;
     return pn;
 }
 
 #endif /* JS_HAS_DESTRUCTURING */
 
-JSParseNode *
+ParseNode *
 Parser::returnOrYield(bool useAssignExpr)
 {
     TokenKind tt, tt2;
-    JSParseNode *pn, *pn2;
+    ParseNode *pn, *pn2;
 
     tt = tokenStream.currentToken().type;
     if (!tc->inFunction()) {
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_RETURN_OR_YIELD,
                           (tt == TOK_RETURN) ? js_return_str : js_yield_str);
         return NULL;
     }
 
@@ -3424,33 +3421,28 @@ Parser::returnOrYield(bool useAssignExpr
                          JSMSG_NO_RETURN_VALUE,
                          JSMSG_ANON_NO_RETURN_VALUE)) {
         return NULL;
     }
 
     return pn;
 }
 
-static JSParseNode *
-PushLexicalScope(JSContext *cx, TokenStream *ts, JSTreeContext *tc,
-                 JSStmtInfo *stmt)
+static ParseNode *
+PushLexicalScope(JSContext *cx, TokenStream *ts, TreeContext *tc, StmtInfo *stmt)
 {
-    JSParseNode *pn;
-    JSObject *obj;
-    JSObjectBox *blockbox;
-
-    pn = LexicalScopeNode::create(tc);
+    ParseNode *pn = LexicalScopeNode::create(tc);
     if (!pn)
         return NULL;
 
-    obj = js_NewBlockObject(cx);
+    JSObject *obj = js_NewBlockObject(cx);
     if (!obj)
         return NULL;
 
-    blockbox = tc->parser->newObjectBox(obj);
+    ObjectBox *blockbox = tc->parser->newObjectBox(obj);
     if (!blockbox)
         return NULL;
 
     js_PushBlockScope(tc, stmt, blockbox, -1);
     pn->setKind(TOK_LEXICALSCOPE);
     pn->setOp(JSOP_LEAVEBLOCK);
     pn->pn_objbox = blockbox;
     pn->pn_cookie.makeFree();
@@ -3458,21 +3450,21 @@ PushLexicalScope(JSContext *cx, TokenStr
     if (!GenerateBlockId(tc, stmt->blockid))
         return NULL;
     pn->pn_blockid = stmt->blockid;
     return pn;
 }
 
 #if JS_HAS_BLOCK_SCOPE
 
-JSParseNode *
+ParseNode *
 Parser::letBlock(JSBool statement)
 {
-    JSParseNode *pn, *pnblock, *pnlet;
-    JSStmtInfo stmtInfo;
+    ParseNode *pn, *pnblock, *pnlet;
+    StmtInfo stmtInfo;
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_LET);
 
     /* Create the let binary node. */
     pnlet = BinaryNode::create(tc);
     if (!pnlet)
         return NULL;
 
@@ -3539,26 +3531,26 @@ Parser::letBlock(JSBool statement)
 
     PopStatement(tc);
     return pn;
 }
 
 #endif /* JS_HAS_BLOCK_SCOPE */
 
 static bool
-PushBlocklikeStatement(JSStmtInfo *stmt, JSStmtType type, JSTreeContext *tc)
+PushBlocklikeStatement(StmtInfo *stmt, StmtType type, TreeContext *tc)
 {
     js_PushStatement(tc, stmt, type, -1);
     return GenerateBlockId(tc, stmt->blockid);
 }
 
-static JSParseNode *
-NewBindingNode(JSAtom *atom, JSTreeContext *tc, bool let = false)
+static ParseNode *
+NewBindingNode(JSAtom *atom, TreeContext *tc, bool let = false)
 {
-    JSParseNode *pn;
+    ParseNode *pn;
     AtomDefnPtr removal;
 
     if ((pn = tc->decls.lookupFirst(atom))) {
         JS_ASSERT(!pn->isPlaceholder());
     } else {
         removal = tc->lexdeps->lookup(atom);
         pn = removal ? removal.value() : NULL;
         JS_ASSERT_IF(pn, pn->isPlaceholder());
@@ -3591,55 +3583,55 @@ NewBindingNode(JSAtom *atom, JSTreeConte
         return NULL;
 
     if (atom == tc->parser->context->runtime->atomState.argumentsAtom)
         tc->countArgumentsUse(pn);
 
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::switchStatement()
 {
-    JSParseNode *pn5, *saveBlock;
+    ParseNode *pn5, *saveBlock;
     JSBool seenDefault = JS_FALSE;
 
-    JSParseNode *pn = BinaryNode::create(tc);
+    ParseNode *pn = BinaryNode::create(tc);
     if (!pn)
         return NULL;
     MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_SWITCH);
 
     /* pn1 points to the switch's discriminant. */
-    JSParseNode *pn1 = parenExpr();
+    ParseNode *pn1 = parenExpr();
     if (!pn1)
         return NULL;
 
     MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_SWITCH);
     MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_SWITCH);
 
     /*
      * NB: we must push stmtInfo before calling GenerateBlockIdForStmtNode
      * because that function states tc->topStmt->blockid.
      */
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     js_PushStatement(tc, &stmtInfo, STMT_SWITCH, -1);
 
     /* pn2 is a list of case nodes. The default case has pn_left == NULL */
-    JSParseNode *pn2 = ListNode::create(tc);
+    ParseNode *pn2 = ListNode::create(tc);
     if (!pn2)
         return NULL;
     pn2->makeEmpty();
     if (!GenerateBlockIdForStmtNode(pn2, tc))
         return NULL;
     saveBlock = tc->blockNode;
     tc->blockNode = pn2;
 
     TokenKind tt;
     while ((tt = tokenStream.getToken()) != TOK_RC) {
-        JSParseNode *pn3;
+        ParseNode *pn3;
         switch (tt) {
           case TOK_DEFAULT:
             if (seenDefault) {
                 reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_TOO_MANY_DEFAULTS);
                 return NULL;
             }
             seenDefault = JS_TRUE;
             /* FALL THROUGH */
@@ -3666,17 +3658,17 @@ Parser::switchStatement()
             return NULL;
 
           default:
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_SWITCH);
             return NULL;
         }
         MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_AFTER_CASE);
 
-        JSParseNode *pn4 = ListNode::create(tc);
+        ParseNode *pn4 = ListNode::create(tc);
         if (!pn4)
             return NULL;
         pn4->setKind(TOK_LC);
         pn4->makeEmpty();
         while ((tt = tokenStream.peekToken(TSF_OPERAND)) != TOK_RC &&
                tt != TOK_CASE && tt != TOK_DEFAULT) {
             if (tt == TOK_ERROR)
                 return NULL;
@@ -3706,30 +3698,30 @@ Parser::switchStatement()
     PopStatement(tc);
 
     pn->pn_pos.end = pn2->pn_pos.end = tokenStream.currentToken().pos.end;
     pn->pn_left = pn1;
     pn->pn_right = pn2;
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::forStatement()
 {
-    JSParseNode *pnseq = NULL;
+    ParseNode *pnseq = NULL;
 #if JS_HAS_BLOCK_SCOPE
-    JSParseNode *pnlet = NULL;
-    JSStmtInfo blockInfo;
+    ParseNode *pnlet = NULL;
+    StmtInfo blockInfo;
 #endif
 
     /* A FOR node is binary, left is loop control and right is the body. */
-    JSParseNode *pn = BinaryNode::create(tc);
+    ParseNode *pn = BinaryNode::create(tc);
     if (!pn)
         return NULL;
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     js_PushStatement(tc, &stmtInfo, STMT_FOR_LOOP, -1);
 
     pn->setOp(JSOP_ITER);
     pn->pn_iflags = 0;
     if (tokenStream.matchToken(TOK_NAME)) {
         if (tokenStream.currentToken().name() == context->runtime->atomState.eachAtom)
             pn->pn_iflags = JSITER_FOREACH;
         else
@@ -3738,17 +3730,17 @@ Parser::forStatement()
 
     MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_AFTER_FOR);
     TokenKind tt = tokenStream.peekToken(TSF_OPERAND);
 
 #if JS_HAS_BLOCK_SCOPE
     bool let = false;
 #endif
 
-    JSParseNode *pn1;
+    ParseNode *pn1;
     if (tt == TOK_SEMI) {
         if (pn->pn_iflags & JSITER_FOREACH) {
             reportErrorNumber(pn, JSREPORT_ERROR, JSMSG_BAD_FOR_EACH_LOOP);
             return NULL;
         }
 
         /* No initializer -- set first kid of left sub-node to null. */
         pn1 = NULL;
@@ -3792,20 +3784,20 @@ Parser::forStatement()
         if (!pn1)
             return NULL;
     }
 
     /*
      * We can be sure that it's a for/in loop if there's still an 'in'
      * keyword here, even if JavaScript recognizes 'in' as an operator,
      * as we've excluded 'in' from being parsed in RelExpr by setting
-     * the TCF_IN_FOR_INIT flag in our JSTreeContext.
+     * the TCF_IN_FOR_INIT flag in our TreeContext.
      */
-    JSParseNode *pn2, *pn3;
-    JSParseNode *pn4 = TernaryNode::create(tc);
+    ParseNode *pn2, *pn3;
+    ParseNode *pn4 = TernaryNode::create(tc);
     if (!pn4)
         return NULL;
     if (pn1 && tokenStream.matchToken(TOK_IN)) {
         /*
          * Parse the rest of the for/in head.
          *
          * Here pn1 is everything to the left of 'in'. At the end of this block,
          * pn1 is a decl or NULL, pn2 is the assignment target that receives the
@@ -3956,17 +3948,17 @@ Parser::forStatement()
         }
 
         /*
          * Parse the object expression as the right operand of 'in', first
          * removing the top statement from the statement-stack if this is a
          * 'for (let x in y)' loop.
          */
 #if JS_HAS_BLOCK_SCOPE
-        JSStmtInfo *save = tc->topStmt;
+        StmtInfo *save = tc->topStmt;
         if (let)
             tc->topStmt = save->down;
 #endif
         pn3 = expr();
         if (!pn3)
             return NULL;
 #if JS_HAS_BLOCK_SCOPE
         if (let)
@@ -4033,20 +4025,20 @@ Parser::forStatement()
         pnseq->pn_pos.end = pn->pn_pos.end;
         pnseq->append(pn);
         pn = pnseq;
     }
     PopStatement(tc);
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::tryStatement()
 {
-    JSParseNode *catchList, *lastCatch;
+    ParseNode *catchList, *lastCatch;
 
     /*
      * try nodes are ternary.
      * kid1 is the try statement
      * kid2 is the catch node list or null
      * kid3 is the finally statement
      *
      * catch nodes are ternary.
@@ -4055,23 +4047,23 @@ Parser::tryStatement()
      * kid3 is the catch block
      *
      * catch lvalue nodes are either:
      *   TOK_NAME for a single identifier
      *   TOK_RB or TOK_RC for a destructuring left-hand side
      *
      * finally nodes are TOK_LC statement lists.
      */
-    JSParseNode *pn = TernaryNode::create(tc);
+    ParseNode *pn = TernaryNode::create(tc);
     if (!pn)
         return NULL;
     pn->setOp(JSOP_NOP);
 
     MUST_MATCH_TOKEN(TOK_LC, JSMSG_CURLY_BEFORE_TRY);
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     if (!PushBlocklikeStatement(&stmtInfo, STMT_TRY, tc))
         return NULL;
     pn->pn_kid1 = statements();
     if (!pn->pn_kid1)
         return NULL;
     MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_TRY);
     PopStatement(tc);
 
@@ -4081,17 +4073,17 @@ Parser::tryStatement()
         catchList = ListNode::create(tc);
         if (!catchList)
             return NULL;
         catchList->setKind(TOK_RESERVED);
         catchList->makeEmpty();
         lastCatch = NULL;
 
         do {
-            JSParseNode *pnblock;
+            ParseNode *pnblock;
             BindData data;
 
             /* Check for another catch after unconditional catch. */
             if (lastCatch && !lastCatch->pn_kid2) {
                 reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_CATCH_AFTER_GENERAL);
                 return NULL;
             }
 
@@ -4106,34 +4098,34 @@ Parser::tryStatement()
 
             /*
              * Legal catch forms are:
              *   catch (lhs)
              *   catch (lhs if <boolean_expression>)
              * where lhs is a name or a destructuring left-hand side.
              * (the latter is legal only #ifdef JS_HAS_CATCH_GUARD)
              */
-            JSParseNode *pn2 = TernaryNode::create(tc);
+            ParseNode *pn2 = TernaryNode::create(tc);
             if (!pn2)
                 return NULL;
             pnblock->pn_expr = pn2;
             MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_CATCH);
 
             /*
              * Contrary to ECMA Ed. 3, the catch variable is lexically
              * scoped, not a property of a new Object instance.  This is
              * an intentional change that anticipates ECMA Ed. 4.
              */
             data.pn = NULL;
             data.op = JSOP_NOP;
             data.binder = BindLet;
             data.let.overflow = JSMSG_TOO_MANY_CATCH_VARS;
 
             tt = tokenStream.getToken();
-            JSParseNode *pn3;
+            ParseNode *pn3;
             switch (tt) {
 #if JS_HAS_DESTRUCTURING
               case TOK_LB:
               case TOK_LC:
                 pn3 = destructuringExpr(&data, tt);
                 if (!pn3)
                     return NULL;
                 break;
@@ -4199,101 +4191,99 @@ Parser::tryStatement()
     }
     if (!catchList && !pn->pn_kid3) {
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_CATCH_OR_FINALLY);
         return NULL;
     }
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::withStatement()
 {
     /*
      * In most cases, we want the constructs forbidden in strict mode
      * code to be a subset of those that JSOPTION_STRICT warns about, and
      * we should use ReportStrictModeError.  However, 'with' is the sole
      * instance of a construct that is forbidden in strict mode code, but
      * doesn't even merit a warning under JSOPTION_STRICT.  See
      * https://bugzilla.mozilla.org/show_bug.cgi?id=514576#c1.
      */
     if (tc->flags & TCF_STRICT_MODE_CODE) {
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_STRICT_CODE_WITH);
         return NULL;
     }
 
-    JSParseNode *pn = BinaryNode::create(tc);
+    ParseNode *pn = BinaryNode::create(tc);
     if (!pn)
         return NULL;
     MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_WITH);
-    JSParseNode *pn2 = parenExpr();
+    ParseNode *pn2 = parenExpr();
     if (!pn2)
         return NULL;
     MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_WITH);
     pn->pn_left = pn2;
 
-    JSParseNode *oldWith = tc->innermostWith;
+    ParseNode *oldWith = tc->innermostWith;
     tc->innermostWith = pn;
 
-    JSStmtInfo stmtInfo;
+    StmtInfo stmtInfo;
     js_PushStatement(tc, &stmtInfo, STMT_WITH, -1);
     pn2 = statement();
     if (!pn2)
         return NULL;
     PopStatement(tc);
 
     pn->pn_pos.end = pn2->pn_pos.end;
     pn->pn_right = pn2;
     tc->flags |= TCF_FUN_HEAVYWEIGHT;
     tc->innermostWith = oldWith;
 
     /*
      * Make sure to deoptimize lexical dependencies inside the |with|
      * to safely optimize binding globals (see bug 561923).
      */
     for (AtomDefnRange r = tc->lexdeps->all(); !r.empty(); r.popFront()) {
-        JSDefinition *defn = r.front().value();
-        JSDefinition *lexdep = defn->resolve();
+        Definition *defn = r.front().value();
+        Definition *lexdep = defn->resolve();
         DeoptimizeUsesWithin(lexdep, pn->pn_pos);
     }
 
     return pn;
 }
 
 #if JS_HAS_BLOCK_SCOPE
-JSParseNode *
+ParseNode *
 Parser::letStatement()
 {
-    JSObjectBox *blockbox;
-
-    JSParseNode *pn;
+    ParseNode *pn;
     do {
         /* Check for a let statement or let expression. */
         if (tokenStream.peekToken() == TOK_LP) {
             pn = letBlock(JS_TRUE);
             if (!pn || pn->isOp(JSOP_LEAVEBLOCK))
                 return pn;
 
             /* Let expressions require automatic semicolon insertion. */
             JS_ASSERT(pn->isKind(TOK_SEMI) || pn->isOp(JSOP_LEAVEBLOCKEXPR));
             break;
         }
 
         /*
-         * This is a let declaration. We must be directly under a block per
-         * the proposed ES4 specs, but not an implicit block created due to
+         * This is a let declaration. We must be directly under a block per the
+         * proposed ES4 specs, but not an implicit block created due to
          * 'for (let ...)'. If we pass this error test, make the enclosing
-         * JSStmtInfo be our scope. Further let declarations in this block
-         * will find this scope statement and use the same block object.
+         * StmtInfo be our scope. Further let declarations in this block will
+         * find this scope statement and use the same block object.
          *
          * If we are the first let declaration in this block (i.e., when the
-         * enclosing maybe-scope JSStmtInfo isn't yet a scope statement) then
+         * enclosing maybe-scope StmtInfo isn't yet a scope statement) then
          * we also need to set tc->blockNode to be our TOK_LEXICALSCOPE.
          */
-        JSStmtInfo *stmt = tc->topStmt;
+        StmtInfo *stmt = tc->topStmt;
         if (stmt &&
             (!STMT_MAYBE_SCOPE(stmt) || (stmt->flags & SIF_FOR_BLOCK))) {
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_LET_DECL_NOT_IN_BLOCK);
             return NULL;
         }
 
         if (stmt && (stmt->flags & SIF_SCOPE)) {
             JS_ASSERT(tc->blockChainBox == stmt->blockBox);
@@ -4325,17 +4315,17 @@ Parser::letStatement()
                       stmt->type == STMT_FINALLY);
             JS_ASSERT(!stmt->downScope);
 
             /* Convert the block statement into a scope statement. */
             JSObject *obj = js_NewBlockObject(tc->parser->context);
             if (!obj)
                 return NULL;
 
-            blockbox = tc->parser->newObjectBox(obj);
+            ObjectBox *blockbox = tc->parser->newObjectBox(obj);
             if (!blockbox)
                 return NULL;
 
             /*
              * Insert stmt on the tc->topScopeStmt/stmtInfo.downScope linked
              * list stack, if it isn't already there.  If it is there, but it
              * lacks the SIF_SCOPE flag, it must be a try, catch, or finally
              * block.
@@ -4345,22 +4335,22 @@ Parser::letStatement()
             tc->topScopeStmt = stmt;
 
             obj->setParent(tc->blockChain());
             blockbox->parent = tc->blockChainBox;
             tc->blockChainBox = blockbox;
             stmt->blockBox = blockbox;
 
 #ifdef DEBUG
-            JSParseNode *tmp = tc->blockNode;
+            ParseNode *tmp = tc->blockNode;
             JS_ASSERT(!tmp || !tmp->isKind(TOK_LEXICALSCOPE));
 #endif
 
             /* Create a new lexical scope node for these statements. */
-            JSParseNode *pn1 = LexicalScopeNode::create(tc);
+            ParseNode *pn1 = LexicalScopeNode::create(tc);
             if (!pn1)
                 return NULL;
 
             pn1->setKind(TOK_LEXICALSCOPE);
             pn1->setOp(JSOP_LEAVEBLOCK);
             pn1->pn_pos = tc->blockNode->pn_pos;
             pn1->pn_objbox = blockbox;
             pn1->pn_expr = tc->blockNode;
@@ -4374,45 +4364,45 @@ Parser::letStatement()
         pn->pn_xflags = PNX_POPVAR;
     } while (0);
 
     /* Check termination of this primitive statement. */
     return MatchOrInsertSemicolon(context, &tokenStream) ? pn : NULL;
 }
 #endif
 
-JSParseNode *
+ParseNode *
 Parser::expressionStatement()
 {
     tokenStream.ungetToken();
-    JSParseNode *pn2 = expr();
+    ParseNode *pn2 = expr();
     if (!pn2)
         return NULL;
 
     if (tokenStream.peekToken() == TOK_COLON) {
         if (!pn2->isKind(TOK_NAME)) {
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_LABEL);
             return NULL;
         }
         JSAtom *label = pn2->pn_atom;
-        for (JSStmtInfo *stmt = tc->topStmt; stmt; stmt = stmt->down) {
+        for (StmtInfo *stmt = tc->topStmt; stmt; stmt = stmt->down) {
             if (stmt->type == STMT_LABEL && stmt->label == label) {
                 reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_DUPLICATE_LABEL);
                 return NULL;
             }
         }
         ForgetUse(pn2);
 
         (void) tokenStream.getToken();
 
         /* Push a label struct and parse the statement. */
-        JSStmtInfo stmtInfo;
+        StmtInfo stmtInfo;
         js_PushStatement(tc, &stmtInfo, STMT_LABEL, -1);
         stmtInfo.label = label;
-        JSParseNode *pn = statement();
+        ParseNode *pn = statement();
         if (!pn)
             return NULL;
 
         /* Normalize empty statement to empty block for the decompiler. */
         if (pn->isKind(TOK_SEMI) && !pn->pn_kid) {
             pn->setKind(TOK_LC);
             pn->setArity(PN_LIST);
             pn->makeEmpty();
@@ -4421,17 +4411,17 @@ Parser::expressionStatement()
         /* Pop the label, set pn_expr, and return early. */
         PopStatement(tc);
         pn2->setKind(TOK_COLON);
         pn2->pn_pos.end = pn->pn_pos.end;
         pn2->pn_expr = pn;
         return pn2;
     }
 
-    JSParseNode *pn = UnaryNode::create(tc);
+    ParseNode *pn = UnaryNode::create(tc);
     if (!pn)
         return NULL;
     pn->setKind(TOK_SEMI);
     pn->pn_pos = pn2->pn_pos;
     pn->pn_kid = pn2;
 
     switch (pn2->getKind()) {
       case TOK_LP:
@@ -4463,20 +4453,20 @@ Parser::expressionStatement()
         break;
       default:;
     }
 
     /* Check termination of this primitive statement. */
     return MatchOrInsertSemicolon(context, &tokenStream) ? pn : NULL;
 }
 
-JSParseNode *
+ParseNode *
 Parser::statement()
 {
-    JSParseNode *pn;
+    ParseNode *pn;
 
     JS_CHECK_RECURSION(context, return NULL);
 
     switch (tokenStream.getToken(TSF_OPERAND)) {
       case TOK_FUNCTION:
       {
 #if JS_HAS_XML_SUPPORT
         TokenKind tt = tokenStream.peekToken(TSF_KEYWORD_IS_NAME);
@@ -4487,25 +4477,25 @@ Parser::statement()
       }
 
       case TOK_IF:
       {
         /* An IF node has three kids: condition, then, and optional else. */
         pn = TernaryNode::create(tc);
         if (!pn)
             return NULL;
-        JSParseNode *pn1 = condition();
+        ParseNode *pn1 = condition();
         if (!pn1)
             return NULL;
-        JSStmtInfo stmtInfo;
+        StmtInfo stmtInfo;
         js_PushStatement(tc, &stmtInfo, STMT_IF, -1);
-        JSParseNode *pn2 = statement();
+        ParseNode *pn2 = statement();
         if (!pn2)
             return NULL;
-        JSParseNode *pn3;
+        ParseNode *pn3;
         if (tokenStream.matchToken(TOK_ELSE, TSF_OPERAND)) {
             stmtInfo.type = STMT_ELSE;
             pn3 = statement();
             if (!pn3)
                 return NULL;
             pn->pn_pos.end = pn3->pn_pos.end;
         } else {
             pn3 = NULL;
@@ -4521,44 +4511,44 @@ Parser::statement()
       case TOK_SWITCH:
         return switchStatement();
 
       case TOK_WHILE:
       {
         pn = BinaryNode::create(tc);
         if (!pn)
             return NULL;
-        JSStmtInfo stmtInfo;
+        StmtInfo stmtInfo;
         js_PushStatement(tc, &stmtInfo, STMT_WHILE_LOOP, -1);
-        JSParseNode *pn2 = condition();
+        ParseNode *pn2 = condition();
         if (!pn2)
             return NULL;
         pn->pn_left = pn2;
-        JSParseNode *pn3 = statement();
+        ParseNode *pn3 = statement();
         if (!pn3)
             return NULL;
         PopStatement(tc);
         pn->pn_pos.end = pn3->pn_pos.end;
         pn->pn_right = pn3;
         return pn;
       }
 
       case TOK_DO:
       {
         pn = BinaryNode::create(tc);
         if (!pn)
             return NULL;
-        JSStmtInfo stmtInfo;
+        StmtInfo stmtInfo;
         js_PushStatement(tc, &stmtInfo, STMT_DO_LOOP, -1);
-        JSParseNode *pn2 = statement();
+        ParseNode *pn2 = statement();
         if (!pn2)
             return NULL;
         pn->pn_left = pn2;
         MUST_MATCH_TOKEN(TOK_WHILE, JSMSG_WHILE_AFTER_DO);
-        JSParseNode *pn3 = condition();
+        ParseNode *pn3 = condition();
         if (!pn3)
             return NULL;
         PopStatement(tc);
         pn->pn_pos.end = pn3->pn_pos.end;
         pn->pn_right = pn3;
         if (versionNumber() != JSVERSION_ECMA_3) {
             /*
              * All legacy and extended versions must do automatic semicolon
@@ -4587,17 +4577,17 @@ Parser::statement()
         TokenKind tt = tokenStream.peekTokenSameLine(TSF_OPERAND);
         if (tt == TOK_ERROR)
             return NULL;
         if (tt == TOK_EOF || tt == TOK_EOL || tt == TOK_SEMI || tt == TOK_RC) {
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
             return NULL;
         }
 
-        JSParseNode *pn2 = expr();
+        ParseNode *pn2 = expr();
         if (!pn2)
             return NULL;
         pn->pn_pos.end = pn2->pn_pos.end;
         pn->setOp(JSOP_THROW);
         pn->pn_kid = pn2;
         break;
       }
 
@@ -4612,17 +4602,17 @@ Parser::statement()
 
       case TOK_BREAK:
       {
         pn = NullaryNode::create(tc);
         if (!pn)
             return NULL;
         if (!MatchLabel(context, &tokenStream, pn))
             return NULL;
-        JSStmtInfo *stmt = tc->topStmt;
+        StmtInfo *stmt = tc->topStmt;
         JSAtom *label = pn->pn_atom;
         if (label) {
             for (; ; stmt = stmt->down) {
                 if (!stmt) {
                     reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_LABEL_NOT_FOUND);
                     return NULL;
                 }
                 if (stmt->type == STMT_LABEL && stmt->label == label)
@@ -4645,20 +4635,20 @@ Parser::statement()
 
       case TOK_CONTINUE:
       {
         pn = NullaryNode::create(tc);
         if (!pn)
             return NULL;
         if (!MatchLabel(context, &tokenStream, pn))
             return NULL;
-        JSStmtInfo *stmt = tc->topStmt;
+        StmtInfo *stmt = tc->topStmt;
         JSAtom *label = pn->pn_atom;
         if (label) {
-            for (JSStmtInfo *stmt2 = NULL; ; stmt = stmt->down) {
+            for (StmtInfo *stmt2 = NULL; ; stmt = stmt->down) {
                 if (!stmt) {
                     reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_LABEL_NOT_FOUND);
                     return NULL;
                 }
                 if (stmt->type == STMT_LABEL) {
                     if (stmt->label == label) {
                         if (!stmt2 || !STMT_IS_LOOP(stmt2)) {
                             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_CONTINUE);
@@ -4709,17 +4699,17 @@ Parser::statement()
         break;
 
       case TOK_LC:
       {
         uintN oldflags;
 
         oldflags = tc->flags;
         tc->flags = oldflags & ~TCF_HAS_FUNCTION_STMT;
-        JSStmtInfo stmtInfo;
+        StmtInfo stmtInfo;
         if (!PushBlocklikeStatement(&stmtInfo, STMT_BLOCK, tc))
             return NULL;
         pn = statements();
         if (!pn)
             return NULL;
 
         MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_IN_COMPOUND);
         PopStatement(tc);
@@ -4764,17 +4754,17 @@ Parser::statement()
             !tokenStream.matchToken(TOK_ASSIGN) ||
             tokenStream.currentToken().t_op != JSOP_NOP) {
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_DEFAULT_XML_NAMESPACE);
             return NULL;
         }
 
         /* Is this an E4X dagger I see before me? */
         tc->flags |= TCF_FUN_HEAVYWEIGHT;
-        JSParseNode *pn2 = expr();
+        ParseNode *pn2 = expr();
         if (!pn2)
             return NULL;
         pn->setOp(JSOP_DEFXMLNS);
         pn->pn_pos.end = pn2->pn_pos.end;
         pn->pn_kid = pn2;
         break;
       }
 #endif
@@ -4788,38 +4778,38 @@ Parser::statement()
 #endif
         return expressionStatement();
     }
 
     /* Check termination of this primitive statement. */
     return MatchOrInsertSemicolon(context, &tokenStream) ? pn : NULL;
 }
 
-JSParseNode *
+ParseNode *
 Parser::variables(bool inLetHead)
 {
     TokenKind tt;
     bool let;
-    JSStmtInfo *scopeStmt;
+    StmtInfo *scopeStmt;
     BindData data;
-    JSParseNode *pn, *pn2;
+    ParseNode *pn, *pn2;
 
     /*
      * The three options here are:
      * - TOK_LET: We are parsing a let declaration.
      * - TOK_LP: We are parsing the head of a let block.
      * - Otherwise, we're parsing var declarations.
      */
     tt = tokenStream.currentToken().type;
     let = (tt == TOK_LET || tt == TOK_LP);
     JS_ASSERT(let || tt == TOK_VAR);
 
 #if JS_HAS_BLOCK_SCOPE
     bool popScope = (inLetHead || (let && (tc->flags & TCF_IN_FOR_INIT)));
-    JSStmtInfo *save = tc->topStmt, *saveScope = tc->topScopeStmt;
+    StmtInfo *save = tc->topStmt, *saveScope = tc->topScopeStmt;
 #endif
 
     /* Make sure that statement set up the tree context correctly. */
     scopeStmt = tc->topScopeStmt;
     if (let) {
         while (scopeStmt && !(scopeStmt->flags & SIF_SCOPE)) {
             JS_ASSERT(!STMT_MAYBE_SCOPE(scopeStmt));
             scopeStmt = scopeStmt->downScope;
@@ -4869,29 +4859,29 @@ Parser::variables(bool inLetHead)
                 goto bad_var_init;
 
 #if JS_HAS_BLOCK_SCOPE
             if (popScope) {
                 tc->topStmt = save->down;
                 tc->topScopeStmt = saveScope->downScope;
             }
 #endif
-            JSParseNode *init = assignExpr();
+            ParseNode *init = assignExpr();
 #if JS_HAS_BLOCK_SCOPE
             if (popScope) {
                 tc->topStmt = save;
                 tc->topScopeStmt = saveScope;
             }
 #endif
 
             if (!init)
                 return NULL;
             UndominateInitializers(pn2, init->pn_pos.end, tc);
 
-            pn2 = JSParseNode::newBinaryOrAppend(TOK_ASSIGN, JSOP_NOP, pn2, init, tc);
+            pn2 = ParseNode::newBinaryOrAppend(TOK_ASSIGN, JSOP_NOP, pn2, init, tc);
             if (!pn2)
                 return NULL;
             pn->append(pn2);
             continue;
         }
 #endif /* JS_HAS_DESTRUCTURING */
 
         if (tt != TOK_NAME) {
@@ -4916,17 +4906,17 @@ Parser::variables(bool inLetHead)
                 goto bad_var_init;
 
 #if JS_HAS_BLOCK_SCOPE
             if (popScope) {
                 tc->topStmt = save->down;
                 tc->topScopeStmt = saveScope->downScope;
             }
 #endif
-            JSParseNode *init = assignExpr();
+            ParseNode *init = assignExpr();
 #if JS_HAS_BLOCK_SCOPE
             if (popScope) {
                 tc->topStmt = save;
                 tc->topScopeStmt = saveScope;
             }
 #endif
             if (!init)
                 return NULL;
@@ -4965,22 +4955,22 @@ Parser::variables(bool inLetHead)
     pn->pn_pos.end = pn->last()->pn_pos.end;
     return pn;
 
 bad_var_init:
     reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_VAR_INIT);
     return NULL;
 }
 
-JSParseNode *
+ParseNode *
 Parser::expr()
 {
-    JSParseNode *pn = assignExpr();
+    ParseNode *pn = assignExpr();
     if (pn && tokenStream.matchToken(TOK_COMMA)) {
-        JSParseNode *pn2 = ListNode::create(tc);
+        ParseNode *pn2 = ListNode::create(tc);
         if (!pn2)
             return NULL;
         pn2->pn_pos.begin = pn->pn_pos.begin;
         pn2->initList(pn);
         pn = pn2;
         do {
 #if JS_HAS_GENERATORS
             pn2 = pn->last();
@@ -5001,191 +4991,191 @@ Parser::expr()
 
 /*
  * For a number of the expression parsers we define an always-inlined version
  * and a never-inlined version (which just calls the always-inlined version).
  * Using the always-inlined version in the hot call-sites givs a ~5% parsing
  * speedup.  These macros help avoid some boilerplate code.
  */
 #define BEGIN_EXPR_PARSER(name)                                               \
-    JS_ALWAYS_INLINE JSParseNode *                                            \
+    JS_ALWAYS_INLINE ParseNode *                                              \
     Parser::name##i()
 
 #define END_EXPR_PARSER(name)                                                 \
-    JS_NEVER_INLINE JSParseNode *                                             \
+    JS_NEVER_INLINE ParseNode *                                               \
     Parser::name##n() {                                                       \
         return name##i();                                                     \
     }
 
 BEGIN_EXPR_PARSER(mulExpr1)
 {
     TokenKind tt;
-    JSParseNode *pn = unaryExpr();
+    ParseNode *pn = unaryExpr();
 
     /*
      * Note: unlike addExpr1() et al, we use getToken() here instead of
      * isCurrentTokenType() because unaryExpr() doesn't leave the TokenStream
      * state one past the end of the unary expression.
      */
     while (pn && ((tt = tokenStream.getToken()) == TOK_STAR || tt == TOK_DIVOP)) {
         tt = tokenStream.currentToken().type;
         JSOp op = tokenStream.currentToken().t_op;
-        pn = JSParseNode::newBinaryOrAppend(tt, op, pn, unaryExpr(), tc);
+        pn = ParseNode::newBinaryOrAppend(tt, op, pn, unaryExpr(), tc);
     }
     return pn;
 }
 END_EXPR_PARSER(mulExpr1)
 
 BEGIN_EXPR_PARSER(addExpr1)
 {
-    JSParseNode *pn = mulExpr1i();
+    ParseNode *pn = mulExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_PLUS, TOK_MINUS)) {
         TokenKind tt = tokenStream.currentToken().type;
         JSOp op = (tt == TOK_PLUS) ? JSOP_ADD : JSOP_SUB;
-        pn = JSParseNode::newBinaryOrAppend(tt, op, pn, mulExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(tt, op, pn, mulExpr1n(), tc);
     }
     return pn;
 }
 END_EXPR_PARSER(addExpr1)
 
 BEGIN_EXPR_PARSER(shiftExpr1)
 {
-    JSParseNode *pn = addExpr1i();
+    ParseNode *pn = addExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_SHOP)) {
         JSOp op = tokenStream.currentToken().t_op;
-        pn = JSParseNode::newBinaryOrAppend(TOK_SHOP, op, pn, addExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_SHOP, op, pn, addExpr1n(), tc);
     }
     return pn;
 }
 END_EXPR_PARSER(shiftExpr1)
 
 BEGIN_EXPR_PARSER(relExpr1)
 {
     uintN inForInitFlag = tc->flags & TCF_IN_FOR_INIT;
 
     /*
      * Uses of the in operator in shiftExprs are always unambiguous,
      * so unset the flag that prohibits recognizing it.
      */
     tc->flags &= ~TCF_IN_FOR_INIT;
 
-    JSParseNode *pn = shiftExpr1i();
+    ParseNode *pn = shiftExpr1i();
     while (pn &&
            (tokenStream.isCurrentTokenType(TOK_RELOP) ||
             /*
              * Recognize the 'in' token as an operator only if we're not
              * currently in the init expr of a for loop.
              */
             (inForInitFlag == 0 && tokenStream.isCurrentTokenType(TOK_IN)) ||
             tokenStream.isCurrentTokenType(TOK_INSTANCEOF))) {
         TokenKind tt = tokenStream.currentToken().type;
         JSOp op = tokenStream.currentToken().t_op;
-        pn = JSParseNode::newBinaryOrAppend(tt, op, pn, shiftExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(tt, op, pn, shiftExpr1n(), tc);
     }
     /* Restore previous state of inForInit flag. */
     tc->flags |= inForInitFlag;
 
     return pn;
 }
 END_EXPR_PARSER(relExpr1)
 
 BEGIN_EXPR_PARSER(eqExpr1)
 {
-    JSParseNode *pn = relExpr1i();
+    ParseNode *pn = relExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_EQOP)) {
         JSOp op = tokenStream.currentToken().t_op;
-        pn = JSParseNode::newBinaryOrAppend(TOK_EQOP, op, pn, relExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_EQOP, op, pn, relExpr1n(), tc);
     }
     return pn;
 }
 END_EXPR_PARSER(eqExpr1)
 
 BEGIN_EXPR_PARSER(bitAndExpr1)
 {
-    JSParseNode *pn = eqExpr1i();
+    ParseNode *pn = eqExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_BITAND))
-        pn = JSParseNode::newBinaryOrAppend(TOK_BITAND, JSOP_BITAND, pn, eqExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_BITAND, JSOP_BITAND, pn, eqExpr1n(), tc);
     return pn;
 }
 END_EXPR_PARSER(bitAndExpr1)
 
 BEGIN_EXPR_PARSER(bitXorExpr1)
 {
-    JSParseNode *pn = bitAndExpr1i();
+    ParseNode *pn = bitAndExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_BITXOR))
-        pn = JSParseNode::newBinaryOrAppend(TOK_BITXOR, JSOP_BITXOR, pn, bitAndExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_BITXOR, JSOP_BITXOR, pn, bitAndExpr1n(), tc);
     return pn;
 }
 END_EXPR_PARSER(bitXorExpr1)
 
 BEGIN_EXPR_PARSER(bitOrExpr1)
 {
-    JSParseNode *pn = bitXorExpr1i();
+    ParseNode *pn = bitXorExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_BITOR))
-        pn = JSParseNode::newBinaryOrAppend(TOK_BITOR, JSOP_BITOR, pn, bitXorExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_BITOR, JSOP_BITOR, pn, bitXorExpr1n(), tc);
     return pn;
 }
 END_EXPR_PARSER(bitOrExpr1)
 
 BEGIN_EXPR_PARSER(andExpr1)
 {
-    JSParseNode *pn = bitOrExpr1i();
+    ParseNode *pn = bitOrExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_AND))
-        pn = JSParseNode::newBinaryOrAppend(TOK_AND, JSOP_AND, pn, bitOrExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_AND, JSOP_AND, pn, bitOrExpr1n(), tc);
     return pn;
 }
 END_EXPR_PARSER(andExpr1)
 
-JS_ALWAYS_INLINE JSParseNode *
+JS_ALWAYS_INLINE ParseNode *
 Parser::orExpr1()
 {
-    JSParseNode *pn = andExpr1i();
+    ParseNode *pn = andExpr1i();
     while (pn && tokenStream.isCurrentTokenType(TOK_OR))
-        pn = JSParseNode::newBinaryOrAppend(TOK_OR, JSOP_OR, pn, andExpr1n(), tc);
+        pn = ParseNode::newBinaryOrAppend(TOK_OR, JSOP_OR, pn, andExpr1n(), tc);
     return pn;
 }
 
-JS_ALWAYS_INLINE JSParseNode *
+JS_ALWAYS_INLINE ParseNode *
 Parser::condExpr1()
 {
-    JSParseNode *pn = orExpr1();
+    ParseNode *pn = orExpr1();
     if (pn && tokenStream.isCurrentTokenType(TOK_HOOK)) {
-        JSParseNode *pn1 = pn;
+        ParseNode *pn1 = pn;
         pn = TernaryNode::create(tc);
         if (!pn)
             return NULL;
 
         /*
          * Always accept the 'in' operator in the middle clause of a ternary,
          * where it's unambiguous, even if we might be parsing the init of a
          * for statement.
          */
         uintN oldflags = tc->flags;
         tc->flags &= ~TCF_IN_FOR_INIT;
-        JSParseNode *pn2 = assignExpr();
+        ParseNode *pn2 = assignExpr();
         tc->flags = oldflags | (tc->flags & TCF_FUN_FLAGS);
 
         if (!pn2)
             return NULL;
         MUST_MATCH_TOKEN(TOK_COLON, JSMSG_COLON_IN_COND);
-        JSParseNode *pn3 = assignExpr();
+        ParseNode *pn3 = assignExpr();
         if (!pn3)
             return NULL;
         pn->pn_pos.begin = pn1->pn_pos.begin;
         pn->pn_pos.end = pn3->pn_pos.end;
         pn->pn_kid1 = pn1;
         pn->pn_kid2 = pn2;
         pn->pn_kid3 = pn3;
         tokenStream.getToken();     /* need to read one token past the end */
     }
     return pn;
 }
 
 bool
-Parser::setAssignmentLhsOps(JSParseNode *pn, JSOp op)
+Parser::setAssignmentLhsOps(ParseNode *pn, JSOp op)
 {
     switch (pn->getKind()) {
       case TOK_NAME:
         if (!CheckStrictAssignment(context, tc, pn))
             return false;
         pn->setOp(pn->isOp(JSOP_GETLOCAL) ? JSOP_SETLOCAL : JSOP_SETNAME);
         NoteLValue(context, pn, tc);
         break;
@@ -5220,64 +5210,64 @@ Parser::setAssignmentLhsOps(JSParseNode 
 #endif
       default:
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_LEFTSIDE_OF_ASS);
         return false;
     }
     return true;
 }
 
-JSParseNode *
+ParseNode *
 Parser::assignExpr()
 {
     JS_CHECK_RECURSION(context, return NULL);
 
 #if JS_HAS_GENERATORS
     if (tokenStream.matchToken(TOK_YIELD, TSF_OPERAND))
         return returnOrYield(true);
 #endif
 
-    JSParseNode *pn = condExpr1();
+    ParseNode *pn = condExpr1();
     if (!pn)
         return NULL;
 
     if (!tokenStream.isCurrentTokenType(TOK_ASSIGN)) {
         tokenStream.ungetToken();
         return pn;
     }
 
     JSOp op = tokenStream.currentToken().t_op;
     if (!setAssignmentLhsOps(pn, op))
         return NULL;
 
-    JSParseNode *rhs = assignExpr();
+    ParseNode *rhs = assignExpr();
     if (!rhs)
         return NULL;
     if (pn->isKind(TOK_NAME) && pn->isUsed()) {
-        JSDefinition *dn = pn->pn_lexdef;
+        Definition *dn = pn->pn_lexdef;
 
         /*
          * If the definition is not flagged as assigned, we must have imputed
          * the initialized flag to it, to optimize for flat closures. But that
          * optimization uses source coordinates to check dominance relations,
          * so we must extend the end of the definition to cover the right-hand
          * side of this assignment, i.e., the initializer.
          */
         if (!dn->isAssigned()) {
             JS_ASSERT(dn->isInitialized());
             dn->pn_pos.end = rhs->pn_pos.end;
         }
     }
 
-    return JSParseNode::newBinaryOrAppend(TOK_ASSIGN, op, pn, rhs, tc);
+    return ParseNode::newBinaryOrAppend(TOK_ASSIGN, op, pn, rhs, tc);
 }
 
-static JSParseNode *
-SetLvalKid(JSContext *cx, TokenStream *ts, JSTreeContext *tc,
-           JSParseNode *pn, JSParseNode *kid, const char *name)
+static ParseNode *
+SetLvalKid(JSContext *cx, TokenStream *ts, TreeContext *tc, ParseNode *pn, ParseNode *kid,
+           const char *name)
 {
     if (!kid->isKind(TOK_NAME) &&
         !kid->isKind(TOK_DOT) &&
         (!kid->isKind(TOK_LP) ||
          (!kid->isOp(JSOP_CALL) && !kid->isOp(JSOP_EVAL) &&
           !kid->isOp(JSOP_FUNCALL) && !kid->isOp(JSOP_FUNAPPLY))) &&
 #if JS_HAS_XML_SUPPORT
         (!kid->isKind(TOK_UNARYOP) || !kid->isOp(JSOP_XMLNAME)) &&
@@ -5290,18 +5280,17 @@ SetLvalKid(JSContext *cx, TokenStream *t
         return NULL;
     pn->pn_kid = kid;
     return kid;
 }
 
 static const char incop_name_str[][10] = {"increment", "decrement"};
 
 static JSBool
-SetIncOpKid(JSContext *cx, TokenStream *ts, JSTreeContext *tc,
-            JSParseNode *pn, JSParseNode *kid,
+SetIncOpKid(JSContext *cx, TokenStream *ts, TreeContext *tc, ParseNode *pn, ParseNode *kid,
             TokenKind tt, JSBool preorder)
 {
     JSOp op;
 
     kid = SetLvalKid(cx, ts, tc, pn, kid, incop_name_str[tt == TOK_DEC]);
     if (!kid)
         return JS_FALSE;
     switch (kid->getKind()) {
@@ -5337,20 +5326,20 @@ SetIncOpKid(JSContext *cx, TokenStream *
       default:
         JS_ASSERT(0);
         op = JSOP_NOP;
     }
     pn->setOp(op);
     return JS_TRUE;
 }
 
-JSParseNode *
+ParseNode *
 Parser::unaryExpr()
 {
-    JSParseNode *pn, *pn2;
+    ParseNode *pn, *pn2;
 
     JS_CHECK_RECURSION(context, return NULL);
 
     TokenKind tt = tokenStream.getToken(TSF_OPERAND);
     switch (tt) {
       case TOK_UNARYOP:
       case TOK_PLUS:
       case TOK_MINUS:
@@ -5389,17 +5378,17 @@ Parser::unaryExpr()
             return NULL;
         pn->pn_pos.end = pn2->pn_pos.end;
 
         /*
          * Under ECMA3, deleting any unary expression is valid -- it simply
          * returns true. Here we fold constants before checking for a call
          * expression, in order to rule out delete of a generator expression.
          */
-        if (foldConstants && !js_FoldConstants(context, pn2, tc))
+        if (foldConstants && !FoldConstants(context, pn2, tc))
             return NULL;
         switch (pn2->getKind()) {
           case TOK_LP:
             if (!(pn2->pn_xflags & PNX_SETCALL)) {
                 /*
                  * Call MakeSetCall to check for errors, but clear PNX_SETCALL
                  * because the optimizer will eliminate the useless delete.
                  */
@@ -5471,29 +5460,29 @@ Parser::unaryExpr()
  * so the transplanter must adjust static level as well as blockid. E's source
  * coordinates in root->pn_pos are critical to deciding which binding links to
  * preserve and which to cut.
  *
  * NB: This is not a general tree transplanter -- it knows in particular that
  * the one or more bindings induced by V have not yet been created.
  */
 class CompExprTransplanter {
-    JSParseNode     *root;
-    JSTreeContext   *tc;
+    ParseNode       *root;
+    TreeContext     *tc;
     bool            genexp;
     uintN           adjust;
     uintN           funcLevel;
 
   public:
-    CompExprTransplanter(JSParseNode *pn, JSTreeContext *tc, bool ge, uintN adj)
+    CompExprTransplanter(ParseNode *pn, TreeContext *tc, bool ge, uintN adj)
       : root(pn), tc(tc), genexp(ge), adjust(adj), funcLevel(0)
     {
     }
 
-    bool transplant(JSParseNode *pn);
+    bool transplant(ParseNode *pn);
 };
 
 /*
  * A helper for lazily checking for the presence of illegal |yield| or |arguments|
  * tokens inside of generator expressions. This must be done lazily since we don't
  * know whether we're in a generator expression until we see the "for" token after
  * we've already parsed the body expression.
  *
@@ -5504,64 +5493,64 @@ class CompExprTransplanter {
  * The guard will keep track of any |yield| or |arguments| tokens that occur while
  * parsing the body. As soon as the parser reaches the end of the body expression,
  * call endBody() to reset the context's state, and then immediately call:
  *
  * - checkValidBody() if this *did* turn out to be a generator expression
  * - maybeNoteGenerator() if this *did not* turn out to be a generator expression
  */
 class GenexpGuard {
-    JSTreeContext   *tc;
+    TreeContext     *tc;
     uint32          startYieldCount;
     uint32          startArgumentsCount;
 
   public:
-    explicit GenexpGuard(JSTreeContext *tc)
+    explicit GenexpGuard(TreeContext *tc)
       : tc(tc)
     {
         if (tc->parenDepth == 0) {
             tc->yieldCount = tc->argumentsCount = 0;
             tc->yieldNode = tc->argumentsNode = NULL;
         }
         startYieldCount = tc->yieldCount;
         startArgumentsCount = tc->argumentsCount;
         tc->parenDepth++;
     }
 
     void endBody();
-    bool checkValidBody(JSParseNode *pn);
-    bool maybeNoteGenerator(JSParseNode *pn);
+    bool checkValidBody(ParseNode *pn);
+    bool maybeNoteGenerator(ParseNode *pn);
 };
 
 void
 GenexpGuard::endBody()
 {
     tc->parenDepth--;
 }
 
 /*
  * Check whether a |yield| or |arguments| token has been encountered in the
  * body expression, and if so, report an error.
  *
  * Call this after endBody() when determining that the body *was* in a
  * generator expression.
  */
 bool
-GenexpGuard::checkValidBody(JSParseNode *pn)
+GenexpGuard::checkValidBody(ParseNode *pn)
 {
     if (tc->yieldCount > startYieldCount) {
-        JSParseNode *errorNode = tc->yieldNode;
+        ParseNode *errorNode = tc->yieldNode;
         if (!errorNode)
             errorNode = pn;
         tc->parser->reportErrorNumber(errorNode, JSREPORT_ERROR, JSMSG_BAD_GENEXP_BODY, js_yield_str);
         return false;
     }
 
     if (tc->argumentsCount > startArgumentsCount) {
-        JSParseNode *errorNode = tc->argumentsNode;
+        ParseNode *errorNode = tc->argumentsNode;
         if (!errorNode)
             errorNode = pn;
         tc->parser->reportErrorNumber(errorNode, JSREPORT_ERROR, JSMSG_BAD_GENEXP_BODY, js_arguments_str);
         return false;
     }
 
     return true;
 }
@@ -5569,17 +5558,17 @@ GenexpGuard::checkValidBody(JSParseNode 
 /*
  * Check whether a |yield| token has been encountered in the body expression,
  * and if so, note that the current function is a generator function.
  *
  * Call this after endBody() when determining that the body *was not* in a
  * generator expression.
  */
 bool
-GenexpGuard::maybeNoteGenerator(JSParseNode *pn)
+GenexpGuard::maybeNoteGenerator(ParseNode *pn)
 {
     if (tc->yieldCount > 0) {
         tc->flags |= TCF_FUN_IS_GENERATOR;
         if (!tc->inFunction()) {
             tc->parser->reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_RETURN_OR_YIELD,
                                           js_yield_str);
             return false;
         }
@@ -5595,17 +5584,17 @@ GenexpGuard::maybeNoteGenerator(JSParseN
 }
 
 /*
  * Any definitions nested within the comprehension expression of a generator
  * expression must move "down" one static level, which of course increases the
  * upvar-frame-skip count.
  */
 static bool
-BumpStaticLevel(JSParseNode *pn, JSTreeContext *tc)
+BumpStaticLevel(ParseNode *pn, TreeContext *tc)
 {
     if (!pn->pn_cookie.isFree()) {
         uintN level = pn->pn_cookie.level() + 1;
 
         JS_ASSERT(level >= tc->staticLevel);
         if (level >= UpvarCookie::FREE_LEVEL) {
             JS_ReportErrorNumber(tc->parser->context, js_GetErrorMessage, NULL,
                                  JSMSG_TOO_DEEP, js_function_str);
@@ -5613,33 +5602,33 @@ BumpStaticLevel(JSParseNode *pn, JSTreeC
         }
 
         pn->pn_cookie.set(level, pn->pn_cookie.slot());
     }
     return true;
 }
 
 static void
-AdjustBlockId(JSParseNode *pn, uintN adjust, JSTreeContext *tc)
+AdjustBlockId(ParseNode *pn, uintN adjust, TreeContext *tc)
 {
     JS_ASSERT(pn->isArity(PN_LIST) || pn->isArity(PN_FUNC) || pn->isArity(PN_NAME));
     pn->pn_blockid += adjust;
     if (pn->pn_blockid >= tc->blockidGen)
         tc->blockidGen = pn->pn_blockid + 1;
 }
 
 bool
-CompExprTransplanter::transplant(JSParseNode *pn)
+CompExprTransplanter::transplant(ParseNode *pn)
 {
     if (!pn)
         return true;
 
     switch (pn->getArity()) {
       case PN_LIST:
-        for (JSParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
+        for (ParseNode *pn2 = pn->pn_head; pn2; pn2 = pn2->pn_next) {
             if (!transplant(pn2))
                 return false;
         }
         if (pn->pn_pos >= root->pn_pos)
             AdjustBlockId(pn, adjust, tc);
         break;
 
       case PN_TERNARY:
@@ -5672,23 +5661,23 @@ CompExprTransplanter::transplant(JSParse
          * to reparent the funbox, since all descendant functions are correctly
          * linked under the top-most funbox. But every visit to this case needs
          * to update funbox->level.
          *
          * Recall that funbox->level is the static level of the code containing
          * the definition or expression of the function and not the static level
          * of the function's body.
          */
-        JSFunctionBox *funbox = pn->pn_funbox;
+        FunctionBox *funbox = pn->pn_funbox;
 
         funbox->level = tc->staticLevel + funcLevel;
         if (++funcLevel == 1 && genexp) {
-            JSFunctionBox *parent = tc->funbox;
-
-            JSFunctionBox **funboxp = &tc->parent->functionList;
+            FunctionBox *parent = tc->funbox;
+
+            FunctionBox **funboxp = &tc->parent->functionList;
             while (*funboxp != funbox)
                 funboxp = &(*funboxp)->siblings;
             *funboxp = funbox->siblings;
 
             funbox->parent = parent;
             funbox->siblings = parent->kids;
             parent->kids = funbox;
             funbox->level = tc->staticLevel;
@@ -5704,17 +5693,17 @@ CompExprTransplanter::transplant(JSParse
 
         if (pn->isDefn()) {
             if (genexp && !BumpStaticLevel(pn, tc))
                 return false;
         } else if (pn->isUsed()) {
             JS_ASSERT(!pn->isOp(JSOP_NOP));
             JS_ASSERT(pn->pn_cookie.isFree());
 
-            JSDefinition *dn = pn->pn_lexdef;
+            Definition *dn = pn->pn_lexdef;
             JS_ASSERT(dn->isDefn());
 
             /*
              * Adjust the definition's block id only if it is a placeholder not
              * to the left of the root node, and if pn is the last use visited
              * in the comprehension expression (to avoid adjusting the blockid
              * multiple times).
              *
@@ -5724,42 +5713,42 @@ CompExprTransplanter::transplant(JSParse
             if (dn->isPlaceholder() && dn->pn_pos >= root->pn_pos && dn->dn_uses == pn) {
                 if (genexp && !BumpStaticLevel(dn, tc))
                     return false;
                 AdjustBlockId(dn, adjust, tc);
             }
 
             JSAtom *atom = pn->pn_atom;
 #ifdef DEBUG
-            JSStmtInfo *stmt = js_LexicalLookup(tc, atom, NULL);
+            StmtInfo *stmt = js_LexicalLookup(tc, atom, NULL);
             JS_ASSERT(!stmt || stmt != tc->topStmt);
 #endif
             if (genexp && !dn->isOp(JSOP_CALLEE)) {
                 JS_ASSERT(!tc->decls.lookupFirst(atom));
 
                 if (dn->pn_pos < root->pn_pos) {
                     /*
                      * The variable originally appeared to be a use of a
                      * definition or placeholder outside the generator, but now
                      * we know it is scoped within the comprehension tail's
                      * clauses. Make it (along with any other uses within the
                      * generator) a use of a new placeholder in the generator's
                      * lexdeps.
                      */
-                    JSDefinition *dn2 = MakePlaceholder(pn, tc);
+                    Definition *dn2 = MakePlaceholder(pn, tc);
                     if (!dn2)
                         return false;
                     dn2->pn_pos = root->pn_pos;
 
                     /* 
                      * Change all uses of |dn| that lie within the generator's
                      * |yield| expression into uses of dn2.
                      */
-                    JSParseNode **pnup = &dn->dn_uses;
-                    JSParseNode *pnu;
+                    ParseNode **pnup = &dn->dn_uses;
+                    ParseNode *pnu;
                     while ((pnu = *pnup) != NULL && pnu->pn_pos >= root->pn_pos) {
                         pnu->pn_lexdef = dn2;
                         dn2->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS;
                         pnup = &pnu->pn_link;
                     }
                     dn2->dn_uses = dn->dn_uses;
                     dn->dn_uses = *pnup;
                     *pnup = NULL;
@@ -5798,23 +5787,23 @@ CompExprTransplanter::transplant(JSParse
  * Starting from a |for| keyword after the first array initialiser element or
  * an expression in an open parenthesis, parse the tail of the comprehension
  * or generator expression signified by this |for| keyword in context.
  *
  * Return null on failure, else return the top-most parse node for the array
  * comprehension or generator expression, with a unary node as the body of the
  * (possibly nested) for-loop, initialized by |type, op, kid|.
  */
-JSParseNode *
-Parser::comprehensionTail(JSParseNode *kid, uintN blockid, bool isGenexp,
+ParseNode *
+Parser::comprehensionTail(ParseNode *kid, uintN blockid, bool isGenexp,
                           TokenKind type, JSOp op)
 {
     uintN adjust;
-    JSParseNode *pn, *pn2, *pn3, **pnp;
-    JSStmtInfo stmtInfo;
+    ParseNode *pn, *pn2, *pn3, **pnp;
+    StmtInfo stmtInfo;
     BindData data;
     TokenKind tt;
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_FOR);
 
     if (type == TOK_SEMI) {
         /*
          * Generator expression desugars to an immediately applied lambda that
@@ -5917,17 +5906,17 @@ Parser::comprehensionTail(JSParseNode *k
           default:
             reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_NO_VARIABLE_NAME);
 
           case TOK_ERROR:
             return NULL;
         }
 
         MUST_MATCH_TOKEN(TOK_IN, JSMSG_IN_AFTER_FOR_NAME);
-        JSParseNode *pn4 = expr();
+        ParseNode *pn4 = expr();
         if (!pn4)
             return NULL;
         MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_FOR_CTRL);
 
         guard.endBody();
 
         if (isGenexp) {
             if (!guard.checkValidBody(pn2))
@@ -5967,17 +5956,17 @@ Parser::comprehensionTail(JSParseNode *k
 
           default:;
         }
 
         /*
          * Synthesize a declaration. Every definition must appear in the parse
          * tree in order for ComprehensionTranslator to work.
          */
-        JSParseNode *vars = ListNode::create(tc);
+        ParseNode *vars = ListNode::create(tc);
         if (!vars)
             return NULL;
         vars->setOp(JSOP_NOP);
         vars->setKind(TOK_VAR);
         vars->pn_pos = pn3->pn_pos;
         vars->makeEmpty();
         vars->append(pn3);
         vars->pn_xflags |= PNX_FORINVAR;
@@ -6029,46 +6018,46 @@ Parser::comprehensionTail(JSParseNode *k
  * application of a generator function that includes the |for| loops and
  * |if| guards, with |kid| as the operand of a |yield| expression as the
  * innermost loop body.
  *
  * Note how unlike Python, we do not evaluate the expression to the right of
  * the first |in| in the chain of |for| heads. Instead, a generator expression
  * is merely sugar for a generator function expression and its application.
  */
-JSParseNode *
-Parser::generatorExpr(JSParseNode *kid)
+ParseNode *
+Parser::generatorExpr(ParseNode *kid)
 {
     /* Create a |yield| node for |kid|. */
-    JSParseNode *pn = UnaryNode::create(tc);
+    ParseNode *pn = UnaryNode::create(tc);
     if (!pn)
         return NULL;
     pn->setKind(TOK_YIELD);
     pn->setOp(JSOP_YIELD);
     pn->setInParens(true);
     pn->pn_pos = kid->pn_pos;
     pn->pn_kid = kid;
     pn->pn_hidden = true;
 
     /* Make a new node for the desugared generator function. */
-    JSParseNode *genfn = FunctionNode::create(tc);
+    ParseNode *genfn = FunctionNode::create(tc);
     if (!genfn)
         return NULL;
     genfn->setKind(TOK_FUNCTION);
     genfn->setOp(JSOP_LAMBDA);
     JS_ASSERT(!genfn->pn_body);
     genfn->pn_dflags = PND_FUNARG;
 
     {
-        JSTreeContext *outertc = tc;
-        JSTreeContext gentc(tc->parser);
+        TreeContext *outertc = tc;
+        TreeContext gentc(tc->parser);
         if (!gentc.init(context))
             return NULL;
 
-        JSFunctionBox *funbox = EnterFunction(genfn, &gentc);
+        FunctionBox *funbox = EnterFunction(genfn, &gentc);
         if (!funbox)
             return NULL;
 
         /*
          * We have to dance around a bit to propagate sharp variables from
          * outertc to gentc before setting TCF_HAS_SHARPS implicitly by
          * propagating all of outertc's TCF_FUN_FLAGS flags. As below, we have
          * to be conservative by leaving TCF_HAS_SHARPS set in outertc if we
@@ -6088,58 +6077,58 @@ Parser::generatorExpr(JSParseNode *kid)
          * removed from tc->flags.
          */
         gentc.flags |= TCF_FUN_IS_GENERATOR | TCF_GENEXP_LAMBDA |
                        (outertc->flags & (TCF_FUN_FLAGS & ~TCF_FUN_PARAM_ARGUMENTS));
         funbox->tcflags |= gentc.flags;
         genfn->pn_funbox = funbox;
         genfn->pn_blockid = gentc.bodyid;
 
-        JSParseNode *body = comprehensionTail(pn, outertc->blockid(), true);
+        ParseNode *body = comprehensionTail(pn, outertc->blockid(), true);
         if (!body)
             return NULL;
         JS_ASSERT(!genfn->pn_body);
         genfn->pn_body = body;
         genfn->pn_pos.begin = body->pn_pos.begin = kid->pn_pos.begin;
         genfn->pn_pos.end = body->pn_pos.end = tokenStream.currentToken().pos.end;
 
         if (!LeaveFunction(genfn, &gentc))
             return NULL;
     }
 
     /*
      * Our result is a call expression that invokes the anonymous generator
      * function object.
      */
-    JSParseNode *result = ListNode::create(tc);
+    ParseNode *result = ListNode::create(tc);
     if (!result)
         return NULL;
     result->setKind(TOK_LP);
     result->setOp(JSOP_CALL);
     result->pn_pos.begin = genfn->pn_pos.begin;
     result->initList(genfn);
     return result;
 }
 
 static const char js_generator_str[] = "generator";
 
 #endif /* JS_HAS_GENERATOR_EXPRS */
 #endif /* JS_HAS_GENERATORS */
 
 JSBool
-Parser::argumentList(JSParseNode *listNode)
+Parser::argumentList(ParseNode *listNode)
 {
     if (tokenStream.matchToken(TOK_RP, TSF_OPERAND))
         return JS_TRUE;
 
     GenexpGuard guard(tc);
     bool arg0 = true;
 
     do {
-        JSParseNode *argNode = assignExpr();
+        ParseNode *argNode = assignExpr();
         if (!argNode)
             return JS_FALSE;
         if (arg0)
             guard.endBody();
 
 #if JS_HAS_GENERATORS
         if (argNode->isKind(TOK_YIELD) &&
             !argNode->isInParens() &&
@@ -6174,34 +6163,34 @@ Parser::argumentList(JSParseNode *listNo
     if (tokenStream.getToken() != TOK_RP) {
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_PAREN_AFTER_ARGS);
         return JS_FALSE;
     }
     return JS_TRUE;
 }
 
 /* Check for an immediately-applied (new'ed) lambda and clear PND_FUNARG. */
-static JSParseNode *
-CheckForImmediatelyAppliedLambda(JSParseNode *pn)
+static ParseNode *
+CheckForImmediatelyAppliedLambda(ParseNode *pn)
 {
     if (pn->isKind(TOK_FUNCTION)) {
         JS_ASSERT(pn->isArity(PN_FUNC));
 
-        JSFunctionBox *funbox = pn->pn_funbox;
+        FunctionBox *funbox = pn->pn_funbox;
         JS_ASSERT((funbox->function())->flags & JSFUN_LAMBDA);
         if (!(funbox->tcflags & (TCF_FUN_USES_ARGUMENTS | TCF_FUN_USES_OWN_NAME)))
             pn->pn_dflags &= ~PND_FUNARG;
     }
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::memberExpr(JSBool allowCallSyntax)
 {
-    JSParseNode *pn, *pn2, *pn3;
+    ParseNode *pn, *pn2, *pn3;
 
     JS_CHECK_RECURSION(context, return NULL);
 
     /* Check for new expression first. */
     TokenKind tt = tokenStream.getToken(TSF_OPERAND);
     if (tt == TOK_NEW) {
         pn = ListNode::create(tc);
         if (!pn)
@@ -6245,18 +6234,18 @@ Parser::memberExpr(JSBool allowCallSynta
         if (tt == TOK_DOT) {
             pn2 = NameNode::create(NULL, tc);
             if (!pn2)
                 return NULL;
 #if JS_HAS_XML_SUPPORT
             tt = tokenStream.getToken(TSF_OPERAND | TSF_KEYWORD_IS_NAME);
 
             /* Treat filters as 'with' statements for name deoptimization. */
-            JSParseNode *oldWith = tc->innermostWith;
-            JSStmtInfo stmtInfo;
+            ParseNode *oldWith = tc->innermostWith;
+            StmtInfo stmtInfo;
             if (tt == TOK_LP) {
                 tc->innermostWith = pn;
                 js_PushStatement(tc, &stmtInfo, STMT_WITH, -1);
             }
 
             pn3 = primaryExpr(tt, JS_TRUE);
             if (!pn3)
                 return NULL;
@@ -6407,42 +6396,40 @@ Parser::memberExpr(JSBool allowCallSynta
 
         pn = pn2;
     }
     if (tt == TOK_ERROR)
         return NULL;
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::bracketedExpr()
 {
     uintN oldflags;
-    JSParseNode *pn;
+    ParseNode *pn;
 
     /*
      * Always accept the 'in' operator in a parenthesized expression,
      * where it's unambiguous, even if we might be parsing the init of a
      * for statement.
      */
     oldflags = tc->flags;
     tc->flags &= ~TCF_IN_FOR_INIT;
     pn = expr();
     tc->flags = oldflags | (tc->flags & TCF_FUN_FLAGS);
     return pn;
 }
 
 #if JS_HAS_XML_SUPPORT
 
-JSParseNode *
+ParseNode *
 Parser::endBracketedExpr()
 {
-    JSParseNode *pn;
-
-    pn = bracketedExpr();
+    ParseNode *pn = bracketedExpr();
     if (!pn)
         return NULL;
 
     MUST_MATCH_TOKEN(TOK_RB, JSMSG_BRACKET_AFTER_ATTR_EXPR);
     return pn;
 }
 
 /*
@@ -6491,43 +6478,43 @@ Parser::endBracketedExpr()
  * And use this production instead of PrimaryExpression: QualifiedIdentifier:
  *
  *      PrimaryExpression:
  *              Identifier QualifiedSuffix
  *
  * We hoist the :: match into callers of QualifiedSuffix, in order to tweak
  * PropertySelector vs. Identifier pn_arity, pn_op, and other members.
  */
-JSParseNode *
+ParseNode *
 Parser::propertySelector()
 {
     DebugOnly<const Token *> tp = &tokenStream.currentToken();
     JS_ASSERT(tp->type == TOK_STAR || tp->type == TOK_NAME);
 
-    JSParseNode *pn = NullaryNode::create(tc);
+    ParseNode *pn = NullaryNode::create(tc);
     if (!pn)
         return NULL;
     if (pn->isKind(TOK_STAR)) {
         pn->setKind(TOK_ANYNAME);
         pn->setOp(JSOP_ANYNAME);
         pn->pn_atom = context->runtime->atomState.starAtom;
     } else {
         JS_ASSERT(pn->isKind(TOK_NAME));
         pn->setOp(JSOP_QNAMEPART);
         pn->setArity(PN_NAME);
         pn->pn_atom = tokenStream.currentToken().name();
         pn->pn_cookie.makeFree();
     }
     return pn;
 }
 
-JSParseNode *
-Parser::qualifiedSuffix(JSParseNode *pn)
+ParseNode *
+Parser::qualifiedSuffix(ParseNode *pn)
 {
-    JSParseNode *pn2, *pn3;
+    ParseNode *pn2, *pn3;
     TokenKind tt;
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_DBLCOLON);
     pn2 = NameNode::create(NULL, tc);
     if (!pn2)
         return NULL;
 
     /* Left operand of :: must be evaluated if it is an identifier. */
@@ -6559,37 +6546,37 @@ Parser::qualifiedSuffix(JSParseNode *pn)
     pn2->setArity(PN_BINARY);
     pn2->pn_pos.begin = pn->pn_pos.begin;
     pn2->pn_pos.end = pn3->pn_pos.end;
     pn2->pn_left = pn;
     pn2->pn_right = pn3;
     return pn2;
 }
 
-JSParseNode *
+ParseNode *
 Parser::qualifiedIdentifier()
 {
     DebugOnly<const Token *> tp = &tokenStream.currentToken();
     JS_ASSERT(tp->type == TOK_STAR || tp->type == TOK_NAME);
 
-    JSParseNode *pn = propertySelector();
+    ParseNode *pn = propertySelector();
     if (!pn)
         return NULL;
     if (tokenStream.matchToken(TOK_DBLCOLON)) {
         /* Hack for bug 496316. Slowing down E4X won't make it go away, alas. */
         tc->flags |= TCF_FUN_HEAVYWEIGHT;
         pn = qualifiedSuffix(pn);
     }
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::attributeIdentifier()
 {
-    JSParseNode *pn, *pn2;
+    ParseNode *pn, *pn2;
     TokenKind tt;
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_AT);
     pn = UnaryNode::create(tc);
     if (!pn)
         return NULL;
     pn->setOp(JSOP_TOATTRNAME);
     tt = tokenStream.getToken(TSF_KEYWORD_IS_NAME);
@@ -6605,20 +6592,20 @@ Parser::attributeIdentifier()
         return NULL;
     pn->pn_kid = pn2;
     return pn;
 }
 
 /*
  * Make a TOK_LC unary node whose pn_kid is an expression.
  */
-JSParseNode *
+ParseNode *
 Parser::xmlExpr(JSBool inTag)
 {
-    JSParseNode *pn, *pn2;
+    ParseNode *pn, *pn2;
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_LC);
     pn = UnaryNode::create(tc);
     if (!pn)
         return NULL;
 
     /*
      * Turn off XML tag mode. We save the old value of the flag because it may
@@ -6640,20 +6627,20 @@ Parser::xmlExpr(JSBool inTag)
 }
 
 /*
  * Make a terminal node for one of TOK_XMLNAME, TOK_XMLATTR, TOK_XMLSPACE,
  * TOK_XMLTEXT, TOK_XMLCDATA, TOK_XMLCOMMENT, or TOK_XMLPI.  When converting
  * parse tree to XML, we preserve a TOK_XMLSPACE node only if it's the sole
  * child of a container tag.
  */
-JSParseNode *
+ParseNode *
 Parser::xmlAtomNode()
 {
-    JSParseNode *pn = NullaryNode::create(tc);
+    ParseNode *pn = NullaryNode::create(tc);
     if (!pn)
         return NULL;
     const Token &tok = tokenStream.currentToken();
     pn->setOp(tok.t_op);
     if (tok.type == TOK_XMLPI) {
         pn->pn_pitarget = tok.xmlPITarget();
         pn->pn_pidata = tok.xmlPIData();
     } else {
@@ -6669,20 +6656,20 @@ Parser::xmlAtomNode()
  *              XMLName XMLNameExpr?
  *              { Expr } XMLNameExpr?
  *
  * Return a PN_LIST, PN_UNARY, or PN_NULLARY according as XMLNameExpr produces
  * a list of names and/or expressions, a single expression, or a single name.
  * If PN_LIST or PN_NULLARY, pn_type will be TOK_XMLNAME; if PN_UNARY, pn_type
  * will be TOK_LC.
  */
-JSParseNode *
+ParseNode *
 Parser::xmlNameExpr()
 {
-    JSParseNode *pn, *pn2, *list;
+    ParseNode *pn, *pn2, *list;
     TokenKind tt;
 
     pn = list = NULL;
     do {
         tt = tokenStream.currentToken().type;
         if (tt == TOK_LC) {
             pn2 = xmlExpr(JS_TRUE);
             if (!pn2)
@@ -6736,20 +6723,20 @@ Parser::xmlNameExpr()
  * produces a list of name and attribute values and/or braced expressions, a
  * single expression, or a single name.
  *
  * If PN_LIST or PN_NULLARY, pn_type will be TOK_XMLNAME for the case where
  * XMLTagContent: XMLNameExpr.  If pn_type is not TOK_XMLNAME but pn_arity is
  * PN_LIST, pn_type will be tagtype.  If PN_UNARY, pn_type will be TOK_LC and
  * we parsed exactly one expression.
  */
-JSParseNode *
+ParseNode *
 Parser::xmlTagContent(TokenKind tagtype, JSAtom **namep)
 {
-    JSParseNode *pn, *pn2, *list;
+    ParseNode *pn, *pn2, *list;
     TokenKind tt;
 
     pn = xmlNameExpr();
     if (!pn)
         return NULL;
     *namep = (pn->isArity(PN_NULLARY)) ? pn->pn_atom : NULL;
     list = NULL;
 
@@ -6809,40 +6796,40 @@ Parser::xmlTagContent(TokenKind tagtype,
         }                                                                                   \
     JS_END_MACRO
 
 /*
  * Consume XML element tag content, including the TOK_XMLETAGO (</) sequence
  * that opens the end tag for the container.
  */
 JSBool
-Parser::xmlElementContent(JSParseNode *pn)
+Parser::xmlElementContent(ParseNode *pn)
 {
     tokenStream.setXMLTagMode(false);
     for (;;) {
         TokenKind tt = tokenStream.getToken(TSF_XMLTEXTMODE);
         XML_CHECK_FOR_ERROR_AND_EOF(tt, JS_FALSE);
 
         JS_ASSERT(tt == TOK_XMLSPACE || tt == TOK_XMLTEXT);
         JSAtom *textAtom = tokenStream.currentToken().atom();
         if (textAtom) {
             /* Non-zero-length XML text scanned. */
-            JSParseNode *pn2 = xmlAtomNode();
+            ParseNode *pn2 = xmlAtomNode();
             if (!pn2)
                 return JS_FALSE;
             pn->pn_pos.end = pn2->pn_pos.end;
             pn->append(pn2);
         }
 
         tt = tokenStream.getToken(TSF_OPERAND);
         XML_CHECK_FOR_ERROR_AND_EOF(tt, JS_FALSE);
         if (tt == TOK_XMLETAGO)
             break;
 
-        JSParseNode *pn2;
+        ParseNode *pn2;
         if (tt == TOK_LC) {
             pn2 = xmlExpr(JS_FALSE);
             pn->pn_xflags |= PNX_CANTFOLD;
         } else if (tt == TOK_XMLSTAGO) {
             pn2 = xmlElementOrList(JS_FALSE);
             if (pn2) {
                 pn2->pn_xflags &= ~PNX_XMLROOT;
                 pn->pn_xflags |= pn2->pn_xflags;
@@ -6861,20 +6848,20 @@ Parser::xmlElementContent(JSParseNode *p
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_XMLETAGO);
     return JS_TRUE;
 }
 
 /*
  * Return a PN_LIST node containing an XML or XMLList Initialiser.
  */
-JSParseNode *
+ParseNode *
 Parser::xmlElementOrList(JSBool allowList)
 {
-    JSParseNode *pn, *pn2, *list;
+    ParseNode *pn, *pn2, *list;
     TokenKind tt;
     JSAtom *startAtom, *endAtom;
 
     JS_CHECK_RECURSION(context, return NULL);
 
     JS_ASSERT(tokenStream.currentToken().type == TOK_XMLSTAGO);
     pn = ListNode::create(tc);
     if (!pn)
@@ -6998,50 +6985,50 @@ Parser::xmlElementOrList(JSBool allowLis
         return NULL;
     }
     tokenStream.setXMLTagMode(false);
 
     pn->pn_pos.end = tokenStream.currentToken().pos.end;
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::xmlElementOrListRoot(JSBool allowList)
 {
     /*
      * Force XML support to be enabled so that comments and CDATA literals
      * are recognized, instead of <! followed by -- starting an HTML comment
      * to end of line (used in script tags to hide content from old browsers
      * that don't recognize <script>).
      */
     bool hadXML = tokenStream.hasXML();
     tokenStream.setXML(true);
-    JSParseNode *pn = xmlElementOrList(allowList);
+    ParseNode *pn = xmlElementOrList(allowList);
     tokenStream.setXML(hadXML);
     return pn;
 }
 
-JSParseNode *
+ParseNode *
 Parser::parseXMLText(JSObject *chain, bool allowList)
 {
     /*
      * Push a compiler frame if we have no frames, or if the top frame is a
      * lightweight function activation, or if its scope chain doesn't match
      * the one passed to us.
      */
-    JSTreeContext xmltc(this);
+    TreeContext xmltc(this);
     if (!xmltc.init(context))
         return NULL;
     xmltc.setScopeChain(chain);
 
     /* Set XML-only mode to turn off special treatment of {expr} in XML. */
     tokenStream.setXMLOnlyMode();
     TokenKind tt = tokenStream.getToken(TSF_OPERAND);
 
-    JSParseNode *pn;
+    ParseNode *pn;
     if (tt != TOK_XMLSTAGO) {
         reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_BAD_XML_MARKUP);
         pn = NULL;
     } else {
         pn = xmlElementOrListRoot(allowList);
     }
     tokenStream.setXMLOnlyMode(false);
 
@@ -7067,32 +7054,32 @@ Parser::parseXMLText(JSObject *chain, bo
  * list or on a hash chain -- see JSAtomMultiList::add*) in order to shadow
  * outer scope bindings of the same name.
  *
  * This simplifies binding lookup code at the price of a linear search here,
  * but only if code uses let (var predominates), and even then this function's
  * loop iterates more than once only in crazy cases.
  */
 static inline bool
-BlockIdInScope(uintN blockid, JSTreeContext *tc)
+BlockIdInScope(uintN blockid, TreeContext *tc)
 {
     if (blockid > tc->blockid())
         return false;
-    for (JSStmtInfo *stmt = tc->topScopeStmt; stmt; stmt = stmt->downScope) {
+    for (StmtInfo *stmt = tc->topScopeStmt; stmt; stmt = stmt->downScope) {
         if (stmt->blockid == blockid)
             return true;
     }
     return false;
 }
 #endif
 
-JSParseNode *
+ParseNode *
 Parser::primaryExpr(TokenKind tt, JSBool afterDot)
 {
-    JSParseNode *pn, *pn2, *pn3;
+    ParseNode *pn, *pn2, *pn3;
     JSOp op;