зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1545540 - Part 1: Use BytecodeSection.lastTarget_=-1 to mark last opcode is not jump target. r=jorendorff
Previously the initial value of BytecodeSection.lastTarget_ is chosen to make the following condition true: lastTargetOffset() + ptrdiff_t(JSOP_JUMPTARGET_LENGTH) == -1 BytecodeOffset class introcuced in part 3 requires the offset value to be either -1 (invalid) or non-negative, and that rule conflicts with above. Changed the initial value of BytecodeSection.lastTarget_ to -1 and added the check for that condition in BytecodeSection::lastOpcodeIsJumpTarget, so that we don't use negative value in BytecodeOffset. Differential Revision: https://phabricator.services.mozilla.com/D33052 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
81744b5dd7
Коммит
755998f123
|
@ -139,7 +139,8 @@ class BytecodeSection {
|
|||
|
||||
// Check if the last emitted opcode is a jump target.
|
||||
bool lastOpcodeIsJumpTarget() const {
|
||||
return offset() - lastTarget_.offset == ptrdiff_t(JSOP_JUMPTARGET_LENGTH);
|
||||
return lastTarget_.offset != -1 &&
|
||||
offset() - lastTarget_.offset == ptrdiff_t(JSOP_JUMPTARGET_LENGTH);
|
||||
}
|
||||
|
||||
// JumpTarget should not be part of the emitted statement, as they can be
|
||||
|
@ -239,7 +240,7 @@ class BytecodeSection {
|
|||
// ---- Jump ----
|
||||
|
||||
// Last jump target emitted.
|
||||
JumpTarget lastTarget_ = {-1 - ptrdiff_t(JSOP_JUMPTARGET_LENGTH)};
|
||||
JumpTarget lastTarget_ = {-1};
|
||||
|
||||
// ---- Stack ----
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче