зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1635958 - Warp: Transpile GuardToBoolean. r=jandem
This gives us comparisons between {int, boolean} x {int, boolean}. Differential Revision: https://phabricator.services.mozilla.com/D74147
This commit is contained in:
Родитель
711bfaeea8
Коммит
1e07ee31d2
|
@ -88,7 +88,7 @@
|
|||
|
||||
- name: GuardToBoolean
|
||||
shared: true
|
||||
transpile: false
|
||||
transpile: true
|
||||
args:
|
||||
input: ValId
|
||||
result: Int32Id
|
||||
|
|
|
@ -256,6 +256,27 @@ bool WarpCacheIRTranspiler::emitGuardToString(ValOperandId inputId) {
|
|||
return emitGuardTo(inputId, MIRType::String);
|
||||
}
|
||||
|
||||
bool WarpCacheIRTranspiler::emitGuardToBoolean(ValOperandId inputId,
|
||||
Int32OperandId resultId) {
|
||||
MDefinition* input = getOperand(inputId);
|
||||
|
||||
MDefinition* boolean;
|
||||
if (input->type() == MIRType::Boolean) {
|
||||
boolean = input;
|
||||
} else {
|
||||
auto* unbox =
|
||||
MUnbox::New(alloc(), input, MIRType::Boolean, MUnbox::Fallible);
|
||||
add(unbox);
|
||||
boolean = unbox;
|
||||
}
|
||||
|
||||
// This is actually a no-op, but still required to get the correct type.
|
||||
auto* ins = MToIntegerInt32::New(alloc(), boolean);
|
||||
add(ins);
|
||||
|
||||
return defineOperand(resultId, ins);
|
||||
}
|
||||
|
||||
bool WarpCacheIRTranspiler::emitGuardToInt32(ValOperandId inputId,
|
||||
Int32OperandId resultId) {
|
||||
MDefinition* input = getOperand(inputId);
|
||||
|
|
Загрузка…
Ссылка в новой задаче