Title: [128242] trunk/Source/WebCore
Revision
128242
Author
commit-qu...@webkit.org
Date
2012-09-11 16:49:09 -0700 (Tue, 11 Sep 2012)

Log Message

[V8] 8% regression in dom_perf
https://bugs.webkit.org/show_bug.cgi?id=96433

Patch by Adam Barth <aba...@chromium.org> on 2012-09-11
Reviewed by Kentaro Hara.

This code used to have a fast path to find the V8PerContextData for DOM
nodes. I tried a bunch of variations, but nothing I can come up with is
as fast as the old fast path, so I've added back the fast path.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateToV8Converters):
* bindings/v8/V8DOMWrapper.cpp:
(WebCore::V8DOMWrapper::instantiateV8Object):
* bindings/v8/V8DOMWrapper.h:
(V8DOMWrapper):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (128241 => 128242)


--- trunk/Source/WebCore/ChangeLog	2012-09-11 23:42:55 UTC (rev 128241)
+++ trunk/Source/WebCore/ChangeLog	2012-09-11 23:49:09 UTC (rev 128242)
@@ -1,3 +1,21 @@
+2012-09-11  Adam Barth  <aba...@chromium.org>
+
+        [V8] 8% regression in dom_perf
+        https://bugs.webkit.org/show_bug.cgi?id=96433
+
+        Reviewed by Kentaro Hara.
+
+        This code used to have a fast path to find the V8PerContextData for DOM
+        nodes. I tried a bunch of variations, but nothing I can come up with is
+        as fast as the old fast path, so I've added back the fast path.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateToV8Converters):
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::V8DOMWrapper::instantiateV8Object):
+        * bindings/v8/V8DOMWrapper.h:
+        (V8DOMWrapper):
+
 2012-09-11  Andreas Kling  <kl...@webkit.org>
 
         ElementAttributeData: Use subclasses to manage varying object layouts.

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (128241 => 128242)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-09-11 23:42:55 UTC (rev 128241)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2012-09-11 23:49:09 UTC (rev 128242)
@@ -3358,7 +3358,18 @@
     }
 
     push(@implContent, <<END);
+    Document* document = 0;
+    UNUSED_PARAM(document);
+END
 
+    if (IsNodeSubType($dataNode)) {
+        push(@implContent, <<END);
+    document = impl->document(); 
+END
+    }
+
+    push(@implContent, <<END);
+
     v8::Handle<v8::Context> context;
     if (!creationContext.IsEmpty() && creationContext->CreationContext() != v8::Context::GetCurrent()) {
         // For performance, we enter the context only if the currently running context
@@ -3368,7 +3379,7 @@
         context->Enter();
     }
 
-    wrapper = V8DOMWrapper::instantiateV8Object(&info, impl.get());
+    wrapper = V8DOMWrapper::instantiateV8Object(document, &info, impl.get());
 
     if (!context.IsEmpty())
         context->Exit();

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp (128241 => 128242)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2012-09-11 23:42:55 UTC (rev 128241)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.cpp	2012-09-11 23:49:09 UTC (rev 128242)
@@ -140,10 +140,17 @@
     return NodeFilter::create(V8NodeFilterCondition::create(filter));
 }
 
-v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(WrapperTypeInfo* type, void* impl)
+v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(Document* document, WrapperTypeInfo* type, void* impl)
 {
-    V8PerContextData* perContextData = V8PerContextData::current();
+    V8PerContextData* perContextData = 0;
 
+    // If we have a pointer to the frame, we cna get the V8PerContextData
+    // directly, which is faster than going through V8.
+    if (document && document->frame())
+        perContextData = perContextDataForCurrentWorld(document->frame());
+    else
+        perContextData = V8PerContextData::current();
+
     v8::Local<v8::Object> instance = perContextData ? perContextData->createWrapperFromCache(type) : V8ObjectConstructor::newInstance(type->getTemplate()->GetFunction());
 
     // Avoid setting the DOM wrapper for failed allocations.

Modified: trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h (128241 => 128242)


--- trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h	2012-09-11 23:42:55 UTC (rev 128241)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h	2012-09-11 23:49:09 UTC (rev 128242)
@@ -112,7 +112,7 @@
 
         static void setNamedHiddenReference(v8::Handle<v8::Object> parent, const char* name, v8::Handle<v8::Value> child);
 
-        static v8::Local<v8::Object> instantiateV8Object(WrapperTypeInfo*, void*);
+        static v8::Local<v8::Object> instantiateV8Object(Document*, WrapperTypeInfo*, void*);
 
         static v8::Handle<v8::Object> getCachedWrapper(Node* node)
         {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to