зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f800c9af17ef (bug 1672172) for bustage complaining about SourceNotes.h CLOSED TREE
This commit is contained in:
Родитель
7efcd4b951
Коммит
4956d7bf15
|
@ -123,7 +123,7 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, SharedContext* sc,
|
|||
: sc(sc),
|
||||
cx(sc->cx_),
|
||||
parent(parent),
|
||||
bytecodeSection_(cx, sc->extent().lineno, sc->extent().column),
|
||||
bytecodeSection_(cx, sc->extent().lineno),
|
||||
perScriptData_(cx, compilationInfo),
|
||||
compilationInfo(compilationInfo),
|
||||
compilationState(compilationState),
|
||||
|
@ -554,11 +554,6 @@ bool BytecodeEmitter::updateLineNumberNotes(uint32_t offset) {
|
|||
unsigned line = er->lineAt(offset);
|
||||
unsigned delta = line - bytecodeSection().currentLine();
|
||||
|
||||
// If we use a `SetLine` note below, we want it to be relative to the
|
||||
// scripts initial line number for better chance of sharing.
|
||||
unsigned initialLine = sc->extent().lineno;
|
||||
MOZ_ASSERT(line >= initialLine);
|
||||
|
||||
/*
|
||||
* Encode any change in the current source line number by using
|
||||
* either several SrcNoteType::NewLine notes or just one
|
||||
|
@ -571,9 +566,10 @@ bool BytecodeEmitter::updateLineNumberNotes(uint32_t offset) {
|
|||
* SrcNoteType::SetLine.
|
||||
*/
|
||||
bytecodeSection().setCurrentLine(line, offset);
|
||||
if (delta >= SrcNote::SetLine::lengthFor(line, initialLine)) {
|
||||
if (delta >= SrcNote::SetLine::lengthFor(line)) {
|
||||
MOZ_ASSERT(line >= sc->extent().lineno);
|
||||
if (!newSrcNote2(SrcNoteType::SetLine,
|
||||
SrcNote::SetLine::toOperand(line, initialLine))) {
|
||||
SrcNote::SetLine::toOperand(line))) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -188,16 +188,14 @@ JSObject* ObjLiteralStencil::create(JSContext* cx,
|
|||
return InterpretObjLiteral(cx, atomCache, atoms_, writer_);
|
||||
}
|
||||
|
||||
BytecodeSection::BytecodeSection(JSContext* cx, uint32_t lineNum,
|
||||
uint32_t column)
|
||||
BytecodeSection::BytecodeSection(JSContext* cx, uint32_t lineNum)
|
||||
: code_(cx),
|
||||
notes_(cx),
|
||||
lastNoteOffset_(0),
|
||||
tryNoteList_(cx),
|
||||
scopeNoteList_(cx),
|
||||
resumeOffsetList_(cx),
|
||||
currentLine_(lineNum),
|
||||
lastColumn_(column) {}
|
||||
currentLine_(lineNum) {}
|
||||
|
||||
void BytecodeSection::updateDepth(BytecodeOffset target) {
|
||||
jsbytecode* pc = code(target);
|
||||
|
|
|
@ -189,7 +189,7 @@ typedef Vector<js::SrcNote, 64> SrcNotesVector;
|
|||
// bytecode is stored in this class.
|
||||
class BytecodeSection {
|
||||
public:
|
||||
BytecodeSection(JSContext* cx, uint32_t lineNum, uint32_t column);
|
||||
BytecodeSection(JSContext* cx, uint32_t lineNum);
|
||||
|
||||
// ---- Bytecode ----
|
||||
|
||||
|
|
|
@ -249,18 +249,13 @@ class SrcNote {
|
|||
}
|
||||
|
||||
public:
|
||||
static inline unsigned lengthFor(unsigned line, size_t initialLine) {
|
||||
unsigned operandSize =
|
||||
toOperand(line, initialLine) > SrcNote::FourBytesOperandMask ? 4 : 1;
|
||||
return 1 /* SetLine */ + operandSize;
|
||||
static inline unsigned lengthFor(unsigned line) {
|
||||
return 1 /* SetLine */ + (line > SrcNote::FourBytesOperandMask ? 4 : 1);
|
||||
}
|
||||
|
||||
static inline ptrdiff_t toOperand(size_t line, size_t initialLine) {
|
||||
MOZ_ASSERT(line >= initialLine);
|
||||
return ptrdiff_t(line - initialLine);
|
||||
}
|
||||
static inline ptrdiff_t toOperand(size_t line) { return ptrdiff_t(line); }
|
||||
|
||||
static inline size_t getLine(const SrcNote* sn, size_t initialLine);
|
||||
static inline size_t getLine(const SrcNote* sn);
|
||||
};
|
||||
|
||||
friend class SrcNoteWriter;
|
||||
|
@ -368,9 +363,8 @@ inline ptrdiff_t SrcNote::ColSpan::getSpan(const SrcNote* sn) {
|
|||
}
|
||||
|
||||
/* static */
|
||||
inline size_t SrcNote::SetLine::getLine(const SrcNote* sn, size_t initialLine) {
|
||||
return initialLine +
|
||||
fromOperand(SrcNoteReader::getOperand(sn, unsigned(Operands::Line)));
|
||||
inline size_t SrcNote::SetLine::getLine(const SrcNote* sn) {
|
||||
return fromOperand(SrcNoteReader::getOperand(sn, unsigned(Operands::Line)));
|
||||
}
|
||||
|
||||
// Iterate over SrcNote array, until it hits terminator.
|
||||
|
|
|
@ -18,7 +18,7 @@ evaluate(`function b03( ){}`)
|
|||
evaluate(`function b04() {}`)
|
||||
evaluate(`function b05(){ }`)
|
||||
assertEq(hasSameBytecodeData(b, b01), true)
|
||||
assertEq(hasSameBytecodeData(b, b02), true)
|
||||
assertEq(hasSameBytecodeData(b, b02), false)
|
||||
assertEq(hasSameBytecodeData(b, b03), false)
|
||||
assertEq(hasSameBytecodeData(b, b04), false)
|
||||
assertEq(hasSameBytecodeData(b, b05), false)
|
||||
|
@ -73,16 +73,16 @@ assertEq(hasSameBytecodeData(h01, h03), true)
|
|||
evaluate(`function i01(){ return\n\n\n\n\n\n\n\n0; }`)
|
||||
evaluate(`\nfunction i02(){ return\n\n\n\n\n\n\n\n0; }`)
|
||||
evaluate(`\n\n\n\n\n\n\nfunction i03(){ return\n\n\n\n\n\n\n\n0; }`)
|
||||
assertEq(hasSameBytecodeData(i01, i02), true)
|
||||
assertEq(hasSameBytecodeData(i01, i03), true)
|
||||
assertEq(hasSameBytecodeData(i01, i02), false)
|
||||
assertEq(hasSameBytecodeData(i01, i03), false)
|
||||
|
||||
|
||||
// Check effect of column number.
|
||||
evaluate(`function j01(){ return 0; }`)
|
||||
evaluate(` function j02(){ return 0; }`)
|
||||
evaluate(` \tfunction j03(){ return 0; }`)
|
||||
assertEq(hasSameBytecodeData(j01, j02), true)
|
||||
assertEq(hasSameBytecodeData(j01, j03), true)
|
||||
assertEq(hasSameBytecodeData(j01, j02), false)
|
||||
assertEq(hasSameBytecodeData(j01, j03), false)
|
||||
|
||||
|
||||
// Check different forms of functions.
|
||||
|
|
|
@ -3127,7 +3127,7 @@ static MOZ_MUST_USE bool SrcNotes(JSContext* cx, HandleScript script,
|
|||
break;
|
||||
|
||||
case SrcNoteType::SetLine:
|
||||
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
|
||||
lineno = SrcNote::SetLine::getLine(sn);
|
||||
if (!sp->jsprintf(" lineno %u", lineno)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -114,9 +114,8 @@ class BytecodeRangeWithPosition : private BytecodeRange {
|
|||
|
||||
BytecodeRangeWithPosition(JSContext* cx, JSScript* script)
|
||||
: BytecodeRange(cx, script),
|
||||
initialLine(script->lineno()),
|
||||
lineno(script->lineno()),
|
||||
column(script->column()),
|
||||
column(0),
|
||||
sn(script->notes()),
|
||||
snpc(script->code()),
|
||||
isEntryPoint(false),
|
||||
|
@ -204,7 +203,7 @@ class BytecodeRangeWithPosition : private BytecodeRange {
|
|||
column += colspan;
|
||||
lastLinePC = snpc;
|
||||
} else if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, initialLine);
|
||||
lineno = SrcNote::SetLine::getLine(sn);
|
||||
column = 0;
|
||||
lastLinePC = snpc;
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
|
@ -224,7 +223,6 @@ class BytecodeRangeWithPosition : private BytecodeRange {
|
|||
isEntryPoint = lastLinePC == frontPC();
|
||||
}
|
||||
|
||||
size_t initialLine;
|
||||
size_t lineno;
|
||||
size_t column;
|
||||
const SrcNote* sn;
|
||||
|
|
|
@ -178,7 +178,7 @@ void LCovSource::writeScript(JSScript* script, const char* scriptName) {
|
|||
sn = *iter;
|
||||
SrcNoteType type = sn->type();
|
||||
if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
|
||||
lineno = SrcNote::SetLine::getLine(sn);
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
lineno++;
|
||||
}
|
||||
|
|
|
@ -4027,11 +4027,11 @@ const js::SrcNote* js::GetSrcNote(JSContext* cx, JSScript* script,
|
|||
return GetSrcNote(cx->caches().gsnCache, script, pc);
|
||||
}
|
||||
|
||||
unsigned js::PCToLineNumber(unsigned startLine, unsigned startCol,
|
||||
SrcNote* notes, jsbytecode* code, jsbytecode* pc,
|
||||
unsigned js::PCToLineNumber(unsigned startLine, SrcNote* notes,
|
||||
jsbytecode* code, jsbytecode* pc,
|
||||
unsigned* columnp) {
|
||||
unsigned lineno = startLine;
|
||||
unsigned column = startCol;
|
||||
unsigned column = 0;
|
||||
|
||||
/*
|
||||
* Walk through source notes accumulating their deltas, keeping track of
|
||||
|
@ -4049,7 +4049,7 @@ unsigned js::PCToLineNumber(unsigned startLine, unsigned startCol,
|
|||
|
||||
SrcNoteType type = sn->type();
|
||||
if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, startLine);
|
||||
lineno = SrcNote::SetLine::getLine(sn);
|
||||
column = 0;
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
lineno++;
|
||||
|
@ -4075,8 +4075,8 @@ unsigned js::PCToLineNumber(JSScript* script, jsbytecode* pc,
|
|||
return 0;
|
||||
}
|
||||
|
||||
return PCToLineNumber(script->lineno(), script->column(), script->notes(),
|
||||
script->code(), pc, columnp);
|
||||
return PCToLineNumber(script->lineno(), script->notes(), script->code(), pc,
|
||||
columnp);
|
||||
}
|
||||
|
||||
jsbytecode* js::LineNumberToPC(JSScript* script, unsigned target) {
|
||||
|
@ -4103,7 +4103,7 @@ jsbytecode* js::LineNumberToPC(JSScript* script, unsigned target) {
|
|||
offset += sn->delta();
|
||||
SrcNoteType type = sn->type();
|
||||
if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
|
||||
lineno = SrcNote::SetLine::getLine(sn);
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
lineno++;
|
||||
}
|
||||
|
@ -4122,7 +4122,7 @@ JS_FRIEND_API unsigned js::GetScriptLineExtent(JSScript* script) {
|
|||
auto sn = *iter;
|
||||
SrcNoteType type = sn->type();
|
||||
if (type == SrcNoteType::SetLine) {
|
||||
lineno = SrcNote::SetLine::getLine(sn, script->lineno());
|
||||
lineno = SrcNote::SetLine::getLine(sn);
|
||||
} else if (type == SrcNoteType::NewLine) {
|
||||
lineno++;
|
||||
}
|
||||
|
|
|
@ -2590,8 +2590,8 @@ namespace js {
|
|||
extern unsigned PCToLineNumber(JSScript* script, jsbytecode* pc,
|
||||
unsigned* columnp = nullptr);
|
||||
|
||||
extern unsigned PCToLineNumber(unsigned startLine, unsigned startCol,
|
||||
SrcNote* notes, jsbytecode* code, jsbytecode* pc,
|
||||
extern unsigned PCToLineNumber(unsigned startLine, SrcNote* notes,
|
||||
jsbytecode* code, jsbytecode* pc,
|
||||
unsigned* columnp = nullptr);
|
||||
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче