Closed Bug 1106947 Opened 5 years ago Closed 5 years ago

Make CodeGenerator visit() methods infallible

Categories

(Core :: JavaScript Engine: JIT, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: bhackett, Assigned: bhackett)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
The visit() methods, which are the main way Ion generates code, can only fail on OOM.  In such cases the OOM can be more cleanly indicated within the macro assembler.  The attached patch makes the visit methods infallible in this fashion, along with many other CodeGenerator methods called by the visit methods.

35 files changed, 2528 insertions(+), 3469 deletions(-)
Attachment #8531399 - Flags: review?(jdemooij)
Comment on attachment 8531399 [details] [diff] [review]
patch

Review of attachment 8531399 [details] [diff] [review]:
-----------------------------------------------------------------

Seems reasonable, it's similar to what we're already doing in the MacroAssembler.

::: js/src/jit/CodeGenerator.cpp
@@ -867,5 @@
>  
>      OutOfLineCode *ool = oolCallVM(IntToStringInfo, lir, (ArgList(), input),
>                                     StoreRegisterTo(output));
> -    if (!ool)
> -        return false;

The OutOfLineCode allocation is infallible so we shouldn't get a nullptr ool right?
Attachment #8531399 - Flags: review?(jdemooij) → review+
(In reply to Jan de Mooij [:jandem] from comment #1)
> The OutOfLineCode allocation is infallible so we shouldn't get a nullptr ool
> right?

Yes, the code was already assuming that OutOfLineCode allocations were infallible, and the only way this function could fail earlier was if we failed to append to some vector.
https://hg.mozilla.org/mozilla-central/rev/60bb5b8e5ae0
Assignee: nobody → bhackett1024
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.