[webkit-changes] cvs commit: JavaScriptCore/kjs collector.cpp
config.h date_object.cpp date_object.h dtoa.cpp
fast_malloc.cpp function.cpp function.h identifier.cpp
internal.cpp internal.h interpreter_map.cpp list.cpp
math_object.cpp nodes.cpp number_object.cpp operations.cpp
regexp.cpp regexp.h regexp_object.cpp regexp_object.h
Darin
darin at opensource.apple.com
Sat Sep 3 18:18:17 PDT 2005
darin 05/09/03 18:18:16
Modified: . ChangeLog
kjs collector.cpp config.h date_object.cpp
date_object.h dtoa.cpp fast_malloc.cpp function.cpp
function.h identifier.cpp internal.cpp internal.h
interpreter_map.cpp list.cpp math_object.cpp
nodes.cpp number_object.cpp operations.cpp
regexp.cpp regexp.h regexp_object.cpp
regexp_object.h
Log:
Reviewed, tweaked and landed by Darin.
- some Windows compilation fixes, hoping to fix the problems reported in these bugs:
4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
* kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
KJS_MULTIPLE_THREADS #if directives.
(KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
* kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
* kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
copysign for Win32.
(KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
that on Win32 there's some other call before that setting errno.
* kjs/date_object.h: Remove unneeded include of <sys/time.h>.
* kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
* kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
(KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
(KJS::sbrk): Change parameter type to match the declaration.
* kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
* kjs/function.h: Remove unneeded friend class Function for FunctionImp.
* kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
non-AVOID_STATIC_CONSTRUCTORS code path.
* kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
* kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
specific to Mac OS X if we like.
* kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
* kjs/list.cpp:
(KJS::ListImp::markValues): Use std::min instead of MIN.
(KJS::List::copy): Ditto.
(KJS::List::copyTail): Ditto.
* kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
* kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
Put the use of always_inline inside __GNUC__.
* kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
when passing an int rather than a double or float.
* kjs/operations.cpp:
(KJS::isInf): Add Win32 implementation.
(KJS::isPosInf): Add Win32 implementation.
(KJS::isNegInf): Add Win32 implementation.
* kjs/regexp.cpp: Use unsigned instead of uint.
* kjs/regexp.h: Ditto.
* kjs/regexp_object.cpp: Ditto.
* kjs/regexp_object.h: Ditto.
Revision Changes Path
1.814 +66 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.813
retrieving revision 1.814
diff -u -r1.813 -r1.814
--- ChangeLog 2 Sep 2005 18:08:28 -0000 1.813
+++ ChangeLog 4 Sep 2005 01:18:08 -0000 1.814
@@ -1,3 +1,69 @@
+2005-09-03 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
+
+ Reviewed, tweaked and landed by Darin.
+
+ - some Windows compilation fixes, hoping to fix the problems reported in these bugs:
+ 4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
+
+ * kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside
+ KJS_MULTIPLE_THREADS #if directives.
+ (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
+
+ * kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
+
+ * kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and
+ copysign for Win32.
+ (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe
+ that on Win32 there's some other call before that setting errno.
+
+ * kjs/date_object.h: Remove unneeded include of <sys/time.h>.
+
+ * kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
+
+ * kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32.
+ (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++.
+ (KJS::sbrk): Change parameter type to match the declaration.
+
+ * kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
+
+ * kjs/function.h: Remove unneeded friend class Function for FunctionImp.
+
+ * kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS
+ define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the
+ non-AVOID_STATIC_CONSTRUCTORS code path.
+
+ * kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>!
+ Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
+
+ * kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this
+ specific to Mac OS X if we like.
+
+ * kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
+
+ * kjs/list.cpp:
+ (KJS::ListImp::markValues): Use std::min instead of MIN.
+ (KJS::List::copy): Ditto.
+ (KJS::List::copyTail): Ditto.
+
+ * kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
+
+ * kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint.
+ Put the use of always_inline inside __GNUC__.
+
+ * kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10"
+ inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen
+ when passing an int rather than a double or float.
+
+ * kjs/operations.cpp:
+ (KJS::isInf): Add Win32 implementation.
+ (KJS::isPosInf): Add Win32 implementation.
+ (KJS::isNegInf): Add Win32 implementation.
+
+ * kjs/regexp.cpp: Use unsigned instead of uint.
+ * kjs/regexp.h: Ditto.
+ * kjs/regexp_object.cpp: Ditto.
+ * kjs/regexp_object.h: Ditto.
+
2005-09-02 Beth Dakin <bdakin at apple.com>
Fix for <rdar://problem/4235531> Denver Regression: Safari crash in KWQStringData::makeUnicode
1.44 +35 -8 JavaScriptCore/kjs/collector.cpp
Index: collector.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/collector.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- collector.cpp 15 Aug 2005 18:47:49 -0000 1.43
+++ collector.cpp 4 Sep 2005 01:18:10 -0000 1.44
@@ -28,12 +28,18 @@
#include <algorithm>
-#if APPLE_CHANGES
+#if !WIN32
+
#include <CoreFoundation/CoreFoundation.h>
#include <pthread.h>
#include <mach/mach_port.h>
#include <mach/task.h>
#include <mach/thread_act.h>
+
+#else
+
+#include <windows.h>
+
#endif
using std::max;
@@ -173,6 +179,8 @@
return newCell;
}
+#if KJS_MULTIPLE_THREADS
+
struct Collector::Thread {
Thread(pthread_t pthread, mach_port_t mthread) : posixThread(pthread), machThread(mthread) {}
Thread *next;
@@ -222,6 +230,8 @@
}
}
+#endif
+
#define IS_POINTER_ALIGNED(p) (((int)(p) & (sizeof(char *) - 1)) == 0)
// cells are 8-byte aligned
@@ -274,16 +284,29 @@
void Collector::markCurrentThreadConservatively()
{
- jmp_buf registers;
- setjmp(registers);
+ jmp_buf registers;
+ setjmp(registers);
- pthread_t thread = pthread_self();
- void *stackBase = pthread_get_stackaddr_np(thread);
- int dummy;
- void *stackPointer = &dummy;
- markStackObjectsConservatively(stackPointer, stackBase);
+#if !WIN32
+ pthread_t thread = pthread_self();
+ void *stackBase = pthread_get_stackaddr_np(thread);
+#else
+ NT_TIB *pTib;
+ __asm {
+ MOV EAX, FS:[18h]
+ MOV pTib, EAX
+ }
+ void *stackBase = (void *)pTib->StackBase;
+#endif
+
+ int dummy;
+ void *stackPointer = &dummy;
+
+ markStackObjectsConservatively(stackPointer, stackBase);
}
+#if KJS_MULTIPLE_THREADS
+
typedef unsigned long usword_t; // word size, assumed to be either 32 or 64 bit
void Collector::markOtherThreadConservatively(Thread *thread)
@@ -323,15 +346,19 @@
thread_resume(thread->machThread);
}
+#endif
+
void Collector::markStackObjectsConservatively()
{
markCurrentThreadConservatively();
+#if KJS_MULTIPLE_THREADS
for (Thread *thread = registeredThreads; thread != NULL; thread = thread->next) {
if (thread->posixThread != pthread_self()) {
markOtherThreadConservatively(thread);
}
}
+#endif
}
void Collector::markProtectedObjects()
1.8 +1 -0 JavaScriptCore/kjs/config.h
Index: config.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/config.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config.h 31 Aug 2005 07:57:56 -0000 1.7
+++ config.h 4 Sep 2005 01:18:10 -0000 1.8
@@ -11,6 +11,7 @@
#define HAVE_FLOAT_H 1
#define HAVE_FUNC__FINITE 1
+#define HAVE_SYS_TIMEB_H 1
#endif
1.53 +9 -3 JavaScriptCore/kjs/date_object.cpp
Index: date_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/date_object.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- date_object.cpp 16 Aug 2005 00:47:24 -0000 1.52
+++ date_object.cpp 4 Sep 2005 01:18:10 -0000 1.53
@@ -51,11 +51,19 @@
#include <stdlib.h>
#include <locale.h>
#include <ctype.h>
+#include <limits.h>
#include "date_object.h"
#include "error_object.h"
#include "operations.h"
+#if WIN32
+#define strncasecmp(x, y, z) strnicmp(x, y, z)
+#include <float.h>
+#define isfinite(x) _finite(x)
+#define copysign(x) _copysign(x)
+#endif
+
#include "date_object.lut.h"
// some constants
@@ -1053,9 +1061,6 @@
int second = 0;
bool have_time = false;
- // for strtol error checking
- errno = 0;
-
// Skip leading space
while(isspace(*dateString))
dateString++;
@@ -1087,6 +1092,7 @@
return invalidDate;
// ' 09-Nov-99 23:12:40 GMT'
+ errno = 0;
day = strtol(dateString, &newPosStr, 10);
if (errno)
return invalidDate;
1.16 +0 -2 JavaScriptCore/kjs/date_object.h
Index: date_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/date_object.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- date_object.h 8 Aug 2005 04:07:27 -0000 1.15
+++ date_object.h 4 Sep 2005 01:18:10 -0000 1.16
@@ -25,8 +25,6 @@
#include "internal.h"
#include "function_object.h"
-#include <sys/time.h>
-
namespace KJS {
class DateInstanceImp : public ObjectImp {
1.3 +1 -0 JavaScriptCore/kjs/dtoa.cpp
Index: dtoa.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/dtoa.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dtoa.cpp 3 Dec 2002 23:20:52 -0000 1.2
+++ dtoa.cpp 4 Sep 2005 01:18:11 -0000 1.3
@@ -177,6 +177,7 @@
#endif
#define INFNAN_CHECK
#include "dtoa.h"
+#undef strtod /* do not remove: needed for WIN32 */
#define strtod kjs_strtod
#define dtoa kjs_dtoa
#define freedtoa kjs_freedtoa
1.4 +8 -5 JavaScriptCore/kjs/fast_malloc.cpp
Index: fast_malloc.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/fast_malloc.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- fast_malloc.cpp 2 Sep 2005 18:08:28 -0000 1.3
+++ fast_malloc.cpp 4 Sep 2005 01:18:11 -0000 1.4
@@ -226,9 +226,12 @@
#include "fast_malloc.h"
+#define MALLOC_FAILURE_ACTION abort()
+
+#if !WIN32
#define MORECORE_CONTIGUOUS 0
#define MORECORE_CANNOT_TRIM 1
-#define MALLOC_FAILURE_ACTION abort()
+#endif
namespace KJS {
@@ -301,7 +304,7 @@
static long getpagesize(void);
static long getregionsize(void);
-static void *sbrk(long size);
+static void *sbrk(ptrdiff_t size);
static void *mmap(void *ptr, long size, long prot, long type, long handle, long arg);
static long munmap(void *ptr, long size);
@@ -5028,7 +5031,7 @@
/* Allocate and link a region entry in the region list */
static int region_list_append (region_list_entry **last, void *base_reserved, long reserve_size) {
- region_list_entry *next = HeapAlloc (GetProcessHeap (), 0, sizeof (region_list_entry));
+ region_list_entry *next = (region_list_entry *) HeapAlloc (GetProcessHeap (), 0, sizeof (region_list_entry));
if (! next)
return FALSE;
next->top_allocated = (char *) base_reserved;
@@ -5057,13 +5060,13 @@
/* #define SBRK_SCALE 4 */
/* sbrk for windows */
-static void *sbrk (long size) {
+static void *sbrk (ptrdiff_t size) {
static long g_pagesize, g_my_pagesize;
static long g_regionsize, g_my_regionsize;
static region_list_entry *g_last;
void *result = (void *) MORECORE_FAILURE;
#ifdef TRACE
- printf ("sbrk %d\n", size);
+ printf ("sbrk %ld\n", (long) size);
#endif
#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
/* Wait for spin lock */
1.57 +6 -0 JavaScriptCore/kjs/function.cpp
Index: function.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- function.cpp 31 Aug 2005 07:57:56 -0000 1.56
+++ function.cpp 4 Sep 2005 01:18:11 -0000 1.57
@@ -42,6 +42,12 @@
#include <unicode/uchar.h>
+#if WIN32
+// Define a locale-independent isxdigit.
+#undef isxdigit
+inline bool isxdigit(int c) { return _isctype(c, _HEX); }
+#endif
+
using namespace KXMLCore;
namespace KJS {
1.34 +0 -1 JavaScriptCore/kjs/function.h
Index: function.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/function.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- function.h 30 Aug 2005 23:56:13 -0000 1.33
+++ function.h 4 Sep 2005 01:18:11 -0000 1.34
@@ -36,7 +36,6 @@
* @short Implementation class for internal Functions.
*/
class FunctionImp : public InternalFunctionImp {
- friend class Function;
friend class ActivationImp;
public:
FunctionImp(ExecState *exec, const Identifier &n = Identifier::null());
1.17 +2 -3 JavaScriptCore/kjs/identifier.cpp
Index: identifier.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/identifier.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- identifier.cpp 19 Aug 2005 20:24:17 -0000 1.16
+++ identifier.cpp 4 Sep 2005 01:18:11 -0000 1.17
@@ -25,9 +25,7 @@
// portable, and it would be good to figure out a 100% clean way that still avoids code that
// runs at init time.
-#if APPLE_CHANGES
#define AVOID_STATIC_CONSTRUCTORS 1
-#endif
#if AVOID_STATIC_CONSTRUCTORS
#define KJS_IDENTIFIER_HIDE_GLOBALS 1
@@ -36,6 +34,7 @@
#include "identifier.h"
#include "fast_malloc.h"
+#include <string.h> // for strlen
#define DUMP_STATISTICS 0
@@ -298,7 +297,7 @@
#if !AVOID_STATIC_CONSTRUCTORS
// Define an Identifier in the normal way.
- #define DEFINE_GLOBAL(name, string) extern const Identifier name ## PropertyName(string);
+ #define DEFINE_GLOBAL(name, string) extern const Identifier name(string);
#else
// Define an Identifier-sized array of pointers to avoid static initialization.
// Use an array of pointers instead of an array of char in case there is some alignment issue.
1.68 +18 -8 JavaScriptCore/kjs/internal.cpp
Index: internal.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- internal.cpp 30 Aug 2005 23:56:14 -0000 1.67
+++ internal.cpp 4 Sep 2005 01:18:11 -0000 1.68
@@ -25,9 +25,6 @@
#include <stdio.h>
#include <math.h>
#include <assert.h>
-#ifndef NDEBUG
-#include <strings.h> // for strdup
-#endif
#include "array_object.h"
#include "bool_object.h"
@@ -49,7 +46,10 @@
#include "regexp_object.h"
#include "string_object.h"
-#define I18N_NOOP(s) s
+#if WIN32
+#include <float.h>
+#define copysign(a, b) _copysign(a, b)
+#endif
extern int kjsyyparse();
@@ -58,7 +58,7 @@
namespace KJS {
#if !APPLE_CHANGES
-
+
#ifdef WORDS_BIGENDIAN
const unsigned char NaN_Bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
const unsigned char Inf_Bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
@@ -69,12 +69,22 @@
const unsigned char NaN_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
const unsigned char Inf_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
#endif
-
+
const double NaN = *(const double*) NaN_Bytes;
const double Inf = *(const double*) Inf_Bytes;
-
+
#endif // APPLE_CHANGES
+#if !KJS_MULTIPLE_THREADS
+
+static inline void initializeInterpreterLock() { }
+static inline void lockInterpreter() { }
+static inline void unlockInterpreter() { }
+
+const int interpreterLockCount = 1;
+
+#else
+
static pthread_once_t interpreterLockOnce = PTHREAD_ONCE_INIT;
static pthread_mutex_t interpreterLock;
static int interpreterLockCount = 0;
@@ -103,7 +113,7 @@
pthread_mutex_unlock(&interpreterLock);
}
-
+#endif
// ------------------------------ UndefinedImp ---------------------------------
1.38 +4 -0 JavaScriptCore/kjs/internal.h
Index: internal.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- internal.h 30 Aug 2005 23:56:14 -0000 1.37
+++ internal.h 4 Sep 2005 01:18:12 -0000 1.38
@@ -34,6 +34,10 @@
#include "scope_chain.h"
#include "shared_ptr.h"
+#if !WIN32
+#define KJS_MULTIPLE_THREADS 1
+#endif
+
#define I18N_NOOP(s) s
namespace KJS {
1.4 +1 -3 JavaScriptCore/kjs/interpreter_map.cpp
Index: interpreter_map.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter_map.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- interpreter_map.cpp 14 Jul 2005 18:27:02 -0000 1.3
+++ interpreter_map.cpp 4 Sep 2005 01:18:12 -0000 1.4
@@ -21,6 +21,7 @@
#include "interpreter_map.h"
#include "pointer_hash.h"
+#include <stdlib.h>
namespace KJS {
@@ -31,7 +32,6 @@
int InterpreterMap::_tableSizeMask;
int InterpreterMap::_keyCount;
-
InterpreterImp * InterpreterMap::getInterpreterForGlobalObject(ObjectImp *global)
{
if (!_table)
@@ -54,7 +54,6 @@
return 0;
}
-
void InterpreterMap::setInterpreterForGlobalObject(InterpreterImp *interpreter, ObjectImp *global)
{
if (!_table)
@@ -171,5 +170,4 @@
return pointerHash(pointer);
}
-
} // namespace
1.16 +6 -4 JavaScriptCore/kjs/list.cpp
Index: list.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/list.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- list.cpp 14 Aug 2005 16:34:02 -0000 1.15
+++ list.cpp 4 Sep 2005 01:18:12 -0000 1.16
@@ -22,9 +22,12 @@
#include "list.h"
#include "internal.h"
+#include <algorithm>
#define DUMP_STATISTICS 0
+using std::min;
+
namespace KJS {
// tunable parameters
@@ -96,10 +99,9 @@
#endif
-
inline void ListImp::markValues()
{
- int inlineSize = MIN(size, inlineValuesSize);
+ int inlineSize = min(size, inlineValuesSize);
for (int i = 0; i != inlineSize; ++i) {
if (!values[i]->marked()) {
values[i]->mark();
@@ -290,7 +292,7 @@
int size = imp->size;
- int inlineSize = MIN(size, inlineValuesSize);
+ int inlineSize = min(size, inlineValuesSize);
for (int i = 0; i != inlineSize; ++i)
copy.append(imp->values[i]);
@@ -311,7 +313,7 @@
int size = imp->size;
- int inlineSize = MIN(size, inlineValuesSize);
+ int inlineSize = min(size, inlineValuesSize);
for (int i = 1; i < inlineSize; ++i)
copy.append(imp->values[i]);
1.18 +26 -0 JavaScriptCore/kjs/math_object.cpp
Index: math_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/math_object.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- math_object.cpp 8 Aug 2005 04:07:28 -0000 1.17
+++ math_object.cpp 4 Sep 2005 01:18:12 -0000 1.18
@@ -32,6 +32,32 @@
#include "math_object.lut.h"
+#if WIN32
+
+#include <float.h>
+static int signbit(double d)
+{
+ // FIXME: Not sure if this is exactly right.
+ switch (_fpclass(d)) {
+ case _FPCLASS_NINF:
+ case _FPCLASS_NN:
+ case _FPCLASS_ND:
+ case _FPCLASS_NZ:
+ // It's one of wacky negatives, report as negative.
+ return 1;
+ case _FPCLASS_PINF:
+ case _FPCLASS_PN:
+ case _FPCLASS_PD:
+ case _FPCLASS_PZ:
+ // It's one of wacky positives, report as positive.
+ return 0;
+ default:
+ return d < 0;
+ }
+}
+
+#endif
+
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif /* M_PI */
1.80 +3 -1 JavaScriptCore/kjs/nodes.cpp
Index: nodes.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/nodes.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- nodes.cpp 31 Aug 2005 18:36:47 -0000 1.79
+++ nodes.cpp 4 Sep 2005 01:18:12 -0000 1.80
@@ -118,7 +118,7 @@
{
fprintf( stderr, "Node::finalCheck(): list count : %d\n", (int)s_nodes.size() );
std::list<Node *>::iterator it = s_nodes->begin();
- for ( uint i = 0; it != s_nodes->end() ; ++it, ++i )
+ for ( unsigned i = 0; it != s_nodes->end() ; ++it, ++i )
fprintf( stderr, "[%d] Still having node %p (%s) (refcount %d)\n", i, (void*)*it, typeid( **it ).name(), (*it)->refcount );
delete s_nodes;
s_nodes = 0L;
@@ -1030,8 +1030,10 @@
// ECMA 11.13
+#if __GNUC__
// gcc refuses to inline this without the always_inline, but inlining it does help
static inline ValueImp *valueForReadModifyAssignment(ExecState * exec, ValueImp *v1, ValueImp *v2, Operator oper) __attribute__((always_inline));
+#endif
static inline ValueImp *valueForReadModifyAssignment(ExecState * exec, ValueImp *v1, ValueImp *v2, Operator oper)
{
1.22 +12 -12 JavaScriptCore/kjs/number_object.cpp
Index: number_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/number_object.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- number_object.cpp 16 Aug 2005 00:47:25 -0000 1.21
+++ number_object.cpp 4 Sep 2005 01:18:12 -0000 1.22
@@ -173,11 +173,11 @@
x = -x;
}
- if (x >= pow(10,21))
+ if (x >= pow(10.0, 21.0))
return String(s+UString::from(x));
- double n = floor(x*pow(10,f));
- if (fabs(n/pow(10,f)-x) > fabs((n+1)/pow(10,f)-x))
+ double n = floor(x*pow(10.0, f));
+ if (fabs(n / pow(10.0, f) - x) > fabs((n + 1) / pow(10.0, f) - x))
n++;
UString m = integer_part_noexp(n);
@@ -211,9 +211,9 @@
int decimalAdjust = 0;
if (!fractionDigits->isUndefined()) {
double logx = floor(log10(x));
- x /= pow(10,logx);
- double fx = floor(x*pow(10,f))/pow(10,f);
- double cx = ceil(x*pow(10,f))/pow(10,f);
+ x /= pow(10.0, logx);
+ double fx = floor(x * pow(10.0, f)) / pow(10.0,f);
+ double cx = ceil(x * pow(10.0, f)) / pow(10.0, f);
if (fabs(fx-x) < fabs(cx-x))
x = fx;
@@ -308,16 +308,16 @@
if (x != 0) {
e = int(log10(x));
- double n = floor(x/pow(10,e-p+1));
- if (n < pow(10,p-1)) {
+ double n = floor(x / pow(10.0, e - p + 1));
+ if (n < pow(10.0, p - 1)) {
e = e - 1;
- n = floor(x/pow(10,e-p+1));
+ n = floor(x / pow(10.0, e - p + 1));
}
- if (fabs((n+1)*pow(10,e-p+1)-x) < fabs(n*pow(10,e-p+1)-x))
+ if (fabs((n + 1) * pow(10.0, e - p + 1) - x) < fabs(n * pow(10.0, e - p + 1) - x))
n++;
- assert(pow(10,p-1) <= n);
- assert(n < pow(10,p));
+ assert(pow(10.0, p - 1) <= n);
+ assert(n < pow(10.0, p));
m = integer_part_noexp(n);
if (e < -6 || e >= p) {
1.10 +26 -26 JavaScriptCore/kjs/operations.cpp
Index: operations.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/operations.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- operations.cpp 31 Aug 2005 07:57:56 -0000 1.9
+++ operations.cpp 4 Sep 2005 01:18:12 -0000 1.10
@@ -20,9 +20,9 @@
*
*/
-#ifdef HAVE_CONFIG_H
+#include "operations.h"
+
#include "config.h"
-#endif
#include <stdio.h>
#include <assert.h>
@@ -39,14 +39,13 @@
#include <float.h>
#endif
-#include "operations.h"
#include "object.h"
-using namespace KJS;
+namespace KJS {
#if !APPLE_CHANGES
-bool KJS::isNaN(double d)
+bool isNaN(double d)
{
#ifdef HAVE_FUNC_ISNAN
return isnan(d);
@@ -57,9 +56,12 @@
#endif
}
-bool KJS::isInf(double d)
+bool isInf(double d)
{
-#if defined(HAVE_FUNC_ISINF)
+#if WIN32
+ int fpClass = _fpclass(d);
+ return _FPCLASS_PINF == fpClass || _FPCLASS_NINF == fpClass;
+#elif defined(HAVE_FUNC_ISINF)
return isinf(d);
#elif HAVE_FUNC_FINITE
return finite(d) == 0 && d == d;
@@ -70,12 +72,11 @@
#endif
}
-bool KJS::isPosInf(double d)
+bool isPosInf(double d)
{
-#if APPLE_CHANGES
- return isinf(d) && d > 0;
-#else
-#if defined(HAVE_FUNC_ISINF)
+#if WIN32
+ return _FPCLASS_PINF == _fpclass(d);
+#elif defined(HAVE_FUNC_ISINF)
return (isinf(d) == 1);
#elif HAVE_FUNC_FINITE
return finite(d) == 0 && d == d; // ### can we distinguish between + and - ?
@@ -84,15 +85,13 @@
#else
return false;
#endif
-#endif
}
-bool KJS::isNegInf(double d)
+bool isNegInf(double d)
{
-#if APPLE_CHANGES
- return isinf(d) && d < 0;
-#else
-#if defined(HAVE_FUNC_ISINF)
+#if WIN32
+ return _FPCLASS_PINF == _fpclass(d);
+#elif defined(HAVE_FUNC_ISINF)
return (isinf(d) == -1);
#elif HAVE_FUNC_FINITE
return finite(d) == 0 && d == d; // ###
@@ -101,13 +100,12 @@
#else
return false;
#endif
-#endif
}
#endif
// ECMA 11.9.3
-bool KJS::equal(ExecState *exec, ValueImp *v1, ValueImp *v2)
+bool equal(ExecState *exec, ValueImp *v1, ValueImp *v2)
{
Type t1 = v1->type();
Type t2 = v2->type();
@@ -161,7 +159,7 @@
return v1 == v2;
}
-bool KJS::strictEqual(ExecState *exec, ValueImp *v1, ValueImp *v2)
+bool strictEqual(ExecState *exec, ValueImp *v1, ValueImp *v2)
{
Type t1 = v1->type();
Type t2 = v2->type();
@@ -193,7 +191,7 @@
return false;
}
-int KJS::relation(ExecState *exec, ValueImp *v1, ValueImp *v2)
+int relation(ExecState *exec, ValueImp *v1, ValueImp *v2)
{
ValueImp *p1 = v1->toPrimitive(exec,NumberType);
ValueImp *p2 = v2->toPrimitive(exec,NumberType);
@@ -210,18 +208,18 @@
return -1; // must be NaN, so undefined
}
-int KJS::maxInt(int d1, int d2)
+int maxInt(int d1, int d2)
{
return (d1 > d2) ? d1 : d2;
}
-int KJS::minInt(int d1, int d2)
+int minInt(int d1, int d2)
{
return (d1 < d2) ? d1 : d2;
}
// ECMA 11.6
-ValueImp *KJS::add(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
+ValueImp *add(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
{
// exception for the Date exception in defaultValue()
Type preferred = oper == '+' ? UnspecifiedType : NumberType;
@@ -246,7 +244,7 @@
}
// ECMA 11.5
-ValueImp *KJS::mult(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
+ValueImp *mult(ExecState *exec, ValueImp *v1, ValueImp *v2, char oper)
{
bool n1KnownToBeInteger;
double n1 = v1->toNumber(exec, n1KnownToBeInteger);
@@ -269,3 +267,5 @@
return jsNumber(result, resultKnownToBeInteger);
}
+
+}
\ No newline at end of file
1.12 +3 -3 JavaScriptCore/kjs/regexp.cpp
Index: regexp.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/regexp.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- regexp.cpp 14 Jul 2005 18:27:03 -0000 1.11
+++ regexp.cpp 4 Sep 2005 01:18:12 -0000 1.12
@@ -141,7 +141,7 @@
#else
- const uint maxMatch = 10;
+ const unsigned maxMatch = 10;
regmatch_t rmatch[maxMatch];
char *str = strdup(s.ascii()); // TODO: why ???
@@ -158,11 +158,11 @@
// map rmatch array to ovector used in PCRE case
_numSubPatterns = 0;
- for(uint j = 1; j < maxMatch && rmatch[j].rm_so >= 0 ; j++)
+ for(unsigned j = 1; j < maxMatch && rmatch[j].rm_so >= 0 ; j++)
_numSubPatterns++;
int ovecsize = (_numSubPatterns+1)*3; // see above
*ovector = new int[ovecsize];
- for (uint j = 0; j < _numSubPatterns + 1; j++) {
+ for (unsigned j = 0; j < _numSubPatterns + 1; j++) {
if (j>maxMatch)
break;
(*ovector)[2*j] = rmatch[j].rm_so + i;
1.8 +2 -2 JavaScriptCore/kjs/regexp.h
Index: regexp.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/regexp.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- regexp.h 14 Jul 2005 18:27:03 -0000 1.7
+++ regexp.h 4 Sep 2005 01:18:13 -0000 1.8
@@ -48,7 +48,7 @@
int flags() const { return _flags; }
UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
- uint subPatterns() const { return _numSubPatterns; }
+ unsigned subPatterns() const { return _numSubPatterns; }
private:
#ifdef HAVE_PCREPOSIX
@@ -57,7 +57,7 @@
regex_t _regex;
#endif
int _flags;
- uint _numSubPatterns;
+ unsigned _numSubPatterns;
RegExp(const RegExp &);
RegExp &operator=(const RegExp &);
1.23 +1 -1 JavaScriptCore/kjs/regexp_object.cpp
Index: regexp_object.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/regexp_object.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- regexp_object.cpp 16 Aug 2005 00:47:26 -0000 1.22
+++ regexp_object.cpp 4 Sep 2005 01:18:13 -0000 1.23
@@ -195,7 +195,7 @@
// The returned array contains 'result' as first item, followed by the list of matches
list.append(String(result));
if ( lastOvector )
- for ( uint i = 1 ; i < lastNrSubPatterns + 1 ; ++i )
+ for ( unsigned i = 1 ; i < lastNrSubPatterns + 1 ; ++i )
{
int start = lastOvector[2*i];
if (start == -1)
1.12 +1 -1 JavaScriptCore/kjs/regexp_object.h
Index: regexp_object.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/regexp_object.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- regexp_object.h 8 Aug 2005 04:07:29 -0000 1.11
+++ regexp_object.h 4 Sep 2005 01:18:13 -0000 1.12
@@ -83,7 +83,7 @@
UString lastString;
int *lastOvector;
- uint lastNrSubPatterns;
+ unsigned lastNrSubPatterns;
};
} // namespace
More information about the webkit-changes
mailing list