I guess it is important to know how the object "this" is created. The object is fully constructed from C++, and then passed to the call() as the receiver.
On Apr 19, 9:50 am, ajg <[email protected]> wrote: > I am trying to optimize a piece of code, or at least make sure the v8 > goodness is properly applied. > Say I have C++ code that does 10,000 JS calls to execute a JS > function. > All calls use same lock, context and same handle scope. > The JS code accesses the same properties on the "this" object, a > simple example is: > > f = function(){ > for ( var i=0; i<this.tags.length; i++ ){ > print( this.tags[i] ); > } > > }; > > Now I want to make sure that v8 uses a hidden class to access the > property "tags" and then each index within tag in a native optimized > way. > Ideally the hidden class would get built on the 1st call, and then the > 9999 remaining calls would make use of it. > What I am wondering is whether: > - hidden class survives across calls > - hidden class will be shared across all "this" objects. > > If it's not the case, does anyone know how to: > - check if hidden class is being used for accessing properties > - how to write code that makes it shared (e.g. use same function to > create objects) > > As I understand this can speed up code 100x so that would be very > significant, thanks for help -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
