зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1045948 - IonMonkey: Make bogus LAllocations have an all-zeros bit pattern. r=bhackett
This commit is contained in:
Родитель
64aabd5f06
Коммит
852da84520
|
@ -82,7 +82,7 @@ class BacktrackingVirtualRegister : public VirtualRegister
|
|||
canonicalSpill_ = alloc;
|
||||
}
|
||||
const LAllocation *canonicalSpill() const {
|
||||
return canonicalSpill_.isUse() ? nullptr : &canonicalSpill_;
|
||||
return canonicalSpill_.isBogus() ? nullptr : &canonicalSpill_;
|
||||
}
|
||||
|
||||
void setCanonicalSpillExclude(CodePosition pos) {
|
||||
|
|
|
@ -362,9 +362,7 @@ PrintDefinition(char *buf, size_t size, const LDefinition &def)
|
|||
char *cursor = buf;
|
||||
char *end = buf + size;
|
||||
|
||||
if (def.virtualRegister())
|
||||
cursor += JS_snprintf(cursor, end - cursor, "v%u", def.virtualRegister());
|
||||
|
||||
cursor += JS_snprintf(cursor, end - cursor, "v%u", def.virtualRegister());
|
||||
cursor += JS_snprintf(cursor, end - cursor, "<%s>", TypeChars[def.type()]);
|
||||
|
||||
if (def.policy() == LDefinition::FIXED)
|
||||
|
@ -378,6 +376,10 @@ LDefinition::toString() const
|
|||
{
|
||||
// Not reentrant!
|
||||
static char buf[40];
|
||||
|
||||
if (isBogusTemp())
|
||||
return "bogus";
|
||||
|
||||
PrintDefinition(buf, sizeof(buf), *this);
|
||||
return buf;
|
||||
}
|
||||
|
@ -416,6 +418,9 @@ LAllocation::toString() const
|
|||
// Not reentrant!
|
||||
static char buf[40];
|
||||
|
||||
if (isBogus())
|
||||
return "bogus";
|
||||
|
||||
switch (kind()) {
|
||||
case LAllocation::CONSTANT_VALUE:
|
||||
case LAllocation::CONSTANT_INDEX:
|
||||
|
|
|
@ -71,9 +71,9 @@ class LAllocation : public TempObject
|
|||
|
||||
public:
|
||||
enum Kind {
|
||||
USE, // Use of a virtual register, with physical allocation policy.
|
||||
CONSTANT_VALUE, // Constant js::Value.
|
||||
CONSTANT_INDEX, // Constant arbitrary index.
|
||||
USE, // Use of a virtual register, with physical allocation policy.
|
||||
GPR, // General purpose register.
|
||||
FPU, // Floating-point register.
|
||||
STACK_SLOT, // Stack slot.
|
||||
|
@ -103,7 +103,9 @@ class LAllocation : public TempObject
|
|||
|
||||
public:
|
||||
LAllocation() : bits_(0)
|
||||
{ }
|
||||
{
|
||||
JS_ASSERT(isBogus());
|
||||
}
|
||||
|
||||
static LAllocation *New(TempAllocator &alloc) {
|
||||
return new(alloc) LAllocation();
|
||||
|
@ -115,6 +117,7 @@ class LAllocation : public TempObject
|
|||
|
||||
// The value pointer must be rooted in MIR and have its low bits cleared.
|
||||
explicit LAllocation(const Value *vp) {
|
||||
JS_ASSERT(vp);
|
||||
bits_ = uintptr_t(vp);
|
||||
JS_ASSERT((bits_ & (KIND_MASK << KIND_SHIFT)) == 0);
|
||||
bits_ |= CONSTANT_VALUE << KIND_SHIFT;
|
||||
|
@ -125,6 +128,9 @@ class LAllocation : public TempObject
|
|||
return (Kind)((bits_ >> KIND_SHIFT) & KIND_MASK);
|
||||
}
|
||||
|
||||
bool isBogus() const {
|
||||
return bits_ == 0;
|
||||
}
|
||||
bool isUse() const {
|
||||
return kind() == USE;
|
||||
}
|
||||
|
@ -328,11 +334,6 @@ class LConstantIndex : public LAllocation
|
|||
{ }
|
||||
|
||||
public:
|
||||
// Used as a placeholder for inputs that can be ignored.
|
||||
static LConstantIndex Bogus() {
|
||||
return LConstantIndex(0);
|
||||
}
|
||||
|
||||
static LConstantIndex FromIndex(uint32_t index) {
|
||||
return LConstantIndex(index);
|
||||
}
|
||||
|
@ -399,9 +400,6 @@ class LDefinition
|
|||
// unless the policy specifies that an input can be re-used and that input
|
||||
// is a stack slot.
|
||||
enum Policy {
|
||||
// A random register of an appropriate class will be assigned.
|
||||
REGISTER,
|
||||
|
||||
// The policy is predetermined by the LAllocation attached to this
|
||||
// definition. The allocation may be:
|
||||
// * A register, which may not appear as any fixed temporary.
|
||||
|
@ -410,6 +408,9 @@ class LDefinition
|
|||
// Register allocation will not modify a fixed allocation.
|
||||
FIXED,
|
||||
|
||||
// A random register of an appropriate class will be assigned.
|
||||
REGISTER,
|
||||
|
||||
// One definition per instruction must re-use the first input
|
||||
// allocation, which (for now) must be a register.
|
||||
MUST_REUSE_INPUT
|
||||
|
@ -462,10 +463,12 @@ class LDefinition
|
|||
}
|
||||
|
||||
LDefinition() : bits_(0)
|
||||
{ }
|
||||
{
|
||||
JS_ASSERT(isBogusTemp());
|
||||
}
|
||||
|
||||
static LDefinition BogusTemp() {
|
||||
return LDefinition(GENERAL, LConstantIndex::Bogus());
|
||||
return LDefinition();
|
||||
}
|
||||
|
||||
Policy policy() const {
|
||||
|
@ -517,7 +520,7 @@ class LDefinition
|
|||
return policy() == FIXED;
|
||||
}
|
||||
bool isBogusTemp() const {
|
||||
return isFixed() && output()->isConstantIndex();
|
||||
return isFixed() && output()->isBogus();
|
||||
}
|
||||
void setVirtualRegister(uint32_t index) {
|
||||
JS_ASSERT(index < VREG_MASK);
|
||||
|
|
|
@ -84,7 +84,7 @@ LinearScanAllocator::allocateRegisters()
|
|||
// Iterate through all intervals in ascending start order.
|
||||
CodePosition prevPosition = CodePosition::MIN;
|
||||
while ((current = unhandled.dequeue()) != nullptr) {
|
||||
JS_ASSERT(current->getAllocation()->isUse());
|
||||
JS_ASSERT(current->getAllocation()->isBogus());
|
||||
JS_ASSERT(current->numRanges() > 0);
|
||||
|
||||
if (mir->shouldCancel("LSRA Allocate Registers (main loop)"))
|
||||
|
|
|
@ -1080,7 +1080,7 @@ LiveInterval::toString() const
|
|||
cursor += n;
|
||||
}
|
||||
|
||||
if (alloc_.kind() != LAllocation::USE) {
|
||||
if (!alloc_.isBogus()) {
|
||||
n = JS_snprintf(cursor, end - cursor, " has(%s)", alloc_.toString());
|
||||
if (n < 0) return "???";
|
||||
cursor += n;
|
||||
|
|
|
@ -52,7 +52,7 @@ class Requirement
|
|||
: kind_(FIXED),
|
||||
allocation_(fixed)
|
||||
{
|
||||
JS_ASSERT(fixed == LAllocation() || !fixed.isUse());
|
||||
JS_ASSERT(!fixed.isBogus() && !fixed.isUse());
|
||||
}
|
||||
|
||||
// Only useful as a hint, encodes where the fixed requirement is used to
|
||||
|
@ -62,7 +62,7 @@ class Requirement
|
|||
allocation_(fixed),
|
||||
position_(at)
|
||||
{
|
||||
JS_ASSERT(fixed == LAllocation() || !fixed.isUse());
|
||||
JS_ASSERT(!fixed.isBogus() && !fixed.isUse());
|
||||
}
|
||||
|
||||
Requirement(uint32_t vreg, CodePosition at)
|
||||
|
@ -76,7 +76,7 @@ class Requirement
|
|||
}
|
||||
|
||||
LAllocation allocation() const {
|
||||
JS_ASSERT(!allocation_.isUse());
|
||||
JS_ASSERT(!allocation_.isBogus() && !allocation_.isUse());
|
||||
return allocation_;
|
||||
}
|
||||
|
||||
|
|
|
@ -2581,8 +2581,6 @@ LIRGenerator::visitInArray(MInArray *ins)
|
|||
LAllocation object;
|
||||
if (ins->needsNegativeIntCheck())
|
||||
object = useRegister(ins->object());
|
||||
else
|
||||
object = LConstantIndex::Bogus();
|
||||
|
||||
LInArray *lir = new(alloc()) LInArray(useRegister(ins->elements()),
|
||||
useRegisterOrConstant(ins->index()),
|
||||
|
|
|
@ -575,8 +575,10 @@ RegisterAllocator::dumpInstructions()
|
|||
fprintf(stderr, " [temp %s]", temp->toString());
|
||||
}
|
||||
|
||||
for (LInstruction::InputIterator alloc(*ins); alloc.more(); alloc.next())
|
||||
fprintf(stderr, " [use %s]", alloc->toString());
|
||||
for (LInstruction::InputIterator alloc(*ins); alloc.more(); alloc.next()) {
|
||||
if (!alloc->isBogus())
|
||||
fprintf(stderr, " [use %s]", alloc->toString());
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
|
|
@ -136,10 +136,10 @@ LIRGeneratorShared::buildSnapshot(LInstruction *ins, MResumePoint *rp, BailoutKi
|
|||
// constants, including known types, we record a dummy placeholder,
|
||||
// since we can recover the same information, much cleaner, from MIR.
|
||||
if (ins->isConstant() || ins->isUnused()) {
|
||||
*type = LConstantIndex::Bogus();
|
||||
*payload = LConstantIndex::Bogus();
|
||||
*type = LAllocation();
|
||||
*payload = LAllocation();
|
||||
} else if (ins->type() != MIRType_Value) {
|
||||
*type = LConstantIndex::Bogus();
|
||||
*type = LAllocation();
|
||||
*payload = use(ins, LUse(LUse::KEEPALIVE));
|
||||
} else {
|
||||
*type = useType(ins, LUse::KEEPALIVE);
|
||||
|
@ -187,7 +187,7 @@ LIRGeneratorShared::buildSnapshot(LInstruction *ins, MResumePoint *rp, BailoutKi
|
|||
LAllocation *a = snapshot->getEntry(index++);
|
||||
|
||||
if (def->isUnused()) {
|
||||
*a = LConstantIndex::Bogus();
|
||||
*a = LAllocation();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче