Mrrrgn's Mumbles
{tags: notes }

Hacking on the JavaScript Engine
Recently I moved from an ops heavy role to pure programming -- hacking on a programming language none-the-less. It's been a real sea-change: exciting, frightening, and at times exhausting.

Working with world experts in language implementation is just ... awe inspiring. I've always been a generalist, and to say that I have self-doubt would be a huge understatement. Over the last few months I've often asked myself: "what can I possibly contribute to this team of incredible people? Do I really belong here?" It can be crippling, so I try to put it out of mind as much as possible.

[ Sometimes I feel like that fella on the right.]

Today though, I'm going to confront self-doubt head on by listing out some of the neat things I've worked on during my stint on the SpiderMonkey team. Not because they're impressive (my work is small potatoes compared to the what's being done by the veterans on the team) but because it's a sign that I'm not just dead weight.

So, here goes:

Implemented TypedArray.sort

This one was a ton of fun. It's not every day that you get a chance to implement a sorting algorithm for realsies. Best of all, the end result ran something like 6x faster than V8 [Google Chrome]'s implementation. (Bug Link)

Expanded Array.sort

Because invoking a JavaScript comparator from C++ carries a lot of overhead custom comparators passed to Array.sort were super slow. To fix this I re-implemented the sort in JavaScript. (Bug Link)

Implemented default values for [object] destructuring

This was my first big language feature. It was especially fun because it required adding a new idiom to the parser: "possible errors". (Bug Link)

Added smart multi-line editing to the Web Console

I've also been hacking on devtools a bit. Thanks to my new familiarity with JSAPI I was able to port some nice JS shell features into Firefox. (Bug Link)

Removed certain TDZ errors from the web console and JS Shell

Another convenience for developers using the repl. Prior to this any error during variable binding with let or const would render the identifier inaccessible. let foo = someerror; // foo is no longer usable. (Bug Link)

Expanded Date parsing syntax

This patch only took an afternoon to write but it made a really big impact to users. Prior to this new Date(...) was a primary source of cross browser compatibility bugs. (Bug Link)

Implemented String.prototype.padStart / padEnd

Another single afternoon patch, these ES7 String methods are fresh off the press. (Bug Link)

Adding `[Learn More]` links to JavaScript error messages in the web console.

I filed this bug after becoming jealous of Rust's fancy error messages. Lucky for me the awesome technical writer Florian Scholz had the same idea just a month earlier. Together [and with other MDN writers] we've gotten this feature to the point where it should ship in the next release. (Bug Link)

A big ol' heap of other small features and bug fixes

For a running list of my patches visit this link.


I've got a looooong way to go before I could hold a candle anyone else on the SpiderMonkey team, but this experience is pure magic. I'm having fun and learning a lot. Hopefully in the next few months this list of "neat things" will double or triple in size (perhaps with some tasty new ES7 features). :]
04-25-2016 , rss feed license