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