From b5924dc9e872e73489c30efec775bcfe78a345e5 Mon Sep 17 00:00:00 2001 From: Tobias Netzel Date: Thu, 4 Apr 2013 13:59:03 +0200 Subject: Yarr JIT isn't big endian compatible https://bugs.webkit.org/show_bug.cgi?id=102897 Patch by Tobias Netzel on 2013-01-22 Reviewed by Oliver Hunt. This patch was tested in the current mozilla codebase only and has passed the regexp tests there. * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): Change-Id: I1eb463aa79a7976a87d1f36a6c0123b058c3ec87 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140438 268f45cc-cd09-0410-ab3c-d52691b4dbfc Reviewed-by: Jocelyn Turcotte --- Source/JavaScriptCore/yarr/YarrJIT.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source/JavaScriptCore/yarr/YarrJIT.cpp') diff --git a/Source/JavaScriptCore/yarr/YarrJIT.cpp b/Source/JavaScriptCore/yarr/YarrJIT.cpp index d5b215413..1aef49bdf 100644 --- a/Source/JavaScriptCore/yarr/YarrJIT.cpp +++ b/Source/JavaScriptCore/yarr/YarrJIT.cpp @@ -756,7 +756,11 @@ class YarrGenerator : private MacroAssembler { const RegisterID character = regT0; int maxCharactersAtOnce = m_charSize == Char8 ? 4 : 2; unsigned ignoreCaseMask = 0; +#if CPU(BIG_ENDIAN) + int allCharacters = ch << (m_charSize == Char8 ? 24 : 16); +#else int allCharacters = ch; +#endif int numberCharacters; int startTermPosition = term->inputPosition; @@ -765,7 +769,11 @@ class YarrGenerator : private MacroAssembler { ASSERT(!m_pattern.m_ignoreCase || isASCIIAlpha(ch) || isCanonicallyUnique(ch)); if (m_pattern.m_ignoreCase && isASCIIAlpha(ch)) +#if 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; @@ -778,7 +786,11 @@ class YarrGenerator : private MacroAssembler { nextOp->m_isDeadCode = true; +#if 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; -- cgit v1.2.1