MorphOS Developer
Posts: 510 from 2003/4/11
Quote:
internetzel wrote:
Did you know that at the time development of JavaScript JIT for OWB was started there already existed a working MacroAssembler for JSC? (I had ported it from TenFourFox to WebKit.)
However I did never try to get the JavaScript JIT working (backporting of whole WebKit is keeping me busy enough) using that assembler but YarrJIT (regular expressions) is working well using it.
Unfortunately I didn't know of a way to get in contact with bigfoot, until now - I'd really like to port this to Leopard WebKit (mainly targetted at PowerPC OS X 10.5).
The problem is not implementing the macro assembler... That was the easy part of this project :) The problem is that Webkit's JIT engine heavily depends on the machine it runs on being little endian. This dependency/assumption is embedded so deep into JSC that 90% of my time has been spent on fixing/working around this.
As an example, Webkit has a structure that looks something like this:
Code:
union EndianFucked
{
double DoubleValue;
int IntegerValue;
};
Then when accessing IntegerValue, it expects to get the lower half of DoubleValue. The JIT engine itself also expects this layout - it assumes that at a 32 pointer to a Javascript value lies the lower half of a 64 bit value, often in ways that are difficult or impossible to detect automatically. Which means I've spent a lot of time running websites, watch the generated code crash, generate hundreds of MB of debug logs over serial, spotting where it could look like that values got swapped, try to figure out where that happened in the JIT generator, and so on.
This is also why this project is as delayed as it is. When I initially looked at it, it looked like I "just" had to implement a PPC code generator to get this working - but it turned out that that part would be less than 10% of the final project. Fixing these endian issues in Webkit is what keeps me busy.
[ Edited by bigfoot 02.10.2014 - 03:46 ]I rarely log in to MorphZone which means that I often miss private messages sent on here. If you wish to contact me, please email me at [username]@asgaard.morphos-team.net, where [username] is my username here on MorphZone.