зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1674719 - Part 7: Transpile CallGetSparseElementResult. r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D95495
This commit is contained in:
Родитель
61b61b2db7
Коммит
2ca4d69834
|
@ -1648,7 +1648,7 @@
|
|||
|
||||
- name: CallGetSparseElementResult
|
||||
shared: true
|
||||
transpile: false
|
||||
transpile: true
|
||||
cost_estimate: 5
|
||||
args:
|
||||
obj: ObjId
|
||||
|
|
|
@ -14849,6 +14849,18 @@ void CodeGenerator::visitCallAddOrUpdateSparseElement(
|
|||
callVM<Fn, js::AddOrUpdateSparseElementHelper>(lir);
|
||||
}
|
||||
|
||||
void CodeGenerator::visitCallGetSparseElement(LCallGetSparseElement* lir) {
|
||||
Register object = ToRegister(lir->object());
|
||||
Register index = ToRegister(lir->index());
|
||||
|
||||
pushArg(index);
|
||||
pushArg(object);
|
||||
|
||||
using Fn =
|
||||
bool (*)(JSContext*, HandleArrayObject, int32_t, MutableHandleValue);
|
||||
callVM<Fn, js::GetSparseElementHelper>(lir);
|
||||
}
|
||||
|
||||
template <size_t NumDefs>
|
||||
void CodeGenerator::emitIonToWasmCallBase(LIonToWasmCallBase<NumDefs>* lir) {
|
||||
wasm::JitCallStackArgVector stackArgs;
|
||||
|
|
|
@ -5563,6 +5563,19 @@ void LIRGenerator::visitCallAddOrUpdateSparseElement(
|
|||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitCallGetSparseElement(MCallGetSparseElement* ins) {
|
||||
MDefinition* object = ins->object();
|
||||
MOZ_ASSERT(object->type() == MIRType::Object);
|
||||
|
||||
MDefinition* index = ins->index();
|
||||
MOZ_ASSERT(index->type() == MIRType::Int32);
|
||||
|
||||
auto* lir = new (alloc()) LCallGetSparseElement(useRegisterAtStart(object),
|
||||
useRegisterAtStart(index));
|
||||
defineReturn(lir, ins);
|
||||
assignSafepoint(lir, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitConstant(MConstant* ins) {
|
||||
if (!IsFloatingPointType(ins->type()) && ins->canEmitAtUses()) {
|
||||
emitAtUses(ins);
|
||||
|
|
|
@ -12625,6 +12625,24 @@ class MCallAddOrUpdateSparseElement
|
|||
bool possiblyCalls() const override { return true; }
|
||||
};
|
||||
|
||||
// Get a sparse element from an array object, possibly by calling an accessor
|
||||
// property.
|
||||
class MCallGetSparseElement
|
||||
: public MBinaryInstruction,
|
||||
public MixPolicy<ObjectPolicy<0>, UnboxedInt32Policy<1>>::Data {
|
||||
MCallGetSparseElement(MDefinition* obj, MDefinition* index)
|
||||
: MBinaryInstruction(classOpcode, obj, index) {
|
||||
setResultType(MIRType::Value);
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(CallGetSparseElement)
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
NAMED_OPERANDS((0, object), (1, index))
|
||||
|
||||
bool possiblyCalls() const override { return true; }
|
||||
};
|
||||
|
||||
// Flips the input's sign bit, independently of the rest of the number's
|
||||
// payload. Note this is different from multiplying by minus-one, which has
|
||||
// side-effects for e.g. NaNs.
|
||||
|
|
|
@ -1674,6 +1674,18 @@ bool WarpCacheIRTranspiler::emitLoadDenseElementHoleResult(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WarpCacheIRTranspiler::emitCallGetSparseElementResult(
|
||||
ObjOperandId objId, Int32OperandId indexId) {
|
||||
MDefinition* obj = getOperand(objId);
|
||||
MDefinition* index = getOperand(indexId);
|
||||
|
||||
auto* call = MCallGetSparseElement::New(alloc(), obj, index);
|
||||
addEffectful(call);
|
||||
|
||||
pushResult(call);
|
||||
return resumeAfter(call);
|
||||
}
|
||||
|
||||
bool WarpCacheIRTranspiler::emitLoadDenseElementExistsResult(
|
||||
ObjOperandId objId, Int32OperandId indexId) {
|
||||
MDefinition* obj = getOperand(objId);
|
||||
|
|
|
@ -8377,6 +8377,20 @@ class LCallAddOrUpdateSparseElement
|
|||
}
|
||||
};
|
||||
|
||||
class LCallGetSparseElement : public LCallInstructionHelper<BOX_PIECES, 2, 0> {
|
||||
public:
|
||||
LIR_HEADER(CallGetSparseElement)
|
||||
|
||||
LCallGetSparseElement(const LAllocation& object, const LAllocation& index)
|
||||
: LCallInstructionHelper(classOpcode) {
|
||||
setOperand(0, object);
|
||||
setOperand(1, index);
|
||||
}
|
||||
|
||||
const LAllocation* object() { return getOperand(0); }
|
||||
const LAllocation* index() { return getOperand(1); }
|
||||
};
|
||||
|
||||
template <size_t NumDefs>
|
||||
class LIonToWasmCallBase : public LVariadicInstruction<NumDefs, 2> {
|
||||
using Base = LVariadicInstruction<NumDefs, 2>;
|
||||
|
|
Загрузка…
Ссылка в новой задаче