JavaScriptCore:
Reviewed by mjs.
On alternate threads, DOMObjects remain in the
ScriptInterpreter's cache because they're not collected. So, they
need an opportunity to mark their children.
I'm not particularly happy with this solution because it fails to
resolve many outstanding issues with the DOM object cache. Since none
of those issues is a crasher or a serious compatibility concern,
and since the behavior of other browsers is not much to go on in this
case, I've filed <rdar://problem/4561439> about that, and I'm moving on
with my life.
- JavaScriptCore.xcodeproj/project.pbxproj:
- kjs/collector.cpp:
(KJS::Collector::collect):
- kjs/internal.cpp:
(KJS::InterpreterImp::mark):
- kjs/internal.h:
- kjs/interpreter.cpp:
(KJS::Interpreter::mark):
- kjs/interpreter.h:
LayoutTests:
Layout tests for DOM object cache and garbage collection,
<rdar://problem/4557926> TOT REGRESSION: Crash occurs when attempting
to view image in slideshow mode at http://d.smugmug.com/gallery/581716
( KJS::IfNode::execute (KJS::ExecState*) + 312) if you use a PAC file
- fast/dom/gc-8-expected.txt: Added.
- fast/dom/gc-8.html: Added.
- fast/dom/gc-9-expected.txt: Added.
- fast/dom/gc-9.html: Added.
WebCore:
Reviewed by mjs.
On alternate threads, DOMObjects remain in the
ScriptInterpreter's cache because they're not collected. So, they
need an opportunity to mark their children.
I'm not particularly happy with this solution because it fails to
resolve many outstanding issues with the DOM object cache. Since none
of those issues is a crasher or a serious compatibility concern,
and since the behavior of other browsers is not much to go on in this
case, I've filed <rdar://problem/4561439> about that, and I'm moving
on with my life.
Also added functionality for testing garbage collection from inside
DumpRenderTree.
Also removed XMLHttpRequest from the DOM object cache because XMLHttpRequest
objects aren't accessed through the DOM.
Also added JS locking around access to some shared data structures in
WebCoreJavaScript, even though it probably doesn't matter in practice.
- bindings/js/JSXMLHttpRequest.cpp:
(KJS::JSXMLHttpRequest::JSXMLHttpRequest):
(KJS::JSXMLHttpRequest::~JSXMLHttpRequest):
- bindings/js/kjs_binding.cpp:
(KJS::ScriptInterpreter::mark):
- bindings/js/kjs_binding.h:
- bridge/mac/WebCoreJavaScript.h:
- bridge/mac/WebCoreJavaScript.mm:
(collect):
(+[WebCoreJavaScript objectCount]):
(+[WebCoreJavaScript interpreterCount]):
(+[WebCoreJavaScript protectedObjectCount]):
(+[WebCoreJavaScript garbageCollect]):
(+[WebCoreJavaScript garbageCollectOnAlternateThread:]):
(+[WebCoreJavaScript shouldPrintExceptions]):
(+[WebCoreJavaScript setShouldPrintExceptions:]):
WebKitTools:
Reviewed by mjs.
Added 'GCController' to DRT to support garbage collection layout tests.
GCController.collect() and GCController.collectOnAlternateThread() do
what you would expect. The latter takes a boolean argument sepcifying
whether to wait for garbage collection to finish before continuing to
execute script.
- DumpRenderTree/DumpRenderTree.m:
(-[WaitUntilDoneDelegate webView:windowScriptObjectAvailable:]):
- DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
- DumpRenderTree/GCController.h: Added.
- DumpRenderTree/GCController.mm: Added.
(+[GCController isSelectorExcludedFromWebScript:]):
(+[GCController webScriptNameForSelector:]):
(-[GCController collect]):
(-[GCController collectOnAlternateThread:]):