summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/JavaScriptCore/yarr/YarrInterpreter.cpp
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/JavaScriptCore/yarr/YarrInterpreter.cpp')
-rw-r--r--Source/JavaScriptCore/yarr/YarrInterpreter.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
index b6bfb2c98..a452bb7f2 100644
--- a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
+++ b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
@@ -565,7 +565,10 @@ public:
if (matchEnd == -1)
return true;
- ASSERT((matchBegin == -1) || (matchBegin <= matchEnd));
+ if (matchBegin == -1)
+ return true;
+
+ ASSERT(matchBegin <= matchEnd);
if (matchBegin == matchEnd)
return true;
@@ -607,7 +610,11 @@ public:
int matchBegin = output[(term.atom.subpatternId << 1)];
int matchEnd = output[(term.atom.subpatternId << 1) + 1];
- ASSERT((matchBegin == -1) || (matchBegin <= matchEnd));
+
+ if (matchBegin == -1)
+ return false;
+
+ ASSERT(matchBegin <= matchEnd);
if (matchBegin == matchEnd)
return false;
@@ -1443,13 +1450,16 @@ public:
int interpret()
{
+ if (input.isNotAvailableInput(0))
+ return -1;
+
+ for (unsigned i = 0; i < pattern->m_body->m_numSubpatterns + 1; ++i)
+ output[i << 1] = -1;
+
allocatorPool = pattern->m_allocator->startAllocator();
if (!allocatorPool)
CRASH();
- for (unsigned i = 0; i < ((pattern->m_body->m_numSubpatterns + 1) << 1); ++i)
- output[i] = -1;
-
DisjunctionContext* context = allocDisjunctionContext(pattern->m_body.get());
JSRegExpResult result = matchDisjunction(pattern->m_body.get(), context, false);
@@ -1462,7 +1472,6 @@ public:
pattern->m_allocator->stopAllocator();
- // RegExp.cpp currently expects all error to be converted to -1.
ASSERT((result == JSRegExpMatch) == (output[0] != -1));
return output[0];
}