Changeset 11918 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jan 6, 2006, 2:43:44 PM (19 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSLock.cpp
r11304 r11918 72 72 void JSLock::lock() 73 73 { 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(); 74 79 } 75 80 -
trunk/JavaScriptCore/kjs/array_object.cpp
r11785 r11918 38 38 #include <stdio.h> 39 39 #include <assert.h> 40 41 template class KJS::JSObject * const & KXMLCore::identityExtract<class KJS::JSObject *>(class KJS::JSObject * const &); 40 42 41 43 using namespace KJS; -
trunk/JavaScriptCore/kjs/collector.cpp
r11566 r11918 43 43 #elif WIN32 44 44 45 #undef ERROR 45 46 #include <windows.h> 46 47 … … 159 160 allocateNewBlock: 160 161 // didn't find one, need to allocate a new block 161 162 162 size_t numBlocks = heap.numBlocks; 163 163 if (usedBlocks == numBlocks) { … … 591 591 } 592 592 593 #if APPLE_CHANGES593 #if __APPLE__ 594 594 595 595 static const char *className(JSCell *val) -
trunk/JavaScriptCore/kjs/date_object.cpp
r11640 r11918 60 60 #define isfinite(x) _finite(x) 61 61 #define strncasecmp(x, y, z) strnicmp(x, y, z) 62 #endif 62 #define snprintf _snprintf 63 #endif 64 65 inline 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 } 63 74 64 75 namespace KJS { … … 219 230 { 220 231 char buffer[100]; 221 if ( t.tm_gmtoff== 0) {232 if (gmtoffset(t) == 0) { 222 233 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT", t.tm_hour, t.tm_min, t.tm_sec); 223 234 } else { 224 int offset = abs( t.tm_gmtoff);235 int offset = abs(gmtoffset(t)); 225 236 snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d GMT%c%02d%02d", 226 237 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); 228 239 } 229 240 return UString(buffer); … … 548 559 double ms = milli - tv * msPerSecond; 549 560 550 tm t; 551 utc ? gmtime_r(&tv, &t) : localtime_r(&tv, &t); 561 tm t = *(utc ? gmtime(&tv) : localtime(&tv)); 552 562 // We had an out of range year. Restore the year (plus/minus offset 553 563 // found by calculating tm_year) and fix the week day calculation. … … 770 780 { 771 781 time_t t = time(0); 772 tm ts; 773 localtime_r(&t, &ts); 782 tm ts = *localtime(&t); 774 783 return jsString(formatDate(ts) + " " + formatTime(ts)); 775 784 } … … 900 909 if (!utc) { 901 910 time_t tval = mktime(t) + (time_t)((ms + yearOffset) / 1000); 902 struct tm t3; 903 localtime_r(&tval, &t3); 911 tm t3 = *localtime(&tval); 904 912 t->tm_isdst = t3.tm_isdst; 905 913 } -
trunk/JavaScriptCore/kjs/identifier.cpp
r11769 r11918 41 41 #include <string.h> // for strlen 42 42 #include <new> // for placement new 43 44 template struct KJS::UString::Rep * const & KXMLCore::identityExtract<struct KJS::UString::Rep *>(struct KJS::UString::Rep * const &); 43 45 44 46 namespace KXMLCore { -
trunk/JavaScriptCore/kjs/internal.cpp
r11661 r11918 52 52 #define copysign(a, b) _copysign(a, b) 53 53 #endif 54 55 template void * const & KXMLCore::extractFirst<struct std::pair<void *,void *>>(struct std::pair<void *, void *> const &); 54 56 55 57 extern int kjsyyparse(); -
trunk/JavaScriptCore/kjs/interpreter.cpp
r11637 r11918 308 308 #endif 309 309 310 #if APPLE_CHANGES311 310 static bool printExceptions = false; 312 311 … … 321 320 } 322 321 323 322 #if __APPLE__ 324 323 void *Interpreter::createLanguageInstanceForValue(ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current) 325 324 { -
trunk/JavaScriptCore/kjs/interpreter.h
r11614 r11918 389 389 */ 390 390 virtual bool isSafeScript (const Interpreter *target) { return true; } 391 391 392 #if __APPLE__ 392 393 virtual void *createLanguageInstanceForValue(ExecState*, int language, JSObject* value, const Bindings::RootObject* origin, const Bindings::RootObject* current); 394 #endif 393 395 394 396 // This is a workaround to avoid accessing the global variables for these identifiers in -
trunk/JavaScriptCore/kjs/math_object.cpp
r11801 r11918 263 263 case MathObjectImp::Random: 264 264 if (!randomSeeded) { 265 srand dev();265 srand(time(0)); 266 266 randomSeeded = true; 267 267 } -
trunk/JavaScriptCore/kxmlcore/Assertions.h
r10634 r11918 36 36 // Defining any of the symbols explicitly prevents this from having any effect. 37 37 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 38 41 #ifdef NDEBUG 39 42 #define ASSERTIONS_DISABLED_DEFAULT 1 40 43 #else 41 44 #define ASSERTIONS_DISABLED_DEFAULT 0 45 #endif 42 46 #endif 43 47 … … 62 66 #endif 63 67 68 #ifdef __GNUC__ 69 #define KXMLCORE_PRETTY_FUNCTION __PRETTY_FUNCTION__ 70 #else 71 #define KXMLCORE_PRETTY_FUNCTION __FUNCTION__ 72 #endif 73 64 74 // These helper functions are always declared, but not necessarily always defined if the corresponding function is disabled. 65 75 … … 75 85 KXCLogChannelState state; 76 86 } KXCLogChannel; 77 87 78 88 void KXCReportAssertionFailure(const char *file, int line, const char *function, const char *assertion); 79 89 void KXCReportAssertionFailureWithMessage(const char *file, int line, const char *function, const char *assertion, const char *format, ...); … … 96 106 97 107 #define ASSERT(assertion) ((void)0) 98 #define ASSERT_WITH_MESSAGE(assertion, formatAndArgs ...) ((void)0)108 #define ASSERT_WITH_MESSAGE(assertion, formatAndArgs, ...) ((void)0) 99 109 #define ASSERT_NOT_REACHED() ((void)0) 100 110 … … 103 113 #define ASSERT(assertion) do \ 104 114 if (!(assertion)) { \ 105 KXCReportAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #assertion); \115 KXCReportAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #assertion); \ 106 116 CRASH(); \ 107 117 } \ 108 118 while (0) 109 #define ASSERT_WITH_MESSAGE(assertion, formatAndArgs ...) do \119 #define ASSERT_WITH_MESSAGE(assertion, formatAndArgs, ...) do \ 110 120 if (!(assertion)) { \ 111 KXCReportAssertionFailureWithMessage(__FILE__, __LINE__, __PRETTY_FUNCTION__, #assertion, formatAndArgs); \121 KXCReportAssertionFailureWithMessage(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #assertion, formatAndArgs); \ 112 122 CRASH(); \ 113 123 } \ 114 124 while (0) 115 125 #define ASSERT_NOT_REACHED() do { \ 116 KXCReportAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, 0); \126 KXCReportAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, 0); \ 117 127 CRASH(); \ 118 128 } while (0) … … 130 140 #define ASSERT_ARG(argName, assertion) do \ 131 141 if (!(assertion)) { \ 132 KXCReportArgumentAssertionFailure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #argName, #assertion); \142 KXCReportArgumentAssertionFailure(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, #argName, #assertion); \ 133 143 CRASH(); \ 134 144 } \ … … 140 150 141 151 #if FATAL_DISABLED 142 #define FATAL(formatAndArgs ...) ((void)0)152 #define FATAL(formatAndArgs, ...) ((void)0) 143 153 #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); \ 146 156 CRASH(); \ 147 157 } while (0) … … 151 161 152 162 #if ERROR_DISABLED 153 #define ERROR(formatAndArgs ...) ((void)0)163 #define ERROR(formatAndArgs, ...) ((void)0) 154 164 #else 155 #define ERROR(formatAndArgs ...) KXCReportError(__FILE__, __LINE__, __PRETTY_FUNCTION__, formatAndArgs)165 #define ERROR(formatAndArgs, ...) KXCReportError(__FILE__, __LINE__, KXMLCORE_PRETTY_FUNCTION, formatAndArgs) 156 166 #endif 157 167 … … 159 169 160 170 #if LOG_DISABLED 161 #define LOG(channel, formatAndArgs ...) ((void)0)171 #define LOG(channel, formatAndArgs, ...) ((void)0) 162 172 #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) 164 174 #define JOIN_LOG_CHANNEL_WITH_PREFIX(prefix, channel) JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) 165 175 #define JOIN_LOG_CHANNEL_WITH_PREFIX_LEVEL_2(prefix, channel) prefix ## channel -
trunk/JavaScriptCore/kxmlcore/FastMalloc.cpp
r10867 r11918 96 96 } 97 97 98 #ifndef WIN32 98 99 void fastMallocRegisterThread(pthread_t thread) 99 100 { 100 101 } 102 #endif 101 103 102 104 } // namespace KJS -
trunk/JavaScriptCore/kxmlcore/FastMallocInternal.h
r10701 r11918 24 24 #define KXMLCORE_FAST_MALLOC_INTERNAL_H 25 25 26 #ifndef WIN32 27 26 28 #include <pthread.h> 27 29 … … 30 32 } 31 33 34 #endif 35 32 36 #endif // KXMLCORE_FAST_MALLOC_INTERNAL_H -
trunk/JavaScriptCore/kxmlcore/TCSystemAlloc.cpp
r10724 r11918 39 39 #include <sys/types.h> 40 40 #endif 41 #ifndef WIN32 41 42 #include <unistd.h> 43 #include <sys/mman.h> 44 #endif 42 45 #include <fcntl.h> 43 #include <sys/mman.h>44 46 #include "TCSystemAlloc.h" 45 47 #include "TCSpinLock.h" -
trunk/JavaScriptCore/pcre/pcre.h
r10495 r11918 70 70 71 71 #define PCRE_UTF16 1 72 73 /* Win32 uses DLL by default; it needs special stuff for exported functions. */74 75 #ifdef _WIN3276 # ifdef PCRE_DEFINITION77 # ifdef DLL_EXPORT78 # define PCRE_DATA_SCOPE __declspec(dllexport)79 # endif80 # else81 # ifndef PCRE_STATIC82 # define PCRE_DATA_SCOPE extern __declspec(dllimport)83 # endif84 # endif85 #endif86 72 87 73 /* For other operating systems, we use the standard "extern". */ -
trunk/JavaScriptCore/pcre/pcre_compile.c
r10495 r11918 1357 1357 #if PCRE_UTF16 1358 1358 1359 static inline BOOL strequal(const pcre_uchar *str1, int len, const char *str2)1359 static __inline BOOL strequal(const pcre_uchar *str1, int len, const char *str2) 1360 1360 { 1361 1361 int i; … … 4894 4894 ++ptr; 4895 4895 } 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 } 4901 4904 } 4902 4905 #else -
trunk/JavaScriptCore/pcre/pcre_exec.c
r10798 r11918 1808 1808 GETUTF8CHARLEN(fc, ecode, length); 1809 1809 #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: 1819 1816 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 } 1825 1827 #else 1826 1828 if (length > md->end_subject - eptr) RRETURN(MATCH_NOMATCH); … … 1946 1948 #ifdef SUPPORT_UTF8 1947 1949 #if PCRE_UTF16 1948 length = 1; 1950 1951 length = 1; 1949 1952 GETUTF8CHARLEN(fc, ecode, length); 1953 { 1950 1954 int utf16Length; // don't initialize on this line as workaround for Win32 compile problem 1951 1955 utf16Length = fc > 0xFFFF ? 2 : 1; … … 2051 2055 } 2052 2056 /* Control never gets here */ 2057 } 2053 2058 #else 2054 2059 if (utf8)
Note:
See TracChangeset
for help on using the changeset viewer.