[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
pvarga at webkit.org
pvarga at webkit.org
Sun Feb 20 22:51:23 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit f5f4c2d27e403b938e09deb5340824a70f58e5e7
Author: pvarga at webkit.org <pvarga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 12 12:57:06 2011 +0000
2011-01-12 Peter Varga <pvarga at webkit.org>
Reviewed by Gavin Barraclough.
Add Yarr.h to YARR
https://bugs.webkit.org/show_bug.cgi?id=51021
Move other common constants and functions from YARR's different files
to Yarr.h.
Use Yarr.h header instead of including other YARR headers where it
is possible.
* JavaScriptCore.gypi:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* runtime/RegExp.cpp:
* yarr/Yarr.h: Added.
* yarr/YarrInterpreter.cpp:
* yarr/YarrInterpreter.h:
* yarr/YarrJIT.cpp:
(JSC::Yarr::jitCompile):
(JSC::Yarr::execute):
* yarr/YarrJIT.h:
* yarr/YarrParser.h:
* yarr/YarrPattern.cpp:
(JSC::Yarr::YarrPattern::compile):
(JSC::Yarr::YarrPattern::YarrPattern):
* yarr/YarrPattern.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 05437da..e8574cc 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,32 @@
+2011-01-12 Peter Varga <pvarga at webkit.org>
+
+ Reviewed by Gavin Barraclough.
+
+ Add Yarr.h to YARR
+ https://bugs.webkit.org/show_bug.cgi?id=51021
+
+ Move other common constants and functions from YARR's different files
+ to Yarr.h.
+ Use Yarr.h header instead of including other YARR headers where it
+ is possible.
+
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * runtime/RegExp.cpp:
+ * yarr/Yarr.h: Added.
+ * yarr/YarrInterpreter.cpp:
+ * yarr/YarrInterpreter.h:
+ * yarr/YarrJIT.cpp:
+ (JSC::Yarr::jitCompile):
+ (JSC::Yarr::execute):
+ * yarr/YarrJIT.h:
+ * yarr/YarrParser.h:
+ * yarr/YarrPattern.cpp:
+ (JSC::Yarr::YarrPattern::compile):
+ (JSC::Yarr::YarrPattern::YarrPattern):
+ * yarr/YarrPattern.h:
+
2011-01-12 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r75595.
diff --git a/Source/JavaScriptCore/JavaScriptCore.gypi b/Source/JavaScriptCore/JavaScriptCore.gypi
index a6c1db4..fa30116 100644
--- a/Source/JavaScriptCore/JavaScriptCore.gypi
+++ b/Source/JavaScriptCore/JavaScriptCore.gypi
@@ -494,6 +494,7 @@
'wtf/win/MainThreadWin.cpp',
'wtf/win/OwnPtrWin.cpp',
'wtf/wx/MainThreadWx.cpp',
+ 'yarr/Yarr.h'
'yarr/YarrInterpreter.cpp',
'yarr/YarrInterpreter.h',
'yarr/YarrJIT.cpp',
diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index f00c18d..c75e85a 100644
--- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -1658,6 +1658,10 @@
Name="yarr"
>
<File
+ RelativePath="..\..\yarr\Yarr.h"
+ >
+ </File>
+ <File
RelativePath="..\..\yarr\YarrInterpreter.cpp"
>
</File>
diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index a778036..c867ffa 100644
--- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -189,6 +189,7 @@
41359CF70FDD89CB00206180 /* DateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 41359CF50FDD89CB00206180 /* DateMath.h */; settings = {ATTRIBUTES = (Private, ); }; };
4409D8470FAF80A200523B87 /* OwnPtrCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */; settings = {ATTRIBUTES = (Private, ); }; };
44DD48530FAEA85000D6B4EB /* PassOwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 451539B912DC994500EF7AC4 /* Yarr.h in Headers */ = {isa = PBXBuildFile; fileRef = 451539B812DC994500EF7AC4 /* Yarr.h */; };
511FC4C9117EE28700425272 /* MD5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511FC4C7117EE23D00425272 /* MD5.cpp */; };
511FC4CB117EE2A800425272 /* MD5.h in Headers */ = {isa = PBXBuildFile; fileRef = 511FC4CA117EE2A800425272 /* MD5.h */; settings = {ATTRIBUTES = (Private, ); }; };
5135FAF212D26ACE003C083B /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 5135FAD512D26856003C083B /* Decoder.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -764,6 +765,7 @@
440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OwnPtrCommon.h; sourceTree = "<group>"; };
449097EE0F8F81B50076A327 /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PassOwnPtr.h; sourceTree = "<group>"; };
+ 451539B812DC994500EF7AC4 /* Yarr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Yarr.h; path = yarr/Yarr.h; sourceTree = "<group>"; };
45E12D8806A49B0F00E9DF84 /* jsc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsc.cpp; sourceTree = "<group>"; tabWidth = 4; };
511FC4C7117EE23D00425272 /* MD5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MD5.cpp; sourceTree = "<group>"; };
511FC4CA117EE2A800425272 /* MD5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MD5.h; sourceTree = "<group>"; };
@@ -1909,6 +1911,7 @@
86EAC48C0F93E8B9008EC948 /* yarr */ = {
isa = PBXGroup;
children = (
+ 451539B812DC994500EF7AC4 /* Yarr.h */,
86704B7D12DBA33700A9FE7B /* YarrInterpreter.cpp */,
86704B7E12DBA33700A9FE7B /* YarrInterpreter.h */,
86704B7F12DBA33700A9FE7B /* YarrJIT.cpp */,
@@ -2397,6 +2400,7 @@
86704B8712DBA33700A9FE7B /* YarrJIT.h in Headers */,
86704B8812DBA33700A9FE7B /* YarrParser.h in Headers */,
86704B8A12DBA33700A9FE7B /* YarrPattern.h in Headers */,
+ 451539B912DC994500EF7AC4 /* Yarr.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Source/JavaScriptCore/runtime/RegExp.cpp b/Source/JavaScriptCore/runtime/RegExp.cpp
index 4ab59bd..31a1abe 100644
--- a/Source/JavaScriptCore/runtime/RegExp.cpp
+++ b/Source/JavaScriptCore/runtime/RegExp.cpp
@@ -24,16 +24,13 @@
#include "RegExp.h"
#include "Lexer.h"
-#include "yarr/YarrInterpreter.h"
-#include "yarr/YarrJIT.h"
-#include "yarr/YarrPattern.h"
+#include "yarr/Yarr.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wtf/Assertions.h>
#include <wtf/OwnArrayPtr.h>
-
namespace JSC {
struct RegExpRepresentation {
diff --git a/Source/JavaScriptCore/yarr/Yarr.h b/Source/JavaScriptCore/yarr/Yarr.h
new file mode 100644
index 0000000..57176bc
--- /dev/null
+++ b/Source/JavaScriptCore/yarr/Yarr.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Peter Varga (pvarga at inf.u-szeged.hu), University of Szeged
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY UNIVERSITY OF SZEGED ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF SZEGED OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Yarr_h
+#define Yarr_h
+
+#include "YarrInterpreter.h"
+#include "YarrJIT.h"
+#include "YarrPattern.h"
+
+namespace JSC { namespace Yarr {
+
+#define YarrStackSpaceForBackTrackInfoPatternCharacter 1 // Only for !fixed quantifiers.
+#define YarrStackSpaceForBackTrackInfoCharacterClass 1 // Only for !fixed quantifiers.
+#define YarrStackSpaceForBackTrackInfoBackReference 2
+#define YarrStackSpaceForBackTrackInfoAlternative 1 // One per alternative.
+#define YarrStackSpaceForBackTrackInfoParentheticalAssertion 1
+#define YarrStackSpaceForBackTrackInfoParenthesesOnce 1 // Only for !fixed quantifiers.
+#define YarrStackSpaceForBackTrackInfoParenthesesTerminal 1
+#define YarrStackSpaceForBackTrackInfoParentheses 2
+
+static const unsigned quantifyInfinite = UINT_MAX;
+
+// The below limit restricts the number of "recursive" match calls in order to
+// avoid spending exponential time on complex regular expressions.
+static const unsigned matchLimit = 1000000;
+
+enum JSRegExpResult {
+ JSRegExpMatch = 1,
+ JSRegExpNoMatch = 0,
+ JSRegExpErrorNoMatch = -1,
+ JSRegExpErrorHitLimit = -2,
+ JSRegExpErrorNoMemory = -3,
+ JSRegExpErrorInternal = -4
+};
+
+PassOwnPtr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
+int interpret(BytecodePattern*, const UChar* input, unsigned start, unsigned length, int* output);
+
+#if ENABLE(YARR_JIT)
+void jitCompile(YarrPattern&, JSGlobalData*, YarrCodeBlock& jitObject);
+int execute(YarrCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output);
+#endif
+
+} } // namespace JSC::Yarr
+
+#endif // Yarr_h
+
diff --git a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
index a4ae88f..d2dbf23 100644
--- a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
+++ b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
@@ -27,7 +27,7 @@
#include "config.h"
#include "YarrInterpreter.h"
-#include "YarrPattern.h"
+#include "Yarr.h"
#include <wtf/BumpPointerAllocator.h>
#ifndef NDEBUG
@@ -1878,7 +1878,6 @@ int interpret(BytecodePattern* bytecode, const UChar* input, unsigned start, uns
return Interpreter(bytecode, output, input, start, length).interpret();
}
-
COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoPatternCharacter) == (YarrStackSpaceForBackTrackInfoPatternCharacter * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoPatternCharacter);
COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoCharacterClass) == (YarrStackSpaceForBackTrackInfoCharacterClass * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoCharacterClass);
COMPILE_ASSERT(sizeof(Interpreter::BackTrackInfoBackReference) == (YarrStackSpaceForBackTrackInfoBackReference * sizeof(uintptr_t)), CheckYarrStackSpaceForBackTrackInfoBackReference);
diff --git a/Source/JavaScriptCore/yarr/YarrInterpreter.h b/Source/JavaScriptCore/yarr/YarrInterpreter.h
index 6ffe9b7..be703a9 100644
--- a/Source/JavaScriptCore/yarr/YarrInterpreter.h
+++ b/Source/JavaScriptCore/yarr/YarrInterpreter.h
@@ -26,7 +26,6 @@
#ifndef YarrInterpreter_h
#define YarrInterpreter_h
-#include "YarrParser.h"
#include "YarrPattern.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/unicode/Unicode.h>
@@ -38,21 +37,6 @@ using WTF::BumpPointerAllocator;
namespace JSC { namespace Yarr {
-// TODO move the matchLimit constant and the JSRegExpResult enum to the JSRegExp.h when pcre is removed.
-
-// The below limit restricts the number of "recursive" match calls in order to
-// avoid spending exponential time on complex regular expressions.
-static const unsigned matchLimit = 1000000;
-
-enum JSRegExpResult {
- JSRegExpMatch = 1,
- JSRegExpNoMatch = 0,
- JSRegExpErrorNoMatch = -1,
- JSRegExpErrorHitLimit = -2,
- JSRegExpErrorNoMemory = -3,
- JSRegExpErrorInternal = -4
-};
-
class ByteDisjunction;
struct ByteTerm {
@@ -373,9 +357,6 @@ private:
Vector<CharacterClass*> m_userCharacterClasses;
};
-PassOwnPtr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
-int interpret(BytecodePattern*, const UChar* input, unsigned start, unsigned length, int* output);
-
} } // namespace JSC::Yarr
#endif // YarrInterpreter_h
diff --git a/Source/JavaScriptCore/yarr/YarrJIT.cpp b/Source/JavaScriptCore/yarr/YarrJIT.cpp
index 545fcf5..ae3cdf2 100644
--- a/Source/JavaScriptCore/yarr/YarrJIT.cpp
+++ b/Source/JavaScriptCore/yarr/YarrJIT.cpp
@@ -30,7 +30,7 @@
#include "JSGlobalData.h"
#include "LinkBuffer.h"
#include "MacroAssembler.h"
-#include "YarrParser.h"
+#include "Yarr.h"
#if ENABLE(YARR_JIT)
@@ -2203,10 +2203,13 @@ private:
void jitCompile(YarrPattern& pattern, JSGlobalData* globalData, YarrCodeBlock& jitObject)
{
- YarrGenerator generator(pattern);
- generator.compile(globalData, jitObject);
+ YarrGenerator(pattern).compile(globalData, jitObject);
}
+int execute(YarrCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output)
+{
+ return jitObject.execute(input, start, length, output);
+}
}}
diff --git a/Source/JavaScriptCore/yarr/YarrJIT.h b/Source/JavaScriptCore/yarr/YarrJIT.h
index dfdc777..414b575 100644
--- a/Source/JavaScriptCore/yarr/YarrJIT.h
+++ b/Source/JavaScriptCore/yarr/YarrJIT.h
@@ -29,7 +29,6 @@
#if ENABLE(YARR_JIT)
#include "MacroAssembler.h"
-#include "YarrPattern.h"
#include "UString.h"
#if CPU(X86) && !COMPILER(MSVC)
@@ -76,13 +75,6 @@ private:
bool m_needFallBack;
};
-void jitCompile(YarrPattern&, JSGlobalData*, YarrCodeBlock& jitObject);
-
-inline int execute(YarrCodeBlock& jitObject, const UChar* input, unsigned start, unsigned length, int* output)
-{
- return jitObject.execute(input, start, length, output);
-}
-
} } // namespace JSC::Yarr
#endif
diff --git a/Source/JavaScriptCore/yarr/YarrParser.h b/Source/JavaScriptCore/yarr/YarrParser.h
index 6c3fba5..8c5741a 100644
--- a/Source/JavaScriptCore/yarr/YarrParser.h
+++ b/Source/JavaScriptCore/yarr/YarrParser.h
@@ -27,13 +27,12 @@
#define YarrParser_h
#include "UString.h"
-#include <limits.h>
+#include "Yarr.h"
#include <wtf/ASCIICType.h>
#include <wtf/unicode/Unicode.h>
namespace JSC { namespace Yarr {
-static const unsigned quantifyInfinite = UINT_MAX;
#define REGEXP_ERROR_PREFIX "Invalid regular expression: "
enum BuiltInCharacterClassID {
diff --git a/Source/JavaScriptCore/yarr/YarrPattern.cpp b/Source/JavaScriptCore/yarr/YarrPattern.cpp
index 9ca04cb..112b65d 100644
--- a/Source/JavaScriptCore/yarr/YarrPattern.cpp
+++ b/Source/JavaScriptCore/yarr/YarrPattern.cpp
@@ -27,7 +27,8 @@
#include "config.h"
#include "YarrPattern.h"
-#include "YarrInterpreter.h"
+#include "Yarr.h"
+#include "YarrParser.h"
#include <wtf/Vector.h>
using namespace WTF;
@@ -929,10 +930,9 @@ private:
bool m_invertParentheticalAssertion;
};
-
-static const char* compile(const UString& patternString, YarrPattern& pattern)
+const char* YarrPattern::compile(const UString& patternString)
{
- YarrPatternConstructor constructor(pattern);
+ YarrPatternConstructor constructor(*this);
if (const char* error = parse(constructor, patternString))
return error;
@@ -941,8 +941,8 @@ static const char* compile(const UString& patternString, YarrPattern& pattern)
// Quoting Netscape's "What's new in JavaScript 1.2",
// "Note: if the number of left parentheses is less than the number specified
// in \#, the \# is taken as an octal escape as described in the next row."
- if (pattern.containsIllegalBackReference()) {
- unsigned numSubpatterns = pattern.m_numSubpatterns;
+ if (containsIllegalBackReference()) {
+ unsigned numSubpatterns = m_numSubpatterns;
constructor.reset();
#if !ASSERT_DISABLED
@@ -951,7 +951,7 @@ static const char* compile(const UString& patternString, YarrPattern& pattern)
parse(constructor, patternString, numSubpatterns);
ASSERT(!error);
- ASSERT(numSubpatterns == pattern.m_numSubpatterns);
+ ASSERT(numSubpatterns == m_numSubpatterns);
}
constructor.checkForTerminalParentheses();
@@ -961,7 +961,7 @@ static const char* compile(const UString& patternString, YarrPattern& pattern)
constructor.setupBeginChars();
return 0;
-};
+}
YarrPattern::YarrPattern(const UString& pattern, bool ignoreCase, bool multiline, const char** error)
: m_ignoreCase(ignoreCase)
@@ -979,7 +979,7 @@ YarrPattern::YarrPattern(const UString& pattern, bool ignoreCase, bool multiline
, nonspacesCached(0)
, nonwordcharCached(0)
{
- *error = compile(pattern, *this);
+ *error = compile(pattern);
}
} }
diff --git a/Source/JavaScriptCore/yarr/YarrPattern.h b/Source/JavaScriptCore/yarr/YarrPattern.h
index 14810c6..2172dda 100644
--- a/Source/JavaScriptCore/yarr/YarrPattern.h
+++ b/Source/JavaScriptCore/yarr/YarrPattern.h
@@ -34,15 +34,6 @@
namespace JSC { namespace Yarr {
-#define YarrStackSpaceForBackTrackInfoPatternCharacter 1 // Only for !fixed quantifiers.
-#define YarrStackSpaceForBackTrackInfoCharacterClass 1 // Only for !fixed quantifiers.
-#define YarrStackSpaceForBackTrackInfoBackReference 2
-#define YarrStackSpaceForBackTrackInfoAlternative 1 // One per alternative.
-#define YarrStackSpaceForBackTrackInfoParentheticalAssertion 1
-#define YarrStackSpaceForBackTrackInfoParenthesesOnce 1 // Only for !fixed quantifiers.
-#define YarrStackSpaceForBackTrackInfoParenthesesTerminal 1
-#define YarrStackSpaceForBackTrackInfoParentheses 2
-
struct PatternDisjunction;
struct CharacterRange {
@@ -410,6 +401,8 @@ struct YarrPattern {
Vector<BeginChar> m_beginChars;
private:
+ const char* compile(const UString& patternString);
+
CharacterClass* newlineCached;
CharacterClass* digitsCached;
CharacterClass* spacesCached;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list