Title: [139458] trunk/Source/WebCore
Revision
139458
Author
[email protected]
Date
2013-01-11 10:37:25 -0800 (Fri, 11 Jan 2013)

Log Message

[V8] Slightly optimize getWrapperFast()
https://bugs.webkit.org/show_bug.cgi?id=106667

Reviewed by Adam Barth.

This patch improves an if condition in getWrapperFast(),
as commented in DOMDataStore.h.

This patch improves performance of div.firstChild from
15.1 ns to 14.0 ns (+7.8%), although I couldn't observe
performance improvement in Dromaeo/dom-traverse.

No tests. No change in behavior.

* bindings/v8/DOMDataStore.h:
(WebCore::DOMDataStore::getWrapperFast):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139457 => 139458)


--- trunk/Source/WebCore/ChangeLog	2013-01-11 18:10:10 UTC (rev 139457)
+++ trunk/Source/WebCore/ChangeLog	2013-01-11 18:37:25 UTC (rev 139458)
@@ -1,3 +1,22 @@
+2013-01-11  Kentaro Hara  <[email protected]>
+
+        [V8] Slightly optimize getWrapperFast()
+        https://bugs.webkit.org/show_bug.cgi?id=106667
+
+        Reviewed by Adam Barth.
+
+        This patch improves an if condition in getWrapperFast(),
+        as commented in DOMDataStore.h.
+
+        This patch improves performance of div.firstChild from
+        15.1 ns to 14.0 ns (+7.8%), although I couldn't observe
+        performance improvement in Dromaeo/dom-traverse.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/DOMDataStore.h:
+        (WebCore::DOMDataStore::getWrapperFast):
+
 2013-01-11  Florin Malita  <[email protected]>
 
         [SVG] Suppress resource rebuilding for unattached and shadow elements

Modified: trunk/Source/WebCore/bindings/v8/DOMDataStore.h (139457 => 139458)


--- trunk/Source/WebCore/bindings/v8/DOMDataStore.h	2013-01-11 18:10:10 UTC (rev 139457)
+++ trunk/Source/WebCore/bindings/v8/DOMDataStore.h	2013-01-11 18:37:25 UTC (rev 139458)
@@ -64,15 +64,18 @@
     template<typename T, typename HolderContainer, typename Wrappable>
     static v8::Handle<v8::Object> getWrapperFast(T* object, const HolderContainer& container, Wrappable* holder)
     {
-        // What we'd really like to check here is whether we're in the main world or
-        // in an isolated world. The fastest way we know how to do that is to check
-        // whether the wrappable's wrapper is the same as the holder
-        if (holderContainsWrapper(container, holder)) {
+        // What we'd really like to check here is whether we're in the
+        // main world or in an isolated world. The fastest way to do that
+        // is to check that there is no isolated world and the 'object'
+        // is an object that can exist in the main world. The second fastest
+        // way is to check whether the wrappable's wrapper is the same as
+        // the holder.
+        if ((!DOMWrapperWorld::isolatedWorldsExist() && isMainWorldObject(object)) || holderContainsWrapper(container, holder)) {
             if (mainWorldWrapperIsStoredInObject(object))
                 return getWrapperFromObject(object);
             return mainWorldStore()->m_wrapperMap.get(object);
         }
-        return getWrapper(object, container.GetIsolate());
+        return current(container.GetIsolate())->get(object);
     }
 
     template<typename T>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to