IonMonkey: Make "value === boolean" fast

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jandem, Assigned: jandem)

Tracking

(Blocks: 2 bugs)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

5 years ago
JM has a fast path for this and we need it for V8 earley-boyer.

A micro-benchmark:
--
function f() {
    var a = [{}, true];
    var res = 0;

    for (var i=0; i<10000000; i++) {
        if (a[i & 1] !== false)
            res += 1;
    }
    print(res);
}

var t = new Date;
f();
print(new Date - t);
--
JM+TI :  22 ms
Ion   : 170 ms
(Assignee)

Comment 1

5 years ago
Created attachment 634877 [details] [diff] [review]
Patch

I tried to use MCompare with different LIR instructions, but adding MCompareConstant seemed a bit simpler. The patch also has a few minor, unrelated MCompare changes.

On earley-boyer, this seems to get rid of all calls to StrictlyEqual<false> (!==). There are still some stub calls left for the === in sc_assq, one of the operands there has type "int or string".
Attachment #634877 - Flags: review?(dvander)
(Assignee)

Comment 2

5 years ago
Created attachment 634914 [details] [diff] [review]
Patch

Fixes a small perf issue.
Attachment #634877 - Attachment is obsolete: true
Attachment #634877 - Flags: review?(dvander)
Attachment #634914 - Flags: review?(dvander)
This is about a 15% perf win on earley-boyer on my machine - nice! Will review tonight.
(Assignee)

Comment 4

5 years ago
Created attachment 636639 [details] [diff] [review]
Patch

Different approach, applies on top of bug 768027.
Attachment #634914 - Attachment is obsolete: true
Attachment #634914 - Flags: review?(dvander)
Attachment #636639 - Flags: review?(dvander)
Attachment #636639 - Flags: review?(dvander) → review+
(Assignee)

Comment 5

5 years ago
https://hg.mozilla.org/projects/ionmonkey/rev/82120910b08f
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Depends on: 839315
You need to log in before you can comment on or make changes to this bug.