Bug 1355046 - Don't reset column and line info when emitting useless statements in BCE. (r=jorendorff)

This commit is contained in:
Shu-yu Guo 2017-05-30 13:38:05 -07:00
Родитель cf9c954c8d
Коммит 92f3250d75
3 изменённых файлов: 22 добавлений и 5 удалений

Просмотреть файл

@ -9134,8 +9134,6 @@ BytecodeEmitter::emitStatement(ParseNode* pn)
return false;
}
} else {
current->currentLine = parser.tokenStream().srcCoords.lineNum(pn2->pn_pos.begin);
current->lastColumn = 0;
if (!reportExtraWarning(pn2, JSMSG_USELESS_EXPR))
return false;
}

Просмотреть файл

@ -191,9 +191,20 @@ struct MOZ_STACK_CLASS BytecodeEmitter
BytecodeVector code; /* bytecode */
SrcNotesVector notes; /* source notes, see below */
ptrdiff_t lastNoteOffset; /* code offset for last source note */
uint32_t currentLine; /* line number for tree-based srcnote gen */
uint32_t lastColumn; /* zero-based column index on currentLine of
last SRC_COLSPAN-annotated opcode */
// Line number for srcnotes.
//
// WARNING: If this becomes out of sync with already-emitted srcnotes,
// we can get undefined behavior.
uint32_t currentLine;
// Zero-based column index on currentLine of last SRC_COLSPAN-annotated
// opcode.
//
// WARNING: If this becomes out of sync with already-emitted srcnotes,
// we can get undefined behavior.
uint32_t lastColumn;
JumpTarget lastTarget; // Last jump target emitted.
EmitSection(JSContext* cx, uint32_t lineNum)

Просмотреть файл

@ -0,0 +1,8 @@
// |jit-test| error: ReferenceError
var localstr = "";
for (var i = 0; i < 0xFFFC; ++i)
localstr += ('\f') + i + "; ";
var arg = "x";
var body = localstr + "for (var i = 0; i < 4; ++i) arr[i](x-1);";
(new Function(arg, body))(1000);