зеркало из https://github.com/mozilla/gecko-dev.git
Bug 962555 part 2 - Add multiple UNTYPED modes to prevent duplicating conditions. r=h4writer
This commit is contained in:
Родитель
019612019c
Коммит
65edb82582
|
@ -1371,11 +1371,16 @@ SnapshotIterator::slotReadable(const Slot &slot)
|
|||
case Slot::TYPED_REG:
|
||||
return machine_.has(slot.reg());
|
||||
|
||||
case Slot::UNTYPED:
|
||||
#if defined(JS_NUNBOX32)
|
||||
return hasLocation(slot.type()) && hasLocation(slot.payload());
|
||||
case Slot::UNTYPED_REG_REG:
|
||||
case Slot::UNTYPED_REG_STACK:
|
||||
case Slot::UNTYPED_STACK_REG:
|
||||
case Slot::UNTYPED_STACK_STACK:
|
||||
return hasLocation(slot.type()) && hasLocation(slot.payload());
|
||||
#elif defined(JS_PUNBOX64)
|
||||
return hasLocation(slot.value());
|
||||
case Slot::UNTYPED_REG:
|
||||
case Slot::UNTYPED_STACK:
|
||||
return hasLocation(slot.value());
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
@ -1426,17 +1431,26 @@ SnapshotIterator::slotValue(const Slot &slot)
|
|||
}
|
||||
}
|
||||
|
||||
case Slot::UNTYPED:
|
||||
{
|
||||
jsval_layout layout;
|
||||
#if defined(JS_NUNBOX32)
|
||||
layout.s.tag = (JSValueTag)fromLocation(slot.type());
|
||||
layout.s.payload.word = fromLocation(slot.payload());
|
||||
#elif defined(JS_PUNBOX64)
|
||||
layout.asBits = fromLocation(slot.value());
|
||||
#endif
|
||||
return IMPL_TO_JSVAL(layout);
|
||||
case Slot::UNTYPED_REG_REG:
|
||||
case Slot::UNTYPED_REG_STACK:
|
||||
case Slot::UNTYPED_STACK_REG:
|
||||
case Slot::UNTYPED_STACK_STACK:
|
||||
{
|
||||
jsval_layout layout;
|
||||
layout.s.tag = (JSValueTag)fromLocation(slot.type());
|
||||
layout.s.payload.word = fromLocation(slot.payload());
|
||||
return IMPL_TO_JSVAL(layout);
|
||||
}
|
||||
#elif defined(JS_PUNBOX64)
|
||||
case Slot::UNTYPED_REG:
|
||||
case Slot::UNTYPED_STACK:
|
||||
{
|
||||
jsval_layout layout;
|
||||
layout.asBits = fromLocation(slot.value());
|
||||
return IMPL_TO_JSVAL(layout);
|
||||
}
|
||||
#endif
|
||||
|
||||
case Slot::JS_UNDEFINED:
|
||||
return UndefinedValue();
|
||||
|
|
|
@ -227,43 +227,42 @@ Slot::write(CompactBufferWriter &writer) const
|
|||
writer.writeSigned(stackSlot());
|
||||
break;
|
||||
}
|
||||
case UNTYPED: {
|
||||
#if defined(JS_NUNBOX32)
|
||||
uint32_t code = 0;
|
||||
if (type().isStackSlot()) {
|
||||
if (payload().isStackSlot())
|
||||
code = NUNBOX32_STACK_STACK;
|
||||
else
|
||||
code = NUNBOX32_STACK_REG;
|
||||
} else {
|
||||
if (payload().isStackSlot())
|
||||
code = NUNBOX32_REG_STACK;
|
||||
else
|
||||
code = NUNBOX32_REG_REG;
|
||||
}
|
||||
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, code);
|
||||
|
||||
if (type().isStackSlot())
|
||||
writer.writeSigned(type().stackSlot());
|
||||
else
|
||||
writer.writeByte(type().reg().code());
|
||||
|
||||
if (payload().isStackSlot())
|
||||
writer.writeSigned(payload().stackSlot());
|
||||
else
|
||||
writer.writeByte(payload().reg().code());
|
||||
|
||||
#elif defined(JS_PUNBOX64)
|
||||
if (value().isStackSlot()) {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, ESC_REG_FIELD_INDEX);
|
||||
writer.writeSigned(value().stackSlot());
|
||||
} else {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, value().reg().code());
|
||||
}
|
||||
#endif
|
||||
case UNTYPED_REG_REG: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, NUNBOX32_REG_REG);
|
||||
writer.writeByte(type().reg().code());
|
||||
writer.writeByte(payload().reg().code());
|
||||
break;
|
||||
}
|
||||
case UNTYPED_REG_STACK: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, NUNBOX32_REG_STACK);
|
||||
writer.writeByte(type().reg().code());
|
||||
writer.writeSigned(payload().stackSlot());
|
||||
break;
|
||||
}
|
||||
case UNTYPED_STACK_REG: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, NUNBOX32_STACK_REG);
|
||||
writer.writeSigned(type().stackSlot());
|
||||
writer.writeByte(payload().reg().code());
|
||||
break;
|
||||
}
|
||||
case UNTYPED_STACK_STACK: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, NUNBOX32_STACK_STACK);
|
||||
writer.writeSigned(type().stackSlot());
|
||||
writer.writeSigned(payload().stackSlot());
|
||||
break;
|
||||
}
|
||||
#elif defined(JS_PUNBOX64)
|
||||
case UNTYPED_REG: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, value().reg().code());
|
||||
break;
|
||||
}
|
||||
case UNTYPED_STACK: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_MAGIC, ESC_REG_FIELD_INDEX);
|
||||
writer.writeSigned(value().stackSlot());
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case JS_UNDEFINED: {
|
||||
writeSlotHeader(writer, JSVAL_TYPE_UNDEFINED, ESC_REG_FIELD_CONST);
|
||||
break;
|
||||
|
@ -347,19 +346,25 @@ Slot::dump(FILE *fp) const
|
|||
fprintf(fp, ")");
|
||||
break;
|
||||
|
||||
case UNTYPED: {
|
||||
fprintf(fp, "value (");
|
||||
#if defined(JS_NUNBOX32)
|
||||
fprintf(fp, "type = ");
|
||||
case UNTYPED_REG_REG:
|
||||
case UNTYPED_REG_STACK:
|
||||
case UNTYPED_STACK_REG:
|
||||
case UNTYPED_STACK_STACK:
|
||||
fprintf(fp, "value (type = ");
|
||||
type().dump(fp);
|
||||
fprintf(fp, ", payload = ");
|
||||
payload().dump(fp);
|
||||
#elif defined(JS_PUNBOX64)
|
||||
value().dump(fp);
|
||||
#endif
|
||||
fprintf(fp, ")");
|
||||
break;
|
||||
}
|
||||
#elif defined(JS_PUNBOX64)
|
||||
case UNTYPED_REG:
|
||||
case UNTYPED_STACK:
|
||||
fprintf(fp, "value (");
|
||||
value().dump(fp);
|
||||
fprintf(fp, ")");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case JS_UNDEFINED:
|
||||
fprintf(fp, "undefined");
|
||||
|
|
|
@ -73,11 +73,32 @@ class Slot
|
|||
FLOAT32_STACK, // Type is float32, payload is on the stack.
|
||||
TYPED_REG, // Type is constant, payload is in a register.
|
||||
TYPED_STACK, // Type is constant, payload is on the stack.
|
||||
UNTYPED, // Type is not known.
|
||||
#if defined(JS_NUNBOX32)
|
||||
UNTYPED_REG_REG, // Type is not known, type & payload are is in
|
||||
// registers.
|
||||
UNTYPED_REG_STACK, // Type is not known, type is in a register and the
|
||||
// payload is on the stack.
|
||||
UNTYPED_STACK_REG, // Type is not known, type is on the stack and the
|
||||
// payload is in a register.
|
||||
UNTYPED_STACK_STACK, // Type is not known, type & payload are on the
|
||||
// stack.
|
||||
#elif defined(JS_PUNBOX64)
|
||||
UNTYPED_REG, // Type is not known, value is in a register.
|
||||
UNTYPED_STACK, // Type is not known, value is on the stack.
|
||||
#endif
|
||||
JS_UNDEFINED, // UndefinedValue()
|
||||
JS_NULL, // NullValue()
|
||||
JS_INT32, // Int32Value(n)
|
||||
INVALID
|
||||
INVALID,
|
||||
|
||||
// Assert that the mode is UNTYPED by checking the range.
|
||||
#if defined(JS_NUNBOX32)
|
||||
UNTYPED_MIN = UNTYPED_REG_REG,
|
||||
UNTYPED_MAX = UNTYPED_STACK_STACK
|
||||
#elif defined(JS_PUNBOX64)
|
||||
UNTYPED_MIN = UNTYPED_REG,
|
||||
UNTYPED_MAX = UNTYPED_STACK
|
||||
#endif
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -137,7 +158,8 @@ class Slot
|
|||
Slot(Mode mode)
|
||||
: mode_(mode)
|
||||
{
|
||||
JS_ASSERT(mode == JS_UNDEFINED || mode == JS_NULL || mode == UNTYPED);
|
||||
JS_ASSERT(mode == JS_UNDEFINED || mode == JS_NULL ||
|
||||
(UNTYPED_MIN <= mode && mode <= UNTYPED_MAX));
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -176,28 +198,28 @@ class Slot
|
|||
// UNTYPED
|
||||
#if defined(JS_NUNBOX32)
|
||||
static Slot UntypedSlot(const Register &type, const Register &payload) {
|
||||
Slot slot(UNTYPED);
|
||||
Slot slot(UNTYPED_REG_REG);
|
||||
slot.unknown_type_.type = Location::From(type);
|
||||
slot.unknown_type_.payload = Location::From(payload);
|
||||
return slot;
|
||||
}
|
||||
|
||||
static Slot UntypedSlot(const Register &type, int32_t payloadStackIndex) {
|
||||
Slot slot(UNTYPED);
|
||||
Slot slot(UNTYPED_REG_STACK);
|
||||
slot.unknown_type_.type = Location::From(type);
|
||||
slot.unknown_type_.payload = Location::From(payloadStackIndex);
|
||||
return slot;
|
||||
}
|
||||
|
||||
static Slot UntypedSlot(int32_t typeStackIndex, const Register &payload) {
|
||||
Slot slot(UNTYPED);
|
||||
Slot slot(UNTYPED_STACK_REG);
|
||||
slot.unknown_type_.type = Location::From(typeStackIndex);
|
||||
slot.unknown_type_.payload = Location::From(payload);
|
||||
return slot;
|
||||
}
|
||||
|
||||
static Slot UntypedSlot(int32_t typeStackIndex, int32_t payloadStackIndex) {
|
||||
Slot slot(UNTYPED);
|
||||
Slot slot(UNTYPED_STACK_STACK);
|
||||
slot.unknown_type_.type = Location::From(typeStackIndex);
|
||||
slot.unknown_type_.payload = Location::From(payloadStackIndex);
|
||||
return slot;
|
||||
|
@ -205,13 +227,13 @@ class Slot
|
|||
|
||||
#elif defined(JS_PUNBOX64)
|
||||
static Slot UntypedSlot(const Register &value) {
|
||||
Slot slot(UNTYPED);
|
||||
Slot slot(UNTYPED_REG);
|
||||
slot.unknown_type_.value = Location::From(value);
|
||||
return slot;
|
||||
}
|
||||
|
||||
static Slot UntypedSlot(int32_t valueStackSlot) {
|
||||
Slot slot(UNTYPED);
|
||||
Slot slot(UNTYPED_STACK);
|
||||
slot.unknown_type_.value = Location::From(valueStackSlot);
|
||||
return slot;
|
||||
}
|
||||
|
@ -270,16 +292,16 @@ class Slot
|
|||
}
|
||||
#if defined(JS_NUNBOX32)
|
||||
Location payload() const {
|
||||
JS_ASSERT(mode() == UNTYPED);
|
||||
JS_ASSERT((UNTYPED_MIN <= mode() && mode() <= UNTYPED_MAX));
|
||||
return unknown_type_.payload;
|
||||
}
|
||||
Location type() const {
|
||||
JS_ASSERT(mode() == UNTYPED);
|
||||
JS_ASSERT((UNTYPED_MIN <= mode() && mode() <= UNTYPED_MAX));
|
||||
return unknown_type_.type;
|
||||
}
|
||||
#elif defined(JS_PUNBOX64)
|
||||
Location value() const {
|
||||
JS_ASSERT(mode() == UNTYPED);
|
||||
JS_ASSERT((UNTYPED_MIN <= mode() && mode() <= UNTYPED_MAX));
|
||||
return unknown_type_.value;
|
||||
}
|
||||
#endif
|
||||
|
@ -303,11 +325,16 @@ class Slot
|
|||
case FLOAT32_STACK:
|
||||
return known_type_.type == s.known_type_.type &&
|
||||
known_type_.payload == s.known_type_.payload;
|
||||
case UNTYPED:
|
||||
#if defined(JS_NUNBOX32)
|
||||
case UNTYPED_REG_REG:
|
||||
case UNTYPED_REG_STACK:
|
||||
case UNTYPED_STACK_REG:
|
||||
case UNTYPED_STACK_STACK:
|
||||
return unknown_type_.type == s.unknown_type_.type &&
|
||||
unknown_type_.payload == s.unknown_type_.payload;
|
||||
#else
|
||||
case UNTYPED_REG:
|
||||
case UNTYPED_STACK:
|
||||
return unknown_type_.value == s.unknown_type_.value;
|
||||
#endif
|
||||
case CONSTANT:
|
||||
|
|
Загрузка…
Ссылка в новой задаче