Changeset 11918 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jan 6, 2006, 2:43:44 PM (19 years ago)
Author:
hyatt
Message:

Land all the changes to make JSCore build again on windows.

Location:
trunk/JavaScriptCore
Files:
16 edited

Legend:

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

    r11304 r11918  
    7272void JSLock::lock()
    7373{
     74  // FIXME: Hack-o-rama. To prevent construction of a global object with a null prototype (4342216),
     75  // we need to intialize our constants before the first object is constructed. InterpreterImp::lock()
     76  // is a good place to do this because you have to call it before doing any allocations. Once we change our
     77  // implementation to use immediate values, we should remove this code.
     78  ConstantValues::initIfNeeded();
    7479}
    7580
  • trunk/JavaScriptCore/kjs/array_object.cpp

    r11785 r11918  
    3838#include <stdio.h>
    3939#include <assert.h>
     40
     41template class KJS::JSObject * const & KXMLCore::identityExtract<class KJS::JSObject *>(class KJS::JSObject * const &);
    4042
    4143using namespace KJS;
  • trunk/JavaScriptCore/kjs/collector.cpp

    r11566 r11918  
    4343#elif WIN32
    4444
     45#undef ERROR
    4546#include <windows.h>
    4647
     
    159160allocateNewBlock:
    160161    // didn't find one, need to allocate a new block
    161 
    162162    size_t numBlocks = heap.numBlocks;
    163163    if (usedBlocks == numBlocks) {
     
    591591}
    592592
    593 #if APPLE_CHANGES
     593#if __APPLE__
    594594
    595595static const char *className(JSCell *val)
  • trunk/JavaScriptCore/kjs/date_object.cpp

    r11640 r11918  
    6060#define isfinite(x) _finite(x)
    6161#define strncasecmp(x, y, z) strnicmp(x, y, z)
    62 #endif
     62#define snprintf _snprintf
     63#endif
     64
     65inline int gmtoffset(const tm& t)
     66{
     67#if WIN32
     68    // FIXME: This might not be completely correct if the time is not the current timezone.
     69    return -(timezone / 60 - (t.tm_isdst > 0 ? 60 : 0 )) * 60;
     70#else
     71    return t.tm_gmtoff;
     72#endif
     73}
    6374
    6475namespace KJS {
     
    219230{
    220231    char buffer[100];
    221     if (t.tm_gmtoff == 0) {
     232    if (gmtoffset(t) == 0) {
    222233        snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.tm_hour, t.tm_min, t.tm_sec);
    223234    } else {
    224         int offset = abs(t.tm_gmtoff);
     235        int offset = abs(gmtoffset(t));
    225236        snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d",
    226237            t.tm_hour, t.tm_min, t.tm_sec,
    227             t.tm_gmtoff < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
     238            gmtoffset(t) < 0 ? '-' : '+', offset / (60*60), (offset / 60) % 60);
    228239    }
    229240    return UString(buffer);
     
    548559  double ms = milli - tv * msPerSecond;
    549560
    550   tm t;
    551   utc ? gmtime_r(&tv, &t) : localtime_r(&tv, &t);
     561  tm t = *(utc ? gmtime(&tv) : localtime(&tv));
    552562  // We had an out of range year. Restore the year (plus/minus offset
    553563  // found by calculating tm_year) and fix the week day calculation.
     
    770780{
    771781    time_t t = time(0);
    772     tm ts;
    773     localtime_r(&t, &ts);
     782    tm ts = *localtime(&t);
    774783    return jsString(formatDate(ts) + " " + formatTime(ts));
    775784}
     
    900909    if (!utc) {
    901910        time_t tval = mktime(t) + (time_t)((ms + yearOffset) / 1000); 
    902         struct tm t3; 
    903         localtime_r(&tval, &t3); 
     911        tm t3 = *localtime(&tval); 
    904912        t->tm_isdst = t3.tm_isdst; 
    905913    }
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r11769 r11918  
    4141#include <string.h> // for strlen
    4242#include <new> // for placement new
     43
     44template struct KJS::UString::Rep * const & KXMLCore::identityExtract<struct KJS::UString::Rep *>(struct KJS::UString::Rep * const &);
    4345
    4446namespace KXMLCore {
  • trunk/JavaScriptCore/kjs/internal.cpp

    r11661 r11918  
    5252#define copysign(a, b) _copysign(a, b)
    5353#endif
     54
     55template void * const & KXMLCore::extractFirst<struct std::pair<void *,void *>>(struct std::pair<void *, void *> const &);
    5456
    5557extern int kjsyyparse();
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r11637 r11918  
    308308#endif
    309309
    310 #if APPLE_CHANGES
    311310static bool printExceptions = false;
    312311
     
    321320}
    322321
    323 
     322#if __APPLE__
    324323void *Interpreter::createLanguageInstanceForValue(ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
    325324{
  • trunk/JavaScriptCore/kjs/interpreter.h

    r11614 r11918  
    389389     */
    390390    virtual bool isSafeScript (const Interpreter *target) { return true; }
    391    
     391 
     392#if __APPLE__
    392393    virtual void *createLanguageInstanceForValue(ExecState*, int language, JSObject* value, const Bindings::RootObject* origin, const Bindings::RootObject* current);
     394#endif
    393395
    394396    // This is a workaround to avoid accessing the global variables for these identifiers in
  • trunk/JavaScriptCore/kjs/math_object.cpp

    r11801 r11918  
    263263  case MathObjectImp::Random:
    264264      if (!randomSeeded) {
    265           sranddev();
     265          srand(time(0));
    266266          randomSeeded = true;
    267267      }
  • trunk/JavaScriptCore/kxmlcore/Assertions.h

    r10634 r11918  
    3636// Defining any of the symbols explicitly prevents this from having any effect.
    3737
     38#ifdef WIN32
     39#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.
     40#else
    3841#ifdef NDEBUG
    3942#define ASSERTIONS_DISABLED_DEFAULT 1
    4043#else
    4144#define ASSERTIONS_DISABLED_DEFAULT 0
     45#endif
    4246#endif
    4347
     
    6266#endif
    6367
     68#ifdef __GNUC__
     69#define KXMLCORE_PRETTY_FUNCTION __PRETTY_FUNCTION__
     70#else
     71#define KXMLCORE_PRETTY_FUNCTION __FUNCTION__
     72#endif
     73
    6474// These helper functions are always declared, but not necessarily always defined if the corresponding function is disabled.
    6575
     
    7585    KXCLogChannelState state;
    7686} KXCLogChannel;
    77    
     87
    7888void KXCReportAssertionFailure(const char *file, int line, const char *function, const char *assertion);
    7989void KXCReportAssertionFailureWithMessage(const char *file, int line, const char *function, const char *assertion, const char *format, ...);
     
    96106
    97107#define ASSERT(assertion) ((void)0)
    98 #define ASSERT_WITH_MESSAGE(assertion, formatAndArgs...) ((void)0)
     108#define ASSERT_WITH_MESSAGE(assertion, formatAndArgs, ...) ((void)0)
    99109#define ASSERT_NOT_REACHED() ((void)0)
    100110
     
    103113#define ASSERT(assertion) do \
    104114    if (!(assertion)) { \
    105         KXCReportAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #assertion); \
     115        KXCReportAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #assertion); \
    106116        CRASH(); \
    107117    } \
    108118while (0)
    109 #define ASSERT_WITH_MESSAGE(assertion, formatAndArgs...) do \
     119#define ASSERT_WITH_MESSAGE(assertion, formatAndArgs, ...) do \
    110120    if (!(assertion)) { \
    111         KXCReportAssertionFailureWithMessage(__FILE__, __LINE__, __PRETTY_FUNCTION__, #assertion, formatAndArgs); \
     121        KXCReportAssertionFailureWithMessage(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #assertion, formatAndArgs); \
    112122        CRASH(); \
    113123    } \
    114124while (0)
    115125#define ASSERT_NOT_REACHED() do { \
    116     KXCReportAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, 0); \
     126    KXCReportAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, 0); \
    117127    CRASH(); \
    118128} while (0)
     
    130140#define ASSERT_ARG(argName, assertion) do \
    131141    if (!(assertion)) { \
    132         KXCReportArgumentAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #argName, #assertion); \
     142        KXCReportArgumentAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #argName, #assertion); \
    133143        CRASH(); \
    134144    } \
     
    140150
    141151#if FATAL_DISABLED
    142 #define FATAL(formatAndArgs...) ((void)0)
     152#define FATAL(formatAndArgs, ...) ((void)0)
    143153#else
    144 #define FATAL(formatAndArgs...) do { \
    145     KXCReportFatalError(__FILE__, __LINE__, __PRETTY_FUNCTION__, formatAndArgs); \
     154#define FATAL(formatAndArgs, ...) do { \
     155    KXCReportFatalError(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, formatAndArgs); \
    146156    CRASH(); \
    147157} while (0)
     
    151161
    152162#if ERROR_DISABLED
    153 #define ERROR(formatAndArgs...) ((void)0)
     163#define ERROR(formatAndArgs, ...) ((void)0)
    154164#else
    155 #define ERROR(formatAndArgs...) KXCReportError(__FILE__, __LINE__, __PRETTY_FUNCTION__, formatAndArgs)
     165#define ERROR(formatAndArgs, ...) KXCReportError(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, formatAndArgs)
    156166#endif
    157167
     
    159169
    160170#if LOG_DISABLED
    161 #define LOG(channel, formatAndArgs...) ((void)0)
     171#define LOG(channel, formatAndArgs, ...) ((void)0)
    162172#else
    163 #define LOG(channel, formatAndArgs...) KXCLog(__FILE__, __LINE__, __PRETTY_FUNCTION__, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), formatAndArgs)
     173#define LOG(channel, formatAndArgs, ...) KXCLog(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), formatAndArgs)
    164174#define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel)
    165175#define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel
  • trunk/JavaScriptCore/kxmlcore/FastMalloc.cpp

    r10867 r11918  
    9696}
    9797
     98#ifndef WIN32
    9899void fastMallocRegisterThread(pthread_t thread)
    99100{
    100101}
     102#endif
    101103
    102104} // namespace KJS
  • trunk/JavaScriptCore/kxmlcore/FastMallocInternal.h

    r10701 r11918  
    2424#define KXMLCORE_FAST_MALLOC_INTERNAL_H
    2525
     26#ifndef WIN32
     27
    2628#include <pthread.h>
    2729
     
    3032}
    3133
     34#endif
     35
    3236#endif //  KXMLCORE_FAST_MALLOC_INTERNAL_H
  • trunk/JavaScriptCore/kxmlcore/TCSystemAlloc.cpp

    r10724 r11918  
    3939#include <sys/types.h>
    4040#endif
     41#ifndef WIN32
    4142#include <unistd.h>
     43#include <sys/mman.h>
     44#endif
    4245#include <fcntl.h>
    43 #include <sys/mman.h>
    4446#include "TCSystemAlloc.h"
    4547#include "TCSpinLock.h"
  • trunk/JavaScriptCore/pcre/pcre.h

    r10495 r11918  
    7070
    7171#define PCRE_UTF16          1
    72 
    73 /* Win32 uses DLL by default; it needs special stuff for exported functions. */
    74 
    75 #ifdef _WIN32
    76 #  ifdef PCRE_DEFINITION
    77 #    ifdef DLL_EXPORT
    78 #      define PCRE_DATA_SCOPE __declspec(dllexport)
    79 #    endif
    80 #  else
    81 #    ifndef PCRE_STATIC
    82 #      define PCRE_DATA_SCOPE extern __declspec(dllimport)
    83 #    endif
    84 #  endif
    85 #endif
    8672
    8773/* For other operating systems, we use the standard "extern". */
  • trunk/JavaScriptCore/pcre/pcre_compile.c

    r10495 r11918  
    13571357#if PCRE_UTF16
    13581358
    1359 static inline BOOL strequal(const pcre_uchar *str1, int len, const char *str2)
     1359static __inline BOOL strequal(const pcre_uchar *str1, int len, const char *str2)
    13601360{
    13611361  int i;
     
    48944894          ++ptr;
    48954895          }
    4896         int i;
    4897         for (i = 0; i < _pcre_utf8_table1_size; i++)
    4898           if (c <= _pcre_utf8_table1[i]) break;
    4899         length += i;
    4900         lastitemlength += i;
     4896       
     4897        {
     4898          int i;
     4899          for (i = 0; i < _pcre_utf8_table1_size; i++)
     4900            if (c <= _pcre_utf8_table1[i]) break;
     4901          length += i;
     4902          lastitemlength += i;
     4903        }
    49014904      }
    49024905#else
  • trunk/JavaScriptCore/pcre/pcre_exec.c

    r10798 r11918  
    18081808      GETUTF8CHARLEN(fc, ecode, length);
    18091809#if PCRE_UTF16
    1810       int dc;
    1811       ecode += length;
    1812       switch (md->end_subject - eptr)
    1813       {
    1814         case 0:
    1815           RRETURN(MATCH_NOMATCH);
    1816         case 1:
    1817           dc = *eptr++;
    1818           if (IS_LEADING_SURROGATE(dc))
     1810      {
     1811        int dc;
     1812        ecode += length;
     1813        switch (md->end_subject - eptr)
     1814        {
     1815          case 0:
    18191816            RRETURN(MATCH_NOMATCH);
    1820           break;
    1821         default:
    1822           GETCHARINC(dc, eptr);
    1823       }
    1824       if (fc != dc) RRETURN(MATCH_NOMATCH);
     1817          case 1:
     1818            dc = *eptr++;
     1819            if (IS_LEADING_SURROGATE(dc))
     1820              RRETURN(MATCH_NOMATCH);
     1821            break;
     1822          default:
     1823            GETCHARINC(dc, eptr);
     1824        }
     1825        if (fc != dc) RRETURN(MATCH_NOMATCH);
     1826     } 
    18251827#else
    18261828      if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH);
     
    19461948#ifdef SUPPORT_UTF8
    19471949#if PCRE_UTF16
    1948       length = 1;
     1950
     1951          length = 1;
    19491952      GETUTF8CHARLEN(fc, ecode, length);
     1953          {
    19501954      int utf16Length; // don't initialize on this line as workaround for Win32 compile problem
    19511955      utf16Length = fc > 0xFFFF ? 2 : 1;
     
    20512055        }
    20522056        /* Control never gets here */
     2057          }
    20532058#else
    20542059    if (utf8)
Note: See TracChangeset for help on using the changeset viewer.