Closed Bug 1617878 Opened 5 years ago Closed 5 years ago

Give cloned derived class constructors scripted function types

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(3 files)

Cloned derived class constructors are never inlined, because they don't have scripted function types installed. This is similar to the issues reported in bug 1606868 and bug 958797.

With scripted function types, the following µ-benchmark finishes ~3x faster than without the patch.

var make = base => class C extends base { constructor() { return {}; } };
var C = make(class {});

function f() {
    var xs = [null, null];
    var t = dateNow();
    for (var i = 0; i < 5000000; ++i) {
        xs[i & 1] = new C();
    }
    return dateNow() - t;
}

for (var i = 0; i < 10; ++i) print(f());

In some places we were still using the old "parent" nomenclature, leading to
inconsistencies between function declarations and definitions, cf.
CloneFunctionReuseScript().

Depends on D64063

Priority: -- → P2
Pushed by nerli@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/080133f25701 Part 1: Remove unused default parameters. r=jandem https://hg.mozilla.org/integration/autoland/rev/038f065c2bbe Part 2: Replace remaining references to "parent" with "enclosingEnv". r=jandem https://hg.mozilla.org/integration/autoland/rev/d93e9fef86dd Part 3: Assign type for cloned derived class constructors. r=jandem
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: