Setting this to null instead of throwing ReferenceError in a derived class' constructor

Ryosuke Niwa rniwa at
Tue Jan 20 10:52:03 PST 2015

Hi all,

We've been working on an experimental implementation of ES6 class syntax in WebKit [1].  And we've found that keeping "this" in uninitialized state inside a derived class's constructor is problematic.  It introduces lots of branching around access to "this", which increases memory foot print and startup time.  We can add a special optimizing compiler path to work to try to eliminate these branches but that would only make the startup problem worse and introduces undesirable complexities in our engine.

Would it be possible to change it so that "this" is set to null until super() is called instead?


- R. Niwa

More information about the es-discuss mailing list