Bug 1635589 - Warp: Transpile GuardType. r=jandem

Unbox here seems a bit wrong, because usually the value isn't used afterwards.
(Interestingly enough we actually do use the value with TruncateDoubleToUInt32)
I doubt this will ever be a performance problem however.

GuardType doesn't just unlock bitwise arithmetic but also other stubs.

Depends on D73975

Differential Revision: https://phabricator.services.mozilla.com/D73976
This commit is contained in:
Tom Schuster 2020-05-06 12:28:22 +00:00
Родитель 846615ac3a
Коммит f78d6f3ca8
2 изменённых файлов: 31 добавлений и 1 удалений

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

@ -158,7 +158,7 @@
- name: GuardType
shared: true
transpile: false
transpile: true
args:
input: ValId
type: ValueTypeImm

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

@ -205,6 +205,36 @@ bool WarpCacheIRTranspiler::emitGuardSpecificAtom(StringOperandId strId,
return true;
}
bool WarpCacheIRTranspiler::emitGuardType(ValOperandId inputId,
ValueType type) {
switch (type) {
case ValueType::String:
case ValueType::Symbol:
case ValueType::BigInt:
case ValueType::Int32:
case ValueType::Double:
case ValueType::Boolean:
return emitGuardTo(inputId, MIRTypeFromValueType(JSValueType(type)));
case ValueType::Undefined: {
auto* ins =
MGuardValue::New(alloc(), getOperand(inputId), UndefinedValue());
add(ins);
return true;
}
case ValueType::Null: {
auto* ins = MGuardValue::New(alloc(), getOperand(inputId), NullValue());
add(ins);
return true;
}
case ValueType::Magic:
case ValueType::PrivateGCThing:
case ValueType::Object:
break;
}
MOZ_CRASH("unexpected type");
}
bool WarpCacheIRTranspiler::emitGuardTo(ValOperandId inputId, MIRType type) {
MDefinition* def = getOperand(inputId);
if (def->type() == type) {