Re: [v8-users] C++ lifetime management via shared_ptr and

2013-06-11 Thread Jim Acquavella
I've updated the code and no longer explicitly calling obj.Dispose(isolateP), and my c++ object does get disposed when I call LowMemoryNotification before terminating v8. The extra Dispose was clearing my near death callback. This is good news and will greatly simplify my design and assure all c+

Re: [v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Michael Schwartz
The best use case I can think of for "with" is in templates. Consider ejs style template: <%= obj.title %> <% for (i=1; i<6; i++) { %> Line #<%= i%> <% } %> This gets "compiled" into a script like: writeln(''); write(''); write(obj.title); writeln(''); writeln(''); for (i=1; i<6; i++) { wri

Re: [v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Andreas Rossberg
On 11 June 2013 18:11, Michael Schwartz wrote: > I never understood why "with" is considered a bad thing. It's got a bad > reputation, though it has some real world use cases that make a lot of > sense. One thing to realise is that every pile of poo in any language can be motivated by use cases.

Re: [v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Michael Schwartz
I never understood why "with" is considered a bad thing. It's got a bad reputation, though it has some real world use cases that make a lot of sense. Granted v8 doesn't optimize code using it. On Jun 11, 2013, at 9:06 AM, Stephan Beal wrote: > On Tue, Jun 11, 2013 at 5:53 PM, Michael Schwartz

Re: [v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Stephan Beal
On Tue, Jun 11, 2013 at 5:53 PM, Michael Schwartz wrote: > with (o) { > Yeah, i was hoping to avoid the 'with'. i assume there is no clean/portable/sane way to do this in JS, and to be honest the idea never occurred to me until today while tinkering on my own pet scripting engine (which, by an a

Re: [v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Michael Schwartz
Ugly but… In JavaScript you can do something like this: var o = { dbRow: whatever, rowNumber: whatever, colNames: whatever, colCount: whatever }; with (o) { function rowCallback() { // dbRow would be accessible without the o. prefix, etc. } } On Jun 11, 2013, at 8:30 AM, Andreas Rossbe

Re: [v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Andreas Rossberg
On 11 June 2013 17:11, Stephan Beal wrote: > Please consider this construct: > > function rowCallback(dbRow){ > // Notes below ref to this scope > } > > myDbDriver.query({ > sql:"SELECT * FROM T", > callback: rowCallback > }); > > That hypothetical code would run the given query and call the

[v8-users] How to achieve "scope property injection" in v8?

2013-06-11 Thread Stephan Beal
Hi, all, Please consider this construct: function rowCallback(dbRow){ // Notes below ref to this scope } myDbDriver.query({ sql:"SELECT * FROM T", callback: rowCallback }); That hypothetical code would run the given query and call the given callback for each row. What i would like to do h

Re: [v8-users] Get a break down of objects that were garbage collected.

2013-06-11 Thread Daniel Clifford
There is no direct way to get statistics about the objects are that are collected, but you may be able to infer this information by looking at the delta between live object counts between two GCs. You can track live object counts by passing the --track_gc_object_stats flag to V8, which records tota

Re: [v8-users] Profiling v8 inside chromium/content_shell

2013-06-11 Thread Ben Noordhuis
On Tue, Jun 11, 2013 at 7:24 AM, Adam Klein wrote: > I'm trying to profile the v8 execution of a web app using Chromium's > content_shell with some success. But I'm also getting some odd > results. I'm using a commandline like: > > content_shell --no-sandbox --js-flags='--prof --noprof-lazy > --lo

Re: [v8-users] Profiling v8 inside chromium/content_shell

2013-06-11 Thread Kentaro Hara
> > Also, I'm a bit surprised at the way the v8 DOM callbacks end up in > the profile: those methods are usually trivial, with the real work > being somewhere deep in the core of Blink. Is it expected that only > the v8 entry point into Blink shows up when using the profiling tool? I've played ar

Re: [v8-users] Profiling v8 inside chromium/content_shell

2013-06-11 Thread Jochen Eisinger
+kentaro for some profiling insights On Tue, Jun 11, 2013 at 7:24 AM, Adam Klein wrote: > I'm trying to profile the v8 execution of a web app using Chromium's > content_shell with some success. But I'm also getting some odd > results. I'm using a commandline like: > > content_shell --no-sandbox