Is it possible to make Node.js use Rhino as the Javascript engine?

允我心安 提交于 2019-12-03 11:25:53

There is an implementation of Node.js on Rhino called Rhinodo by MuleSoft.

But you no longer have to use Rhino as a backend for Node.js - there is a recent port of Node.js and V8 for PowerPC by Andrew Low (IBM).

No, node.js is tied to V8, in almost every source file, and including all the add-ons that have been written. Even if you have the C++ experience, it would be a huge task to do the conversion.

Not to mention that, if you go down this path alone, you'll also be alone in maintaining it. (Whereas node.js itself has gathered a large community contributing.)

If you really want to put in that kind of effort, consider discussing it on the mailing list first. Or alternatively, gather momentum for a PPC port of V8. (An equally, if not more daunting task.)

For a server-side JavaScript engine that uses Rhino out of the box, take a look at the Narwhal project. (Though it seems less active.)

This is impossible, as Shtééf already said Node.js is tightly tied to V8, it uses specific V8 methods all over the place, the dependency will only grow in the near future, there are "hacks" on the way to get into V8's internals in order to massively improve performance when writing strings to sockets.

Many modules (assert, inspect etc.) depend on specific V8 functions. There's no way code will be in any way portable between V8 and other server side JS engines.

While Shtééf considers options, I see only one solution:
Get rid of the PPC hardware.

If you really want to make it run on Rhino, you'll end up in a maintaining nightmare, in the end you'll have two write either two distinct applications, or create a giant runtime layer for Rhino which tries to emulate Node.js, good luck with that, since many things just won't be available in Rhino.

Also there will be no support for 3rd party libraries.

Seriously, get another computer, writing all the wrappers etc. on your own will only cost your time, in which you could have written awesome Node.js stuff. And since time is money...

ppc-v8-snood

Project to port the V8 JavaScript engine originated at Google to the PowerPC architecture.

https://github.com/ic/v8-powerpc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!