Changeset 52791 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Jan 5, 2010, 12:58:28 AM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Collector.cpp
r52729 r52791 46 46 #include <wtf/VMTags.h> 47 47 48 #if PLATFORM(DARWIN)48 #if OS(DARWIN) 49 49 50 50 #include <mach/mach_init.h> … … 54 54 #include <mach/vm_map.h> 55 55 56 #elif PLATFORM(SYMBIAN)56 #elif OS(SYMBIAN) 57 57 #include <e32std.h> 58 58 #include <e32cmn.h> 59 59 #include <unistd.h> 60 60 61 #elif PLATFORM(WIN_OS)61 #elif OS(WINDOWS) 62 62 63 63 #include <windows.h> 64 64 #include <malloc.h> 65 65 66 #elif PLATFORM(HAIKU)66 #elif OS(HAIKU) 67 67 68 68 #include <OS.h> 69 69 70 #elif PLATFORM(UNIX)70 #elif OS(UNIX) 71 71 72 72 #include <stdlib.h> 73 #if ! PLATFORM(HAIKU)73 #if !OS(HAIKU) 74 74 #include <sys/mman.h> 75 75 #endif 76 76 #include <unistd.h> 77 77 78 #if PLATFORM(SOLARIS)78 #if OS(SOLARIS) 79 79 #include <thread.h> 80 80 #else … … 86 86 #endif 87 87 88 #if PLATFORM(QNX)88 #if OS(QNX) 89 89 #include <fcntl.h> 90 90 #include <sys/procfs.h> … … 110 110 #define MIN_ARRAY_SIZE (static_cast<size_t>(14)) 111 111 112 #if PLATFORM(SYMBIAN)112 #if OS(SYMBIAN) 113 113 const size_t MAX_NUM_BLOCKS = 256; // Max size of collector heap set to 16 MB 114 114 static RHeap* userChunk = 0; … … 117 117 #if ENABLE(JSC_MULTIPLE_THREADS) 118 118 119 #if PLATFORM(DARWIN)119 #if OS(DARWIN) 120 120 typedef mach_port_t PlatformThread; 121 #elif PLATFORM(WIN_OS)121 #elif OS(WINDOWS) 122 122 typedef HANDLE PlatformThread; 123 123 #endif … … 150 150 ASSERT(globalData); 151 151 152 #if PLATFORM(SYMBIAN)152 #if OS(SYMBIAN) 153 153 // Symbian OpenC supports mmap but currently not the MAP_ANON flag. 154 154 // Using fastMalloc() does not properly align blocks on 64k boundaries … … 168 168 CRASH(); 169 169 } 170 #endif // PLATFORM(SYMBIAN)170 #endif // OS(SYMBIAN) 171 171 172 172 memset(&m_heap, 0, sizeof(CollectorHeap)); … … 215 215 NEVER_INLINE CollectorBlock* Heap::allocateBlock() 216 216 { 217 #if PLATFORM(DARWIN)217 #if OS(DARWIN) 218 218 vm_address_t address = 0; 219 219 vm_map(current_task(), &address, BLOCK_SIZE, BLOCK_OFFSET_MASK, VM_FLAGS_ANYWHERE | VM_TAG_FOR_COLLECTOR_MEMORY, MEMORY_OBJECT_NULL, 0, FALSE, VM_PROT_DEFAULT, VM_PROT_DEFAULT, VM_INHERIT_DEFAULT); 220 #elif PLATFORM(SYMBIAN)220 #elif OS(SYMBIAN) 221 221 // Allocate a 64 kb aligned CollectorBlock 222 222 unsigned char* mask = reinterpret_cast<unsigned char*>(userChunk->Alloc(BLOCK_SIZE)); … … 224 224 CRASH(); 225 225 uintptr_t address = reinterpret_cast<uintptr_t>(mask); 226 #elif PLATFORM(WINCE)226 #elif OS(WINCE) 227 227 void* address = VirtualAlloc(NULL, BLOCK_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); 228 #elif PLATFORM(WIN_OS)228 #elif OS(WINDOWS) 229 229 #if COMPILER(MINGW) 230 230 void* address = __mingw_aligned_malloc(BLOCK_SIZE, BLOCK_SIZE); … … 309 309 NEVER_INLINE void Heap::freeBlockPtr(CollectorBlock* block) 310 310 { 311 #if PLATFORM(DARWIN)311 #if OS(DARWIN) 312 312 vm_deallocate(current_task(), reinterpret_cast<vm_address_t>(block), BLOCK_SIZE); 313 #elif PLATFORM(SYMBIAN)313 #elif OS(SYMBIAN) 314 314 userChunk->Free(reinterpret_cast<TAny*>(block)); 315 #elif PLATFORM(WINCE)315 #elif OS(WINCE) 316 316 VirtualFree(block, 0, MEM_RELEASE); 317 #elif PLATFORM(WIN_OS)317 #elif OS(WINDOWS) 318 318 #if COMPILER(MINGW) 319 319 __mingw_aligned_free(block); … … 451 451 } 452 452 453 #if PLATFORM(WINCE)453 #if OS(WINCE) 454 454 void* g_stackBase = 0; 455 455 … … 508 508 #endif 509 509 510 #if PLATFORM(QNX)510 #if OS(QNX) 511 511 static inline void *currentThreadStackBaseQNX() 512 512 { … … 537 537 static inline void* currentThreadStackBase() 538 538 { 539 #if PLATFORM(DARWIN)539 #if OS(DARWIN) 540 540 pthread_t thread = pthread_self(); 541 541 return pthread_get_stackaddr_np(thread); 542 #elif PLATFORM(WIN_OS) && CPU(X86) && COMPILER(MSVC)542 #elif OS(WINDOWS) && CPU(X86) && COMPILER(MSVC) 543 543 // offset 0x18 from the FS segment register gives a pointer to 544 544 // the thread information block for the current thread … … 549 549 } 550 550 return static_cast<void*>(pTib->StackBase); 551 #elif PLATFORM(WIN_OS) && CPU(X86_64) && COMPILER(MSVC) 551 #elif OS(WINDOWS) && CPU(X86_64) && COMPILER(MSVC) 552 // FIXME: why only for MSVC? 552 553 PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb()); 553 554 return reinterpret_cast<void*>(pTib->StackBase); 554 #elif PLATFORM(WIN_OS) && CPU(X86) && COMPILER(GCC)555 #elif OS(WINDOWS) && CPU(X86) && COMPILER(GCC) 555 556 // offset 0x18 from the FS segment register gives a pointer to 556 557 // the thread information block for the current thread … … 560 561 ); 561 562 return static_cast<void*>(pTib->StackBase); 562 #elif PLATFORM(QNX)563 #elif OS(QNX) 563 564 return currentThreadStackBaseQNX(); 564 #elif PLATFORM(SOLARIS)565 #elif OS(SOLARIS) 565 566 stack_t s; 566 567 thr_stksegment(&s); 567 568 return s.ss_sp; 568 #elif PLATFORM(OPENBSD)569 #elif OS(OPENBSD) 569 570 pthread_t thread = pthread_self(); 570 571 stack_t stack; 571 572 pthread_stackseg_np(thread, &stack); 572 573 return stack.ss_sp; 573 #elif PLATFORM(SYMBIAN)574 #elif OS(SYMBIAN) 574 575 static void* stackBase = 0; 575 576 if (stackBase == 0) { … … 580 581 } 581 582 return (void*)stackBase; 582 #elif PLATFORM(HAIKU)583 #elif OS(HAIKU) 583 584 thread_info threadInfo; 584 585 get_thread_info(find_thread(NULL), &threadInfo); 585 586 return threadInfo.stack_end; 586 #elif PLATFORM(UNIX)587 #elif OS(UNIX) 587 588 static void* stackBase = 0; 588 589 static size_t stackSize = 0; … … 592 593 pthread_attr_t sattr; 593 594 pthread_attr_init(&sattr); 594 #if HAVE(PTHREAD_NP_H) || PLATFORM(NETBSD)595 #if HAVE(PTHREAD_NP_H) || OS(NETBSD) 595 596 // e.g. on FreeBSD 5.4, [email protected] 596 597 pthread_attr_get_np(thread, &sattr); … … 606 607 } 607 608 return static_cast<char*>(stackBase) + stackSize; 608 #elif PLATFORM(WINCE)609 #elif OS(WINCE) 609 610 if (g_stackBase) 610 611 return g_stackBase; … … 622 623 static inline PlatformThread getCurrentPlatformThread() 623 624 { 624 #if PLATFORM(DARWIN)625 #if OS(DARWIN) 625 626 return pthread_mach_thread_np(pthread_self()); 626 #elif PLATFORM(WIN_OS)627 #elif OS(WINDOWS) 627 628 return pthread_getw32threadhandle_np(pthread_self()); 628 629 #endif … … 800 801 static inline void suspendThread(const PlatformThread& platformThread) 801 802 { 802 #if PLATFORM(DARWIN)803 #if OS(DARWIN) 803 804 thread_suspend(platformThread); 804 #elif PLATFORM(WIN_OS)805 #elif OS(WINDOWS) 805 806 SuspendThread(platformThread); 806 807 #else … … 811 812 static inline void resumeThread(const PlatformThread& platformThread) 812 813 { 813 #if PLATFORM(DARWIN)814 #if OS(DARWIN) 814 815 thread_resume(platformThread); 815 #elif PLATFORM(WIN_OS)816 #elif OS(WINDOWS) 816 817 ResumeThread(platformThread); 817 818 #else … … 822 823 typedef unsigned long usword_t; // word size, assumed to be either 32 or 64 bit 823 824 824 #if PLATFORM(DARWIN)825 #if OS(DARWIN) 825 826 826 827 #if CPU(X86) … … 838 839 #endif 839 840 840 #elif PLATFORM(WIN_OS)&& CPU(X86)841 #elif OS(WINDOWS) && CPU(X86) 841 842 typedef CONTEXT PlatformThreadRegisters; 842 843 #else … … 846 847 static size_t getPlatformThreadRegisters(const PlatformThread& platformThread, PlatformThreadRegisters& regs) 847 848 { 848 #if PLATFORM(DARWIN)849 #if OS(DARWIN) 849 850 850 851 #if CPU(X86) … … 874 875 } 875 876 return user_count * sizeof(usword_t); 876 // end PLATFORM(DARWIN)877 878 #elif PLATFORM(WIN_OS) && CPU(X86)877 // end OS(DARWIN) 878 879 #elif OS(WINDOWS) && CPU(X86) 879 880 regs.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL | CONTEXT_SEGMENTS; 880 881 GetThreadContext(platformThread, ®s); … … 887 888 static inline void* otherThreadStackPointer(const PlatformThreadRegisters& regs) 888 889 { 889 #if PLATFORM(DARWIN)890 #if OS(DARWIN) 890 891 891 892 #if __DARWIN_UNIX03 … … 917 918 #endif // __DARWIN_UNIX03 918 919 919 // end PLATFORM(DARWIN)920 #elif CPU(X86) && PLATFORM(WIN_OS)920 // end OS(DARWIN) 921 #elif CPU(X86) && OS(WINDOWS) 921 922 return reinterpret_cast<void*>((uintptr_t) regs.Esp); 922 923 #else -
trunk/JavaScriptCore/runtime/Collector.h
r52176 r52791 182 182 template<> struct CellSize<sizeof(uint64_t)> { static const size_t m_value = 64; }; 183 183 184 #if PLATFORM(WINCE) || PLATFORM(SYMBIAN)184 #if OS(WINCE) || OS(SYMBIAN) 185 185 const size_t BLOCK_SIZE = 64 * 1024; // 64k 186 186 #else -
trunk/JavaScriptCore/runtime/DateConstructor.cpp
r52028 r52791 36 36 #include <wtf/MathExtras.h> 37 37 38 #if PLATFORM(WINCE) && !PLATFORM(QT)38 #if OS(WINCE) && !PLATFORM(QT) 39 39 extern "C" time_t time(time_t* timer); // Provided by libce. 40 40 #endif -
trunk/JavaScriptCore/runtime/DatePrototype.cpp
r52028 r52791 60 60 #endif 61 61 62 #if PLATFORM(WINCE) && !PLATFORM(QT)62 #if OS(WINCE) && !PLATFORM(QT) 63 63 extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t); //provided by libce 64 64 #endif … … 198 198 #if HAVE(LANGINFO_H) 199 199 static const nl_item formats[] = { D_T_FMT, D_FMT, T_FMT }; 200 #elif ( PLATFORM(WINCE) && !PLATFORM(QT)) || PLATFORM(SYMBIAN)200 #elif (OS(WINCE) && !PLATFORM(QT)) || OS(SYMBIAN) 201 201 // strftime() does not support '#' on WinCE or Symbian 202 202 static const char* const formatStrings[] = { "%c", "%x", "%X" }; -
trunk/JavaScriptCore/runtime/InitializeThreading.cpp
r50608 r52791 42 42 namespace JSC { 43 43 44 #if PLATFORM(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)44 #if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS) 45 45 static pthread_once_t initializeThreadingKeyOnce = PTHREAD_ONCE_INIT; 46 46 #endif … … 58 58 void initializeThreading() 59 59 { 60 #if PLATFORM(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS)60 #if OS(DARWIN) && ENABLE(JSC_MULTIPLE_THREADS) 61 61 pthread_once(&initializeThreadingKeyOnce, initializeThreadingOnce); 62 62 #else -
trunk/JavaScriptCore/runtime/MarkStack.h
r51461 r52791 154 154 if (size == m_allocated) 155 155 return; 156 #if PLATFORM(WIN_OS) || PLATFORM(SYMBIAN)156 #if OS(WINDOWS) || OS(SYMBIAN) 157 157 // We cannot release a part of a region with VirtualFree. To get around this, 158 158 // we'll release the entire region and reallocate the size that we want. -
trunk/JavaScriptCore/runtime/MarkStackPosix.cpp
r52355 r52791 27 27 #include "MarkStack.h" 28 28 29 #if PLATFORM(UNIX) && !PLATFORM(SYMBIAN)29 #if OS(UNIX) && !OS(SYMBIAN) 30 30 31 31 #include <unistd.h> -
trunk/JavaScriptCore/runtime/MarkStackSymbian.cpp
r52355 r52791 21 21 #include "MarkStack.h" 22 22 23 #if PLATFORM(SYMBIAN)23 #if OS(SYMBIAN) 24 24 25 25 #include <e32hal.h> -
trunk/JavaScriptCore/runtime/MarkStackWin.cpp
r52355 r52791 27 27 #include "MarkStack.h" 28 28 29 #if PLATFORM(WIN_OS)29 #if OS(WINDOWS) 30 30 31 31 #include "windows.h" -
trunk/JavaScriptCore/runtime/StringPrototype.cpp
r52346 r52791 480 480 else if (!(dpos <= len)) // true for NaN 481 481 dpos = len; 482 #if PLATFORM(SYMBIAN)482 #if OS(SYMBIAN) 483 483 // Work around for broken NaN compare operator 484 484 else if (isnan(dpos)) -
trunk/JavaScriptCore/runtime/TimeoutChecker.cpp
r48736 r52791 34 34 #include "JSGlobalObject.h" 35 35 36 #if PLATFORM(DARWIN)36 #if OS(DARWIN) 37 37 #include <mach/mach.h> 38 #elif PLATFORM(WIN_OS)38 #elif OS(WINDOWS) 39 39 #include <windows.h> 40 40 #else … … 55 55 static inline unsigned getCPUTime() 56 56 { 57 #if PLATFORM(DARWIN)57 #if OS(DARWIN) 58 58 mach_msg_type_number_t infoCount = THREAD_BASIC_INFO_COUNT; 59 59 thread_basic_info_data_t info; … … 68 68 69 69 return time; 70 #elif PLATFORM(WIN_OS)70 #elif OS(WINDOWS) 71 71 union { 72 72 FILETIME fileTime; -
trunk/JavaScriptCore/runtime/UString.cpp
r52463 r52791 290 290 else if (i == std::numeric_limits<long long>::min()) { 291 291 char minBuf[1 + sizeof(i) * 3]; 292 #if PLATFORM(WIN_OS)292 #if OS(WINDOWS) 293 293 snprintf(minBuf, sizeof(minBuf) - 1, "%I64d", std::numeric_limits<long long>::min()); 294 294 #else
Note:
See TracChangeset
for help on using the changeset viewer.