Bug 21054: Construction of certain DOM objects is heavily regressed by r36675
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Sep 2008 11:53:40 +0000 (11:53 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Sep 2008 11:53:40 +0000 (11:53 +0000)
commit69ab0d05a2388324882df2acf71c2dd71f4bd2aa
treed7d55076af6250042370cf4e3a7fb65e802a2eb8
parent5e1ad595016f67f89257e15cff65d845b36b9fb4
Bug 21054: Construction of certain DOM objects is heavily regressed by r36675
<https://bugs.webkit.org/show_bug.cgi?id=21054>

Reviewed by Maciej Stachowiak

This performance regression is actually just a symptom of a correctness
bug.  The constructor objects for a number of properties that have security
checks on access were returning new objects each time.  The most obvious
symptom of this bug is that window.Image != window.Image, etc.

The solution to this is to make sure we cache these constructors
in the same way as all the other DOM constructors.  To achieve this
without causing any refcount cycles it is necessary to replace the
refcounted document pointer in the Image, MessageChannel, Option,
XMLHttpRequest, and Audio constructor objects with a reference to
the document's JS wrapper.

Tests: fast/dom/constructors-cached-navigate.html
       fast/dom/constructors-cached.html

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@36954 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/constructors-cached-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/constructors-cached-navigate-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/constructors-cached-navigate.html [new file with mode: 0644]
LayoutTests/fast/dom/constructors-cached.html [new file with mode: 0644]
LayoutTests/fast/dom/resources/constructors-cached-navigate.js [new file with mode: 0644]
LayoutTests/fast/dom/resources/constructors-cached.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/bindings/js/JSAudioConstructor.cpp
WebCore/bindings/js/JSAudioConstructor.h
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowBase.h
WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp
WebCore/bindings/js/JSHTMLOptionElementConstructor.h
WebCore/bindings/js/JSImageConstructor.cpp
WebCore/bindings/js/JSImageConstructor.h
WebCore/bindings/js/JSMessageChannelConstructor.cpp
WebCore/bindings/js/JSMessageChannelConstructor.h
WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp
WebCore/bindings/js/JSXMLHttpRequestConstructor.h