[webkit-changes] cvs commit: JavaScriptCore/pcre pcre.h
pcre_compile.c pcre_exec.c
David
hyatt at opensource.apple.com
Fri Jan 6 14:43:45 PST 2006
hyatt 06/01/06 14:43:45
Modified: kjs JSLock.cpp array_object.cpp collector.cpp
date_object.cpp identifier.cpp internal.cpp
interpreter.cpp interpreter.h math_object.cpp
kxmlcore Assertions.h FastMalloc.cpp FastMallocInternal.h
TCSystemAlloc.cpp
pcre pcre.h pcre_compile.c pcre_exec.c
Log:
Land all the changes to make JSCore build again on windows.
Revision Changes Path
1.3 +5 -0 JavaScriptCore/kjs/JSLock.cpp
Index: JSLock.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/JSLock.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JSLock.cpp 27 Nov 2005 07:54:44 -0000 1.2
+++ JSLock.cpp 6 Jan 2006 22:43:40 -0000 1.3
@@ -71,6 +71,11 @@
void JSLock::lock()
{
+ // FIXME: Hack-o-rama. To prevent construction of a global object with a null prototype (4342216),
+ // we need to intialize our constants before the first object is constructed. InterpreterImp::lock()
+ // is a good place to do this because you have to call it before doing any allocations. Once we change our
+ // implementation to use immediate values, we should remove this code.
+ ConstantValues::initIfNeeded();
}
void JSLock::unlock()
1.63 +2 -0 JavaScriptCore/kjs/array_object.cpp
Index: array_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/array_object.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- array_object.cpp 27 Dec 2005 20:02:00 -0000 1.62
+++ array_object.cpp 6 Jan 2006 22:43:40 -0000 1.63
@@ -38,6 +38,8 @@
#include <stdio.h>
#include <assert.h>
+template class KJS::JSObject * const & KXMLCore::identityExtract<class KJS::JSObject *>(class KJS::JSObject * const &);
+
using namespace KJS;
// ------------------------------ ArrayInstance -----------------------------
1.56 +2 -2 JavaScriptCore/kjs/collector.cpp
Index: collector.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/collector.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- collector.cpp 13 Dec 2005 21:24:50 -0000 1.55
+++ collector.cpp 6 Jan 2006 22:43:40 -0000 1.56
@@ -42,6 +42,7 @@
#elif WIN32
+#undef ERROR
#include <windows.h>
#else
@@ -158,7 +159,6 @@
} else {
allocateNewBlock:
// didn't find one, need to allocate a new block
-
size_t numBlocks = heap.numBlocks;
if (usedBlocks == numBlocks) {
numBlocks = max(MIN_ARRAY_SIZE, numBlocks * GROWTH_FACTOR);
@@ -590,7 +590,7 @@
return protectedValues().size();
}
-#if APPLE_CHANGES
+#if __APPLE__
static const char *className(JSCell *val)
{
1.67 +17 -9 JavaScriptCore/kjs/date_object.cpp
Index: date_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/date_object.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- date_object.cpp 16 Dec 2005 23:01:33 -0000 1.66
+++ date_object.cpp 6 Jan 2006 22:43:40 -0000 1.67
@@ -59,8 +59,19 @@
#define copysign(x, y) _copysign(x, y)
#define isfinite(x) _finite(x)
#define strncasecmp(x, y, z) strnicmp(x, y, z)
+#define snprintf _snprintf
#endif
+inline int gmtoffset(const tm& t)
+{
+#if WIN32
+ // FIXME: This might not be completely correct if the time is not the current timezone.
+ return -(timezone / 60 - (t.tm_isdst > 0 ? 60 : 0 )) * 60;
+#else
+ return t.tm_gmtoff;
+#endif
+}
+
namespace KJS {
/**
@@ -218,13 +229,13 @@
static UString formatTime(const tm &t)
{
char buffer[100];
- if (t.tm_gmtoff == 0) {
+ if (gmtoffset(t) == 0) {
snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.tm_hour, t.tm_min, t.tm_sec);
} else {
- int offset = abs(t.tm_gmtoff);
+ int offset = abs(gmtoffset(t));
snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d",
t.tm_hour, t.tm_min, t.tm_sec,
- t.tm_gmtoff < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
+ gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
}
return UString(buffer);
}
@@ -547,8 +558,7 @@
time_t tv = (time_t) floor(milli / msPerSecond);
double ms = milli - tv * msPerSecond;
- tm t;
- utc ? gmtime_r(&tv, &t) : localtime_r(&tv, &t);
+ tm t = *(utc ? gmtime(&tv) : localtime(&tv));
// We had an out of range year. Restore the year (plus/minus offset
// found by calculating tm_year) and fix the week day calculation.
if (realYearOffset != 0) {
@@ -769,8 +779,7 @@
JSValue *DateObjectImp::callAsFunction(ExecState * /*exec*/, JSObject * /*thisObj*/, const List &/*args*/)
{
time_t t = time(0);
- tm ts;
- localtime_r(&t, &ts);
+ tm ts = *localtime(&t);
return jsString(formatDate(ts) + " " + formatTime(ts));
}
@@ -899,8 +908,7 @@
// produce incorrect results, but there's no other option when calling localtime_r().
if (!utc) {
time_t tval = mktime(t) + (time_t)((ms + yearOffset) / 1000);
- struct tm t3;
- localtime_r(&tval, &t3);
+ tm t3 = *localtime(&tval);
t->tm_isdst = t3.tm_isdst;
}
1.29 +2 -0 JavaScriptCore/kjs/identifier.cpp
Index: identifier.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/identifier.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- identifier.cpp 26 Dec 2005 22:23:55 -0000 1.28
+++ identifier.cpp 6 Jan 2006 22:43:40 -0000 1.29
@@ -41,6 +41,8 @@
#include <string.h> // for strlen
#include <new> // for placement new
+template struct KJS::UString::Rep * const & KXMLCore::identityExtract<struct KJS::UString::Rep *>(struct KJS::UString::Rep * const &);
+
namespace KXMLCore {
template<typename T> class DefaultHash;
1.86 +2 -0 JavaScriptCore/kjs/internal.cpp
Index: internal.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- internal.cpp 19 Dec 2005 10:38:07 -0000 1.85
+++ internal.cpp 6 Jan 2006 22:43:40 -0000 1.86
@@ -52,6 +52,8 @@
#define copysign(a, b) _copysign(a, b)
#endif
+template void * const & KXMLCore::extractFirst<struct std::pair<void *,void *>>(struct std::pair<void *, void *> const &);
+
extern int kjsyyparse();
namespace KJS {
1.37 +1 -2 JavaScriptCore/kjs/interpreter.cpp
Index: interpreter.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- interpreter.cpp 16 Dec 2005 22:45:35 -0000 1.36
+++ interpreter.cpp 6 Jan 2006 22:43:41 -0000 1.37
@@ -307,7 +307,6 @@
}
#endif
-#if APPLE_CHANGES
static bool printExceptions = false;
bool Interpreter::shouldPrintExceptions()
@@ -320,7 +319,7 @@
printExceptions = print;
}
-
+#if __APPLE__
void *Interpreter::createLanguageInstanceForValue(ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
{
return Bindings::Instance::createLanguageInstanceForValue (exec, (Bindings::Instance::BindingLanguage)language, value, origin, current);
1.33 +3 -1 JavaScriptCore/kjs/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- interpreter.h 16 Dec 2005 08:08:05 -0000 1.32
+++ interpreter.h 6 Jan 2006 22:43:41 -0000 1.33
@@ -388,8 +388,10 @@
* not allowed unless isSafeScript returns true.
*/
virtual bool isSafeScript (const Interpreter *target) { return true; }
-
+
+#if __APPLE__
virtual void *createLanguageInstanceForValue(ExecState*, int language, JSObject* value, const Bindings::RootObject* origin, const Bindings::RootObject* current);
+#endif
// This is a workaround to avoid accessing the global variables for these identifiers in
// important property lookup functions, to avoid taking PIC branches in Mach-O binaries
1.24 +1 -1 JavaScriptCore/kjs/math_object.cpp
Index: math_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/math_object.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- math_object.cpp 29 Dec 2005 11:02:07 -0000 1.23
+++ math_object.cpp 6 Jan 2006 22:43:41 -0000 1.24
@@ -262,7 +262,7 @@
break;
case MathObjectImp::Random:
if (!randomSeeded) {
- sranddev();
+ srand(time(0));
randomSeeded = true;
}
result = (double)rand() / RAND_MAX;
1.2 +24 -14 JavaScriptCore/kxmlcore/Assertions.h
Index: Assertions.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/Assertions.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Assertions.h 27 Sep 2005 22:36:53 -0000 1.1
+++ Assertions.h 6 Jan 2006 22:43:43 -0000 1.2
@@ -35,11 +35,15 @@
// For non-debug builds, everything is disabled by default.
// Defining any of the symbols explicitly prevents this from having any effect.
+#ifdef WIN32
+#define ASSERT_DISABLED 1 // FIXME: We have to undo all the assert macros, since they are currently in a .mm file and use obj-c.
+#else
#ifdef NDEBUG
#define ASSERTIONS_DISABLED_DEFAULT 1
#else
#define ASSERTIONS_DISABLED_DEFAULT 0
#endif
+#endif
#ifndef ASSERT_DISABLED
#define ASSERT_DISABLED ASSERTIONS_DISABLED_DEFAULT
@@ -61,6 +65,12 @@
#define LOG_DISABLED ASSERTIONS_DISABLED_DEFAULT
#endif
+#ifdef __GNUC__
+#define KXMLCORE_PRETTY_FUNCTION __PRETTY_FUNCTION__
+#else
+#define KXMLCORE_PRETTY_FUNCTION __FUNCTION__
+#endif
+
// These helper functions are always declared, but not necessarily always defined if the corresponding function is disabled.
#ifdef __cplusplus
@@ -74,7 +84,7 @@
const char *defaultName;
KXCLogChannelState state;
} KXCLogChannel;
-
+
void KXCReportAssertionFailure(const char *file, int line, const char *function, const char *assertion);
void KXCReportAssertionFailureWithMessage(const char *file, int line, const char *function, const char *assertion, const char *format, ...);
void KXCReportArgumentAssertionFailure(const char *file, int line, const char *function, const char *argName, const char *assertion);
@@ -95,25 +105,25 @@
#if ASSERT_DISABLED
#define ASSERT(assertion) ((void)0)
-#define ASSERT_WITH_MESSAGE(assertion, formatAndArgs...) ((void)0)
+#define ASSERT_WITH_MESSAGE(assertion, formatAndArgs, ...) ((void)0)
#define ASSERT_NOT_REACHED() ((void)0)
#else
#define ASSERT(assertion) do \
if (!(assertion)) { \
- KXCReportAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #assertion); \
+ KXCReportAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #assertion); \
CRASH(); \
} \
while (0)
-#define ASSERT_WITH_MESSAGE(assertion, formatAndArgs...) do \
+#define ASSERT_WITH_MESSAGE(assertion, formatAndArgs, ...) do \
if (!(assertion)) { \
- KXCReportAssertionFailureWithMessage(__FILE__, __LINE__, __PRETTY_FUNCTION__, #assertion, formatAndArgs); \
+ KXCReportAssertionFailureWithMessage(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #assertion, formatAndArgs); \
CRASH(); \
} \
while (0)
#define ASSERT_NOT_REACHED() do { \
- KXCReportAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, 0); \
+ KXCReportAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, 0); \
CRASH(); \
} while (0)
@@ -129,7 +139,7 @@
#define ASSERT_ARG(argName, assertion) do \
if (!(assertion)) { \
- KXCReportArgumentAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #argName, #assertion); \
+ KXCReportArgumentAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #argName, #assertion); \
CRASH(); \
} \
while (0)
@@ -139,10 +149,10 @@
// FATAL
#if FATAL_DISABLED
-#define FATAL(formatAndArgs...) ((void)0)
+#define FATAL(formatAndArgs, ...) ((void)0)
#else
-#define FATAL(formatAndArgs...) do { \
- KXCReportFatalError(__FILE__, __LINE__, __PRETTY_FUNCTION__, formatAndArgs); \
+#define FATAL(formatAndArgs, ...) do { \
+ KXCReportFatalError(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, formatAndArgs); \
CRASH(); \
} while (0)
#endif
@@ -150,17 +160,17 @@
// ERROR
#if ERROR_DISABLED
-#define ERROR(formatAndArgs...) ((void)0)
+#define ERROR(formatAndArgs, ...) ((void)0)
#else
-#define ERROR(formatAndArgs...) KXCReportError(__FILE__, __LINE__, __PRETTY_FUNCTION__, formatAndArgs)
+#define ERROR(formatAndArgs, ...) KXCReportError(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, formatAndArgs)
#endif
// LOG
#if LOG_DISABLED
-#define LOG(channel, formatAndArgs...) ((void)0)
+#define LOG(channel, formatAndArgs, ...) ((void)0)
#else
-#define LOG(channel, formatAndArgs...) KXCLog(__FILE__, __LINE__, __PRETTY_FUNCTION__, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), formatAndArgs)
+#define LOG(channel, formatAndArgs, ...) KXCLog(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), formatAndArgs)
#define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel)
#define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel
#endif
1.5 +2 -0 JavaScriptCore/kxmlcore/FastMalloc.cpp
Index: FastMalloc.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/FastMalloc.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FastMalloc.cpp 18 Oct 2005 03:15:26 -0000 1.4
+++ FastMalloc.cpp 6 Jan 2006 22:43:43 -0000 1.5
@@ -95,9 +95,11 @@
return realloc(p, n);
}
+#ifndef WIN32
void fastMallocRegisterThread(pthread_t thread)
{
}
+#endif
} // namespace KJS
1.2 +4 -0 JavaScriptCore/kxmlcore/FastMallocInternal.h
Index: FastMallocInternal.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/FastMallocInternal.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FastMallocInternal.h 3 Oct 2005 21:11:58 -0000 1.1
+++ FastMallocInternal.h 6 Jan 2006 22:43:43 -0000 1.2
@@ -23,10 +23,14 @@
#ifndef KXMLCORE_FAST_MALLOC_INTERNAL_H
#define KXMLCORE_FAST_MALLOC_INTERNAL_H
+#ifndef WIN32
+
#include <pthread.h>
namespace KXMLCore {
void fastMallocRegisterThread(pthread_t thread);
}
+#endif
+
#endif // KXMLCORE_FAST_MALLOC_INTERNAL_H
1.4 +3 -1 JavaScriptCore/kxmlcore/TCSystemAlloc.cpp
Index: TCSystemAlloc.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/TCSystemAlloc.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TCSystemAlloc.cpp 4 Oct 2005 05:57:13 -0000 1.3
+++ TCSystemAlloc.cpp 6 Jan 2006 22:43:43 -0000 1.4
@@ -38,9 +38,11 @@
#else
#include <sys/types.h>
#endif
+#ifndef WIN32
#include <unistd.h>
-#include <fcntl.h>
#include <sys/mman.h>
+#endif
+#include <fcntl.h>
#include "TCSystemAlloc.h"
#include "TCSpinLock.h"
1.7 +0 -14 JavaScriptCore/pcre/pcre.h
Index: pcre.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/pcre/pcre.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- pcre.h 9 Sep 2005 00:51:06 -0000 1.6
+++ pcre.h 6 Jan 2006 22:43:44 -0000 1.7
@@ -70,20 +70,6 @@
#define PCRE_UTF16 1
-/* Win32 uses DLL by default; it needs special stuff for exported functions. */
-
-#ifdef _WIN32
-# ifdef PCRE_DEFINITION
-# ifdef DLL_EXPORT
-# define PCRE_DATA_SCOPE __declspec(dllexport)
-# endif
-# else
-# ifndef PCRE_STATIC
-# define PCRE_DATA_SCOPE extern __declspec(dllimport)
-# endif
-# endif
-#endif
-
/* For other operating systems, we use the standard "extern". */
#ifndef PCRE_DATA_SCOPE
1.4 +9 -6 JavaScriptCore/pcre/pcre_compile.c
Index: pcre_compile.c
===================================================================
RCS file: /cvs/root/JavaScriptCore/pcre/pcre_compile.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- pcre_compile.c 9 Sep 2005 00:51:06 -0000 1.3
+++ pcre_compile.c 6 Jan 2006 22:43:44 -0000 1.4
@@ -1356,7 +1356,7 @@
#if PCRE_UTF16
-static inline BOOL strequal(const pcre_uchar *str1, int len, const char *str2)
+static __inline BOOL strequal(const pcre_uchar *str1, int len, const char *str2)
{
int i;
for (i = 0; i < len; i++)
@@ -4893,11 +4893,14 @@
c = DECODE_SURROGATE_PAIR(c, *ptr);
++ptr;
}
- int i;
- for (i = 0; i < _pcre_utf8_table1_size; i++)
- if (c <= _pcre_utf8_table1[i]) break;
- length += i;
- lastitemlength += i;
+
+ {
+ int i;
+ for (i = 0; i < _pcre_utf8_table1_size; i++)
+ if (c <= _pcre_utf8_table1[i]) break;
+ length += i;
+ lastitemlength += i;
+ }
}
#else
#ifdef SUPPORT_UTF8
1.6 +19 -14 JavaScriptCore/pcre/pcre_exec.c
Index: pcre_exec.c
===================================================================
RCS file: /cvs/root/JavaScriptCore/pcre/pcre_exec.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- pcre_exec.c 9 Oct 2005 04:25:00 -0000 1.5
+++ pcre_exec.c 6 Jan 2006 22:43:44 -0000 1.6
@@ -1807,21 +1807,23 @@
ecode++;
GETUTF8CHARLEN(fc, ecode, length);
#if PCRE_UTF16
- int dc;
- ecode += length;
- switch (md->end_subject - eptr)
{
- case 0:
- RRETURN(MATCH_NOMATCH);
- case 1:
- dc = *eptr++;
- if (IS_LEADING_SURROGATE(dc))
+ int dc;
+ ecode += length;
+ switch (md->end_subject - eptr)
+ {
+ case 0:
RRETURN(MATCH_NOMATCH);
- break;
- default:
- GETCHARINC(dc, eptr);
- }
- if (fc != dc) RRETURN(MATCH_NOMATCH);
+ case 1:
+ dc = *eptr++;
+ if (IS_LEADING_SURROGATE(dc))
+ RRETURN(MATCH_NOMATCH);
+ break;
+ default:
+ GETCHARINC(dc, eptr);
+ }
+ if (fc != dc) RRETURN(MATCH_NOMATCH);
+ }
#else
if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
while (length-- > 0) if (*ecode++ != *eptr++) RRETURN(MATCH_NOMATCH);
@@ -1945,8 +1947,10 @@
REPEATCHAR:
#ifdef SUPPORT_UTF8
#if PCRE_UTF16
- length = 1;
+
+ length = 1;
GETUTF8CHARLEN(fc, ecode, length);
+ {
int utf16Length; // don't initialize on this line as workaround for Win32 compile problem
utf16Length = fc > 0xFFFF ? 2 : 1;
if (min * utf16Length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
@@ -2050,6 +2054,7 @@
/* Control never gets here */
}
/* Control never gets here */
+ }
#else
if (utf8)
{
More information about the webkit-changes
mailing list