Closed Bug 499201 Opened 12 years ago Closed 7 years ago

Need support for classes with virtual properties in jsapi


(Core :: JavaScript Engine, defect, P2)




Tracking Status
blocking2.0 --- -
status2.0 --- wanted


(Reporter: bzbarsky, Assigned: peterv)


(Blocks 3 open bugs, )



(1 file)

This is actually somewhat described in bug 497795, but to be more precise what we need is:

1)  A way to flag objects as having IndexGetter/IndexSetter
2)  A way to quickly ask the object what range of indices it supports, and a way
    for it to indicate "all integers".
3)  For indices in the supported range, a way to quickly call the relevant
    getter/setter function.
4)  Filing followup bugs to make our DOM classes use this.
5)  Filing followup bugs to make the JS engine use this as needed.

A key goal here is avoiding all the overhead of resolving the indices, then calling getters, etc.  The premise is that all the index stuff will live on the object, not the proto, so we don't need all that overhead.

I ran into a case where this seems like it would help when profiling the domJQueryAttributeFilters benchmark in the dom section of the peacekeeper benchmark.  That code is doing Array.slice() on the return value of querySelectorAll, which ends up spending about 2/3 as much time as the querySelectorAll call did...  Some of this might be xpconnect wrapping of the nodes, but some is just pure overhead.
Blocks: peacekeeper
Attached file Microbenchmark
Blocks: 522967
Blocks: 559396
OS: Mac OS X → All
Priority: -- → P2
Hardware: x86 → All
Assignee: general → gal
Assignee: gal → peterv
blocking2.0: --- → betaN+
Summary: Need support for classes with IndexGetter/IndexSetter in jsapi → Need support for classes with virtual properties in jsapi
blocking2.0: betaN+ → -
status2.0: --- → wanted
A lot has changed in the recent years. Is this bug still relevant, or are there different solutions?
At this point we're well along on doing what this bug wants with proxies.  I don't think this bug's particularly useful any more -- proxy work would go in other bugs.
Closed: 7 years ago
Resolution: --- → INCOMPLETE
We're well along to doing with proxies everything except the "fast" parts of comment 0.  ;)
You need to log in before you can comment on or make changes to this bug.