mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1048414 - Use prepareForDiscard in DiscardIgnoreOperands. r=sunfish
This commit is contained in:
parent
2503a380bf
commit
bdaef16793
@ -758,16 +758,6 @@ MBasicBlock::moveBefore(MInstruction *at, MInstruction *ins)
|
||||
ins->setTrackedSite(at->trackedSite());
|
||||
}
|
||||
|
||||
static inline void
|
||||
AssertSafelyDiscardable(MDefinition *def)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Instructions captured by resume points cannot be safely discarded, since
|
||||
// they are necessary for interpreter frame reconstruction in case of bailout.
|
||||
JS_ASSERT(!def->hasUses());
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
MBasicBlock::discardResumePoint(MResumePoint *rp, ReferencesType refType /* = RefType_Default */)
|
||||
{
|
||||
@ -800,9 +790,11 @@ MBasicBlock::prepareForDiscard(MInstruction *ins, ReferencesType refType /* = Re
|
||||
// point.
|
||||
MOZ_ASSERT_IF(refType & RefType_AssertNoUses, !ins->hasUses());
|
||||
|
||||
MOZ_ASSERT(refType & RefType_DiscardOperands);
|
||||
for (size_t i = 0, e = ins->numOperands(); i < e; i++)
|
||||
ins->discardOperand(i);
|
||||
const uint32_t InstructionOperands = RefType_DiscardOperands | RefType_DiscardInstruction;
|
||||
if ((refType & InstructionOperands) == InstructionOperands) {
|
||||
for (size_t i = 0, e = ins->numOperands(); i < e; i++)
|
||||
ins->discardOperand(i);
|
||||
}
|
||||
|
||||
ins->setDiscarded();
|
||||
}
|
||||
@ -817,12 +809,12 @@ MBasicBlock::discard(MInstruction *ins)
|
||||
void
|
||||
MBasicBlock::discardIgnoreOperands(MInstruction *ins)
|
||||
{
|
||||
AssertSafelyDiscardable(ins);
|
||||
#ifdef DEBUG
|
||||
for (size_t i = 0, e = ins->numOperands(); i < e; i++)
|
||||
JS_ASSERT(ins->operandDiscarded(i));
|
||||
#endif
|
||||
|
||||
prepareForDiscard(ins, RefType_IgnoreOperands);
|
||||
instructions_.remove(ins);
|
||||
}
|
||||
|
||||
|
@ -66,11 +66,29 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
|
||||
|
||||
enum ReferencesType {
|
||||
RefType_None = 0,
|
||||
|
||||
// Assert that the instruction is unused.
|
||||
RefType_AssertNoUses = 1 << 0,
|
||||
|
||||
// Discard the operands of the resume point / instructions if the
|
||||
// following flag are given too.
|
||||
RefType_DiscardOperands = 1 << 1,
|
||||
RefType_DiscardResumePoint = 1 << 2,
|
||||
RefType_DefaultNoAssert = RefType_DiscardOperands | RefType_DiscardResumePoint,
|
||||
RefType_Default = RefType_AssertNoUses | RefType_DiscardOperands | RefType_DiscardResumePoint
|
||||
RefType_DiscardInstruction = 1 << 3,
|
||||
|
||||
// Discard operands of the instruction and its resume point.
|
||||
RefType_DefaultNoAssert = RefType_DiscardOperands |
|
||||
RefType_DiscardResumePoint |
|
||||
RefType_DiscardInstruction,
|
||||
|
||||
// Discard everything and assert that the instruction is not used.
|
||||
RefType_Default = RefType_AssertNoUses | RefType_DefaultNoAssert,
|
||||
|
||||
// Discard resume point operands only, without discarding the operands
|
||||
// of the current instruction. Asserts that the instruction is unused.
|
||||
RefType_IgnoreOperands = RefType_AssertNoUses |
|
||||
RefType_DiscardOperands |
|
||||
RefType_DiscardResumePoint
|
||||
};
|
||||
|
||||
void discardResumePoint(MResumePoint *rp, ReferencesType refType = RefType_Default);
|
||||
|
Loading…
Reference in New Issue
Block a user