var log = console.log;
log(process.versions);
Error.stackTraceLimit = Infinity;
Error.prepareStackTrace = function(err, stack) { return stack;};
function printST() { var obj = {}; Error.captureStackTrace(obj, printST); log('\tStack length: ' + obj.stack.length);}log('Initiation:');printST();
function recur(n) { if(n > 1) { return recur(--n); } log('recur():'); printST();}
for(var i = 1; i <= 10; i++) { log(i + '/'); recur(1000);}{ http_parser: '2.2',node: '0.11.13',v8: '3.25.30',uv: '0.11.25',zlib: '1.2.3',modules: '14',openssl: '1.0.1g' }Initiation:Stack length: 81/recur():Stack length: 10082/recur():Stack length: 10083/recur():Stack length: 04/recur():Stack length: 10085/recur():Stack length: 06/recur():Stack length: 10087/recur():Stack length: 08/recur():Stack length: 09/recur():Stack length: 010/recur():Stack length: 0
{ http_parser: '1.0',node: '0.10.29',v8: '3.14.5.9',ares: '1.9.0-DEV',uv: '0.10.27',zlib: '1.2.3',modules: '11',openssl: '1.0.1h' }Initiation:Stack length: 81/recur():Stack length: 10082/recur():Stack length: 03/recur():Stack length: 04/recur():Stack length: 05/recur():Stack length: 06/recur():Stack length: 07/recur():Stack length: 08/recur():Stack length: 09/recur():Stack length: 010/recur():Stack length: 0
_ Where should I insert that code snippet? Why the 42 check? Is 42 some kind of magic number?
_ Why pass x to printST() while it's main purpose is just simply print out stack length that needs no argument? If x is necessary then what is the value of x should I pass? Where should I call the new printST(x)?
_ What is self-optimizing JS code, isn't V8 responsible for optimization process of JS run-time? Should I do self-optimizing a lot?
_ Where is raw_frame located in C++ source files? How can an exit frame generated where I couldn't see any line of code I wrote that call a Node.js native C++ addon?
_ Is the call stack behavior different and unpredictable in live-optimized and interpreted languages like JS compare to pre-optimized and then compiled languages like C? If an exit frame wipe out entire current stack then how could Node.js profiling be accurate?
You are welcome to just ignore me because that is a lot of questions and I am in a totally different and extremely lower level than you (I have no experience in C/C++, although I did learn some in my university). I feel embarrassed to even ask the question in the first place. But still I want to learn more (university seem never enough) . So any direction pointing would be much appreciated. Thank you for your time.
function printST(x) { if(!x) { return printST(1); } var obj = {}; Error.captureStackTrace(obj, printST); log('\tStack length: ' + obj.stack.length);}function printST(bl) { var obj = {}; Error.captureStackTrace(obj, arguments.callee); log('\tStack length: ' + obj.stack.length);}
--
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 nodejs+un...@googlegroups.com.
To post to this group, send email to nod...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/0e95c1fa-9b9a-46c4-9536-6a160cdb977c%40googlegroups.com.