Closed Bug 928971 Opened 10 years ago Closed 10 years ago

Run-once closure analysis bug can cause unnecessary script cloning

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: jandem, Assigned: bhackett1024)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Noticed this on the "[coll (take 100000 (iterate inc 0))] (reduce + 0 coll)" Clojurescript test. We keep cloning some scripts (and hence never JIT them). See the function literals on line 2 and 10:

    var Fi = function Di(b, c) {
        return new kc(null, function () {
            if (0 < b) {
                var e = B(c);
                return e ? I(C(e), Di(b - 1, D(e))) : null
            }
            return null
        }, null, null)
    }(1E5, function Ei(b, c) {
        return I(c, new kc(null, function () {
            return Ei(b, b.a ? b.a(c) : b.call(null, c))
        }, null, null))
    }(function (a) {
        return a + 1
    }, 0));
Not fixed by bug 880085?
Oops, n/m
Attached patch patchSplinter Review
We don't end up emitting a run once lambda here because of the outer name, but due to an inconsistency between how run once lambdas are detected the inner functions of the lambda are still given singleton type and end up being deep cloned each time the outer script runs.
Assignee: nobody → bhackett1024
Attachment #819767 - Flags: review?(luke)
Excellent, on this subtest the patch improves our time from > 700 ms to 130-140 ms.
Attachment #819767 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/d2b4e498b5aa
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.