How does Bluebird’s util.toFastProperties function make an object’s properties “fast”?

2017 update: First, for readers coming today – here is a version that works with Node 7 (4+): function enforceFastProperties(o) { function Sub() {} Sub.prototype = o; var receiver = new Sub(); // create an instance function ic() { return typeof receiver.foo; } // perform access ic(); ic(); return o; eval(“o” + o); // ensure … Read more

Access function location programmatically

The answer, for now, is no. The [[FunctionLocation]] property you see in Inspector is added in V8Debugger::internalProperties() in the debugger’s C++ code, which uses another C++ function V8Debugger::functionLocation() to gather information about the function. functionLocation() then uses a number of V8-specific C++ APIs such as v8::Function::GetScriptLineNumber() and GetScriptColumnNumber() to find out the exact information. All … 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

Using ‘let’ as a variable name is not throwing any errors in google v8

A nice write-up of the reasoning behind this can be found in this article by Mohsen Azimi. Here’s a quick summary of it. The following keywords are defined in the JavaScript spec as FutureReservedWord: implements interface let package private protected public static yield In normal mode, these can be used as variable names without errors; … Read more