зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1146619 - Rename "Prolog" to "Prologue" everywhere. r=efaust
This commit is contained in:
Родитель
62331928fc
Коммит
a0f2b74c75
|
@ -113,7 +113,7 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
|
||||||
parent(parent),
|
parent(parent),
|
||||||
script(cx, script),
|
script(cx, script),
|
||||||
lazyScript(cx, lazyScript),
|
lazyScript(cx, lazyScript),
|
||||||
prolog(cx, lineNum),
|
prologue(cx, lineNum),
|
||||||
main(cx, lineNum),
|
main(cx, lineNum),
|
||||||
current(&main),
|
current(&main),
|
||||||
parser(parser),
|
parser(parser),
|
||||||
|
@ -2979,7 +2979,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
|
||||||
FunctionBox* funbox = sc->asFunctionBox();
|
FunctionBox* funbox = sc->asFunctionBox();
|
||||||
if (funbox->argumentsHasLocalBinding()) {
|
if (funbox->argumentsHasLocalBinding()) {
|
||||||
MOZ_ASSERT(offset() == 0); /* See JSScript::argumentsBytecode. */
|
MOZ_ASSERT(offset() == 0); /* See JSScript::argumentsBytecode. */
|
||||||
switchToProlog();
|
switchToPrologue();
|
||||||
if (!emit1(JSOP_ARGUMENTS))
|
if (!emit1(JSOP_ARGUMENTS))
|
||||||
return false;
|
return false;
|
||||||
InternalBindingsHandle bindings(script, &script->bindings);
|
InternalBindingsHandle bindings(script, &script->bindings);
|
||||||
|
@ -3007,7 +3007,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
|
||||||
*/
|
*/
|
||||||
bool runOnce = isRunOnceLambda();
|
bool runOnce = isRunOnceLambda();
|
||||||
if (runOnce) {
|
if (runOnce) {
|
||||||
switchToProlog();
|
switchToPrologue();
|
||||||
if (!emit1(JSOP_RUNONCE))
|
if (!emit1(JSOP_RUNONCE))
|
||||||
return false;
|
return false;
|
||||||
switchToMain();
|
switchToMain();
|
||||||
|
@ -3095,7 +3095,7 @@ BytecodeEmitter::emitFunctionScript(ParseNode* body)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BytecodeEmitter::maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result)
|
BytecodeEmitter::maybeEmitVarDecl(JSOp prologueOp, ParseNode* pn, jsatomid* result)
|
||||||
{
|
{
|
||||||
jsatomid atomIndex;
|
jsatomid atomIndex;
|
||||||
|
|
||||||
|
@ -3109,10 +3109,10 @@ BytecodeEmitter::maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result
|
||||||
if (JOF_OPTYPE(pn->getOp()) == JOF_ATOM &&
|
if (JOF_OPTYPE(pn->getOp()) == JOF_ATOM &&
|
||||||
(!sc->isFunctionBox() || sc->asFunctionBox()->isHeavyweight()))
|
(!sc->isFunctionBox() || sc->asFunctionBox()->isHeavyweight()))
|
||||||
{
|
{
|
||||||
switchToProlog();
|
switchToPrologue();
|
||||||
if (!updateSourceCoordNotes(pn->pn_pos.begin))
|
if (!updateSourceCoordNotes(pn->pn_pos.begin))
|
||||||
return false;
|
return false;
|
||||||
if (!emitIndexOp(prologOp, atomIndex))
|
if (!emitIndexOp(prologueOp, atomIndex))
|
||||||
return false;
|
return false;
|
||||||
switchToMain();
|
switchToMain();
|
||||||
}
|
}
|
||||||
|
@ -3124,7 +3124,7 @@ BytecodeEmitter::maybeEmitVarDecl(JSOp prologOp, ParseNode* pn, jsatomid* result
|
||||||
|
|
||||||
template <BytecodeEmitter::DestructuringDeclEmitter EmitName>
|
template <BytecodeEmitter::DestructuringDeclEmitter EmitName>
|
||||||
bool
|
bool
|
||||||
BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pattern)
|
BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologueOp, ParseNode* pattern)
|
||||||
{
|
{
|
||||||
if (pattern->isKind(PNK_ARRAY)) {
|
if (pattern->isKind(PNK_ARRAY)) {
|
||||||
for (ParseNode* element = pattern->pn_head; element; element = element->pn_next) {
|
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))
|
if (target->isKind(PNK_ASSIGN))
|
||||||
target = target->pn_left;
|
target = target->pn_left;
|
||||||
if (target->isKind(PNK_NAME)) {
|
if (target->isKind(PNK_NAME)) {
|
||||||
if (!EmitName(this, prologOp, target))
|
if (!EmitName(this, prologueOp, target))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologOp, target))
|
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologueOp, target))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3159,10 +3159,10 @@ BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pat
|
||||||
if (target->isKind(PNK_ASSIGN))
|
if (target->isKind(PNK_ASSIGN))
|
||||||
target = target->pn_left;
|
target = target->pn_left;
|
||||||
if (target->isKind(PNK_NAME)) {
|
if (target->isKind(PNK_NAME)) {
|
||||||
if (!EmitName(this, prologOp, target))
|
if (!EmitName(this, prologueOp, target))
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologOp, target))
|
if (!emitDestructuringDeclsWithEmitter<EmitName>(prologueOp, target))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3170,24 +3170,24 @@ BytecodeEmitter::emitDestructuringDeclsWithEmitter(JSOp prologOp, ParseNode* pat
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
EmitDestructuringDecl(BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn)
|
EmitDestructuringDecl(BytecodeEmitter* bce, JSOp prologueOp, ParseNode* pn)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(pn->isKind(PNK_NAME));
|
MOZ_ASSERT(pn->isKind(PNK_NAME));
|
||||||
if (!bce->bindNameToSlot(pn))
|
if (!bce->bindNameToSlot(pn))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MOZ_ASSERT(!pn->isOp(JSOP_CALLEE));
|
MOZ_ASSERT(!pn->isOp(JSOP_CALLEE));
|
||||||
return bce->maybeEmitVarDecl(prologOp, pn, nullptr);
|
return bce->maybeEmitVarDecl(prologueOp, pn, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
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
|
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->isKind(PNK_NAME));
|
||||||
MOZ_ASSERT(pn->isBound());
|
MOZ_ASSERT(pn->isBound());
|
||||||
|
@ -3195,9 +3195,9 @@ EmitInitializeDestructuringDecl(BytecodeEmitter* bce, JSOp prologOp, ParseNode*
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BytecodeEmitter::emitInitializeDestructuringDecls(JSOp prologOp, ParseNode* pattern)
|
BytecodeEmitter::emitInitializeDestructuringDecls(JSOp prologueOp, ParseNode* pattern)
|
||||||
{
|
{
|
||||||
return emitDestructuringDeclsWithEmitter<EmitInitializeDestructuringDecl>(prologOp, pattern);
|
return emitDestructuringDeclsWithEmitter<EmitInitializeDestructuringDecl>(prologueOp, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -4726,7 +4726,7 @@ BytecodeEmitter::emitForInOrOfVariables(ParseNode* pn, bool* letDecl)
|
||||||
MOZ_ASSERT_IF(*letDecl, pn->isLexical());
|
MOZ_ASSERT_IF(*letDecl, pn->isLexical());
|
||||||
|
|
||||||
// If the left part is 'var x', emit code to define x if necessary using a
|
// 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
|
// will initialize let bindings in emitForOf and emitForIn with
|
||||||
// undefineds.
|
// 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
|
* 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
|
* names in the variable object before the already-generated main code
|
||||||
* is executed. This extra work for top-level scripts is not necessary
|
* 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
|
* 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->pn_cookie.isFree());
|
||||||
MOZ_ASSERT(pn->getOp() == JSOP_NOP);
|
MOZ_ASSERT(pn->getOp() == JSOP_NOP);
|
||||||
MOZ_ASSERT(!topStmt);
|
MOZ_ASSERT(!topStmt);
|
||||||
switchToProlog();
|
switchToPrologue();
|
||||||
if (!emitIndex32(JSOP_DEFFUN, index))
|
if (!emitIndex32(JSOP_DEFFUN, index))
|
||||||
return false;
|
return false;
|
||||||
if (!updateSourceCoordNotes(pn->pn_pos.begin))
|
if (!updateSourceCoordNotes(pn->pn_pos.begin))
|
||||||
|
@ -6956,7 +6956,7 @@ BytecodeEmitter::emitTree(ParseNode* pn)
|
||||||
if (pn2->pn_next == pnlast && fun->hasRest() && !hasDefaults) {
|
if (pn2->pn_next == pnlast && fun->hasRest() && !hasDefaults) {
|
||||||
// Fill rest parameter. We handled the case with defaults above.
|
// Fill rest parameter. We handled the case with defaults above.
|
||||||
MOZ_ASSERT(!sc->asFunctionBox()->argumentsHasLocalBinding());
|
MOZ_ASSERT(!sc->asFunctionBox()->argumentsHasLocalBinding());
|
||||||
switchToProlog();
|
switchToPrologue();
|
||||||
if (!emit1(JSOP_REST))
|
if (!emit1(JSOP_REST))
|
||||||
return false;
|
return false;
|
||||||
checkTypeSet(JSOP_REST);
|
checkTypeSet(JSOP_REST);
|
||||||
|
@ -7489,21 +7489,21 @@ BytecodeEmitter::finishTakingSrcNotes(uint32_t* out)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(current == &main);
|
MOZ_ASSERT(current == &main);
|
||||||
|
|
||||||
unsigned prologCount = prolog.notes.length();
|
unsigned prologueCount = prologue.notes.length();
|
||||||
if (prologCount && prolog.currentLine != firstLine) {
|
if (prologueCount && prologue.currentLine != firstLine) {
|
||||||
switchToProlog();
|
switchToPrologue();
|
||||||
if (!newSrcNote2(SRC_SETLINE, ptrdiff_t(firstLine)))
|
if (!newSrcNote2(SRC_SETLINE, ptrdiff_t(firstLine)))
|
||||||
return false;
|
return false;
|
||||||
switchToMain();
|
switchToMain();
|
||||||
} else {
|
} 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
|
* 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
|
* 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.
|
* 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);
|
MOZ_ASSERT(offset >= 0);
|
||||||
if (offset > 0 && main.notes.length() != 0) {
|
if (offset > 0 && main.notes.length() != 0) {
|
||||||
/* NB: Use as much of the first main note's delta as we can. */
|
/* 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
|
// 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.
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BytecodeEmitter::copySrcNotes(jssrcnote* destination, uint32_t nsrcnotes)
|
BytecodeEmitter::copySrcNotes(jssrcnote* destination, uint32_t nsrcnotes)
|
||||||
{
|
{
|
||||||
unsigned prologCount = prolog.notes.length();
|
unsigned prologueCount = prologue.notes.length();
|
||||||
unsigned mainCount = main.notes.length();
|
unsigned mainCount = main.notes.length();
|
||||||
unsigned totalCount = prologCount + mainCount;
|
unsigned totalCount = prologueCount + mainCount;
|
||||||
MOZ_ASSERT(totalCount == nsrcnotes - 1);
|
MOZ_ASSERT(totalCount == nsrcnotes - 1);
|
||||||
if (prologCount)
|
if (prologueCount)
|
||||||
PodCopy(destination, prolog.notes.begin(), prologCount);
|
PodCopy(destination, prologue.notes.begin(), prologueCount);
|
||||||
PodCopy(destination + prologCount, main.notes.begin(), mainCount);
|
PodCopy(destination + prologueCount, main.notes.begin(), mainCount);
|
||||||
SN_MAKE_TERMINATOR(&destination[totalCount]);
|
SN_MAKE_TERMINATOR(&destination[totalCount]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7724,12 +7724,12 @@ CGBlockScopeList::finish(BlockScopeArray* array)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CGYieldOffsetList::finish(YieldOffsetArray& array, uint32_t prologLength)
|
CGYieldOffsetList::finish(YieldOffsetArray& array, uint32_t prologueLength)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(length() == array.length());
|
MOZ_ASSERT(length() == array.length());
|
||||||
|
|
||||||
for (unsigned i = 0; i < length(); i++)
|
for (unsigned i = 0; i < length(); i++)
|
||||||
array[i] = prologLength + list[i];
|
array[i] = prologueLength + list[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -80,7 +80,7 @@ struct CGYieldOffsetList {
|
||||||
|
|
||||||
bool append(uint32_t offset) { return list.append(offset); }
|
bool append(uint32_t offset) { return list.append(offset); }
|
||||||
size_t length() const { return list.length(); }
|
size_t length() const { return list.length(); }
|
||||||
void finish(YieldOffsetArray& array, uint32_t prologLength);
|
void finish(YieldOffsetArray& array, uint32_t prologueLength);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LoopStmtInfo;
|
struct LoopStmtInfo;
|
||||||
|
@ -130,7 +130,7 @@ struct BytecodeEmitter
|
||||||
: code(cx), notes(cx), lastNoteOffset(0), currentLine(lineNum), lastColumn(0)
|
: code(cx), notes(cx), lastNoteOffset(0), currentLine(lineNum), lastColumn(0)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
EmitSection prolog, main, *current;
|
EmitSection prologue, main, *current;
|
||||||
|
|
||||||
/* the parser */
|
/* the parser */
|
||||||
Parser<FullParseHandler>* const parser;
|
Parser<FullParseHandler>* const parser;
|
||||||
|
@ -257,9 +257,9 @@ struct BytecodeEmitter
|
||||||
BytecodeVector& code() const { return current->code; }
|
BytecodeVector& code() const { return current->code; }
|
||||||
jsbytecode* code(ptrdiff_t offset) const { return current->code.begin() + offset; }
|
jsbytecode* code(ptrdiff_t offset) const { return current->code.begin() + offset; }
|
||||||
ptrdiff_t offset() const { return current->code.end() - current->code.begin(); }
|
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 switchToMain() { current = &main; }
|
||||||
void switchToProlog() { current = &prolog; }
|
void switchToPrologue() { current = &prologue; }
|
||||||
|
|
||||||
SrcNotesVector& notes() const { return current->notes; }
|
SrcNotesVector& notes() const { return current->notes; }
|
||||||
ptrdiff_t lastNoteOffset() const { return current->lastNoteOffset; }
|
ptrdiff_t lastNoteOffset() const { return current->lastNoteOffset; }
|
||||||
|
@ -451,7 +451,7 @@ struct BytecodeEmitter
|
||||||
bool emitNameOp(ParseNode* pn, bool callContext);
|
bool emitNameOp(ParseNode* pn, bool callContext);
|
||||||
bool emitNameIncDec(ParseNode* pn);
|
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 emitVariables(ParseNode* pn, VarEmitOption emitOption, bool isLetExpr = false);
|
||||||
|
|
||||||
bool emitNewInit(JSProtoKey key);
|
bool emitNewInit(JSProtoKey key);
|
||||||
|
@ -506,16 +506,16 @@ struct BytecodeEmitter
|
||||||
bool emitDestructuringOpsObjectHelper(ParseNode* pattern, VarEmitOption emitOption);
|
bool emitDestructuringOpsObjectHelper(ParseNode* pattern, VarEmitOption emitOption);
|
||||||
|
|
||||||
typedef bool
|
typedef bool
|
||||||
(*DestructuringDeclEmitter)(BytecodeEmitter* bce, JSOp prologOp, ParseNode* pn);
|
(*DestructuringDeclEmitter)(BytecodeEmitter* bce, JSOp prologueOp, ParseNode* pn);
|
||||||
|
|
||||||
template <DestructuringDeclEmitter EmitName>
|
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
|
// Emit code to initialize all destructured names to the value on the top of
|
||||||
// the stack.
|
// the stack.
|
||||||
bool emitInitializeDestructuringDecls(JSOp prologOp, ParseNode* pattern);
|
bool emitInitializeDestructuringDecls(JSOp prologueOp, ParseNode* pattern);
|
||||||
|
|
||||||
// emitIterator expects the iterable to already be on the stack.
|
// emitIterator expects the iterable to already be on the stack.
|
||||||
// It will replace that stack value with the corresponding iterator
|
// It will replace that stack value with the corresponding iterator
|
||||||
|
|
|
@ -1175,7 +1175,7 @@ struct BindData
|
||||||
/* name node for definition processing and error source coordinates */
|
/* name node for definition processing and error source coordinates */
|
||||||
typename ParseHandler::Node pn;
|
typename ParseHandler::Node pn;
|
||||||
|
|
||||||
JSOp op; /* prolog bytecode or nop */
|
JSOp op; /* prologue bytecode or nop */
|
||||||
Binder binder; /* binder, discriminates u */
|
Binder binder; /* binder, discriminates u */
|
||||||
bool isConst; /* const binding? */
|
bool isConst; /* const binding? */
|
||||||
|
|
||||||
|
|
|
@ -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
|
- 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
|
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.
|
its first command-line argument.
|
||||||
|
|
||||||
Thanks To:
|
Thanks To:
|
||||||
|
|
|
@ -46,7 +46,7 @@ void reportError(JSContext* cx, const char* message, JSErrorReport* report)
|
||||||
message);
|
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.
|
// to easily return control to GDB where desired.
|
||||||
void breakpoint() {
|
void breakpoint() {
|
||||||
// If we leave this function empty, the linker will unify it with other
|
// If we leave this function empty, the linker will unify it with other
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Apparently, there's simply no way to ask GDB to exit with a non-zero
|
# 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
|
# 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.
|
# 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.
|
# and catch errors.
|
||||||
#
|
#
|
||||||
# Remember, errors in this file will cause spurious passes, so keep this as
|
# Remember, errors in this file will cause spurious passes, so keep this as
|
||||||
|
@ -15,7 +15,7 @@ import traceback
|
||||||
try:
|
try:
|
||||||
# testlibdir is set on the GDB command line, via:
|
# testlibdir is set on the GDB command line, via:
|
||||||
# --eval-command python testlibdir=...
|
# --eval-command python testlibdir=...
|
||||||
execfile(os.path.join(testlibdir, 'prolog.py'))
|
execfile(os.path.join(testlibdir, 'prologue.py'))
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
sys.stderr.write('Error running GDB prologue:\n')
|
sys.stderr.write('Error running GDB prologue:\n')
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
|
@ -5,7 +5,7 @@ assert_subprinter_registered('SpiderMonkey', 'ref-to-JSObject')
|
||||||
|
|
||||||
run_fragment('JSObject.simple')
|
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
|
# address off', which avoids putting varying addresses in the output. After
|
||||||
# the '(JSObject *) ', there is a 'void *' value printing as the empty
|
# the '(JSObject *) ', there is a 'void *' value printing as the empty
|
||||||
# string.
|
# string.
|
||||||
|
|
|
@ -32,7 +32,7 @@ For more options:
|
||||||
Simply create a JS file under the 'tests/' directory. Most tests should go in
|
Simply create a JS file under the 'tests/' directory. Most tests should go in
|
||||||
'tests/basic/'.
|
'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
|
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
|
of the 'lib' directory. To include a file 'foo.js' from the lib directory in a
|
||||||
test case:
|
test case:
|
||||||
|
|
|
@ -245,12 +245,12 @@ def main(argv):
|
||||||
options.ignore_timeouts = set()
|
options.ignore_timeouts = set()
|
||||||
|
|
||||||
prefix = [which(args[0])] + shlex.split(options.shell_args)
|
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:
|
if options.remote:
|
||||||
prolog = posixpath.join(options.remote_test_root,
|
prologue = posixpath.join(options.remote_test_root,
|
||||||
'jit-tests', 'jit-tests', 'lib', 'prolog.js')
|
'jit-tests', 'jit-tests', 'lib', 'prologue.js')
|
||||||
|
|
||||||
prefix += ['-f', prolog]
|
prefix += ['-f', prologue]
|
||||||
|
|
||||||
# Clean up any remnants from previous crashes etc
|
# Clean up any remnants from previous crashes etc
|
||||||
shutil.rmtree(jittests.JS_CACHE_DIR, ignore_errors=True)
|
shutil.rmtree(jittests.JS_CACHE_DIR, ignore_errors=True)
|
||||||
|
|
|
@ -586,7 +586,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
|
||||||
uint32_t length, lineno, column, nslots, staticLevel;
|
uint32_t length, lineno, column, nslots, staticLevel;
|
||||||
uint32_t natoms, nsrcnotes, i;
|
uint32_t natoms, nsrcnotes, i;
|
||||||
uint32_t nconsts, nobjects, nregexps, ntrynotes, nblockscopes, nyieldoffsets;
|
uint32_t nconsts, nobjects, nregexps, ntrynotes, nblockscopes, nyieldoffsets;
|
||||||
uint32_t prologLength, version;
|
uint32_t prologueLength, version;
|
||||||
uint32_t funLength = 0;
|
uint32_t funLength = 0;
|
||||||
uint32_t nTypeSets = 0;
|
uint32_t nTypeSets = 0;
|
||||||
uint32_t scriptBits = 0;
|
uint32_t scriptBits = 0;
|
||||||
|
@ -633,7 +633,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mode == XDR_ENCODE) {
|
if (mode == XDR_ENCODE) {
|
||||||
prologLength = script->mainOffset();
|
prologueLength = script->mainOffset();
|
||||||
MOZ_ASSERT(script->getVersion() != JSVERSION_UNKNOWN);
|
MOZ_ASSERT(script->getVersion() != JSVERSION_UNKNOWN);
|
||||||
version = script->getVersion();
|
version = script->getVersion();
|
||||||
lineno = script->lineno();
|
lineno = script->lineno();
|
||||||
|
@ -702,7 +702,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
|
||||||
scriptBits |= (1 << HasPollutedGlobalScope);
|
scriptBits |= (1 << HasPollutedGlobalScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xdr->codeUint32(&prologLength))
|
if (!xdr->codeUint32(&prologueLength))
|
||||||
return false;
|
return false;
|
||||||
if (!xdr->codeUint32(&version))
|
if (!xdr->codeUint32(&version))
|
||||||
return false;
|
return false;
|
||||||
|
@ -787,7 +787,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleObject enclosingScope, HandleScript enc
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!script->mainOffset());
|
MOZ_ASSERT(!script->mainOffset());
|
||||||
script->mainOffset_ = prologLength;
|
script->mainOffset_ = prologueLength;
|
||||||
script->setLength(length);
|
script->setLength(length);
|
||||||
script->funLength_ = funLength;
|
script->funLength_ = funLength;
|
||||||
|
|
||||||
|
@ -2567,7 +2567,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
|
||||||
MOZ_ASSERT(bce->regexpList.length <= INDEX_LIMIT);
|
MOZ_ASSERT(bce->regexpList.length <= INDEX_LIMIT);
|
||||||
|
|
||||||
uint32_t mainLength = bce->offset();
|
uint32_t mainLength = bce->offset();
|
||||||
uint32_t prologLength = bce->prologOffset();
|
uint32_t prologueLength = bce->prologueOffset();
|
||||||
uint32_t nsrcnotes;
|
uint32_t nsrcnotes;
|
||||||
if (!bce->finishTakingSrcNotes(&nsrcnotes))
|
if (!bce->finishTakingSrcNotes(&nsrcnotes))
|
||||||
return false;
|
return false;
|
||||||
|
@ -2581,19 +2581,19 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(script->mainOffset() == 0);
|
MOZ_ASSERT(script->mainOffset() == 0);
|
||||||
script->mainOffset_ = prologLength;
|
script->mainOffset_ = prologueLength;
|
||||||
|
|
||||||
script->lineno_ = bce->firstLine;
|
script->lineno_ = bce->firstLine;
|
||||||
|
|
||||||
script->setLength(prologLength + mainLength);
|
script->setLength(prologueLength + mainLength);
|
||||||
script->natoms_ = natoms;
|
script->natoms_ = natoms;
|
||||||
SharedScriptData* ssd = SharedScriptData::new_(cx, script->length(), nsrcnotes, natoms);
|
SharedScriptData* ssd = SharedScriptData::new_(cx, script->length(), nsrcnotes, natoms);
|
||||||
if (!ssd)
|
if (!ssd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
jsbytecode* code = ssd->data;
|
jsbytecode* code = ssd->data;
|
||||||
PodCopy<jsbytecode>(code, bce->prolog.code.begin(), prologLength);
|
PodCopy<jsbytecode>(code, bce->prologue.code.begin(), prologueLength);
|
||||||
PodCopy<jsbytecode>(code + prologLength, bce->code().begin(), mainLength);
|
PodCopy<jsbytecode>(code + prologueLength, bce->code().begin(), mainLength);
|
||||||
bce->copySrcNotes((jssrcnote*)(code + script->length()), nsrcnotes);
|
bce->copySrcNotes((jssrcnote*)(code + script->length()), nsrcnotes);
|
||||||
InitAtomMap(bce->atomIndices.getMap(), ssd->atoms());
|
InitAtomMap(bce->atomIndices.getMap(), ssd->atoms());
|
||||||
|
|
||||||
|
@ -2639,7 +2639,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext* cx, HandleScript script, Byteco
|
||||||
script->setGeneratorKind(funbox->generatorKind());
|
script->setGeneratorKind(funbox->generatorKind());
|
||||||
script->setFunction(funbox->function());
|
script->setFunction(funbox->function());
|
||||||
if (bce->yieldOffsetList.length() != 0)
|
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.
|
// 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;
|
unsigned bestdiff = SN_MAX_OFFSET;
|
||||||
for (jssrcnote* sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
|
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.
|
* nearest greater-or-equal line number match.
|
||||||
*/
|
*/
|
||||||
if (lineno == target && offset >= ptrdiff_t(script->mainOffset()))
|
if (lineno == target && offset >= ptrdiff_t(script->mainOffset()))
|
||||||
|
|
|
@ -862,7 +862,7 @@ class JSScript : public js::gc::TenuredCell
|
||||||
uint32_t column_; /* base column of script, optionally set */
|
uint32_t column_; /* base column of script, optionally set */
|
||||||
|
|
||||||
uint32_t mainOffset_;/* offset of main entry point from code, after
|
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 natoms_; /* length of atoms array */
|
||||||
uint32_t nslots_; /* vars plus maximum stack depth */
|
uint32_t nslots_; /* vars plus maximum stack depth */
|
||||||
|
|
|
@ -80,7 +80,7 @@ class XULInfo:
|
||||||
|
|
||||||
class XULInfoTester:
|
class XULInfoTester:
|
||||||
def __init__(self, xulinfo, js_bin):
|
def __init__(self, xulinfo, js_bin):
|
||||||
self.js_prolog = xulinfo.as_js()
|
self.js_prologue = xulinfo.as_js()
|
||||||
self.js_bin = js_bin
|
self.js_bin = js_bin
|
||||||
# Maps JS expr to evaluation result.
|
# Maps JS expr to evaluation result.
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
|
@ -91,7 +91,7 @@ class XULInfoTester:
|
||||||
if ans is None:
|
if ans is None:
|
||||||
cmd = [
|
cmd = [
|
||||||
self.js_bin,
|
self.js_bin,
|
||||||
'-e', self.js_prolog,
|
'-e', self.js_prologue,
|
||||||
'-e', 'print(!!({}))'.format(cond)
|
'-e', 'print(!!({}))'.format(cond)
|
||||||
]
|
]
|
||||||
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче