Ignore:
Timestamp:
Sep 3, 2005, 6:18:13 PM (20 years ago)
Author:
darin
Message:

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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/collector.cpp

    r10197 r10456  
    2929#include <algorithm>
    3030
    31 #if APPLE_CHANGES
     31#if !WIN32
     32
    3233#include <CoreFoundation/CoreFoundation.h>
    3334#include <pthread.h>
     
    3536#include <mach/task.h>
    3637#include <mach/thread_act.h>
     38
     39#else
     40
     41#include <windows.h>
     42
    3743#endif
    3844
     
    174180}
    175181
     182#if KJS_MULTIPLE_THREADS
     183
    176184struct Collector::Thread {
    177185  Thread(pthread_t pthread, mach_port_t mthread) : posixThread(pthread), machThread(mthread) {}
     
    222230  }
    223231}
     232
     233#endif
    224234
    225235#define IS_POINTER_ALIGNED(p) (((int)(p) & (sizeof(char *) - 1)) == 0)
     
    275285void Collector::markCurrentThreadConservatively()
    276286{
    277   jmp_buf registers;
    278   setjmp(registers);
    279 
    280   pthread_t thread = pthread_self();
    281   void *stackBase = pthread_get_stackaddr_np(thread);
    282   int dummy;
    283   void *stackPointer = &dummy;
    284   markStackObjectsConservatively(stackPointer, stackBase);
    285 }
     287    jmp_buf registers;
     288    setjmp(registers);
     289
     290#if !WIN32
     291    pthread_t thread = pthread_self();
     292    void *stackBase = pthread_get_stackaddr_np(thread);
     293#else
     294    NT_TIB *pTib;
     295    __asm {
     296        MOV EAX, FS:[18h]
     297        MOV pTib, EAX
     298    }
     299    void *stackBase = (void *)pTib->StackBase;
     300#endif
     301
     302    int dummy;
     303    void *stackPointer = &dummy;
     304
     305    markStackObjectsConservatively(stackPointer, stackBase);
     306}
     307
     308#if KJS_MULTIPLE_THREADS
    286309
    287310typedef unsigned long usword_t; // word size, assumed to be either 32 or 64 bit
     
    324347}
    325348
     349#endif
     350
    326351void Collector::markStackObjectsConservatively()
    327352{
    328353  markCurrentThreadConservatively();
    329354
     355#if KJS_MULTIPLE_THREADS
    330356  for (Thread *thread = registeredThreads; thread != NULL; thread = thread->next) {
    331357    if (thread->posixThread != pthread_self()) {
     
    333359    }
    334360  }
     361#endif
    335362}
    336363
Note: See TracChangeset for help on using the changeset viewer.