Changeset 72197 in webkit for trunk/JavaScriptCore/yarr/RegexJIT.h
- Timestamp:
- Nov 17, 2010, 5:15:56 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/yarr/RegexJIT.h
r71691 r72197 30 30 31 31 #include "MacroAssembler.h" 32 #include "RegexInterpreter.h" // temporary, remove when fallback is removed. 32 33 #include "RegexPattern.h" 33 34 #include "UString.h" 34 35 #include "pcre.h"36 struct JSRegExp; // temporary, remove when fallback is removed.37 35 38 36 #if CPU(X86) && !COMPILER(MSVC) … … 54 52 public: 55 53 RegexCodeBlock() 56 : m_ fallback(0)54 : m_needFallback(false) 57 55 { 58 56 } … … 60 58 ~RegexCodeBlock() 61 59 { 62 if (m_fallback)63 jsRegExpFree(m_fallback);64 60 } 65 61 66 JSRegExp* getFallback() { return m_fallback; } 67 void setFallback(JSRegExp* fallback) { m_fallback = fallback; } 62 BytecodePattern* getFallback() { return m_fallback.get(); } 63 bool isFallback() { return m_needFallback; } 64 void setFallback(PassOwnPtr<BytecodePattern> fallback) 65 { 66 m_fallback = fallback; 67 m_needFallback = true; 68 } 68 69 69 70 bool operator!() { return (!m_ref.m_code.executableAddress() && !m_fallback); } … … 74 75 return reinterpret_cast<RegexJITCode>(m_ref.m_code.executableAddress())(input, start, length, output); 75 76 } 76 77 77 78 #if ENABLE(REGEXP_TRACING) 78 79 void *getAddr() { return m_ref.m_code.executableAddress(); } … … 81 82 private: 82 83 MacroAssembler::CodeRef m_ref; 83 JSRegExp* m_fallback; 84 OwnPtr<Yarr::BytecodePattern> m_fallback; 85 bool m_needFallback; 84 86 }; 85 87 86 void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase = false, bool multiline = false);88 void jitCompileRegex(JSGlobalData* globalData, RegexCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, BumpPointerAllocator* allocator, bool ignoreCase = false, bool multiline = false); 87 89 88 inline int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output , int outputArraySize)90 inline int executeRegex(RegexCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output) 89 91 { 90 if ( JSRegExp* fallback = jitObject.getFallback())91 return ( jsRegExpExecute(fallback, input, length, start, output, outputArraySize) < 0) ? -1 : output[0];92 if (jitObject.isFallback()) 93 return (interpretRegex(jitObject.getFallback(), input, start, length, output)); 92 94 93 95 return jitObject.execute(input, start, length, output);
Note:
See TracChangeset
for help on using the changeset viewer.