2010-12-02 Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed by Gavin Barraclough.
Move regex parsing and fallback handling to runtime/RegExp.cpp
https://bugs.webkit.org/show_bug.cgi?id=50015
* runtime/RegExp.cpp:
(JSC::RegExp::RegExp):
(JSC::RegExp::create):
(JSC::RegExp::compile):
(JSC::RegExp::match):
(JSC::RegExp::printTraceData):
* runtime/RegExp.h:
(JSC::RegExp::pattern):
* yarr/RegexInterpreter.cpp:
* yarr/RegexInterpreter.h:
* yarr/RegexJIT.cpp:
(JSC::Yarr::RegexGenerator::compile):
(JSC::Yarr::jitCompileRegex):
* yarr/RegexJIT.h:
(JSC::Yarr::RegexCodeBlock::RegexCodeBlock):
(JSC::Yarr::RegexCodeBlock::setFallBack):
(JSC::Yarr::RegexCodeBlock::isFallBack):
(JSC::Yarr::executeRegex):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/runtime/RegExp.h b/JavaScriptCore/runtime/RegExp.h
index e6e2fbc..8f33f57 100644
--- a/JavaScriptCore/runtime/RegExp.h
+++ b/JavaScriptCore/runtime/RegExp.h
@@ -41,7 +41,7 @@
bool ignoreCase() const { return m_flagBits & IgnoreCase; }
bool multiline() const { return m_flagBits & Multiline; }
- const UString& pattern() const { return m_pattern; }
+ const UString& pattern() const { return m_patternString; }
bool isValid() const { return !m_constructionError; }
const char* errorMessage() const { return m_constructionError; }
@@ -56,11 +56,16 @@
private:
RegExp(JSGlobalData* globalData, const UString& pattern, const UString& flags);
- void compile(JSGlobalData*);
+ enum RegExpState {
+ ParseError,
+ JITCode,
+ ByteCode
+ } m_state;
+
+ RegExpState compile(JSGlobalData*);
enum FlagBits { Global = 1, IgnoreCase = 2, Multiline = 4 };
-
- UString m_pattern; // FIXME: Just decompile m_regExp instead of storing this.
+ UString m_patternString;
int m_flagBits;
const char* m_constructionError;
unsigned m_numSubpatterns;