Changeset 74357 in webkit
- Timestamp:
- Dec 20, 2010 12:09:25 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 1 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/Android.mk
r70318 r74357 163 163 wtf/HashTable.cpp \ 164 164 wtf/MainThread.cpp \ 165 jit/PageAllocation.cpp\165 wtf/PageBlock.cpp\ 166 166 wtf/RandomNumber.cpp \ 167 167 wtf/RefCountedLeakCounter.cpp \ -
trunk/JavaScriptCore/CMakeLists.txt
r69516 r74357 172 172 173 173 wtf/DateMath.cpp 174 wtf/Page Allocation.cpp174 wtf/PageBlock.cpp 175 175 ) 176 176 SET(JavaScriptCore_HEADERS ) -
trunk/JavaScriptCore/ChangeLog
r74309 r74357 1 2010-12-17 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Factored common page set management into a new PageBlock base class 6 https://bugs.webkit.org/show_bug.cgi?id=51285 7 8 * Android.mk: 9 * CMakeLists.txt: 10 * GNUmakefile.am: 11 * JavaScriptCore.gypi: 12 * JavaScriptCore.vcproj/WTF/WTF.vcproj: 13 * JavaScriptCore.xcodeproj/project.pbxproj: 14 * interpreter/RegisterFile.h: 15 (JSC::RegisterFile::RegisterFile): 16 * jit/ExecutableAllocator.cpp: 17 (JSC::ExecutableAllocator::intializePageSize): 18 * wtf/PageAllocation.cpp: Removed. 19 * wtf/PageAllocation.h: 20 (WTF::PageAllocation::deallocate): 21 (WTF::PageAllocation::PageAllocation): 22 * wtf/PageReservation.h: 23 (WTF::PageReservation::commit): 24 (WTF::PageReservation::decommit): 25 (WTF::PageReservation::deallocate): 26 (WTF::PageReservation::PageReservation): 27 * wtf/wtf.pri: 28 1 29 2010-12-17 Michael Saboff <msaboff@apple.com> 2 30 -
trunk/JavaScriptCore/GNUmakefile.am
r73109 r74357 476 476 JavaScriptCore/wtf/OwnPtrCommon.h \ 477 477 JavaScriptCore/wtf/OwnPtr.h \ 478 JavaScriptCore/wtf/PageAllocation.cpp \479 478 JavaScriptCore/wtf/PageAllocation.h \ 480 479 JavaScriptCore/wtf/PageReservation.h \ 480 JavaScriptCore/wtf/PageBlock.cpp \ 481 481 JavaScriptCore/wtf/PassOwnArrayPtr.h \ 482 482 JavaScriptCore/wtf/PassOwnPtr.h \ -
trunk/JavaScriptCore/JavaScriptCore.gypi
r73105 r74357 407 407 'wtf/OwnPtr.h', 408 408 'wtf/OwnPtrCommon.h', 409 'wtf/Page Allocation.cpp',409 'wtf/PageBlock.cpp', 410 410 'wtf/PageAllocation.h', 411 411 'wtf/PageReservation', -
trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
r73091 r74357 698 698 </File> 699 699 <File 700 RelativePath="..\..\wtf\Page Allocation.cpp"700 RelativePath="..\..\wtf\PageBlock.cpp" 701 701 > 702 702 </File> -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r73568 r74357 162 162 14A42E400F4F60EE00599099 /* TimeoutChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A42E3E0F4F60EE00599099 /* TimeoutChecker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 163 163 14ABDF600A437FEF00ECCA01 /* JSCallbackObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */; }; 164 14B3EF0512BC24DD00D29EFF /* PageBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 14B3EF0312BC24DD00D29EFF /* PageBlock.h */; settings = {ATTRIBUTES = (Private, ); }; }; 165 14B3EF0612BC24DD00D29EFF /* PageBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */; }; 164 166 14B8EC720A5652090062BE54 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; }; 165 167 14BD59C50A3E8F9F00BAF59C /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; }; … … 206 208 860161E60F3A83C100F84710 /* MacroAssemblerX86Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */; }; 207 209 8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8626BECE11928E3900782FAB /* StringStatics.cpp */; }; 208 8627E5EB11F1281900A313B5 /* PageAllocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8627E5E911F1281900A313B5 /* PageAllocation.cpp */; };209 210 8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8627E5EA11F1281900A313B5 /* PageAllocation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 210 211 862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 719 720 14ABDF5D0A437FEF00ECCA01 /* JSCallbackObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObject.h; sourceTree = "<group>"; }; 720 721 14ABDF5E0A437FEF00ECCA01 /* JSCallbackObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCallbackObject.cpp; sourceTree = "<group>"; }; 722 14B3EF0312BC24DD00D29EFF /* PageBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageBlock.h; sourceTree = "<group>"; }; 723 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; }; 721 724 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.exp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; 722 725 14BD59BF0A3E8F9000BAF59C /* testapi */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testapi; sourceTree = BUILT_PRODUCTS_DIR; }; … … 819 822 860161E20F3A83C100F84710 /* MacroAssemblerX86Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerX86Common.h; sourceTree = "<group>"; }; 820 823 8626BECE11928E3900782FAB /* StringStatics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringStatics.cpp; path = text/StringStatics.cpp; sourceTree = "<group>"; }; 821 8627E5E911F1281900A313B5 /* PageAllocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageAllocation.cpp; sourceTree = "<group>"; };822 824 8627E5EA11F1281900A313B5 /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; }; 823 825 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecimalNumber.h; sourceTree = "<group>"; }; … … 1530 1532 C0A2723F0E509F1E00E96E15 /* NotFound.h */, 1531 1533 933F5CDB126922690049191E /* NullPtr.h */, 1534 1400067612A6F7830064D123 /* OSAllocator.h */, 1532 1535 1400069212A6F9E10064D123 /* OSAllocatorPosix.cpp */, 1533 1400067612A6F7830064D123 /* OSAllocator.h */,1534 1536 9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */, 1535 1537 BCFBE697122561D200309E9D /* OwnArrayPtrCommon.h */, … … 1537 1539 9303F567099118FA00AD71B8 /* OwnPtr.h */, 1538 1540 440B7AED0FAF7FCB0073323E /* OwnPtrCommon.h */, 1539 8627E5E911F1281900A313B5 /* PageAllocation.cpp */,1540 1541 8627E5EA11F1281900A313B5 /* PageAllocation.h */, 1542 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */, 1543 14B3EF0312BC24DD00D29EFF /* PageBlock.h */, 1541 1544 8690231412092D5C00630AF9 /* PageReservation.h */, 1542 1545 BCFBE695122560E800309E9D /* PassOwnArrayPtr.h */, … … 2365 2368 F3BD31ED126735770065467F /* TextPosition.h in Headers */, 2366 2369 1400067712A6F7830064D123 /* OSAllocator.h in Headers */, 2370 14B3EF0512BC24DD00D29EFF /* PageBlock.h in Headers */, 2367 2371 ); 2368 2372 runOnlyForDeploymentPostprocessing = 0; … … 2814 2818 86D08D5311793613006E5ED0 /* WTFThreadData.cpp in Sources */, 2815 2819 DDF7ABD511F60ED200108E36 /* GCActivityCallbackCF.cpp in Sources */, 2816 8627E5EB11F1281900A313B5 /* PageAllocation.cpp in Sources */,2817 2820 DDE82AD71209D955005C1756 /* GCHandle.cpp in Sources */, 2818 2821 A74DE1D0120B875600D40D5B /* ARMv7Assembler.cpp in Sources */, … … 2824 2827 0F29479C126E698C00B3ABF5 /* DecimalNumber.cpp in Sources */, 2825 2828 1400069312A6F9E10064D123 /* OSAllocatorPosix.cpp in Sources */, 2829 14B3EF0612BC24DD00D29EFF /* PageBlock.cpp in Sources */, 2826 2830 ); 2827 2831 runOnlyForDeploymentPostprocessing = 0; -
trunk/JavaScriptCore/interpreter/RegisterFile.h
r73570 r74357 160 160 , m_max(0) 161 161 { 162 ASSERT(maxGlobals && PageAllocation::isPageAligned(maxGlobals));163 ASSERT(capacity && PageAllocation::isPageAligned(capacity));162 ASSERT(maxGlobals && isPageAligned(maxGlobals)); 163 ASSERT(capacity && isPageAligned(capacity)); 164 164 165 165 size_t bufferLength = (capacity + maxGlobals) * sizeof(Register); -
trunk/JavaScriptCore/jit/ExecutableAllocator.cpp
r73571 r74357 46 46 ExecutableAllocator::pageSize = 256 * 1024; 47 47 #else 48 ExecutableAllocator::pageSize = PageAllocation::pageSize();48 ExecutableAllocator::pageSize = WTF::pageSize(); 49 49 #endif 50 50 } -
trunk/JavaScriptCore/wtf/PageAllocation.h
r74297 r74357 29 29 #include <wtf/Assertions.h> 30 30 #include <wtf/OSAllocator.h> 31 #include <wtf/PageBlock.h> 31 32 #include <wtf/UnusedParam.h> 32 33 #include <wtf/VMTags.h> … … 82 83 size is a power of two that is >= system page size. 83 84 */ 84 class PageAllocation { 85 86 class PageAllocation : private PageBlock { 85 87 public: 86 PageAllocation()87 : m_base(0)88 , m_size(0)89 {90 }91 92 bool operator!() const { return !m_base; }93 void* base() const { return m_base; }94 size_t size() const { return m_size; }95 96 88 static PageAllocation allocate(size_t size, OSAllocator::Usage usage = OSAllocator::UnknownUsage, bool writable = true, bool executable = false) 97 89 { … … 109 101 #endif 110 102 103 PageAllocation(); 104 105 using PageBlock::operator bool; 106 using PageBlock::base; 107 using PageBlock::size; 108 111 109 void deallocate() 112 110 { 113 ASSERT(m_base); 114 void* tmp = 0; 115 std::swap(tmp, m_base); 116 OSAllocator::release(tmp, m_size); 117 } 118 119 static size_t pageSize() 120 { 121 if (!s_pageSize) 122 s_pageSize = systemPageSize(); 123 ASSERT(isPowerOfTwo(s_pageSize)); 124 return s_pageSize; 125 } 126 127 #ifndef NDEBUG 128 static bool isPageAligned(void* address) { return !(reinterpret_cast<intptr_t>(address) & (pageSize() - 1)); } 129 static bool isPageAligned(size_t size) { return !(size & (pageSize() - 1)); } 130 static bool isPowerOfTwo(size_t size) { return !(size & (size - 1)); } 131 #endif 132 133 protected: 111 ASSERT(*this); 112 PageAllocation tmp; 113 std::swap(tmp, *this); 114 OSAllocator::release(tmp.base(), tmp.size()); 115 } 116 117 private: 134 118 PageAllocation(void* base, size_t size) 135 : m_base(base) 136 , m_size(size) 119 : PageBlock(base, size) 137 120 { 138 121 } … … 141 124 static PageAllocation systemAllocateAligned(size_t, OSAllocator::Usage); 142 125 #endif 143 static size_t systemPageSize();144 145 void* m_base;146 size_t m_size;147 148 static JS_EXPORTDATA size_t s_pageSize;149 126 }; 150 127 128 inline PageAllocation::PageAllocation() 129 : PageBlock() 130 { 131 } 132 151 133 152 134 #if HAVE(MMAP) 153 154 135 155 136 inline PageAllocation PageAllocation::systemAllocateAligned(size_t size, OSAllocator::Usage usage) … … 196 177 } 197 178 198 inline size_t PageAllocation::systemPageSize()199 {200 return getpagesize();201 }202 203 204 179 #elif HAVE(VIRTUALALLOC) 205 206 180 207 181 #if HAVE(ALIGNED_MALLOC) … … 218 192 #endif 219 193 220 inline size_t PageAllocation::systemPageSize() 221 { 222 static size_t size = 0; 223 SYSTEM_INFO system_info; 224 GetSystemInfo(&system_info); 225 size = system_info.dwPageSize; 226 return size; 227 } 228 229 230 #elif OS(SYMBIAN) 231 232 233 inline size_t PageAllocation::systemPageSize() 234 { 235 static TInt page_size = 0; 236 UserHal::PageSizeInBytes(page_size); 237 return page_size; 238 } 239 240 241 #endif 242 194 #endif 243 195 244 196 } -
trunk/JavaScriptCore/wtf/PageReservation.h
r74297 r74357 54 54 protection before decommit is called. 55 55 */ 56 class PageReservation : private PageAllocation { 56 57 class PageReservation : private PageBlock { 57 58 public: 58 59 PageReservation() 59 60 { 60 61 } 61 62 using Page Allocation::operator!;63 using Page Allocation::base;64 using Page Allocation::size;62 63 using PageBlock::operator bool; 64 using PageBlock::base; 65 using PageBlock::size; 65 66 66 67 void commit(void* start, size_t size) 67 68 { 68 ASSERT( m_base);69 ASSERT(*this); 69 70 ASSERT(isPageAligned(start)); 70 71 ASSERT(isPageAligned(size)); … … 78 79 void decommit(void* start, size_t size) 79 80 { 80 ASSERT( m_base);81 ASSERT(*this); 81 82 ASSERT(isPageAligned(start)); 82 83 ASSERT(isPageAligned(size)); … … 97 98 { 98 99 ASSERT(!m_committed); 99 PageAllocation::deallocate(); 100 ASSERT(*this); 101 PageReservation tmp; 102 std::swap(tmp, *this); 103 OSAllocator::release(tmp.base(), tmp.size()); 100 104 } 101 105 102 106 private: 103 107 PageReservation(void* base, size_t size, bool writable, bool executable) 104 : Page Allocation(base, size)108 : PageBlock(base, size) 105 109 #ifndef NDEBUG 106 110 , m_committed(0) -
trunk/JavaScriptCore/wtf/wtf.pri
r73842 r74357 17 17 wtf/qt/StringQt.cpp \ 18 18 wtf/qt/ThreadingQt.cpp \ 19 wtf/Page Allocation.cpp \19 wtf/PageBlock.cpp \ 20 20 wtf/RandomNumber.cpp \ 21 21 wtf/RefCountedLeakCounter.cpp \ -
trunk/JavaScriptGlue/ChangeLog
r73094 r74357 1 2010-12-20 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Factored common page set management into a new PageBlock base class 6 https://bugs.webkit.org/show_bug.cgi?id=51285 7 8 * ForwardingHeaders/wtf/PageBlock.h: Added. 9 1 10 2010-12-01 Geoffrey Garen <ggaren@apple.com> 2 11 -
trunk/WebCore/ChangeLog
r74354 r74357 1 2010-12-20 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Factored common page set management into a new PageBlock base class 6 https://bugs.webkit.org/show_bug.cgi?id=51285 7 8 * ForwardingHeaders/wtf/PageBlock.h: Added. 9 1 10 2010-12-20 Steve Block <steveblock@google.com> 2 11
Note: See TracChangeset
for help on using the changeset viewer.