Open Bug 1325386 Opened 7 years ago Updated 7 days ago

Use MFBT Result<T, E> in MInstruction::New.

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

defect

Tracking

()

People

(Reporter: nbp, Unassigned)

References

(Blocks 1 open bug)

Details

Today, our MIR Instructions have 2 different New static functions:

    static MThisOpcode* New(TempAllocator& alloc, ...)
    static MThisOpcode* New(TempAllocator::Fallible alloc, ...)

Ideally the type of the argument should be enough to know if we should check for failures or not, but unfortunately, we still have tens of legacy New function taking the infallible Allocator and returning either null or a valid pointer.

I suggest we rewrite the signature of the above to:

    static NotNull<MThisOpcode*> New(TempAllocator& alloc, ...)
    static AbortReasonOr<NotNull<MThisOpcode*>> New(TempAllocator::Fallible alloc, ...)

This would have the benefit of forcing any function using these New functions to forward the error code, and also to prevent useless checks for null pointers from Ion code base (mozilla::NotNull::operator bool() = delete).
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.