Changeset 24493 in webkit
- Timestamp:
- Jul 20, 2007, 3:58:24 PM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r24492 r24493 1 2007-07-20 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Fixed http://bugs.webkit.org/show_bug.cgi?id=12900 Page tear-down 6 forces garbage collection once per frame 7 8 Also fixed <rdar://problem/5286989> GC on window close does not always 9 bring the JS object count down to 0 10 11 Implemented a 0-delay GC timer in WebCore. Instead of forcing GC 12 immediately, code that thinks it has created a lot of garbage starts 13 the timer. This has two advantages: 14 15 1) Multiple GCs can coalesce. In my pathological test case, this 16 improves performance by an order of magnitude. 17 18 2) Conservative marking is less likely to keep alive important dead 19 objects, like the window object, because the stack is small and free of 20 JS processing when the timer fires. 21 22 Added GCController.h/.cpp, sometimes blindly: 23 * WebCore.pro: 24 * WebCore.vcproj/WebCore.vcproj: 25 * WebCore.xcodeproj/project.pbxproj: 26 * WebCoreSources.bkl: 27 28 Added singleton that implements GC on a 0-delay timer: 29 * bindings/js/GCController.h: Added. 30 * bindings/js/GCController.cpp: Added. 31 32 Changed Collector::collect() calls below to call to the singleton: 33 * bindings/js/kjs_proxy.cpp: 34 (WebCore::KJSProxy::~KJSProxy): 35 * bindings/js/kjs_window.cpp: 36 (KJS::Window::clear): 37 * history/CachedPage.cpp: 38 (WebCore::CachedPage::clear): 39 40 * page/Frame.cpp: 41 (WebCore::Frame::~Frame): Removed previous slightly hackish attempt to 42 avoid conservative marking of the window object. 43 1 44 2007-07-20 Anders Carlsson <andersca@apple.com> 2 45 -
trunk/WebCore/WebCore.pro
r24485 r24493 279 279 280 280 SOURCES += \ 281 bindings/js/GCController.cpp \ 281 282 bindings/js/JSCanvasRenderingContext2DCustom.cpp \ 282 283 bindings/js/JSCSSRuleCustom.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r24485 r24493 7116 7116 > 7117 7117 <File 7118 RelativePath="..\bindings\js\GCController.cpp" 7119 > 7120 </File> 7121 <File 7122 RelativePath="..\bindings\js\GCController.h" 7123 > 7124 </File> 7125 <File 7118 7126 RelativePath="..\bindings\js\JSCanvasRenderingContext2DCustom.cpp" 7119 7127 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r24490 r24493 44 44 06FC442D0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06FC442B0BAE5A9E0090EDE1 /* JavaScriptStatistics.cpp */; }; 45 45 06FC442E0BAE5A9E0090EDE1 /* JavaScriptStatistics.h in Headers */ = {isa = PBXBuildFile; fileRef = 06FC442C0BAE5A9E0090EDE1 /* JavaScriptStatistics.h */; settings = {ATTRIBUTES = (Private, ); }; }; 46 0F31CBF92B654730BA0535E8 /* BidiContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 514AF320BE854014A7DA49FB /* BidiContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 46 47 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; }; 47 48 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; }; … … 54 55 142011B60A003133008303F9 /* JSCSSStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 142011B40A003133008303F9 /* JSCSSStyleDeclaration.cpp */; }; 55 56 142011B70A003133008303F9 /* JSCSSStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = 142011B50A003133008303F9 /* JSCSSStyleDeclaration.h */; }; 57 1432E8470C51493800B1500F /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1432E8460C51493800B1500F /* GCController.h */; }; 58 1432E8490C51493F00B1500F /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1432E8480C51493F00B1500F /* GCController.cpp */; }; 56 59 1477E7760BF4134A00152872 /* PageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1477E7740BF4134A00152872 /* PageCache.cpp */; }; 57 60 1477E7770BF4134A00152872 /* PageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1477E7750BF4134A00152872 /* PageCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 280 283 37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; }; 281 284 37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; }; 282 0F31CBF92B654730BA0535E8 /* BidiContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 514AF320BE854014A7DA49FB /* BidiContext.h */; settings = {ATTRIBUTES = (Private, ); }; };283 F971E27FD70F4382BC66D792 /* BidiContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A579C284B928484FB9A446BC /* BidiContext.cpp */; };284 285 448A29BF0A46D9CB0030759F /* JSHTMLOptionsCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */; }; 285 286 448A29C00A46D9CB0030759F /* JSHTMLOptionsCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */; }; … … 3031 3032 ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; }; 3032 3033 EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; }; 3034 F971E27FD70F4382BC66D792 /* BidiContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A579C284B928484FB9A446BC /* BidiContext.cpp */; }; 3033 3035 FAE0418F097596C9000540BE /* SVGImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE0418D097596C9000540BE /* SVGImageLoader.cpp */; }; 3034 3036 FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE0418E097596C9000540BE /* SVGImageLoader.h */; }; … … 3265 3267 142011B40A003133008303F9 /* JSCSSStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleDeclaration.cpp; sourceTree = "<group>"; }; 3266 3268 142011B50A003133008303F9 /* JSCSSStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSStyleDeclaration.h; sourceTree = "<group>"; }; 3269 1432E8460C51493800B1500F /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; }; 3270 1432E8480C51493F00B1500F /* GCController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GCController.cpp; sourceTree = "<group>"; }; 3267 3271 1477E7740BF4134A00152872 /* PageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PageCache.cpp; sourceTree = "<group>"; }; 3268 3272 1477E7750BF4134A00152872 /* PageCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PageCache.h; sourceTree = "<group>"; }; … … 3522 3526 37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; }; 3523 3527 37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; }; 3524 514AF320BE854014A7DA49FB /* BidiContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiContext.h; sourceTree = "<group>"; };3525 A579C284B928484FB9A446BC /* BidiContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BidiContext.cpp; sourceTree = "<group>"; };3526 3528 448A29BD0A46D9CB0030759F /* JSHTMLOptionsCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLOptionsCollection.h; sourceTree = "<group>"; }; 3527 3529 448A29BE0A46D9CB0030759F /* JSHTMLOptionsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLOptionsCollection.cpp; sourceTree = "<group>"; }; … … 3575 3577 513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; }; 3576 3578 513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; }; 3579 514AF320BE854014A7DA49FB /* BidiContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiContext.h; sourceTree = "<group>"; }; 3577 3580 5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 3578 3581 5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 4843 4846 93F9B79F0BA6032600854064 /* JSCDATASection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCDATASection.h; sourceTree = "<group>"; }; 4844 4847 93FDAFC90B11307400E2746F /* EditorInsertAction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EditorInsertAction.h; sourceTree = "<group>"; }; 4848 A579C284B928484FB9A446BC /* BidiContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BidiContext.cpp; sourceTree = "<group>"; }; 4845 4849 A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; }; 4846 4850 A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; }; … … 9308 9312 isa = PBXGroup; 9309 9313 children = ( 9314 BC4EDEF70C08F414007EDD49 /* Custom */, 9310 9315 14DFB33F0A7DF7630018F769 /* Derived Sources */, 9311 BC4EDEF70C08F414007EDD49 /* Custom */,9312 9316 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */, 9317 1432E8480C51493F00B1500F /* GCController.cpp */, 9318 1432E8460C51493800B1500F /* GCController.h */, 9313 9319 E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */, 9314 9320 E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */, … … 11698 11704 B402007C0C4D217800210AA6 /* BidiReorderCharacters.h in Headers */, 11699 11705 0F31CBF92B654730BA0535E8 /* BidiContext.h in Headers */, 11706 1432E8470C51493800B1500F /* GCController.h in Headers */, 11700 11707 ); 11701 11708 runOnlyForDeploymentPostprocessing = 0; … … 13137 13144 F971E27FD70F4382BC66D792 /* BidiContext.cpp in Sources */, 13138 13145 B402007D0C4D217800210AA6 /* BidiReorderCharacters.cpp in Sources */, 13146 1432E8490C51493F00B1500F /* GCController.cpp in Sources */, 13139 13147 ); 13140 13148 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/WebCoreSources.bkl
r24485 r24493 728 728 729 729 <set append="1" var="WEBCORE_SOURCES_JS"> 730 bindings/js/GCController.cpp 730 731 bindings/js/JSCanvasRenderingContext2DCustom.cpp 731 732 bindings/js/JSCustomXPathNSResolver.cpp -
trunk/WebCore/bindings/js/kjs_proxy.cpp
r24126 r24493 26 26 #include "Frame.h" 27 27 #include "FrameLoader.h" 28 #include "GCController.h" 28 29 #include "JSDOMWindow.h" 29 30 #include "Page.h" … … 50 51 // in our interpreter. 51 52 ASSERT(!m_script || !m_script->context()); 52 m_script = 0;53 53 54 // It's likely that destroying the interpreter has created a lot of garbage. 55 JSLock lock; 56 Collector::collect(); 54 if (m_script) { 55 m_script = 0; 56 57 // It's likely that destroying the interpreter has created a lot of garbage. 58 gcController()->garbageCollectSoon(); 59 } 57 60 } 58 61 -
trunk/WebCore/bindings/js/kjs_window.cpp
r24462 r24493 38 38 #include "FrameTree.h" 39 39 #include "FrameView.h" 40 #include "GCController.h" 40 41 #include "HTMLDocument.h" 41 42 #include "JSCSSRule.h" … … 1062 1063 1063 1064 // there's likely to be lots of garbage now 1064 Collector::collect();1065 gcController()->garbageCollectSoon(); 1065 1066 } 1066 1067 -
trunk/WebCore/history/CachedPage.cpp
r21745 r24493 34 34 #include "FrameLoader.h" 35 35 #include "FrameView.h" 36 #include "GCController.h" 36 37 #include "Logging.h" 37 38 #include "Page.h" … … 186 187 m_pausedTimeouts.clear(); 187 188 188 Collector::collect();189 gcController()->garbageCollectSoon(); 189 190 } 190 191 -
trunk/WebCore/page/Frame.cpp
r24398 r24493 188 188 #endif 189 189 190 if (d->m_jscript && d->m_jscript->haveInterpreter()) { 191 Window* volatile w = static_cast<Window*>(d->m_jscript->interpreter()->globalObject()); 192 ASSERT(w); 193 w->disconnectFrame(); 194 // Clear w, otherwise we will not garbage-collect collect the window 195 // (inside the call to delete d below). w is volatile to ensure that the 196 // compiler doesn't optimize out this operation. 197 w = 0; 198 } 190 if (d->m_jscript && d->m_jscript->haveInterpreter()) 191 static_cast<Window*>(d->m_jscript->interpreter()->globalObject())->disconnectFrame(); 199 192 200 193 disconnectOwnerElement();
Note:
See TracChangeset
for help on using the changeset viewer.