Closed
Bug 882736
Opened 11 years ago
Closed 11 years ago
IM: Add support for JSOP_INITPROP_GETTER and JSOP_INITPROP_SETTER
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: till, Assigned: jandem)
References
Details
(Whiteboard: [js:t])
Attachments
(1 file)
35.32 KB,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
Running the following script takes about 85ms for me: instance = { field : 1, // get prop() this.field, method : function() this.field }; //Object.defineProperty(instance, "prop", {get : function() this.field}); var t1 = Date.now(); for (i = 0; i < 50000000; i++) instance.field; print(Date.now() - t1); As soon as I remove the comment from the third line, adding a getter to the object but not using it in any way, that increases to about 1170ms. That's a slowdown of ~12.8x. Removing the comment from line 6, otoh, doesn't affect performance at all. Maybe we're forcing objects into dictionary mode when parsing the literal shorthand?
Comment 1•11 years ago
|
||
The 'get prop' will inhibit Ion compilation, and when that is commented out Ion should be able to loop hoist the instance.field access so it is running an empty loop body.
Reporter | ||
Comment 2•11 years ago
|
||
(In reply to Brian Hackett (:bhackett) from comment #1) > The 'get prop' will inhibit Ion compilation Mmh, but why does the literal shorthand way of defining a getter do that, while defineProperty doesn't? Shouldn't the result be the same as far as the jit is concerned? > and when that is commented out > Ion should be able to loop hoist the instance.field access so it is running > an empty loop body. You're right. I wrongly reduced a more complex case to this. Here's a version that forces the loop body to be interpreted: var instance = {field : 1, get prop() this.field }; var t1 = Date.now(); for (var i = 0, result = 0; i < 50000000; i++) result += instance.field; print(Date.now() - t1, result); Turns out the comparison is even worse, now that we have to do more stuff, while still not running the jit: 1690ms vs 98ms with the second line commented out.
Comment 3•11 years ago
|
||
(In reply to Till Schneidereit [:till] from comment #2) > Mmh, but why does the literal shorthand way of defining a getter do that, > while defineProperty doesn't? Shouldn't the result be the same as far as the > jit is concerned? The shorthand uses an opcode, JSOP_INITPROP_GETTER or somesuch, that isn't handled by IonBuilder, causing Ion compilation to abort.
Reporter | ||
Updated•11 years ago
|
Summary: Defining getters using the object literal shorthand slows down property access dramatically → IM: Add support for JSOP_INITPROP_GETTER
Whiteboard: [js:t]
Reporter | ||
Comment 4•11 years ago
|
||
Might just as well do both at the same time, I suppose.
Summary: IM: Add support for JSOP_INITPROP_GETTER → IM: Add support for JSOP_INITPROP_GETTER and JSOP_INITPROP_SETTER
Assignee | ||
Comment 5•11 years ago
|
||
Also changes InitGetterSetterOperation to take the value as HandleObject instead of HandleValue.
Assignee: general → jdemooij
Status: NEW → ASSIGNED
Attachment #782662 -
Flags: review?(bhackett1024)
Updated•11 years ago
|
Attachment #782662 -
Flags: review?(bhackett1024) → review+
Assignee | ||
Comment 6•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/25e81fe30063 (OS X/Linux Try: https://tbpl.mozilla.org/?tree=Try&rev=3fa5edc48595)
Comment 7•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/25e81fe30063
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•