[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:58:04 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 485e8cb76b07961b4fb2fb640b74585f1ceb716a
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 26 15:59:46 2009 +0000

    2009-11-26  Anton Muhin  <antonm at chromium.org>
    
            Reviewed by Adam Barth.
    
            Use an internal field instead of hidden property to speedup lookup
            of entered isolated world.
    
            Plus some inlinings.
            https://bugs.webkit.org/show_bug.cgi?id=31884
    
            Covered by layout tests + manual running of some benchmarks as
            content scripts.
    
            * bindings/v8/V8DOMWrapper.cpp:
            * bindings/v8/V8DOMWrapper.h:
            (WebCore::V8DOMWrapper::setDOMWrapper):
            * bindings/v8/V8HiddenPropertyName.h:
            * bindings/v8/V8IsolatedWorld.cpp:
            (WebCore::V8IsolatedWorld::V8IsolatedWorld):
            * bindings/v8/V8IsolatedWorld.h:
            (WebCore::V8IsolatedWorld::getEntered):
            (WebCore::V8IsolatedWorld::getGlobalObject):
            * bindings/v8/custom/V8CustomBinding.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51416 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0857df9..1d56f71 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2009-11-26  Anton Muhin  <antonm at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Use an internal field instead of hidden property to speedup lookup
+        of entered isolated world.
+
+        Plus some inlinings.
+        https://bugs.webkit.org/show_bug.cgi?id=31884
+
+        Covered by layout tests + manual running of some benchmarks as
+        content scripts.
+
+        * bindings/v8/V8DOMWrapper.cpp:
+        * bindings/v8/V8DOMWrapper.h:
+        (WebCore::V8DOMWrapper::setDOMWrapper):
+        * bindings/v8/V8HiddenPropertyName.h:
+        * bindings/v8/V8IsolatedWorld.cpp:
+        (WebCore::V8IsolatedWorld::V8IsolatedWorld):
+        * bindings/v8/V8IsolatedWorld.h:
+        (WebCore::V8IsolatedWorld::getEntered):
+        (WebCore::V8IsolatedWorld::getGlobalObject):
+        * bindings/v8/custom/V8CustomBinding.h:
+
 2009-11-26  Jocelyn Turcotte  <jocelyn.turcotte at nokia.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 15f966e..f8fb4a0 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -920,13 +920,6 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI
     return instance;
 }
 
-void V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr)
-{
-    ASSERT(object->InternalFieldCount() >= 2);
-    object->SetPointerInInternalField(V8Custom::kDOMWrapperObjectIndex, cptr);
-    object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer::New(type));
-}
-
 #ifndef NDEBUG
 bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
 {
diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h
index 7ca2e63..0ea3669 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.h
+++ b/WebCore/bindings/v8/V8DOMWrapper.h
@@ -109,7 +109,12 @@ namespace WebCore {
 #endif
 
         // Sets contents of a DOM wrapper.
-        static void setDOMWrapper(v8::Handle<v8::Object>, int type, void* ptr);
+        static void setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr)
+        {
+            ASSERT(object->InternalFieldCount() >= 2);
+            object->SetPointerInInternalField(V8Custom::kDOMWrapperObjectIndex, cptr);
+            object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer::New(type));
+        }
 
         static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Object> object)
         {
diff --git a/WebCore/bindings/v8/V8HiddenPropertyName.h b/WebCore/bindings/v8/V8HiddenPropertyName.h
index 5ef89cb..bb1ca4c 100644
--- a/WebCore/bindings/v8/V8HiddenPropertyName.h
+++ b/WebCore/bindings/v8/V8HiddenPropertyName.h
@@ -37,7 +37,6 @@ namespace WebCore {
 
 #define V8_HIDDEN_PROPERTIES(V) \
     V(objectPrototype) \
-    V(isolatedWorld) \
     V(listener) \
     V(attributeListener) \
     V(sleepFunction) \
diff --git a/WebCore/bindings/v8/V8IsolatedWorld.cpp b/WebCore/bindings/v8/V8IsolatedWorld.cpp
index a417930..cb65097 100644
--- a/WebCore/bindings/v8/V8IsolatedWorld.cpp
+++ b/WebCore/bindings/v8/V8IsolatedWorld.cpp
@@ -64,7 +64,7 @@ V8IsolatedWorld::V8IsolatedWorld(V8Proxy* proxy, int extensionGroup)
     // Run code in the new context.
     v8::Context::Scope context_scope(m_context->get());
 
-    m_context->get()->Global()->SetHiddenValue(V8HiddenPropertyName::isolatedWorld(), v8::External::Wrap(this));
+    getGlobalObject(m_context->get())->SetPointerInInternalField(V8Custom::kDOMWindowEnteredIsolatedWorldIndex, this);
 
     V8Proxy::installHiddenObjectPrototype(m_context->get());
     proxy->installDOMWindow(m_context->get(), proxy->frame()->domWindow());
@@ -91,17 +91,4 @@ V8IsolatedWorld::~V8IsolatedWorld()
     m_context->disposeHandle();
 }
 
-V8IsolatedWorld* V8IsolatedWorld::getEnteredImpl()
-{
-    if (!v8::Context::InContext())
-        return 0;
-    v8::HandleScope scope;
-
-    v8::Local<v8::Value> world = v8::Context::GetEntered()->Global()->GetHiddenValue(V8HiddenPropertyName::isolatedWorld());
-    if (world.IsEmpty())
-        return 0;
-
-    return static_cast<V8IsolatedWorld*>(v8::External::Unwrap(world));
-}
-
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/V8IsolatedWorld.h b/WebCore/bindings/v8/V8IsolatedWorld.h
index 2b23092..6313da8 100644
--- a/WebCore/bindings/v8/V8IsolatedWorld.h
+++ b/WebCore/bindings/v8/V8IsolatedWorld.h
@@ -85,7 +85,9 @@ namespace WebCore {
             // worlds at all.
             if (!isolatedWorldCount)
                 return 0;
-            return getEnteredImpl();
+            if (!v8::Context::InContext())
+                return 0;
+            return reinterpret_cast<V8IsolatedWorld*>(getGlobalObject(v8::Context::GetEntered())->GetPointerFromInternalField(V8Custom::kDOMWindowEnteredIsolatedWorldIndex));
         }
 
         v8::Handle<v8::Context> context() { return m_context->get(); }
@@ -94,7 +96,10 @@ namespace WebCore {
         DOMDataStore* getDOMDataStore() const { return m_domDataStore.getStore(); }
 
     private:
-        static V8IsolatedWorld* getEnteredImpl();
+        static v8::Handle<v8::Object> getGlobalObject(v8::Handle<v8::Context> context)
+        {
+            return v8::Handle<v8::Object>::Cast(context->Global()->GetPrototype());
+        }
 
         // Called by the garbage collector when our JavaScript context is about
         // to be destroyed.
diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h
index 7a220eb..4bd6d79 100644
--- a/WebCore/bindings/v8/custom/V8CustomBinding.h
+++ b/WebCore/bindings/v8/custom/V8CustomBinding.h
@@ -168,7 +168,8 @@ namespace WebCore {
         static const int kDOMWindowLocationIndex = kDefaultWrapperInternalFieldCount + 11;
         static const int kDOMWindowDOMSelectionIndex = kDefaultWrapperInternalFieldCount + 12;
         static const int kDOMWindowEventListenerCacheIndex = kDefaultWrapperInternalFieldCount + 13;
-        static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 14;
+        static const int kDOMWindowEnteredIsolatedWorldIndex = kDefaultWrapperInternalFieldCount + 14;
+        static const int kDOMWindowInternalFieldCount = kDefaultWrapperInternalFieldCount + 15;
 
         static const int kStyleSheetOwnerNodeIndex = kDefaultWrapperInternalFieldCount + 0;
         static const int kStyleSheetInternalFieldCount = kDefaultWrapperInternalFieldCount + 1;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list