Closed Bug 922406 Opened 12 years ago Closed 10 years ago

Top-level use of "this" prevents ion compilation

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: jruderman, Assigned: jandem)

References

Details

(Keywords: perf, regression, testcase)

Attachments

(2 files)

Removing the second line of this shell program makes it 9x faster: var start = dateNow(); this.Array; for (var i = 0; i < 10000000; ++i) {} var end = dateNow(); print(Math.floor(end - start) + " ms"); Pretty much anything more complicated than "this;" causes the slowdown, e.g. * this.Array; * this, {}; * (function(){})(this); // often needed for asm modules or strict-mode code I noticed this slowdown while converting Mersenne Twister to asm style.
Attached file regression-range.txt
Regression range depends on the exact second line. The attachment above is for "this, {};". Its large regression range seems to be due to hgrange('d2cce982a7c8', '4a6b8dd4dfe3'), # broken virtualenv
> (function(){})(this) The first bad revision is: changeset: http://hg.mozilla.org/mozilla-central/rev/e0bc47d3f814 user: Jan de Mooij date: Mon Dec 17 11:04:08 2012 +0100 summary: Bug 821682 - Compile DEFVAR, DEFCONST and PICK. r=djvj > this.Array; The first bad revision is: changeset: http://hg.mozilla.org/mozilla-central/rev/c13b9e58eedb user: Jan de Mooij date: Wed Dec 19 09:43:22 2012 +0100 summary: Bug 822744 - Compile OBJECT, REGEXP, LAMBDA. r=djvj > this, {}; Large regression range in comment 1.
Component: JavaScript Engine → JavaScript Engine: JIT
OS: Mac OS X → All
Hardware: x86_64 → All
Not sure if this is still valid, but putting a needinfo on jandem to be sure.
Flags: needinfo?(jdemooij)
With 'this.Array;' I get 260ms on Nightly and 45ms on Chrome 43 Without 'this.Array;' I get 23ms on Nightly and 45ms on Chrome 43.
(In reply to Christian Holler (:decoder) from comment #4) > Not sure if this is still valid, but putting a needinfo on jandem to be sure. It is, thanks for the reminder. Patch in a bit.
(In reply to Jan de Mooij [:jandem] from comment #6) > (In reply to Christian Holler (:decoder) from comment #4) > > Not sure if this is still valid, but putting a needinfo on jandem to be sure. > > It is, thanks for the reminder. Patch in a bit. Actually, this bug is a fair amount of work to fix: we either (1) should add an extra MBasicBlock/snapshot slot for `this` in global scripts, or (2) fix bug 1125423, so that we have the global `this` for the compartment readily available. (2) is a bit annoying because it requires changes outside SpiderMonkey, but I think it's where we want to be long-term so I'd prefer it over putting a lot of effort on (1). Unfortunately neither of these is trivial.
Depends on: 1125423
Flags: needinfo?(jdemooij)
Blocks: 1212247
Attached patch PatchSplinter Review
After all the other changes, fixing this is almost trivial.
Assignee: nobody → jdemooij
Status: NEW → ASSIGNED
Attachment #8691334 - Flags: review?(shu)
Depends on: 1132183
Comment on attachment 8691334 [details] [diff] [review] Patch Review of attachment 8691334 [details] [diff] [review]: ----------------------------------------------------------------- A triumph.
Attachment #8691334 - Flags: review?(shu) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: