Live data from Hacker News

Microsoft Edge's JavaScript engine to go open-source

blogs.windows.com

211–220 of 283 posts

Re: Microsoft Edge's JavaScript engine to go open-source

#211
post #10

I have a somewhat off topic question: is there anything in the design of Javascript that mandates single-threadedness? Could any Javascript engine implement threads? I'm asking because I'm wondering if Node.js's evented approach is the only way to do things.

Mozilla is working on a spec for something called SharedArrayBuffer, which will allow Workers other than the main thread of execution to share memory.

The reason for this is that as soon as you have separate threads sharing memory, it introduces non-determinsism into the mix. When developers use synchronization mechanisms incorrectly, or not at all, this can lead to deadlock between threads.

This must not be allowed to occur on the main thread shared with the rendering engine.

So keep your eyes out for SharedArrayBuffer.

The event loop is very important to the existing language semantics and isn't going anywhere.

Re: Microsoft Edge's JavaScript engine to go open-source

#212

Earlier quoted context omitted.

Engineer on the Chakra team here. As the blog post says, we are definitely interested in going cross-platform. Which platforms would you be interested in seeing first?

OS X. I don't use it but I think it'd have great value. I often hear engineers talk about how they don't want to work with IE because they have to boot up a VM to use it. So...they don't even test it, they know nothing about it except for how IE used to be 10 years ago when they still used Windows machines. That'd be the coolest thing since it'd encourage developers that shy away from MS technology to dive into it.

They're open sourcing the JavaScript engine, not the browser. A port to OSX would mean you can run there server side programs before deploying them to Windows servers. I believe there are more Linux servers out there. Still a port to OSX would be useful because there are many developers with Macs that deploy to Linux.

Re: Microsoft Edge's JavaScript engine to go open-source

#213
post #8

I wonder if in the future node will enable swappable js engine edit: ok just found this https://news.ycombinator.com/item?id=9534138

I've hoped for this since it's inception. It gives the benefits of having multiple competing implementations but unlike the browser platform we (the developers) get to choose which one we use.

Native addons and even Node core are too tightly coupled with v8. NAN will need an overhaul.

Re: Microsoft Edge's JavaScript engine to go open-source

#214

Earlier quoted context omitted.

OS X. I don't use it but I think it'd have great value. I often hear engineers talk about how they don't want to work with IE because they have to boot up a VM to use it. So...they don't even test it, they know nothing about it except for how IE used to be 10 years ago when they still used Windows machines. That'd be the coolest thing since it'd encourage developers that shy away from MS technology to dive into it.

They're open sourcing the JavaScript engine, not the browser. A port to OSX would mean you can run there server side programs before deploying them to Windows servers. I believe there are more Linux servers out there. Still a port to OSX would be useful because there are many developers with Macs that deploy to Linux.

I don't see how it'd help deploying server-side programs. Maybe that makes sense with IoT. And as a Node alternative/enhancement.

BUT, once you have the JS engine over, I could see them porting over the rest. But anyways, you could still run headless browser (or just Chakra) and run tests against it.

Re: Microsoft Edge's JavaScript engine to go open-source

#215

I'd like to see Node.js using Chkara by default, V8 developers have showed that they don't care much about Node.js, they are more interested in Chrome, and MS have showed more interest in Node.js than Google and I'm sure it will be better for all, fingers crossed.

This is the first I've heard that v8 devs don't care for node. Since I am not in the know, are there some sources that detail this issue in depth?

Re: Microsoft Edge's JavaScript engine to go open-source

#216

Earlier quoted context omitted.

You're comparing apples and oranges here. Rendering engines (all in C++ except Servo): - Servo - Blink (Chrome/Opera) - Trident/Spartan (IE/Edge) - Webkit (Safari) JS engines: - Spidermonkey (used by Servo and Firefox) - Chakra (used by Trident/Edge) - V8 (used by Blink, also by Node) Servo already uses a JS engine in C++ because a Rust JS engine is a huge undertaking in itself (see [1]) It does make sense to try out…

I have a vested interest in creating a SM -> Chakra adapter to swap out SpiderMonkey and be able to compare it to see how it does because Chakra is also an interpreter and not JIT-only like V8. Such an adapter would also make playing with Servo -> Chakra possible. I haven't play with Servo, but is there a list of all the JSAPI calls that it needs to function or can you easily dump that list?

https://news.ycombinator.com/item?id=10682291 this?

Re: Microsoft Edge's JavaScript engine to go open-source

#217
post #69

Earlier quoted context omitted.

A toy javascript interpreter is quite easy. But a high-performance, production-ready engine is a totally different story.

Anyone have a recommendation for a good place to begin, if I was interested in writing a toy javascript interpreter?

You can check this code https://github.com/espruino/Espruino/blob/master/README.md

I quote

"Espruino is a JavaScript interpreter for microcontrollers. It is designed to fit into devices with as little as 128kB Flash and 8kB RAM."

It could be a good example of a small js interpreter. I remember the author said to be 95% compatible with real js. That was a couple of years ago.

Re: Microsoft Edge's JavaScript engine to go open-source

#218

Earlier quoted context omitted.

Web Worker is very weird in that you have to have a separate file.

Agreed! FWIW this is why I made Operative. It gives you a way of writing "inline" JS that utilizes web workers (caveat: not actually inline; no scope/context access of course). It provides good support across browsers and fallbacks for envs where web workers don't exist (and ~all the in-between cases): https://github.com/padolsey/operative

Looks nice! I took a stab at this a while back https://gist.github.com/icodeforlove/deb0f19a9e7bd528bd48

Re: Microsoft Edge's JavaScript engine to go open-source

#219
post #10

I have a somewhat off topic question: is there anything in the design of Javascript that mandates single-threadedness? Could any Javascript engine implement threads? I'm asking because I'm wondering if Node.js's evented approach is the only way to do things.

https://www.npmjs.com/package/webworker-threads

Re: Microsoft Edge's JavaScript engine to go open-source

#220
post #69

Earlier quoted context omitted.

A toy javascript interpreter is quite easy. But a high-performance, production-ready engine is a totally different story.

Anyone have a recommendation for a good place to begin, if I was interested in writing a toy javascript interpreter?

You can start with https://github.com/DigitalMars/DMDScript which is an open source (Boost licensed) JavaScript engine written in D.
Post reply on HN