зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1132888 part 1 - Re-add recover instruction for recovering typed array allocations. r=h4writer
This commit is contained in:
Родитель
6e33ec823b
Коммит
8425620cf7
|
@ -2372,7 +2372,9 @@ IonBuilder::inlineTypedArray(CallInfo& callInfo, Native native)
|
|||
return InliningStatus_NotInlined;
|
||||
|
||||
callInfo.setImplicitlyUsedUnchecked();
|
||||
ins = MNewTypedArray::New(alloc(), constraints(), obj,
|
||||
MConstant* templateConst = MConstant::NewConstraintlessObject(alloc(), obj);
|
||||
current->add(templateConst);
|
||||
ins = MNewTypedArray::New(alloc(), constraints(), templateConst,
|
||||
obj->group()->initialHeap(constraints()));
|
||||
}
|
||||
|
||||
|
|
|
@ -3365,34 +3365,28 @@ class MNewArrayDynamicLength
|
|||
}
|
||||
};
|
||||
|
||||
class MNewTypedArray : public MNullaryInstruction
|
||||
class MNewTypedArray
|
||||
: public MUnaryInstruction,
|
||||
public NoTypePolicy::Data
|
||||
{
|
||||
CompilerGCPointer<TypedArrayObject*> templateObject_;
|
||||
gc::InitialHeap initialHeap_;
|
||||
|
||||
MNewTypedArray(CompilerConstraintList* constraints, TypedArrayObject* templateObject,
|
||||
MNewTypedArray(CompilerConstraintList* constraints, MConstant* templateConst,
|
||||
gc::InitialHeap initialHeap)
|
||||
: templateObject_(templateObject),
|
||||
: MUnaryInstruction(templateConst),
|
||||
initialHeap_(initialHeap)
|
||||
{
|
||||
MOZ_ASSERT(!templateObject->isSingleton());
|
||||
MOZ_ASSERT(!templateObject()->isSingleton());
|
||||
setResultType(MIRType::Object);
|
||||
setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject));
|
||||
setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject()));
|
||||
}
|
||||
|
||||
public:
|
||||
INSTRUCTION_HEADER(NewTypedArray)
|
||||
|
||||
static MNewTypedArray* New(TempAllocator& alloc,
|
||||
CompilerConstraintList* constraints,
|
||||
TypedArrayObject* templateObject,
|
||||
gc::InitialHeap initialHeap)
|
||||
{
|
||||
return new(alloc) MNewTypedArray(constraints, templateObject, initialHeap);
|
||||
}
|
||||
TRIVIAL_NEW_WRAPPERS
|
||||
|
||||
TypedArrayObject* templateObject() const {
|
||||
return templateObject_;
|
||||
return &getOperand(0)->toConstant()->toObject().as<TypedArrayObject>();
|
||||
}
|
||||
|
||||
gc::InitialHeap initialHeap() const {
|
||||
|
@ -3403,8 +3397,9 @@ class MNewTypedArray : public MNullaryInstruction
|
|||
return AliasSet::None();
|
||||
}
|
||||
|
||||
bool appendRoots(MRootList& roots) const override {
|
||||
return roots.append(templateObject_);
|
||||
MOZ_MUST_USE bool writeRecoverData(CompactBufferWriter& writer) const override;
|
||||
bool canRecoverOnBailout() const override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1305,6 +1305,34 @@ RNewObject::recover(JSContext* cx, SnapshotIterator& iter) const
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
MNewTypedArray::writeRecoverData(CompactBufferWriter& writer) const
|
||||
{
|
||||
MOZ_ASSERT(canRecoverOnBailout());
|
||||
writer.writeUnsigned(uint32_t(RInstruction::Recover_NewTypedArray));
|
||||
return true;
|
||||
}
|
||||
|
||||
RNewTypedArray::RNewTypedArray(CompactBufferReader& reader)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
RNewTypedArray::recover(JSContext* cx, SnapshotIterator& iter) const
|
||||
{
|
||||
RootedObject templateObject(cx, &iter.read().toObject());
|
||||
RootedValue result(cx);
|
||||
|
||||
uint32_t length = templateObject.as<TypedArrayObject>()->length();
|
||||
JSObject* resultObject = TypedArrayCreateWithTemplate(cx, templateObject, length);
|
||||
if (!resultObject)
|
||||
return false;
|
||||
|
||||
result.setObject(*resultObject);
|
||||
iter.storeInstructionResult(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
MNewArray::writeRecoverData(CompactBufferWriter& writer) const
|
||||
{
|
||||
|
|
|
@ -100,6 +100,7 @@ namespace jit {
|
|||
_(ToFloat32) \
|
||||
_(TruncateToInt32) \
|
||||
_(NewObject) \
|
||||
_(NewTypedArray) \
|
||||
_(NewArray) \
|
||||
_(NewDerivedTypedObject) \
|
||||
_(CreateThisWithTemplate) \
|
||||
|
@ -565,6 +566,14 @@ class RNewObject final : public RInstruction
|
|||
MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const;
|
||||
};
|
||||
|
||||
class RNewTypedArray final : public RInstruction
|
||||
{
|
||||
public:
|
||||
RINSTRUCTION_HEADER_NUM_OP_(NewTypedArray, 1)
|
||||
|
||||
MOZ_MUST_USE bool recover(JSContext* cx, SnapshotIterator& iter) const;
|
||||
};
|
||||
|
||||
class RNewArray final : public RInstruction
|
||||
{
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче