Great explanation. Although, It took novice-me quite some time to dig in 
and digest. V8 is really "pretty large and complex" just as you said. The 
topic of V8 deserve full-time dedication in order to catch up. So, for now 
I am happy with the little bit of under the hood knowledge I just obtain. 
Just FYI, your fix for my code to mitigate the V8 bug works flawlessly. 
Just to check if my understanding of the 42 check is correct, I modify it a 
little bit (shorter, less typing):

function printST(x) {
if(!x) {
return printST(1);
} 
var obj = {};
Error.captureStackTrace(obj, printST);
log('\tStack length: ' + obj.stack.length);
}

It also works just like your fix. Any chance the C++ fix (not the JS above) 
going to upstream Node.js, or better V8?

I am interested in call stack (also stack trace API) because I am writing a 
module (for my private project) that organize and execute a arbitrary long 
sequence of functions, using next() callback to signal completion at each 
one, inspired by Connect pipeline. But my module encourage both sync and 
async style of continuation. Therefore, I want to find a way to mitigate 
call stack growth potential problem when doing sync. And also a way to 
correctly test it if I could figure out a solution (It's a work in progress 
though).

I thought of using nextTick() as a fast and reliable built-in trampoline 
(to eliminate tail-call). But what I think I need is a way to insert a 
function to the head of the queue (like stack), not the back as nextTick() 
does. The queue output direction remains the same. The rationale is that I 
want to ensure the next function will always be executed right after the 
current one, but before everything else. Do you have any advice on this?

Lastly, a tiny problem, any ideas why my code kept not being highlighted 
although I used the "Highlight code syntax" button before entering it? It 
annoys and also embarrasses me to post my code for others to see but have 
no highlight.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/072459a7-e704-4fcf-aeed-77e46faf9c69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to