mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1322019 - Part 4: Remove unnecessary if in BytecodeParser::simulateOp. r=nbp
This commit is contained in:
parent
922fcc522a
commit
87031e6deb
@ -431,16 +431,13 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
|
||||
|
||||
case JSOP_DUP:
|
||||
MOZ_ASSERT(ndefs == 2);
|
||||
if (offsetStack)
|
||||
offsetStack[stackDepth + 1] = offsetStack[stackDepth];
|
||||
offsetStack[stackDepth + 1] = offsetStack[stackDepth];
|
||||
break;
|
||||
|
||||
case JSOP_DUP2:
|
||||
MOZ_ASSERT(ndefs == 4);
|
||||
if (offsetStack) {
|
||||
offsetStack[stackDepth + 2] = offsetStack[stackDepth];
|
||||
offsetStack[stackDepth + 3] = offsetStack[stackDepth + 1];
|
||||
}
|
||||
offsetStack[stackDepth + 2] = offsetStack[stackDepth];
|
||||
offsetStack[stackDepth + 3] = offsetStack[stackDepth + 1];
|
||||
break;
|
||||
|
||||
case JSOP_DUPAT: {
|
||||
@ -448,31 +445,27 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
|
||||
jsbytecode* pc = script_->offsetToPC(offset);
|
||||
unsigned n = GET_UINT24(pc);
|
||||
MOZ_ASSERT(n < stackDepth);
|
||||
if (offsetStack)
|
||||
offsetStack[stackDepth] = offsetStack[stackDepth - 1 - n];
|
||||
offsetStack[stackDepth] = offsetStack[stackDepth - 1 - n];
|
||||
break;
|
||||
}
|
||||
|
||||
case JSOP_SWAP:
|
||||
case JSOP_SWAP: {
|
||||
MOZ_ASSERT(ndefs == 2);
|
||||
if (offsetStack) {
|
||||
uint32_t tmp = offsetStack[stackDepth + 1];
|
||||
offsetStack[stackDepth + 1] = offsetStack[stackDepth];
|
||||
offsetStack[stackDepth] = tmp;
|
||||
}
|
||||
uint32_t tmp = offsetStack[stackDepth + 1];
|
||||
offsetStack[stackDepth + 1] = offsetStack[stackDepth];
|
||||
offsetStack[stackDepth] = tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
case JSOP_PICK: {
|
||||
jsbytecode* pc = script_->offsetToPC(offset);
|
||||
unsigned n = GET_UINT8(pc);
|
||||
MOZ_ASSERT(ndefs == n + 1);
|
||||
if (offsetStack) {
|
||||
uint32_t top = stackDepth + n;
|
||||
uint32_t tmp = offsetStack[stackDepth];
|
||||
for (uint32_t i = stackDepth; i < top; i++)
|
||||
offsetStack[i] = offsetStack[i + 1];
|
||||
offsetStack[top] = tmp;
|
||||
}
|
||||
uint32_t top = stackDepth + n;
|
||||
uint32_t tmp = offsetStack[stackDepth];
|
||||
for (uint32_t i = stackDepth; i < top; i++)
|
||||
offsetStack[i] = offsetStack[i + 1];
|
||||
offsetStack[top] = tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -480,13 +473,11 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
|
||||
jsbytecode* pc = script_->offsetToPC(offset);
|
||||
unsigned n = GET_UINT8(pc);
|
||||
MOZ_ASSERT(ndefs == n + 1);
|
||||
if (offsetStack) {
|
||||
uint32_t top = stackDepth + n;
|
||||
uint32_t tmp = offsetStack[top];
|
||||
for (uint32_t i = top; i > stackDepth; i--)
|
||||
offsetStack[i] = offsetStack[i - 1];
|
||||
offsetStack[stackDepth] = tmp;
|
||||
}
|
||||
uint32_t top = stackDepth + n;
|
||||
uint32_t tmp = offsetStack[top];
|
||||
for (uint32_t i = top; i > stackDepth; i--)
|
||||
offsetStack[i] = offsetStack[i - 1];
|
||||
offsetStack[stackDepth] = tmp;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user