Bug 1799490 - Part 2: Transpile Map.prototype.size and Set.prototype.size in Warp. r=iain

Transpile both CacheIR operations in Warp.

Differential Revision: https://phabricator.services.mozilla.com/D161489
This commit is contained in:
André Bargull 2022-11-08 14:21:09 +00:00
Родитель 81264e1d84
Коммит fbcd4f9076
7 изменённых файлов: 80 добавлений и 2 удалений

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

@ -2777,7 +2777,7 @@
- name: SetSizeResult
shared: true
transpile: false
transpile: true
cost_estimate: 1
args:
set: ObjId
@ -2880,7 +2880,7 @@
- name: MapSizeResult
shared: true
transpile: false
transpile: true
cost_estimate: 1
args:
map: ObjId

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

@ -17198,6 +17198,13 @@ void CodeGenerator::visitSetObjectHasValueVMCall(
callVM<Fn, jit::SetObjectHas>(ins);
}
void CodeGenerator::visitSetObjectSize(LSetObjectSize* ins) {
Register setObj = ToRegister(ins->setObject());
Register output = ToRegister(ins->output());
masm.loadSetObjectSize(setObj, output);
}
void CodeGenerator::visitMapObjectHasNonBigInt(LMapObjectHasNonBigInt* ins) {
Register mapObj = ToRegister(ins->mapObject());
ValueOperand input = ToValue(ins, LMapObjectHasNonBigInt::InputIndex);
@ -17296,6 +17303,13 @@ void CodeGenerator::visitMapObjectGetValueVMCall(
callVM<Fn, jit::MapObjectGet>(ins);
}
void CodeGenerator::visitMapObjectSize(LMapObjectSize* ins) {
Register mapObj = ToRegister(ins->mapObject());
Register output = ToRegister(ins->output());
masm.loadMapObjectSize(mapObj, output);
}
template <size_t NumDefs>
void CodeGenerator::emitIonToWasmCallBase(LIonToWasmCallBase<NumDefs>* lir) {
wasm::JitCallStackArgVector stackArgs;

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

@ -3303,6 +3303,11 @@
setObject: WordSized
input: BoxedValue
- name: SetObjectSize
result_type: WordSized
operands:
setObject: WordSized
- name: MapObjectHasNonBigInt
result_type: WordSized
operands:
@ -3365,6 +3370,11 @@
mapObject: WordSized
input: BoxedValue
- name: MapObjectSize
result_type: WordSized
operands:
mapObject: WordSized
- name: BigIntAsUintN
result_type: WordSized
operands:

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

@ -6263,6 +6263,11 @@ void LIRGenerator::visitSetObjectHasValueVMCall(MSetObjectHasValueVMCall* ins) {
assignSafepoint(lir, ins);
}
void LIRGenerator::visitSetObjectSize(MSetObjectSize* ins) {
auto* lir = new (alloc()) LSetObjectSize(useRegisterAtStart(ins->set()));
define(lir, ins);
}
void LIRGenerator::visitMapObjectHasNonBigInt(MMapObjectHasNonBigInt* ins) {
auto* lir = new (alloc())
LMapObjectHasNonBigInt(useRegister(ins->map()), useBox(ins->value()),
@ -6319,6 +6324,11 @@ void LIRGenerator::visitMapObjectGetValueVMCall(MMapObjectGetValueVMCall* ins) {
assignSafepoint(lir, ins);
}
void LIRGenerator::visitMapObjectSize(MMapObjectSize* ins) {
auto* lir = new (alloc()) LMapObjectSize(useRegisterAtStart(ins->map()));
define(lir, ins);
}
void LIRGenerator::visitConstant(MConstant* ins) {
if (!IsFloatingPointType(ins->type()) && ins->canEmitAtUses()) {
emitAtUses(ins);

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

@ -6766,6 +6766,10 @@ AliasSet MSetObjectHasValueVMCall::getAliasSet() const {
return AliasSet::Load(AliasSet::MapOrSetHashTable);
}
AliasSet MSetObjectSize::getAliasSet() const {
return AliasSet::Load(AliasSet::MapOrSetHashTable);
}
AliasSet MMapObjectHasNonBigInt::getAliasSet() const {
return AliasSet::Load(AliasSet::MapOrSetHashTable);
}
@ -6798,6 +6802,10 @@ AliasSet MMapObjectGetValueVMCall::getAliasSet() const {
return AliasSet::Load(AliasSet::MapOrSetHashTable);
}
AliasSet MMapObjectSize::getAliasSet() const {
return AliasSet::Load(AliasSet::MapOrSetHashTable);
}
MIonToWasmCall* MIonToWasmCall::New(TempAllocator& alloc,
WasmInstanceObject* instanceObj,
const wasm::FuncExport& funcExport) {

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

@ -2532,6 +2532,14 @@
alias_set: custom
possibly_calls: true
- name: SetObjectSize
operands:
set: Object
result_type: Int32
movable: true
congruent_to: if_operands_equal
alias_set: custom
- name: MapObjectHasNonBigInt
operands:
map: Object
@ -2612,6 +2620,14 @@
alias_set: custom
possibly_calls: true
- name: MapObjectSize
operands:
map: Object
result_type: Int32
movable: true
congruent_to: if_operands_equal
alias_set: custom
- name: WasmNeg
gen_boilerplate: false

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

@ -4189,6 +4189,16 @@ bool WarpCacheIRTranspiler::emitSetHasResult(ObjOperandId setId,
return true;
}
bool WarpCacheIRTranspiler::emitSetSizeResult(ObjOperandId setId) {
MDefinition* set = getOperand(setId);
auto* ins = MSetObjectSize::New(alloc(), set);
add(ins);
pushResult(ins);
return true;
}
bool WarpCacheIRTranspiler::emitMapHasNonGCThingResult(ObjOperandId mapId,
ValOperandId valId) {
MDefinition* map = getOperand(mapId);
@ -4397,6 +4407,16 @@ bool WarpCacheIRTranspiler::emitMapGetResult(ObjOperandId mapId,
return true;
}
bool WarpCacheIRTranspiler::emitMapSizeResult(ObjOperandId mapId) {
MDefinition* map = getOperand(mapId);
auto* ins = MMapObjectSize::New(alloc(), map);
add(ins);
pushResult(ins);
return true;
}
bool WarpCacheIRTranspiler::emitTruthyResult(OperandId inputId) {
MDefinition* input = getOperand(inputId);