Closed Bug 1392088 Opened 7 years ago Closed 5 years ago

Shrink PromiseReactionRecord from 12 to 8 slots

Categories

(Core :: JavaScript: Standard Library, enhancement, P3)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1475678
Performance Impact none
Tracking Status
firefox57 --- affected

People

(Reporter: till, Assigned: till)

Details

(Keywords: perf, Whiteboard: [MemShrink:P2])

Attachments

(1 file)

PromiseReactionRecord has 9 slots but really doesn't need more than 8, so let's change that.

We can go even further than this and shrink it to 4 slots, but that requires fairly drastic changes to how reaction jobs are structured, such as introducing subclasses for the different kinds of jobs, and a dedicated subclass for jobs that have default values for resolve/reject functions, and an incumbentGlobal that's identical to the Promise's global. Combined with using the resultOrReason from the Promise instead of storing handlerArg on the reaction, that gets us to 4 slots.

I don't want to do that work until bug 1342044 is done, because that'll make it somewhat easier to do this.
Comment on attachment 8899258 [details] [diff] [review]
Shrink PromiseReactionRecord from 12 to 8 slots

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

Looks good, but I'm not sure about the latter part.

::: js/src/builtin/Promise.cpp
@@ +649,5 @@
>      // This is relevant for some html APIs like fetch that derive information
>      // from said global.
>      mozilla::Maybe<AutoCompartment> ac2;
> +    bool promiseNeedsWrapping = false;
> +    if (handler.isObject() && handler.toObject().compartment() != cx->compartment()) {

Can you explain how this change is related to this bug?
Flags: needinfo?(till)
(In reply to Tooru Fujisawa [:arai] from comment #2)
> Can you explain how this change is related to this bug?

Sorry, it's not related - just a tiny optimization that I threw in because I didn't think it's worth filing a bug over. I meant to mention that, but forgot. If you think it shouldn't be bundled in here, I'll file a new bug.
Flags: needinfo?(till)
Comment on attachment 8899258 [details] [diff] [review]
Shrink PromiseReactionRecord from 12 to 8 slots

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

(In reply to Till Schneidereit [:till] from comment #3)
> (In reply to Tooru Fujisawa [:arai] from comment #2)
> > Can you explain how this change is related to this bug?
> 
> Sorry, it's not related - just a tiny optimization that I threw in because I
> didn't think it's worth filing a bug over. I meant to mention that, but
> forgot. If you think it shouldn't be bundled in here, I'll file a new bug.

Okay, thanks :)
just wondered if it's somehow related and I'm missing the relation.
Attachment #8899258 - Flags: review?(arai.unmht) → review+
Whiteboard: [MemShrink][qf] → [MemShrink][qf-]
Pushed by tschneidereit@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d080b90698bc
Shrink PromiseReactionRecord from 12 to 8 slots. r=arai
Whiteboard: [MemShrink][qf-] → [MemShrink:P2][qf-]
Backout by kwierso@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9bc711acee91
Backed out changeset d080b90698bc for leaks a=backout CLOSED TREE
Astoundingly, this is the patch that caused the window leaks: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e709bc4acca8a70e413f4292499656a93b4d8603

It's very unclear to me how this is happening. I don't have time to do it right now, but will investigate in a while.
Priority: -- → P3
Keywords: perf
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Performance Impact: --- → -
Whiteboard: [MemShrink:P2][qf-] → [MemShrink:P2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: