Bug 1322019 - Part 4: Remove unnecessary if in BytecodeParser::simulateOp. r=nbp

This commit is contained in:
Tooru Fujisawa 2017-02-27 20:02:55 +09:00
Родитель 922fcc522a
Коммит 87031e6deb
1 изменённых файлов: 19 добавлений и 28 удалений

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

@ -431,16 +431,13 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
case JSOP_DUP: case JSOP_DUP:
MOZ_ASSERT(ndefs == 2); MOZ_ASSERT(ndefs == 2);
if (offsetStack)
offsetStack[stackDepth + 1] = offsetStack[stackDepth]; offsetStack[stackDepth + 1] = offsetStack[stackDepth];
break; break;
case JSOP_DUP2: case JSOP_DUP2:
MOZ_ASSERT(ndefs == 4); MOZ_ASSERT(ndefs == 4);
if (offsetStack) {
offsetStack[stackDepth + 2] = offsetStack[stackDepth]; offsetStack[stackDepth + 2] = offsetStack[stackDepth];
offsetStack[stackDepth + 3] = offsetStack[stackDepth + 1]; offsetStack[stackDepth + 3] = offsetStack[stackDepth + 1];
}
break; break;
case JSOP_DUPAT: { case JSOP_DUPAT: {
@ -448,31 +445,27 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
jsbytecode* pc = script_->offsetToPC(offset); jsbytecode* pc = script_->offsetToPC(offset);
unsigned n = GET_UINT24(pc); unsigned n = GET_UINT24(pc);
MOZ_ASSERT(n < stackDepth); MOZ_ASSERT(n < stackDepth);
if (offsetStack)
offsetStack[stackDepth] = offsetStack[stackDepth - 1 - n]; offsetStack[stackDepth] = offsetStack[stackDepth - 1 - n];
break; break;
} }
case JSOP_SWAP: case JSOP_SWAP: {
MOZ_ASSERT(ndefs == 2); MOZ_ASSERT(ndefs == 2);
if (offsetStack) {
uint32_t tmp = offsetStack[stackDepth + 1]; uint32_t tmp = offsetStack[stackDepth + 1];
offsetStack[stackDepth + 1] = offsetStack[stackDepth]; offsetStack[stackDepth + 1] = offsetStack[stackDepth];
offsetStack[stackDepth] = tmp; offsetStack[stackDepth] = tmp;
}
break; break;
}
case JSOP_PICK: { case JSOP_PICK: {
jsbytecode* pc = script_->offsetToPC(offset); jsbytecode* pc = script_->offsetToPC(offset);
unsigned n = GET_UINT8(pc); unsigned n = GET_UINT8(pc);
MOZ_ASSERT(ndefs == n + 1); MOZ_ASSERT(ndefs == n + 1);
if (offsetStack) {
uint32_t top = stackDepth + n; uint32_t top = stackDepth + n;
uint32_t tmp = offsetStack[stackDepth]; uint32_t tmp = offsetStack[stackDepth];
for (uint32_t i = stackDepth; i < top; i++) for (uint32_t i = stackDepth; i < top; i++)
offsetStack[i] = offsetStack[i + 1]; offsetStack[i] = offsetStack[i + 1];
offsetStack[top] = tmp; offsetStack[top] = tmp;
}
break; break;
} }
@ -480,13 +473,11 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
jsbytecode* pc = script_->offsetToPC(offset); jsbytecode* pc = script_->offsetToPC(offset);
unsigned n = GET_UINT8(pc); unsigned n = GET_UINT8(pc);
MOZ_ASSERT(ndefs == n + 1); MOZ_ASSERT(ndefs == n + 1);
if (offsetStack) {
uint32_t top = stackDepth + n; uint32_t top = stackDepth + n;
uint32_t tmp = offsetStack[top]; uint32_t tmp = offsetStack[top];
for (uint32_t i = top; i > stackDepth; i--) for (uint32_t i = top; i > stackDepth; i--)
offsetStack[i] = offsetStack[i - 1]; offsetStack[i] = offsetStack[i - 1];
offsetStack[stackDepth] = tmp; offsetStack[stackDepth] = tmp;
}
break; break;
} }