Rename PopStatementCG and NewScriptFromCG. Bug 696876, part 3 of 3. r=dvander.

--HG--
rename : js/src/frontend/BytecodeGenerator.cpp => js/src/frontend/BytecodeEmitter.cpp
rename : js/src/frontend/BytecodeGenerator.h => js/src/frontend/BytecodeEmitter.h
extra : rebase_source : de8a4aa72e70ecc321a987227ee88a1883400db9
This commit is contained in:
Jason Orendorff 2011-10-27 09:29:50 -05:00
parent b9c4c91103
commit 13bf278d0f
6 changed files with 28 additions and 28 deletions

View File

@ -263,7 +263,7 @@ BytecodeCompiler::compileScript(JSContext *cx, JSObject *scopeChain, StackFrame
JS_ASSERT(bce.version() == version);
script = JSScript::NewScriptFromCG(cx, &bce);
script = JSScript::NewScriptFromEmitter(cx, &bce);
if (!script)
goto out;

View File

@ -1686,7 +1686,7 @@ frontend::PopStatementTC(TreeContext *tc)
}
JSBool
frontend::PopStatementCG(JSContext *cx, BytecodeEmitter *bce)
frontend::PopStatementBCE(JSContext *cx, BytecodeEmitter *bce)
{
StmtInfo *stmt = bce->topStmt;
if (!STMT_IS_TRYING(stmt) &&
@ -3895,7 +3895,7 @@ out:
if (table)
cx->free_(table);
if (ok) {
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
#if JS_HAS_BLOCK_SCOPE
if (ok && pn->pn_right->isKind(TOK_LEXICALSCOPE))
@ -3951,7 +3951,7 @@ frontend::EmitFunctionScript(JSContext *cx, BytecodeEmitter *bce, ParseNode *bod
return EmitTree(cx, bce, body) &&
Emit1(cx, bce, JSOP_STOP) >= 0 &&
JSScript::NewScriptFromCG(cx, bce);
JSScript::NewScriptFromEmitter(cx, bce);
}
static bool
@ -5227,7 +5227,7 @@ EmitTry(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
}
JS_ASSERT(bce->stackDepth == depth);
}
if (!PopStatementCG(cx, bce))
if (!PopStatementBCE(cx, bce))
return false;
if (NewSrcNote(cx, bce, SRC_ENDBRACE) < 0 || Emit1(cx, bce, JSOP_NOP) < 0)
@ -5310,8 +5310,8 @@ EmitIf(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
/*
* Emit a JSOP_BACKPATCH op to jump from the end of our then part
* around the else part. The PopStatementCG call at the bottom of this
* function will fix up the backpatch chain linked from
* around the else part. The PopStatementBCE call at the bottom of
* this function will fix up the backpatch chain linked from
* stmtInfo.breaks.
*/
jmp = EmitGoto(cx, bce, &stmtInfo, &stmtInfo.breaks);
@ -5341,7 +5341,7 @@ EmitIf(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
/* No else part, fixup the branch-if-false to come here. */
CHECK_AND_SET_JUMP_OFFSET_AT(cx, bce, beq);
}
return PopStatementCG(cx, bce);
return PopStatementBCE(cx, bce);
}
#if JS_HAS_BLOCK_SCOPE
@ -5527,7 +5527,7 @@ EmitLexicalScope(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, JSBool &ok)
if (!EmitLeaveBlock(cx, bce, op, objbox))
return false;
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
return true;
}
@ -5548,7 +5548,7 @@ EmitWith(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, JSBool &ok)
return false;
if (Emit1(cx, bce, JSOP_LEAVEWITH) < 0)
return false;
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
return true;
}
@ -5679,7 +5679,7 @@ EmitForIn(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
return false;
/* Now fixup all breaks and continues (before the JSOP_ENDITER). */
if (!PopStatementCG(cx, bce))
if (!PopStatementBCE(cx, bce))
return false;
if (!NewTryNote(cx, bce, JSTRY_ITER, bce->stackDepth, top, bce->offset()))
@ -5829,7 +5829,7 @@ EmitNormalFor(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top)
return false;
/* Now fixup all breaks and continues. */
return PopStatementCG(cx, bce);
return PopStatementBCE(cx, bce);
}
static inline bool
@ -6092,7 +6092,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
return JS_FALSE;
if (!SetSrcNoteOffset(cx, bce, noteIndex, 0, beq - jmp))
return JS_FALSE;
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
break;
case TOK_DO:
@ -6140,7 +6140,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
return JS_FALSE;
if (!SetSrcNoteOffset(cx, bce, noteIndex, 0, 1 + (off - top)))
return JS_FALSE;
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
break;
case TOK_FOR:
@ -6348,7 +6348,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (noteIndex >= 0 && !SetSrcNoteOffset(cx, bce, (uintN)noteIndex, 0, bce->offset() - tmp))
return JS_FALSE;
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
break;
}
@ -6359,7 +6359,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (!EmitTree(cx, bce, pn2))
return JS_FALSE;
}
ok = PopStatementCG(cx, bce);
ok = PopStatementBCE(cx, bce);
break;
case TOK_SEMI:
@ -6462,7 +6462,7 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
stmtInfo.label = atom;
if (!EmitTree(cx, bce, pn2))
return JS_FALSE;
if (!PopStatementCG(cx, bce))
if (!PopStatementBCE(cx, bce))
return JS_FALSE;
/* If the statement was compound, emit a note for the end brace. */

View File

@ -196,9 +196,9 @@ struct StmtInfo {
/*
* A request flag passed to BytecodeCompiler::compileScript and then down via
* BytecodeEmitter to JSScript::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).
* BytecodeEmitter to JSScript::NewScriptFromEmitter, 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
@ -624,7 +624,7 @@ struct BytecodeEmitter : public TreeContext
OwnedAtomIndexMapPtr atomIndices; /* literals indexed for mapping */
AtomDefnMapPtr roLexdeps;
uintN firstLine; /* first line, for JSScript::NewScriptFromCG */
uintN firstLine; /* first line, for JSScript::NewScriptFromEmitter */
intN stackDepth; /* current stack depth in script frame */
uintN maxStackDepth; /* maximum stack depth so far */
@ -839,7 +839,7 @@ PushStatement(TreeContext *tc, StmtInfo *stmt, StmtType type, ptrdiff_t top);
/*
* Push a block scope statement and link blockObj into tc->blockChain. To pop
* this statement info record, use PopStatementTC as usual, or if appropriate
* (if generating code), PopStatementCG.
* (if generating code), PopStatementBCE.
*/
void
PushBlockScope(TreeContext *tc, StmtInfo *stmt, ObjectBox *blockBox, ptrdiff_t top);
@ -857,7 +857,7 @@ PopStatementTC(TreeContext *tc);
* jump offset overflows.
*/
JSBool
PopStatementCG(JSContext *cx, BytecodeEmitter *bce);
PopStatementBCE(JSContext *cx, BytecodeEmitter *bce);
/*
* Define and lookup a primitive jsval associated with the const named by atom.

View File

@ -1124,7 +1124,7 @@ class EvalScriptGuard
}
void setNewScript(JSScript *script) {
/* NewScriptFromCG has already called js_CallNewScriptHook. */
/* NewScriptFromEmitter has already called js_CallNewScriptHook. */
JS_ASSERT(!script_ && script);
script_ = script;
script_->isActiveEval = true;

View File

@ -1058,7 +1058,7 @@ JSScript::NewScript(JSContext *cx, uint32 length, uint32 nsrcnotes, uint32 natom
}
JSScript *
JSScript::NewScriptFromCG(JSContext *cx, BytecodeEmitter *bce)
JSScript::NewScriptFromEmitter(JSContext *cx, BytecodeEmitter *bce)
{
uint32 mainLength, prologLength, nfixed;
JSScript *script;

View File

@ -430,7 +430,7 @@ struct JSScript : public js::gc::Cell {
/*
* Two successively less primitive ways to make a new JSScript. The first
* does *not* call a non-null cx->runtime->newScriptHook -- only the second,
* NewScriptFromCG, calls this optional debugger hook.
* NewScriptFromEmitter, calls this optional debugger hook.
*
* The NewScript function can't know whether the script it creates belongs
* to a function, or is top-level or eval code, but the debugger wants access
@ -444,7 +444,7 @@ struct JSScript : public js::gc::Cell {
uint16 nClosedArgs, uint16 nClosedVars, uint32 nTypeSets,
JSVersion version);
static JSScript *NewScriptFromCG(JSContext *cx, js::BytecodeEmitter *bce);
static JSScript *NewScriptFromEmitter(JSContext *cx, js::BytecodeEmitter *bce);
#ifdef JS_CRASH_DIAGNOSTICS
/*
@ -854,7 +854,7 @@ extern void
js_SweepScriptFilenames(JSCompartment *comp);
/*
* New-script-hook calling is factored from js_NewScriptFromCG so that it
* New-script-hook calling is factored from NewScriptFromEmitter so that it
* and callers of js_XDRScript can share this code. In the case of callers
* of js_XDRScript, the hook should be invoked only after successful decode
* of any owning function (the fun parameter) or script object (null fun).