Optimize ConvertAndCopyTo calls in MIR code

NEW
Assigned to

Status

()

P5
normal
5 years ago
2 years ago

People

(Reporter: nmatsakis, Assigned: nmatsakis)

Tracking

(Depends on: 2 bugs, Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 obsolete attachments)

(Assignee)

Description

5 years ago
Both new object creation (bug 933277) and assignments (bug 933289) can result in calls to the self-hosted helper ConvertAndCopyTo. In some cases we should be able to further optimize these calls by "unrolling" them into a series of accesses and assignments. We have to be very careful because if a jit bailout should occur it may not be observable, and there is no convenient bytecode to jump back into. Therefore I would probably write this optimization to examine the value being converted and handle two cases:

1. The value being converted is known to be a typed object of equivalent type. We can use memcpy in that case. This may be better done in IonBuilder directly.

2. TI can guarantee for us that loading the properties and converting the values we need to load/convert will not have side-effects, so it's okay for these loads/conversions to be replayed if necessary. This will frequently occur in the common case of users using literal syntax (`new Point({x: 22, y: 44})`) -- in that case we should be able to determine the precise *value* that is being loaded (22 for `x`, etc).
(Assignee)

Updated

5 years ago
Blocks: 578700
Depends on: 933277, 933289
(Assignee)

Updated

5 years ago
Assignee: nobody → nmatsakis
(Assignee)

Comment 2

5 years ago
Created attachment 830572 [details] [diff] [review]
Bug933293.diff
Attachment #830572 - Flags: review?(jdemooij)
Attachment #830572 - Flags: feedback?(pnkfelix)
(Assignee)

Comment 3

5 years ago
Created attachment 830574 [details]
jaswanth.js

Test case that performs better. I'm reluctant to add this as a jit-test, instead I'd like to setup some benchmarks in awfy (perhaps including this one).
(Assignee)

Comment 4

5 years ago
Comment on attachment 830572 [details] [diff] [review]
Bug933293.diff

Attached to wrong bug (argh).
Attachment #830572 - Attachment is obsolete: true
Attachment #830572 - Flags: review?(jdemooij)
Attachment #830572 - Flags: feedback?(pnkfelix)
(Assignee)

Comment 5

5 years ago
Comment on attachment 830574 [details]
jaswanth.js

Attached to wrong bug (argh).
Attachment #830574 - Attachment is obsolete: true
Assuming p5 because related to typed objects, which are nightly-only and not specced yet.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.