keeleysam / tenfourfox

Automatically exported from code.google.com/p/tenfourfox
0 stars 0 forks source link

upstream YarrJIT update isn't big endian compatible #192

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Since big endian is obsolete (at least for main CPUs in 
desktop/laptop/tablet/smartphone computing) the WebKit team replaced the big 
endian compatible version with in an incompatible one.

Here the patch fragments that were needed to restore big endian compatibility:
{{{
     void initCallFrame()
@@ -814,7 +805,11 @@
         const RegisterID character = regT0;
         int maxCharactersAtOnce = m_charSize == Char8 ? 4 : 2;
         unsigned ignoreCaseMask = 0;
+#if WTF_CPU_BIG_ENDIAN
+        int allCharacters = ch << (m_charSize == Char8 ? 24 : 16);
+#else
         int allCharacters = ch;
+#endif
         int numberCharacters;
         int startTermPosition = term->inputPosition;

@@ -823,7 +818,11 @@
         ASSERT(!m_pattern.m_ignoreCase || isASCIIAlpha(ch) || isCanonicallyUnique(ch));

         if (m_pattern.m_ignoreCase && isASCIIAlpha(ch))
+#if WTF_CPU_BIG_ENDIAN
+            ignoreCaseMask |= 32 << (m_charSize == Char8 ? 24 : 16);
+#else
             ignoreCaseMask |= 32;
+#endif

         for (numberCharacters = 1; numberCharacters < maxCharactersAtOnce && nextOp->m_op == OpTerm; ++numberCharacters, nextOp = &m_ops[opIndex + numberCharacters]) {
             PatternTerm* nextTerm = nextOp->m_term;
@@ -836,7 +835,11 @@

             nextOp->m_isDeadCode = true;

+#if WTF_CPU_BIG_ENDIAN
+            int shiftAmount = (m_charSize == Char8 ? 24 : 16) - ((m_charSize 
== Char8 ? 8 : 16) * numberCharacters);
+#else
             int shiftAmount = (m_charSize == Char8 ? 8 : 16) * numberCharacters;
+#endif

             UChar currentCharacter = nextTerm->patternCharacter;

}}}

However I've not yet restored the latest speed tweaks done by Ben 
(YARR_AVOID_CHARACTER_INDEX). Maybe he himself can look into it?
It's the following changeset: 
http://hg.mozilla.org/releases/mozilla-aurora/rev/8bf2f8cb5e73 .

Original issue reported on code.google.com by Tobias.N...@gmail.com on 21 Nov 2012 at 1:15

GoogleCodeExporter commented 9 years ago
These small additions are just copied from the changes done to the other macro 
assemblers.

Original comment by Tobias.N...@gmail.com on 21 Nov 2012 at 8:40

Attachments:

GoogleCodeExporter commented 9 years ago
I'm looking at this now. I don't think Ben's code applies anymore, but it may 
not be necessary -- there appear to be some significant refactors which may 
make the baseline more efficient anyhow.

Original comment by classi...@floodgap.com on 3 Dec 2012 at 12:39

GoogleCodeExporter commented 9 years ago
All tests pass, including regexes, in mozilla-19 with gcc 4.6. Going on to 
build the main browser.

Original comment by classi...@floodgap.com on 3 Dec 2012 at 5:31

GoogleCodeExporter commented 9 years ago
Found that in the WebKit sources YarrJIT never was big endian compatible. Only 
the mozilla sources had that fix.

Original comment by Tobias.N...@gmail.com on 15 Dec 2012 at 10:09

GoogleCodeExporter commented 9 years ago
Figures.

Anyway, this works, so we can close it.

Original comment by classi...@floodgap.com on 15 Dec 2012 at 10:12