On Jun 21, 2011, at 4:13 PM, Sean Eagan wrote: > On Tue, Jun 21, 2011 at 9:40 AM, Axel Rauschmayer <a...@rauschma.de> wrote: >>>> We wish to avoid another parameter computed potentially differently for >>>> each >>>> call. It will cost >>> >>> What costs do you foresee? I am not sure that there is much to >>> compute. Assume a method call O.m(). Assume "m" is found on an >>> object P within O's protoype chain. This will result in P.m being >>> called, for which the "super binding" can simply be computed as >>> P.[[Prototype]]. Next assume a direct function call, e.g. >>> f.call(this) or f() (this === undefined), the "super binding" here >>> could just be calculated as this.[[Prototype]] or undefined if |this| >>> is not an object. >> >> >> This may already be what you are suggesting, so to clarify: >> >> I would introduce a binding called "here" that points to the object P where >> m has been found. >> >> - Method that uses super: compute super as here.[[Prototype]] >> - Non-method function that uses super: "here" is undefined, using super >> causes an error. >> >> If super is not used there is little computational cost! (Other than a >> binding per function call which may still be prohibitive.) > > Regardless of any "here" binding, "super" would only need to be bound > within functions that actually use it (the same should be true for > |this|). However, as I mentioned, it seems the cost of a dynamic > |super| binding should be relatively low, comparable to the cost of a > dynamic |this| binding. >
No, dynamic 'super' is an additional overhead that is the same as the dynamic 'this' overhead. Dynamic 'super' essentially doubles the dynamic 'this' overhead on every call. Allen
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss