Tail Call Optimization implementation in Javascript Engines [duplicate]

TCO, or rather, Tail Call Elimination in JavaScript — also often referred to as Proper Tail Calls (PTC) in discussions — is a long and sad story. Around 2011, TC39 (the JavaScript standards committee) decided to adopt mandatory TCE for the forthcoming ES6 standard, with consensus from all major browser vendors. In 2015, the new … Read more

Relationship between event loop,libuv and v8 engine

The event loop is, first and foremost, a high-level concept that’s a fundamental part of the JavaScript programming model. Practically, every V8 embedder needs to implement an event loop. V8 provides a default implementation, which embedders can replace or extend. I don’t understand the question. (I guess the answer is “yes”, but what’s the difference … Read more

Is node.js a viable alternative to traditional scripting languages like Perl and Python? [closed]

In terms of Node.js, I can’t see it becoming a mainstream way of using javascript as a general purpose scripting language. The main reason for that would be the async nature of 99% of the libraries and functions available in Node.js. Because of the async nature, you have to completely change your thinking. Not having … Read more

V8 and ECMAScript differences

Edit: Direct answer: Track status of ES5 implementations in progress which indicates the V8 googlecode issues tagged es5 or https://github.com/joyent/node/wiki/ECMA-5-Mozilla-Features-Implemented-in-V8 V8 implements all of ES5 currently aside from a handful of edge cases, and only then in order to be compliant with the majority of how other current browsers handle the given situation. Because it … Read more

Under the hood, are Javascript objects hash tables? [duplicate]

First of all, the answer is probably somewhat different for different JS engines. Also, I assume you’re specifically asking about the property storage; obviously objects have a bunch of other state too (prototype chain link being an obvious one). In the case of Spidermonkey, objects basically have a linked list of (propname, information about property) … Read more

Why is Function.prototype.bind slow?

Based on http://jsperf.com/bind-vs-emulate/6, which adds the es5-shim version for comparison, it looks like the culprit is the extra branch and instanceof that the bound version has to perform to test if it’s being called as a constructor. Each time the bound version is run, the code that gets executed is essentially: if (this instanceof bound) … Read more

stack and heap in V8 ( JavaScript)

In V8 null, undefined, true and false internally are heap allocated objects. If you are comming from Java you can say that true and false in V8 are more like Boolean.TRUE and Boolean.FALSE in Java. There is an important difference between real local variables and variables that are captured by closures or shadowed by eval/with. … Read more

garbage collection with node.js

Simple answer: if value of the str is not referenced from anywhere else (and str itself is not referenced from restofprogram) it will become unreachable as soon as the function (str) { … } returns. Details: V8 compiler distinguishes real local variables from so called context variables captured by a closure, shadowed by a with-statement … Read more

tech