Closed Bug 1365769 Opened 9 years ago Closed 9 years ago

[Ion] Fix MToString when it throws due to a Symbol

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached file MToString_Symbol.js
If attached example is run with --ion-eager --ion-offthread-compile=off, the TypeError escapes the try block.
Blocks: 1365758
In this case, the MToString is marked setMovable, so LICM hoists it outside of the try-block, causing the exception to think it fired at line 4 and does not get caught. One fix would be to *not* mark setMovable *if* Symbol (or Object) case.
After fixing the code motion problem, the next issue we hit is that when the |ConvertToStringPolicy| of |MNewStringObject| gets applied, we introduce an MToString that has no resume point. This causes |x| to have the wrong value in the catch block.
Attached file MToString_Symbol-2.js
A further bug occurs when we use JSOP_TOSTRING (via template literals). In this case we are missing the |resumeAfter| in |IonBuilder::jsop_tostring| when |value->mightBeType(MIRType::Symbol)|.
Proposed fix is to simply bailout on Symbols and have the exception fire off in Baseline instead. This allows us to keep the MToString as movable. If LICM hoists the node, we simply bail out sooner and perform the details in Baseline instead.
Assignee: nobody → tcampbell
Comment on attachment 8869095 [details] Bug 1365769 - MToString should bailout on Symbols https://reviewboard.mozilla.org/r/140718/#review145110 Good catch, thanks for fixing.
Attachment #8869095 - Flags: review?(jdemooij) → review+
Pushed by tcampbell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8ed5deec4fc3 MToString should bailout on Symbols r=jandem
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: