[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:15:31 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 81a1bf4ec696f1bab38bc6387595296d7fb1145a
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 16 19:07:52 2002 +0000

            Reviewed by Darin.
    
    	- fixed 3129008 - REGRESSION: Successive hot/cached runs of cvs-base PLT are slightly slower
    
    	This was due to me reintroducing a leak of the document. Now fixed.
    
            * khtml/ecma/kjs_dom.cpp:
            (DOMDocument::~DOMDocument): forget self from cached DOM object table.
            (KJS::getDOMDocumentNode): Instead of storing the document in the
    	marked per-document table, store it in the unmarked table, and as
    	a property on the Window object.
            (KJS::getDOMNode): use getDocumentNode when appropriate.
            * khtml/ecma/kjs_dom.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3085 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 89a415d..fb27df2 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,20 @@
+2002-12-16  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Darin.
+
+	- fixed 3129008 - REGRESSION: Successive hot/cached runs of cvs-base PLT are slightly slower
+
+	This was due to me reintroducing a leak of the document. Now fixed.
+	
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMDocument::~DOMDocument): forget self from cached DOM object table.
+        (KJS::getDOMDocumentNode): Instead of storing the document in the
+	marked per-document table, store it in the unmarked table, and as
+	a property on the Window object.
+        (KJS::getDOMNode): use getDocumentNode when appropriate.
+        * khtml/ecma/kjs_dom.h:
+
+
 2002-12-15  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3128728.  Ensure that list markers get placed into an
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 89a415d..fb27df2 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2002-12-16  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Darin.
+
+	- fixed 3129008 - REGRESSION: Successive hot/cached runs of cvs-base PLT are slightly slower
+
+	This was due to me reintroducing a leak of the document. Now fixed.
+	
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMDocument::~DOMDocument): forget self from cached DOM object table.
+        (KJS::getDOMDocumentNode): Instead of storing the document in the
+	marked per-document table, store it in the unmarked table, and as
+	a property on the Window object.
+        (KJS::getDOMNode): use getDocumentNode when appropriate.
+        * khtml/ecma/kjs_dom.h:
+
+
 2002-12-15  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3128728.  Ensure that list markers get placed into an
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index a312190..a75a376 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -687,6 +687,11 @@ DOMDocument::DOMDocument(ExecState *exec, const DOM::Document &d)
 DOMDocument::DOMDocument(const Object &proto, const DOM::Document &d)
   : DOMNode(proto, d) { }
 
+DOMDocument::~DOMDocument()
+{
+  ScriptInterpreter::forgetDOMObject(node.handle());
+}
+
 Value DOMDocument::tryGet(ExecState *exec, const Identifier &propertyName) const
 {
 #ifdef KJS_VERBOSE
@@ -1244,6 +1249,33 @@ Value DOMEntity::getValueProperty(ExecState *, int token) const
 
 // -------------------------------------------------------------------------
 
+Value KJS::getDOMDocumentNode(ExecState *exec, const DOM::Document &n)
+{
+  DOMDocument *ret = 0;
+  ScriptInterpreter* interp = static_cast<ScriptInterpreter *>(exec->interpreter());
+
+  if ((ret = static_cast<DOMDocument *>(interp->getDOMObject(n.handle()))))
+    return Value(ret);
+
+  if (n.isHTMLDocument())
+    ret = new HTMLDocument(exec, static_cast<DOM::HTMLDocument>(n));
+  else
+    ret = new DOMDocument(exec, n);
+
+  Value val(ret);
+  
+  // Make sure the document is kept around by the window object, and works right with the
+  // back/forward cache.
+  if (n.view()) {
+    static Identifier documentIdentifier("document");
+    Window::retrieveWindow(n.view()->part())->putDirect(documentIdentifier, ret, DontDelete|ReadOnly);
+  }
+
+  interp->putDOMObject(n.handle(), ret);
+
+  return val;
+}
+
 Value KJS::getDOMNode(ExecState *exec, const DOM::Node &n)
 {
   DOMObject *ret = 0;
@@ -1282,12 +1314,8 @@ Value KJS::getDOMNode(ExecState *exec, const DOM::Node &n)
       ret = new DOMCharacterData(exec, static_cast<DOM::CharacterData>(n));
       break;
     case DOM::Node::DOCUMENT_NODE:
-      if (static_cast<DOM::Document>(n).isHTMLDocument())
-        ret = new HTMLDocument(exec, static_cast<DOM::HTMLDocument>(n));
-      else
-        ret = new DOMDocument(exec, static_cast<DOM::Document>(n));
-      doc = n.handle();
-      break;
+      // we don't want to cache the document itself in the per-document dictionary
+      return getDOMDocumentNode(exec, static_cast<DOM::Document>(n));
     case DOM::Node::DOCUMENT_TYPE_NODE:
       ret = new DOMDocumentType(exec, static_cast<DOM::DocumentType>(n));
       break;
diff --git a/WebCore/khtml/ecma/kjs_dom.h b/WebCore/khtml/ecma/kjs_dom.h
index 13ffeb7..f3b35a3 100644
--- a/WebCore/khtml/ecma/kjs_dom.h
+++ b/WebCore/khtml/ecma/kjs_dom.h
@@ -103,6 +103,7 @@ namespace KJS {
     DOMDocument(ExecState *exec, const DOM::Document &d);
     // Constructor for inherited classes
     DOMDocument(const Object &proto, const DOM::Document &d);
+    ~DOMDocument();
     virtual Value tryGet(ExecState *exec, const Identifier &propertyName) const;
     Value getValueProperty(ExecState *exec, int token) const;
     virtual void tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
@@ -248,6 +249,7 @@ namespace KJS {
     static const ClassInfo info;
   };
 
+  Value getDOMDocumentNode(ExecState *exec, const DOM::Document &n);
   Value getDOMNode(ExecState *exec, const DOM::Node &n);
   Value getDOMNamedNodeMap(ExecState *exec, const DOM::NamedNodeMap &m);
   Value getDOMNodeList(ExecState *exec, const DOM::NodeList &l);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list