Bug 1146619 - Rename "Prolog" to "Prologue" everywhere. r=efaust

This commit is contained in:
Sean Stangl 2015-03-23 14:13:26 -07:00
parent 650e4f7e36
commit 9bdb826506
14 changed files with 72 additions and 72 deletions

View File

@ -113,7 +113,7 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
parent(parent),
script(cx, script),
lazyScript(cx, lazyScript),
prolog(cx, lineNum),
prologue(cx, lineNum),
main(cx, lineNum),
current(&main),
parser(parser),
@ -2979,7 +2979,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
FunctionBox* funbox = sc->asFunctionBox();
if (funbox->argumentsHasLocalBinding()) {
MOZ_ASSERT(offset() == 0); /* See JSScript::argumentsBytecode. */
switchToProlog();
switchToPrologue();
if (!emit1(JSOP_ARGUMENTS))
return false;
InternalBindingsHandle bindings(script, &script->bindings);
@ -3007,7 +3007,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
*/
bool runOnce = isRunOnceLambda();
if (runOnce) {
switchToProlog();
switchToPrologue();
if (!emit1(JSOP_RUNONCE))
return false;
switchToMain();
@ -3095,7 +3095,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
}
bool
BytecodeEmitter::maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result)
BytecodeEmitter::maybeEmitVarDecl(JSOp prologueOp, ParseNode* pn, jsatomid* result)
{
jsatomid atomIndex;
@ -3109,10 +3109,10 @@ BytecodeEmitter::maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result
if (JOF_OPTYPE(pn->getOp()) == JOF_ATOM &&
(!sc->isFunctionBox() || sc->asFunctionBox()->isHeavyweight()))
{
switchToProlog();
switchToPrologue();
if (!updateSourceCoordNotes(pn->pn_pos.begin))
return false;
if (!emitIndexOp(prologOp, atomIndex))
if (!emitIndexOp(prologueOp, atomIndex))
return false;
switchToMain();
}
@ -3124,7 +3124,7 @@ BytecodeEmitter::maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result
template <BytecodeEmitter::DestructuringDeclEmitter EmitName>
bool
BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pattern)
BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologueOp, ParseNode* pattern)
{
if (pattern->isKind(PNK_ARRAY)) {
for (ParseNode* element = pattern->pn_head; element; element = element->pn_next) {
@ -3138,10 +3138,10 @@ BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pat
if (target->isKind(PNK_ASSIGN))
target = target->pn_left;
if (target->isKind(PNK_NAME)) {
if (!EmitName(this, prologOp, target))
if (!EmitName(this, prologueOp, target))
return false;
} else {
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologOp, target))
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologueOp, target))
return false;
}
}
@ -3159,10 +3159,10 @@ BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pat
if (target->isKind(PNK_ASSIGN))
target = target->pn_left;
if (target->isKind(PNK_NAME)) {
if (!EmitName(this, prologOp, target))
if (!EmitName(this, prologueOp, target))
return false;
} else {
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologOp, target))
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologueOp, target))
return false;
}
}
@ -3170,24 +3170,24 @@ BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pat
}
static bool
EmitDestructuringDecl(BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn)
EmitDestructuringDecl(BytecodeEmitter* bce, JSOp prologueOp, ParseNode* pn)
{
MOZ_ASSERT(pn->isKind(PNK_NAME));
if (!bce->bindNameToSlot(pn))
return false;
MOZ_ASSERT(!pn->isOp(JSOP_CALLEE));
return bce->maybeEmitVarDecl(prologOp, pn, nullptr);
return bce->maybeEmitVarDecl(prologueOp, pn, nullptr);
}
bool
BytecodeEmitter::emitDestructuringDecls(JSOp prologOp, ParseNode* pattern)
BytecodeEmitter::emitDestructuringDecls(JSOp prologueOp, ParseNode* pattern)
{
return emitDestructuringDeclsWithEmitter<EmitDestructuringDecl>(prologOp, pattern);
return emitDestructuringDeclsWithEmitter<EmitDestructuringDecl>(prologueOp, pattern);
}
static bool
EmitInitializeDestructuringDecl(BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn)
EmitInitializeDestructuringDecl(BytecodeEmitter* bce, JSOp prologueOp, ParseNode* pn)
{
MOZ_ASSERT(pn->isKind(PNK_NAME));
MOZ_ASSERT(pn->isBound());
@ -3195,9 +3195,9 @@ EmitInitializeDestructuringDecl(BytecodeEmitter* bce, JSOp prologOp, ParseNode*
}
bool
BytecodeEmitter::emitInitializeDestructuringDecls(JSOp prologOp, ParseNode* pattern)
BytecodeEmitter::emitInitializeDestructuringDecls(JSOp prologueOp, ParseNode* pattern)
{
return emitDestructuringDeclsWithEmitter<EmitInitializeDestructuringDecl>(prologOp, pattern);
return emitDestructuringDeclsWithEmitter<EmitInitializeDestructuringDecl>(prologueOp, pattern);
}
bool
@ -4726,7 +4726,7 @@ BytecodeEmitter::emitForInOrOfVariables(ParseNode* pn, bool* letDecl)
MOZ_ASSERT_IF(*letDecl, pn->isLexical());
// 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 it is 'let x', enterBlockScope
// prologue opcode, but do not emit a pop. If it is 'let x', enterBlockScope
// will initialize let bindings in emitForOf and emitForIn with
// undefineds.
//
@ -5304,7 +5304,7 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto)
/*
* For a script we emit the code as we parse. Thus the bytecode for
* top-level functions should go in the prolog to predefine their
* top-level functions should go in the prologue to predefine their
* names in the variable object before the already-generated main code
* is executed. This extra work for top-level scripts is not necessary
* when we emit the code for a function. It is fully parsed prior to
@ -5315,7 +5315,7 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto)
MOZ_ASSERT(pn->pn_cookie.isFree());
MOZ_ASSERT(pn->getOp() == JSOP_NOP);
MOZ_ASSERT(!topStmt);
switchToProlog();
switchToPrologue();
if (!emitIndex32(JSOP_DEFFUN, index))
return false;
if (!updateSourceCoordNotes(pn->pn_pos.begin))
@ -6956,7 +6956,7 @@ BytecodeEmitter::emitTree(ParseNode* pn)
if (pn2->pn_next == pnlast && fun->hasRest() && !hasDefaults) {
// Fill rest parameter. We handled the case with defaults above.
MOZ_ASSERT(!sc->asFunctionBox()->argumentsHasLocalBinding());
switchToProlog();
switchToPrologue();
if (!emit1(JSOP_REST))
return false;
checkTypeSet(JSOP_REST);
@ -7489,21 +7489,21 @@ BytecodeEmitter::finishTakingSrcNotes(uint32_t* out)
{
MOZ_ASSERT(current == &main);
unsigned prologCount = prolog.notes.length();
if (prologCount && prolog.currentLine != firstLine) {
switchToProlog();
unsigned prologueCount = prologue.notes.length();
if (prologueCount && prologue.currentLine != firstLine) {
switchToPrologue();
if (!newSrcNote2(SRC_SETLINE, ptrdiff_t(firstLine)))
return false;
switchToMain();
} else {
/*
* Either no prolog srcnotes, or no line number change over prolog.
* Either no prologue srcnotes, or no line number change over prologue.
* We don't need a SRC_SETLINE, but we may need to adjust the offset
* of the first main note, by adding to its delta and possibly even
* prepending SRC_XDELTA notes to it to account for prolog bytecodes
* prepending SRC_XDELTA notes to it to account for prologue bytecodes
* that came at and after the last annotated bytecode.
*/
ptrdiff_t offset = prologOffset() - prolog.lastNoteOffset;
ptrdiff_t offset = prologueOffset() - prologue.lastNoteOffset;
MOZ_ASSERT(offset >= 0);
if (offset > 0 && main.notes.length() != 0) {
/* NB: Use as much of the first main note's delta as we can. */
@ -7525,23 +7525,23 @@ BytecodeEmitter::finishTakingSrcNotes(uint32_t* out)
}
}
// The prolog count might have changed, so we can't reuse prologCount.
// The prologue count might have changed, so we can't reuse prologueCount.
// The + 1 is to account for the final SN_MAKE_TERMINATOR that is appended
// when the notes are copied to their final destination by CopySrcNotes.
*out = prolog.notes.length() + main.notes.length() + 1;
*out = prologue.notes.length() + main.notes.length() + 1;
return true;
}
void
BytecodeEmitter::copySrcNotes(jssrcnote* destination, uint32_t nsrcnotes)
{
unsigned prologCount = prolog.notes.length();
unsigned prologueCount = prologue.notes.length();
unsigned mainCount = main.notes.length();
unsigned totalCount = prologCount + mainCount;
unsigned totalCount = prologueCount + mainCount;
MOZ_ASSERT(totalCount == nsrcnotes - 1);
if (prologCount)
PodCopy(destination, prolog.notes.begin(), prologCount);
PodCopy(destination + prologCount, main.notes.begin(), mainCount);
if (prologueCount)
PodCopy(destination, prologue.notes.begin(), prologueCount);
PodCopy(destination + prologueCount, main.notes.begin(), mainCount);
SN_MAKE_TERMINATOR(&destination[totalCount]);
}
@ -7724,12 +7724,12 @@ CGBlockScopeList::finish(BlockScopeArray* array)
}
void
CGYieldOffsetList::finish(YieldOffsetArray& array, uint32_t prologLength)
CGYieldOffsetList::finish(YieldOffsetArray& array, uint32_t prologueLength)
{
MOZ_ASSERT(length() == array.length());
for (unsigned i = 0; i < length(); i++)
array[i] = prologLength + list[i];
array[i] = prologueLength + list[i];
}
/*

View File

@ -80,7 +80,7 @@ struct CGYieldOffsetList {
bool append(uint32_t offset) { return list.append(offset); }
size_t length() const { return list.length(); }
void finish(YieldOffsetArray& array, uint32_t prologLength);
void finish(YieldOffsetArray& array, uint32_t prologueLength);
};
struct LoopStmtInfo;
@ -130,7 +130,7 @@ struct BytecodeEmitter
: code(cx), notes(cx), lastNoteOffset(0), currentLine(lineNum), lastColumn(0)
{}
};
EmitSection prolog, main, *current;
EmitSection prologue, main, *current;
/* the parser */
Parser<FullParseHandler>* const parser;
@ -257,9 +257,9 @@ struct BytecodeEmitter
BytecodeVector& code() const { return current->code; }
jsbytecode* code(ptrdiff_t offset) const { return current->code.begin() + offset; }
ptrdiff_t offset() const { return current->code.end() - current->code.begin(); }
ptrdiff_t prologOffset() const { return prolog.code.end() - prolog.code.begin(); }
ptrdiff_t prologueOffset() const { return prologue.code.end() - prologue.code.begin(); }
void switchToMain() { current = &main; }
void switchToProlog() { current = &prolog; }
void switchToPrologue() { current = &prologue; }
SrcNotesVector& notes() const { return current->notes; }
ptrdiff_t lastNoteOffset() const { return current->lastNoteOffset; }
@ -451,7 +451,7 @@ struct BytecodeEmitter
bool emitNameOp(ParseNode* pn, bool callContext);
bool emitNameIncDec(ParseNode* pn);
bool maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result);
bool maybeEmitVarDecl(JSOp prologueOp, ParseNode* pn, jsatomid* result);
bool emitVariables(ParseNode* pn, VarEmitOption emitOption, bool isLetExpr = false);
bool emitNewInit(JSProtoKey key);
@ -506,16 +506,16 @@ struct BytecodeEmitter
bool emitDestructuringOpsObjectHelper(ParseNode* pattern, VarEmitOption emitOption);
typedef bool
(*DestructuringDeclEmitter)(BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn);
(*DestructuringDeclEmitter)(BytecodeEmitter* bce, JSOp prologueOp, ParseNode* pn);
template <DestructuringDeclEmitter EmitName>
bool emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pattern);
bool emitDestructuringDeclsWithEmitter(JSOp prologueOp, ParseNode* pattern);
bool emitDestructuringDecls(JSOp prologOp, ParseNode* pattern);
bool emitDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
// Emit code to initialize all destructured names to the value on the top of
// the stack.
bool emitInitializeDestructuringDecls(JSOp prologOp, ParseNode* pattern);
bool emitInitializeDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
// emitIterator expects the iterable to already be on the stack.
// It will replace that stack value with the corresponding iterator

