diff options
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/yarr')
5 files changed, 26 insertions, 30 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp index c7b3c81..9cd3d12 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexCompiler.cpp @@ -708,7 +708,7 @@ const char* compileRegex(const UString& patternString, RegexPattern& pattern) unsigned numSubpatterns = pattern.m_numSubpatterns; constructor.reset(); -#ifndef NDEBUG +#if !ASSERT_DISABLED const char* error = #endif parse(constructor, patternString, numSubpatterns); diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.cpp index aafea3c..d088086 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexInterpreter.cpp @@ -1490,7 +1490,7 @@ public: closeBodyAlternative(); } - void alterantiveBodyDisjunction() + void alternativeBodyDisjunction() { int newAlternativeIndex = m_bodyDisjunction->terms.size(); m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; @@ -1499,7 +1499,7 @@ public: m_currentAlternativeIndex = newAlternativeIndex; } - void alterantiveDisjunction() + void alternativeDisjunction() { int newAlternativeIndex = m_bodyDisjunction->terms.size(); m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; @@ -1515,9 +1515,9 @@ public: if (alt) { if (disjunction == m_pattern.m_body) - alterantiveBodyDisjunction(); + alternativeBodyDisjunction(); else - alterantiveDisjunction(); + alternativeDisjunction(); } PatternAlternative* alternative = disjunction->m_alternatives[alt]; diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp index d777424..fcb8d86 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.cpp @@ -44,7 +44,7 @@ namespace JSC { namespace Yarr { class RegexGenerator : private MacroAssembler { friend void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline); -#if PLATFORM(ARM) +#if CPU(ARM) static const RegisterID input = ARMRegisters::r0; static const RegisterID index = ARMRegisters::r1; static const RegisterID length = ARMRegisters::r2; @@ -54,7 +54,7 @@ class RegexGenerator : private MacroAssembler { static const RegisterID regT1 = ARMRegisters::r6; static const RegisterID returnRegister = ARMRegisters::r0; -#elif PLATFORM(X86) +#elif CPU(X86) static const RegisterID input = X86Registers::eax; static const RegisterID index = X86Registers::edx; static const RegisterID length = X86Registers::ecx; @@ -64,7 +64,7 @@ class RegexGenerator : private MacroAssembler { static const RegisterID regT1 = X86Registers::esi; static const RegisterID returnRegister = X86Registers::eax; -#elif PLATFORM(X86_64) +#elif CPU(X86_64) static const RegisterID input = X86Registers::edi; static const RegisterID index = X86Registers::esi; static const RegisterID length = X86Registers::edx; @@ -1264,7 +1264,7 @@ class RegexGenerator : private MacroAssembler { // complex here in compilation, and in the common case we should end up coallescing the checks. // // FIXME: a nice improvement here may be to stop trying to match sooner, based on the least - // of the minimum-alterantive-lengths. E.g. if I have two alternatives of length 200 and 150, + // of the minimum-alternative-lengths. E.g. if I have two alternatives of length 200 and 150, // and a string of length 100, we'll end up looping index from 0 to 100, checking whether there // is sufficient input to run either alternative (constantly failing). If there had been only // one alternative, or if the shorter alternative had come first, we would have terminated @@ -1288,11 +1288,11 @@ class RegexGenerator : private MacroAssembler { void generateEnter() { -#if PLATFORM(X86_64) +#if CPU(X86_64) push(X86Registers::ebp); move(stackPointerRegister, X86Registers::ebp); push(X86Registers::ebx); -#elif PLATFORM(X86) +#elif CPU(X86) push(X86Registers::ebp); move(stackPointerRegister, X86Registers::ebp); // TODO: do we need spill registers to fill the output pointer if there are no sub captures? @@ -1308,10 +1308,7 @@ class RegexGenerator : private MacroAssembler { #else loadPtr(Address(X86Registers::ebp, 2 * sizeof(void*)), output); #endif -#elif PLATFORM(ARM) -#if PLATFORM(ARM_TRADITIONAL) - push(ARMRegisters::lr); -#endif +#elif CPU(ARM) push(ARMRegisters::r4); push(ARMRegisters::r5); push(ARMRegisters::r6); @@ -1321,15 +1318,15 @@ class RegexGenerator : private MacroAssembler { void generateReturn() { -#if PLATFORM(X86_64) +#if CPU(X86_64) pop(X86Registers::ebx); pop(X86Registers::ebp); -#elif PLATFORM(X86) +#elif CPU(X86) pop(X86Registers::esi); pop(X86Registers::edi); pop(X86Registers::ebx); pop(X86Registers::ebp); -#elif PLATFORM(ARM) +#elif CPU(ARM) pop(ARMRegisters::r6); pop(ARMRegisters::r5); pop(ARMRegisters::r4); @@ -1400,14 +1397,6 @@ void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const } } -int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output, int outputArraySize) -{ - if (JSRegExp* fallback = jitObject.getFallback()) - return (jsRegExpExecute(fallback, input, length, start, output, outputArraySize) < 0) ? -1 : output[0]; - - return jitObject.execute(input, start, length, output); -} - }} #endif diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h index 5b0df9d..5ead00f 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h @@ -37,7 +37,7 @@ #include <pcre.h> struct JSRegExp; // temporary, remove when fallback is removed. -#if PLATFORM(X86) && !COMPILER(MSVC) +#if CPU(X86) && !COMPILER(MSVC) #define YARR_CALL __attribute__ ((regparm (3))) #else #define YARR_CALL @@ -73,7 +73,7 @@ public: int execute(const UChar* input, unsigned start, unsigned length, int* output) { - return reinterpret_cast<RegexJITCode>(m_ref.m_code.executableAddress())(input, start, length, output); + return ((RegexJITCode)(m_ref.m_code.executableAddress()))(input, start, length, output); } private: @@ -82,7 +82,14 @@ private: }; void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase = false, bool multiline = false); -int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output, int outputArraySize); + +inline int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output, int outputArraySize) +{ + if (JSRegExp* fallback = jitObject.getFallback()) + return (jsRegExpExecute(fallback, input, length, start, output, outputArraySize) < 0) ? -1 : output[0]; + + return jitObject.execute(input, start, length, output); +} } } // namespace JSC::Yarr diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h index a451131..dd7512d 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexPattern.h @@ -137,7 +137,7 @@ struct PatternTerm { PatternTerm(unsigned spatternId) : type(TypeBackReference) - , invertOrCapture(invertOrCapture) + , invertOrCapture(false) { subpatternId = spatternId; quantityType = QuantifierFixedCount; |