Closed Bug 786146 Opened 7 years ago Closed 7 years ago

IonMonkey: eagerly generate stubs/wrappers, store in runtime

Categories

(Core :: JavaScript Engine, defect)

Other Branch
x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: bhackett, Unassigned)

References

Details

(Whiteboard: [ion:t])

Attachments

(1 file)

The main difficulty with bug 785762 is the need to get IonCode objects for various stubs (VM function wrappers, etc.) that are lazily generated and need to be constructed on the main thread.  It would be much simpler for off thread compilation if these objects were eagerly generated and guaranteed present during code generation, so that the compilation thread does not have to try to allocate any IonCode objects nor defer a linking step to later.

The attached patch eagerly generates all stubs/wrappers which were formerly lazily generated.  On my machine this takes about .2ms and generates about 16KB of code (plus the IonCode objects themselves).  This is a little steep when done per compartment, so this patch also moves this data into a new IonRuntime.  The stubs are allocated in the atoms compartment and, once created, are not collected until the runtime is destroyed.
Attachment #655857 - Flags: review?(dvander)
Comment on attachment 655857 [details] [diff] [review]
patch (01854460aa68)

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

::: js/src/ion/Ion.cpp
@@ +142,2 @@
>  {
> +    SwitchToCompartment sc(cx, cx->runtime->atomsCompartment);

I agree with the final goal, but either this compartment should be renamed or these executable pieces of code should be allocated in their own compartment.
Attachment #655857 - Flags: feedback+
Attachment #655857 - Flags: review?(dvander) → review+
Pushed, with a couple tweaks to unbitrot off thread compilation.

https://hg.mozilla.org/integration/mozilla-inbound/rev/589b6766b99a
https://hg.mozilla.org/mozilla-central/rev/6ba78023b367
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Depends on: 812235
Depends on: 819635
Depends on: 905210
You need to log in before you can comment on or make changes to this bug.