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

4

15

I use Node.js for several jobs on my web apps and so far everthing's ok.

But the Node.js uses Google's V8 as the default Javascript engine (JSE) and V8 runs exlusively on the x86 and ARM Instruction Set Architectures (ISA).

Now I have a PPC processor Mac computer on which I want to run the Node.js .

To do that, I'm adviced to use the Rhino + OpenJDK Shark Virtual Machine + Low Level Virtual Machine (LLVM) as the JIT compiler. Currently, that looks like the most applicable way of running Node.js on the PPC ISA. Or, is there a better way to do it?

Could you tell beforehand if it would be possible to make Node.js work with Rhino? Btw, Node.js is written in C++ and I do have the C++ programming experience, i.e. I may attempt to re-edit the code of Node.js if I have to.

Thanks.

Mnemonics answered 4/12, 2010 at 10:35 Comment(3)
github.com/ic/v8-powerpcImpalpable
Still work in progress but it may be worth checking: github.com/mulesoft/rhinodoFerryboat
rhinodo looks like a promising way to run node.js in non-x86 architectures, for which Java VM support.Mnemonics
D
6

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).

Diedrediefenbaker answered 17/10, 2013 at 21:31 Comment(1)
Yeah this one looks like the most promising work on porting the V8 to PowerPC. I will start trying to use at the first opportunity.Mnemonics
S
19

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.)

Strati answered 4/12, 2010 at 11:7 Comment(3)
Some folks have started an effort to get Node.js running on SpiderMonkey, which I believe has PPC support. Just noting this here: blog.zpao.com/post/4620873765/about-that-hybrid-v8monkey-engineDenadenae
I wouldn't discourage Ömer so quickly if I were you, Java has a far too extensive eco-system to simply discard ever integrating the two technologies. Most of the time when I give up from using node.js on a new project is because I really need to use a specialized Java lib to get a job done (especially in the closed source enterprisey domain).Basophil
At least judging from ruby EventMachine Java and C++ implementations (github.com/eventmachine/eventmachine - compare ext and java folders), the V8 api should be far simpler to reimplement in Java then it was to originally implement in C++Basophil
D
6

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).

Diedrediefenbaker answered 17/10, 2013 at 21:31 Comment(1)
Yeah this one looks like the most promising work on porting the V8 to PowerPC. I will start trying to use at the first opportunity.Mnemonics
G
4

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...

Gyno answered 4/12, 2010 at 11:27 Comment(2)
Oh see, someone needed to boost his ego, glad I'm helped with a nearly one year old question :)Gyno
Yeah- you have a point. Sorry for my comment. And, you did add to the discussion- thank you for that. (my -1 comment removed)Poynter
F
0

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

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

Foliose answered 5/10, 2011 at 18:34 Comment(1)
This project has been inactive for 2 years now, there is a better alternative above.Diedrediefenbaker

© 2022 - 2024 — McMap. All rights reserved.