View File

@ -1175,7 +1175,7 @@ struct BindData
/* name node for definition processing and error source coordinates */
typename ParseHandler::Node pn;
JSOp op; /* prolog bytecode or nop */
JSOp op; /* prologue bytecode or nop */
Binder binder; /* binder, discriminates u */
bool isConst; /* const binding? */

View File

@ -184,7 +184,7 @@ C++ code. Running tests works like this:
- Then, for each '.py' test script in js/src/gdb/tests, the harness starts
GDB on the 'gdb-tests' executable, and then has GDB run
js/src/gdb/lib-for-tests/prolog.py, passing it the test script's path as
js/src/gdb/lib-for-tests/prologue.py, passing it the test script's path as
its first command-line argument.
Thanks To:

View File

@ -46,7 +46,7 @@ void reportError(JSContext* cx, const char* message, JSErrorReport* report)
message);
}
// prolog.py sets a breakpoint on this function; test functions can call it
// prologue.py sets a breakpoint on this function; test functions can call it
// to easily return control to GDB where desired.
void breakpoint() {
// If we leave this function empty, the linker will unify it with other

View File

@ -1,9 +1,9 @@
# Apparently, there's simply no way to ask GDB to exit with a non-zero
# status when the script run with the --eval-command option fails. Thus, if
# we have --eval-command run prolog.py directly, syntax errors there will
# we have --eval-command run prologue.py directly, syntax errors there will
# lead GDB to exit with no indication anything went wrong.
#
# To avert that, we use this very small launcher script to run prolog.py
# To avert that, we use this very small launcher script to run prologue.py
# and catch errors.
#
# Remember, errors in this file will cause spurious passes, so keep this as
@ -15,7 +15,7 @@ import traceback
try:
# testlibdir is set on the GDB command line, via:
# --eval-command python testlibdir=...
execfile(os.path.join(testlibdir, 'prolog.py'))
execfile(os.path.join(testlibdir, 'prologue.py'))
except Exception as err:
sys.stderr.write('Error running GDB prologue:\n')
traceback.print_exc()

View File

@ -5,7 +5,7 @@ assert_subprinter_registered('SpiderMonkey', 'ref-to-JSObject')
run_fragment('JSObject.simple')
# These patterns look a little strange because of prolog.py's 'set print
# These patterns look a little strange because of prologue.py's 'set print
# address off', which avoids putting varying addresses in the output. After
# the '(JSObject *) ', there is a 'void *' value printing as the empty
# string.

View File

@ -32,7 +32,7 @@ For more options:
Simply create a JS file under the 'tests/' directory. Most tests should go in
'tests/basic/'.
All tests are run with 'lib/prolog.js' included first on the command line. The
All tests are run with 'lib/prologue.js' included first on the command line. The
command line also creates a global variable 'libdir' that is set to the path
of the 'lib' directory. To include a file 'foo.js' from the lib directory in a
test case:

View File

@ -245,12 +245,12 @@ def main(argv):
options.ignore_timeouts = set()
prefix = [which(args[0])] + shlex.split(options.shell_args)
prolog = os.path.join(jittests.LIB_DIR, 'prolog.js')
prologue = os.path.join(jittests.LIB_DIR, 'prologue.js')
if options.remote:
prolog = posixpath.join(options.remote_test_root,
'jit-tests', 'jit-tests', 'lib', 'prolog.js')
prologue = posixpath.join(options.remote_test_root,
'jit-tests', 'jit-tests', 'lib', 'prologue.js')
prefix += ['-f', prolog]
prefix += ['-f', prologue]
# Clean up any remnants from previous crashes etc
shutil.rmtree(jittests.JS_CACHE_DIR, ignore_errors=True)

View File

@ -586,7 +586,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
uint32_t length, lineno, column, nslots, staticLevel;
uint32_t natoms, nsrcnotes, i;
uint32_t nconsts, nobjects, nregexps, ntrynotes, nblockscopes, nyieldoffsets;
uint32_t prologLength, version;
uint32_t prologueLength, version;
uint32_t funLength = 0;
uint32_t nTypeSets = 0;
uint32_t scriptBits = 0;
@ -633,7 +633,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
return false;
if (mode == XDR_ENCODE) {
prologLength = script->mainOffset();
prologueLength = script->mainOffset();
MOZ_ASSERT(script->getVersion() != JSVERSION_UNKNOWN);
version = script->getVersion();
lineno = script->lineno();
@ -702,7 +702,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
scriptBits |= (1 << HasPollutedGlobalScope);
}
if (!xdr->codeUint32(&prologLength))
if (!xdr->codeUint32(&prologueLength))
return false;
if (!xdr->codeUint32(&version))
return false;
@ -787,7 +787,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
}
MOZ_ASSERT(!script->mainOffset());
script->mainOffset_ = prologLength;
script->mainOffset_ = prologueLength;
script->setLength(length);
script->funLength_ = funLength;
@ -2567,7 +2567,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
MOZ_ASSERT(bce->regexpList.length <= INDEX_LIMIT);
uint32_t mainLength = bce->offset();
uint32_t prologLength = bce->prologOffset();
uint32_t prologueLength = bce->prologueOffset();
uint32_t nsrcnotes;
if (!bce->finishTakingSrcNotes(&nsrcnotes))
return false;
@ -2581,19 +2581,19 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
}
MOZ_ASSERT(script->mainOffset() == 0);
script->mainOffset_ = prologLength;
script->mainOffset_ = prologueLength;
script->lineno_ = bce->firstLine;
script->setLength(prologLength + mainLength);
script->setLength(prologueLength + mainLength);
script->natoms_ = natoms;
SharedScriptData* ssd = SharedScriptData::new_(cx, script->length(), nsrcnotes, natoms);
if (!ssd)
return false;
jsbytecode* code = ssd->data;
PodCopy<jsbytecode>(code, bce->prolog.code.begin(), prologLength);
PodCopy<jsbytecode>(code + prologLength, bce->code().begin(), mainLength);
PodCopy<jsbytecode>(code, bce->prologue.code.begin(), prologueLength);
PodCopy<jsbytecode>(code + prologueLength, bce->code().begin(), mainLength);
bce->copySrcNotes((jssrcnote*)(code + script->length()), nsrcnotes);
InitAtomMap(bce->atomIndices.getMap(), ssd->atoms());
@ -2639,7 +2639,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
script->setGeneratorKind(funbox->generatorKind());
script->setFunction(funbox->function());
if (bce->yieldOffsetList.length() != 0)
bce->yieldOffsetList.finish(script->yieldOffsets(), prologLength);
bce->yieldOffsetList.finish(script->yieldOffsets(), prologueLength);
}
// The call to nfixed() depends on the above setFunction() call.
@ -2855,7 +2855,7 @@ js::LineNumberToPC(JSScript* script, unsigned target)
unsigned bestdiff = SN_MAX_OFFSET;
for (jssrcnote* sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
/*
* Exact-match only if offset is not in the prolog; otherwise use
* Exact-match only if offset is not in the prologue; otherwise use
* nearest greater-or-equal line number match.
*/
if (lineno == target && offset >= ptrdiff_t(script->mainOffset()))

View File

@ -862,7 +862,7 @@ class JSScript : public js::gc::TenuredCell
uint32_t column_; /* base column of script, optionally set */
uint32_t mainOffset_;/* offset of main entry point from code, after
predef'ing prolog */
predef'ing prologue */
uint32_t natoms_; /* length of atoms array */
uint32_t nslots_; /* vars plus maximum stack depth */

View File

@ -80,7 +80,7 @@ class XULInfo:
class XULInfoTester:
def __init__(self, xulinfo, js_bin):
self.js_prolog = xulinfo.as_js()
self.js_prologue = xulinfo.as_js()
self.js_bin = js_bin
# Maps JS expr to evaluation result.
self.cache = {}
@ -91,7 +91,7 @@ class XULInfoTester:
if ans is None:
cmd = [
self.js_bin,
'-e', self.js_prolog,
'-e', self.js_prologue,
'-e', 'print(!!({}))'.format(cond)
]
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)