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

japhet at chromium.org japhet at chromium.org
Thu Apr 8 02:18:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 5108953f7640d85b82113e088fad47c7db42c329
Author: japhet at chromium.org <japhet at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 10 20:33:37 2010 +0000

    2010-03-10  Nate Chapin  <japhet at chromium.org>
    
            Reviewed by Dimitri Glazkov.
    
            [V8] Instead of describing the type of a wrapped v8 object
            with an enum value, use a pointer to struct with more complete
            information.
    
            https://bugs.webkit.org/show_bug.cgi?id=35941
    
            Refactoring only, so new tests.
    
            * bindings/scripts/CodeGeneratorV8.pm:
            * bindings/v8/DOMData.cpp:
            * bindings/v8/DOMData.h:
            * bindings/v8/NPV8Object.cpp:
            * bindings/v8/V8Collection.h:
            * bindings/v8/V8DOMWindowShell.cpp:
            * bindings/v8/V8DOMWindowShell.h:
            * bindings/v8/V8DOMWrapper.cpp:
            * bindings/v8/V8DOMWrapper.h:
            * bindings/v8/V8GCController.cpp:
            * bindings/v8/V8Helpers.cpp:
            * bindings/v8/V8Helpers.h:
            * bindings/v8/V8Index.cpp: Removed.
            * bindings/v8/V8Index.h:
            * bindings/v8/V8NPObject.cpp:
            * bindings/v8/V8Proxy.cpp:
            * bindings/v8/V8Proxy.h:
            * bindings/v8/WorkerContextExecutionProxy.cpp:
            * bindings/v8/custom/V8DOMWindowCustom.cpp:
            * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
            * bindings/v8/custom/V8HTMLAudioElementConstructor.h:
            * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
            * bindings/v8/custom/V8HTMLImageElementConstructor.h:
            * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
            * bindings/v8/custom/V8HTMLOptionElementConstructor.h:
            * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
            * bindings/v8/custom/V8MessageChannelConstructor.cpp:
            * bindings/v8/custom/V8SharedWorkerCustom.cpp:
            * bindings/v8/custom/V8WebGLArrayBufferCustom.cpp:
            * bindings/v8/custom/V8WebGLArrayCustom.h:
            * bindings/v8/custom/V8WebGLByteArrayCustom.cpp:
            * bindings/v8/custom/V8WebGLFloatArrayCustom.cpp:
            * bindings/v8/custom/V8WebGLIntArrayCustom.cpp:
            * bindings/v8/custom/V8WebGLShortArrayCustom.cpp:
            * bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp:
            * bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp:
            * bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp:
            * bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp:
            * bindings/v8/custom/V8WebKitPointConstructor.cpp:
            * bindings/v8/custom/V8WebSocketCustom.cpp:
            * bindings/v8/custom/V8WorkerCustom.cpp:
            * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
            * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55798 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk
index fecf531..49d61de 100644
--- a/WebCore/Android.v8bindings.mk
+++ b/WebCore/Android.v8bindings.mk
@@ -72,7 +72,6 @@ LOCAL_SRC_FILES += \
 	bindings/v8/V8GCController.cpp \
 	bindings/v8/V8Helpers.cpp \
 	bindings/v8/V8HiddenPropertyName.cpp \
-	bindings/v8/V8Index.cpp \
 	bindings/v8/V8IsolatedWorld.cpp \
 	bindings/v8/V8LazyEventListener.cpp \
 	bindings/v8/V8NPObject.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5a38e50..bba0301 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,59 @@
+2010-03-10  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        [V8] Instead of describing the type of a wrapped v8 object
+        with an enum value, use a pointer to struct with more complete
+        information.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35941
+
+        Refactoring only, so new tests.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/v8/DOMData.cpp:
+        * bindings/v8/DOMData.h:
+        * bindings/v8/NPV8Object.cpp:
+        * bindings/v8/V8Collection.h:
+        * bindings/v8/V8DOMWindowShell.cpp:
+        * bindings/v8/V8DOMWindowShell.h:
+        * bindings/v8/V8DOMWrapper.cpp:
+        * bindings/v8/V8DOMWrapper.h:
+        * bindings/v8/V8GCController.cpp:
+        * bindings/v8/V8Helpers.cpp:
+        * bindings/v8/V8Helpers.h:
+        * bindings/v8/V8Index.cpp: Removed.
+        * bindings/v8/V8Index.h:
+        * bindings/v8/V8NPObject.cpp:
+        * bindings/v8/V8Proxy.cpp:
+        * bindings/v8/V8Proxy.h:
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp:
+        * bindings/v8/custom/V8HTMLAudioElementConstructor.h:
+        * bindings/v8/custom/V8HTMLImageElementConstructor.cpp:
+        * bindings/v8/custom/V8HTMLImageElementConstructor.h:
+        * bindings/v8/custom/V8HTMLOptionElementConstructor.cpp:
+        * bindings/v8/custom/V8HTMLOptionElementConstructor.h:
+        * bindings/v8/custom/V8InjectedScriptHostCustom.cpp:
+        * bindings/v8/custom/V8MessageChannelConstructor.cpp:
+        * bindings/v8/custom/V8SharedWorkerCustom.cpp:
+        * bindings/v8/custom/V8WebGLArrayBufferCustom.cpp:
+        * bindings/v8/custom/V8WebGLArrayCustom.h:
+        * bindings/v8/custom/V8WebGLByteArrayCustom.cpp:
+        * bindings/v8/custom/V8WebGLFloatArrayCustom.cpp:
+        * bindings/v8/custom/V8WebGLIntArrayCustom.cpp:
+        * bindings/v8/custom/V8WebGLShortArrayCustom.cpp:
+        * bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp:
+        * bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp:
+        * bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp:
+        * bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp:
+        * bindings/v8/custom/V8WebKitPointConstructor.cpp:
+        * bindings/v8/custom/V8WebSocketCustom.cpp:
+        * bindings/v8/custom/V8WorkerCustom.cpp:
+        * bindings/v8/custom/V8XMLHttpRequestConstructor.cpp:
+        * bindings/v8/custom/V8XSLTProcessorCustom.cpp:
+
 2010-03-10  Antonio Gomes  <tonikitoo at webkit.org>
 
         Reviewed by Dave Hyatt.
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index eded622..51470ae 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -873,7 +873,6 @@
             'bindings/v8/V8Helpers.h',
             'bindings/v8/V8HiddenPropertyName.cpp',
             'bindings/v8/V8HiddenPropertyName.h',
-            'bindings/v8/V8Index.cpp',
             'bindings/v8/V8Index.h',
             'bindings/v8/V8IsolatedContext.cpp',
             'bindings/v8/V8IsolatedContext.h',
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index fe7b14b..5aca121 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -247,10 +247,15 @@ public:
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
     static ${nativeType}* toNative(v8::Handle<v8::Object>);
     static v8::Handle<v8::Object> wrap(${nativeType}*${forceNewObjectParameter});
+    static void derefObject(void*);
+    static WrapperTypeInfo info;
 END
+    if (IsActiveDomType($implClassName)) {
+        push(@headerContent, "    static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);\n");
+    }
 
     if ($implClassName eq "DOMWindow") {
-      push(@headerContent, <<END);
+        push(@headerContent, <<END);
     static v8::Persistent<v8::ObjectTemplate> GetShadowObjectTemplate();
 END
     }
@@ -546,8 +551,8 @@ sub GenerateConstructorGetter
 static v8::Handle<v8::Value> ${implClassName}ConstructorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) {
     INC_STATS(\"DOM.$implClassName.constructors._get\");
     v8::Handle<v8::Value> data = info.Data();
-    ASSERT(data->IsNumber());
-    V8ClassIndex::V8WrapperType type = V8ClassIndex::FromInt(data->Int32Value());
+    ASSERT(data->IsExternal() || data->IsNumber());
+    WrapperTypeInfo* type = reinterpret_cast<WrapperTypeInfo*>(v8::External::Unwrap(data));
 END
 
     if ($implClassName eq "DOMWindow") {
@@ -1179,17 +1184,17 @@ sub GenerateSingleBatchedAttribute
     }
 
     my $on_proto = "0 /* on instance */";
-    my $data = "V8ClassIndex::INVALID_CLASS_INDEX /* no data */";
+    my $data = "0 /* no data */";
 
     # Constructor
     if ($attribute->signature->type =~ /Constructor$/) {
         my $constructorType = $codeGenerator->StripModule($attribute->signature->type);
         $constructorType =~ s/Constructor$//;
-        my $constructorIndex = uc($constructorType);
+        $implIncludes{"V8${constructorType}.h"} = 1;
         if ($customAccessor) {
             $getter = "V8${customAccessor}AccessorGetter";
         } else {
-            $data = "V8ClassIndex::${constructorIndex}";
+            $data = "&V8${constructorType}::info";
             $getter = "${interfaceName}Internal::${interfaceName}ConstructorGetter";
         }
         $setter = "0";
@@ -1457,7 +1462,10 @@ sub GenerateImplementation
 
     AddIncludesForType($interfaceName);
 
-    push(@implContentDecls, "namespace WebCore {\n");
+    my $toActive = IsActiveDomType($interfaceName) ? "${className}::toActiveDOMObject" : "0";
+
+    push(@implContentDecls, "namespace WebCore {\n\n");
+    push(@implContentDecls, "WrapperTypeInfo ${className}::info = {V8ClassIndex::ToInt(V8ClassIndex::${classIndex}), ${className}::GetTemplate, ${className}::derefObject, ${toActive} };\n\n");   
     push(@implContentDecls, "namespace ${interfaceName}Internal {\n\n");
     push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n");
 
@@ -1626,7 +1634,7 @@ END
 v8::Handle<v8::Value> ${className}::constructorCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.${interfaceName}.Contructor");
-    return V8Proxy::constructDOMObject<V8ClassIndex::${classIndex}, $interfaceName>(args);
+    return V8Proxy::constructDOMObject<$interfaceName>(args, &info);
 }
 END
    }
@@ -1880,6 +1888,18 @@ bool ${className}::HasInstance(v8::Handle<v8::Value> value)
 
 END
 
+    if (IsActiveDomType($interfaceName)) {
+        # MessagePort is handled like an active dom object even though it doesn't inherit
+        # from ActiveDOMObject, so don't try to cast it to ActiveDOMObject.
+        my $returnValue = $interfaceName eq "MessagePort" ? "0" : "toNative(object)";
+        push(@implContent, <<END);
+ActiveDOMObject* ${className}::toActiveDOMObject(v8::Handle<v8::Object> object)
+{
+    return ${returnValue};
+}      
+END
+    }
+
     if ($implClassName eq "DOMWindow") {
         push(@implContent, <<END);
 v8::Persistent<v8::ObjectTemplate> V8DOMWindow::GetShadowObjectTemplate()
@@ -1897,6 +1917,20 @@ END
     GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType);
 
     push(@implContent, <<END);
+
+void ${className}::derefObject(void* object)
+{
+END
+
+    if (IsRefPtrType($interfaceName)) {
+        push(@implContent, <<END);
+    static_cast<${nativeType}*>(object)->deref();
+END
+    }
+
+    push(@implContent, <<END);
+}
+
 } // namespace WebCore
 END
 
@@ -1961,7 +1995,7 @@ END
     }
 
     push(@implContent, <<END);
-    wrapper = V8DOMWrapper::instantiateV8Object(proxy, ${wrapperType}, impl);
+    wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
 END
 
     if (IsNodeSubType($dataNode)) {
diff --git a/WebCore/bindings/v8/DOMData.cpp b/WebCore/bindings/v8/DOMData.cpp
index 417426f..666326b 100644
--- a/WebCore/bindings/v8/DOMData.cpp
+++ b/WebCore/bindings/v8/DOMData.cpp
@@ -58,7 +58,7 @@ DOMData* DOMData::getCurrent()
     return childThreadDOMData;
 }
 
-void DOMData::ensureDeref(V8ClassIndex::V8WrapperType type, void* domObject)
+void DOMData::ensureDeref(WrapperTypeInfo* type, void* domObject)
 {
     if (m_owningThread == WTF::currentThread()) {
         // No need to delay the work. We can deref right now.
@@ -78,35 +78,9 @@ void DOMData::ensureDeref(V8ClassIndex::V8WrapperType type, void* domObject)
     }
 }
 
-void DOMData::derefObject(V8ClassIndex::V8WrapperType type, void* domObject)
+void DOMData::derefObject(WrapperTypeInfo* type, void* domObject)
 {
-    switch (type) {
-    case V8ClassIndex::NODE:
-        static_cast<Node*>(domObject)->deref();
-        break;
-
-#define MakeCase(type, name)   \
-        case V8ClassIndex::type: static_cast<name*>(domObject)->deref(); break;
-    DOM_OBJECT_TYPES(MakeCase)   // This includes both active and non-active.
-#undef MakeCase
-
-#if ENABLE(SVG)
-#define MakeCase(type, name)     \
-        case V8ClassIndex::type: static_cast<name*>(domObject)->deref(); break;
-    SVG_OBJECT_TYPES(MakeCase)   // This also includes SVGElementInstance.
-#undef MakeCase
-
-#define MakeCase(type, name)     \
-        case V8ClassIndex::type:    \
-            static_cast<V8SVGPODTypeWrapper<name>*>(domObject)->deref(); break;
-    SVG_POD_NATIVE_TYPES(MakeCase)
-#undef MakeCase
-#endif
-
-    default:
-        ASSERT_NOT_REACHED();
-        break;
-    }
+    type->derefObject(domObject);
 }
 
 void DOMData::derefDelayedObjects()
diff --git a/WebCore/bindings/v8/DOMData.h b/WebCore/bindings/v8/DOMData.h
index 3ca29bf..3551c9d 100644
--- a/WebCore/bindings/v8/DOMData.h
+++ b/WebCore/bindings/v8/DOMData.h
@@ -67,17 +67,17 @@ namespace WebCore {
         ThreadIdentifier owningThread() const { return m_owningThread; }
 
     private:
-        typedef WTF::HashMap<void*, V8ClassIndex::V8WrapperType> DelayedObjectMap;
+        typedef WTF::HashMap<void*, WrapperTypeInfo*> DelayedObjectMap;
 
-        void ensureDeref(V8ClassIndex::V8WrapperType type, void* domObject);
-        static void derefObject(V8ClassIndex::V8WrapperType type, void* domObject);
+        void ensureDeref(WrapperTypeInfo* type, void* domObject);
+        static void derefObject(WrapperTypeInfo* type, void* domObject);
 
         template<typename T>
         class WrapperMapObjectRemover : public WeakReferenceMap<T, v8::Object>::Visitor {
         public:
             virtual void visitDOMWrapper(T* domObject, v8::Persistent<v8::Object> v8Object)
             {
-                V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(v8Object);
+                WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(v8Object);
                 derefObject(type, domObject);
                 v8Object.Dispose();
             }
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index 22c3b83..75eaa69 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -59,6 +59,7 @@ using WebCore::V8ClassIndex;
 using WebCore::V8DOMWrapper;
 using WebCore::V8GCController;
 using WebCore::V8Proxy;
+using WebCore::WrapperTypeInfo;
 
 // FIXME: Comments on why use malloc and free.
 static NPObject* allocV8NPObject(NPP, NPClass*)
@@ -115,8 +116,8 @@ NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, WebCore
 {
     // Check to see if this object is already wrapped.
     if (object->InternalFieldCount() == npObjectInternalFieldCount) {
-        v8::Local<v8::Value> typeIndex = object->GetInternalField(WebCore::v8DOMWrapperTypeIndex);
-        if (typeIndex->IsNumber() && typeIndex->Uint32Value() == V8ClassIndex::NPOBJECT) {
+        WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(WebCore::v8DOMWrapperTypeIndex));
+        if (typeInfo->index == V8ClassIndex::NPOBJECT) {
 
             NPObject* returnValue = v8ObjectToNPObject(object);
             _NPN_RetainObject(returnValue);
diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h
index 9611571..fe3466a 100644
--- a/WebCore/bindings/v8/V8Collection.h
+++ b/WebCore/bindings/v8/V8Collection.h
@@ -63,7 +63,7 @@ template<class Collection, class ItemType> static v8::Handle<v8::Value> getNamed
 {
     // FIXME: assert object is a collection type
     ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
-    ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE);
+    ASSERT(V8DOMWrapper::domWrapperType(object)->index != V8ClassIndex::NODE);
     Collection* collection = toNativeCollection<Collection>(object);
     AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name);
     return getV8Object<ItemType>(collection->namedItem(propertyName));
@@ -89,7 +89,7 @@ template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndex
 {
     // FIXME: Assert that object must be a collection type.
     ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
-    ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE);
+    ASSERT(V8DOMWrapper::domWrapperType(object)->index != V8ClassIndex::NODE);
     Collection* collection = toNativeCollection<Collection>(object);
     return getV8Object<ItemType>(collection->item(index));
 }
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp
index bdc2c1f..867820c 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.cpp
+++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp
@@ -369,22 +369,22 @@ bool V8DOMWindowShell::installDOMWindow(v8::Handle<v8::Context> context, DOMWind
         return false;
 
     // Create a new JS window object and use it as the prototype for the  shadow global object.
-    v8::Handle<v8::Function> windowConstructor = V8DOMWrapper::getConstructor(V8ClassIndex::DOMWINDOW, getHiddenObjectPrototype(context));
+    v8::Handle<v8::Function> windowConstructor = V8DOMWrapper::getConstructor(&V8DOMWindow::info, getHiddenObjectPrototype(context));
     v8::Local<v8::Object> jsWindow = SafeAllocation::newInstance(windowConstructor);
     // Bail out if allocation failed.
     if (jsWindow.IsEmpty())
         return false;
 
     // Wrap the window.
-    V8DOMWrapper::setDOMWrapper(jsWindow, V8ClassIndex::ToInt(V8ClassIndex::DOMWINDOW), window);
-    V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(jsWindow->GetPrototype()), V8ClassIndex::ToInt(V8ClassIndex::DOMWINDOW), window);
+    V8DOMWrapper::setDOMWrapper(jsWindow, &V8DOMWindow::info, window);
+    V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(jsWindow->GetPrototype()), &V8DOMWindow::info, window);
 
     window->ref();
     V8DOMWrapper::setJSWrapperForDOMObject(window, v8::Persistent<v8::Object>::New(jsWindow));
 
     // Insert the window instance as the prototype of the shadow object.
     v8::Handle<v8::Object> v8Global = context->Global();
-    V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(v8Global->GetPrototype()), V8ClassIndex::ToInt(V8ClassIndex::DOMWINDOW), window);
+    V8DOMWrapper::setDOMWrapper(v8::Handle<v8::Object>::Cast(v8Global->GetPrototype()), &V8DOMWindow::info, window);
     v8Global->Set(implicitProtoString, jsWindow);
     return true;
 }
@@ -532,10 +532,10 @@ void V8DOMWindowShell::installHiddenObjectPrototype(v8::Handle<v8::Context> cont
     context->Global()->SetHiddenValue(hiddenObjectPrototypeString, objectPrototype);
 }
 
-v8::Local<v8::Object> V8DOMWindowShell::createWrapperFromCacheSlowCase(V8ClassIndex::V8WrapperType type)
+v8::Local<v8::Object> V8DOMWindowShell::createWrapperFromCacheSlowCase(WrapperTypeInfo* type)
 {
     // Not in cache.
-    int classIndex = V8ClassIndex::ToInt(type);
+    int classIndex = type->index;
     initContextIfNeeded();
     v8::Context::Scope scope(m_context);
     v8::Local<v8::Function> function = V8DOMWrapper::getConstructor(type, getHiddenObjectPrototype(m_context));
diff --git a/WebCore/bindings/v8/V8DOMWindowShell.h b/WebCore/bindings/v8/V8DOMWindowShell.h
index 5114f7a..5ac91e8 100644
--- a/WebCore/bindings/v8/V8DOMWindowShell.h
+++ b/WebCore/bindings/v8/V8DOMWindowShell.h
@@ -77,9 +77,9 @@ public:
     // To create JS Wrapper objects, we create a cache of a 'boiler plate'
     // object, and then simply Clone that object each time we need a new one.
     // This is faster than going through the full object creation process.
-    v8::Local<v8::Object> createWrapperFromCache(V8ClassIndex::V8WrapperType type)
+    v8::Local<v8::Object> createWrapperFromCache(WrapperTypeInfo* type)
     {
-        int classIndex = V8ClassIndex::ToInt(type);
+        int classIndex = type->index;
         v8::Local<v8::Object> clone(m_wrapperBoilerplates->CloneElementAt(classIndex));
         return clone.IsEmpty() ? createWrapperFromCacheSlowCase(type) : clone;
     }
@@ -101,7 +101,7 @@ private:
     void updateDocumentWrapperCache();
     void clearDocumentWrapperCache();
 
-    v8::Local<v8::Object> createWrapperFromCacheSlowCase(V8ClassIndex::V8WrapperType);
+    v8::Local<v8::Object> createWrapperFromCacheSlowCase(WrapperTypeInfo*);
 
     Frame* m_frame;
 
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 48cbd45..dd359d9 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -133,17 +133,7 @@ void V8DOMWrapper::setIndexedPropertiesToExternalArray(v8::Handle<v8::Object> wr
 void V8DOMWrapper::setJSWrapperForDOMObject(void* object, v8::Persistent<v8::Object> wrapper)
 {
     ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper));
-#ifndef NDEBUG
-    V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper);
-    switch (type) {
-#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE:
-        ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-        ASSERT_NOT_REACHED();
-#undef MAKE_CASE
-    default:
-        break;
-    }
-#endif
+    ASSERT(!domWrapperType(wrapper)->toActiveDOMObjectFunction);
     getDOMObjectMap().set(object, wrapper);
 }
 
@@ -151,16 +141,7 @@ void V8DOMWrapper::setJSWrapperForDOMObject(void* object, v8::Persistent<v8::Obj
 void V8DOMWrapper::setJSWrapperForActiveDOMObject(void* object, v8::Persistent<v8::Object> wrapper)
 {
     ASSERT(V8DOMWrapper::maybeDOMWrapper(wrapper));
-#ifndef NDEBUG
-    V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper);
-    switch (type) {
-#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE: break;
-        ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-    default: 
-        ASSERT_NOT_REACHED();
-#undef MAKE_CASE
-    }
-#endif
+    ASSERT(domWrapperType(wrapper)->toActiveDOMObjectFunction);
     getActiveDOMObjectMap().set(object, wrapper);
 }
 
@@ -171,7 +152,7 @@ void V8DOMWrapper::setJSWrapperForDOMNode(Node* node, v8::Persistent<v8::Object>
     getDOMNodeMap().set(node, wrapper);
 }
 
-v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> objectPrototype)
+v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, v8::Handle<v8::Value> objectPrototype)
 {
     // A DOM constructor is a function instance created from a DOM constructor
     // template. There is one instance per context. A DOM constructor is
@@ -182,7 +163,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     // The reason for 2) is that, in Safari, a DOM constructor is a normal JS
     // object, but not a function. Hotmail relies on the fact that, in Safari,
     // HTMLElement.__proto__ == Object.prototype.
-    v8::Handle<v8::FunctionTemplate> functionTemplate = V8ClassIndex::getTemplate(type);
+    v8::Handle<v8::FunctionTemplate> functionTemplate = type->getTemplate();
     // Getting the function might fail if we're running out of
     // stack or memory.
     v8::TryCatch tryCatch;
@@ -195,7 +176,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     return value;
 }
 
-v8::Local<v8::Function> V8DOMWrapper::getConstructorForContext(V8ClassIndex::V8WrapperType type, v8::Handle<v8::Context> context)
+v8::Local<v8::Function> V8DOMWrapper::getConstructorForContext(WrapperTypeInfo* type, v8::Handle<v8::Context> context)
 {
     // Enter the scope for this context to get the correct constructor.
     v8::Context::Scope scope(context);
@@ -203,7 +184,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructorForContext(V8ClassIndex::V8W
     return getConstructor(type, V8DOMWindowShell::getHiddenObjectPrototype(context));
 }
 
-v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, DOMWindow* window)
+v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, DOMWindow* window)
 {
     Frame* frame = window->frame();
     if (!frame)
@@ -216,7 +197,7 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType
     return getConstructorForContext(type, context);
 }
 
-v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType type, WorkerContext*)
+v8::Local<v8::Function> V8DOMWrapper::getConstructor(WrapperTypeInfo* type, WorkerContext*)
 {
     WorkerContextExecutionProxy* proxy = WorkerContextExecutionProxy::retrieve();
     if (!proxy)
@@ -248,11 +229,10 @@ void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalInde
     global->SetInternalField(internalIndex, jsObject);
 }
 
-V8ClassIndex::V8WrapperType V8DOMWrapper::domWrapperType(v8::Handle<v8::Object> object)
+WrapperTypeInfo* V8DOMWrapper::domWrapperType(v8::Handle<v8::Object> object)
 {
     ASSERT(V8DOMWrapper::maybeDOMWrapper(object));
-    v8::Handle<v8::Value> type = object->GetInternalField(v8DOMWrapperTypeIndex);
-    return V8ClassIndex::FromInt(type->Int32Value());
+    return static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
 }
 
 PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value> filter)
@@ -285,7 +265,7 @@ static bool globalObjectPrototypeIsDOMWindow(v8::Handle<v8::Object> objectProtot
     return objectPrototype->InternalFieldCount() == V8DOMWindow::internalFieldCount;
 }
 
-v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl)
+v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo* type, void* impl)
 {
     WorkerContext* workerContext = 0;
     if (V8IsolatedContext::getEntered()) {
@@ -314,12 +294,12 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI
         if (workerContext)
             function = getConstructor(type, workerContext);
         else
-            function = V8ClassIndex::getTemplate(type)->GetFunction();
+            function = type->getTemplate()->GetFunction();
         instance = SafeAllocation::newInstance(function);
     }
     if (!instance.IsEmpty()) {
         // Avoid setting the DOM wrapper for failed allocations.
-        setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl);
+        setDOMWrapper(instance, type, impl);
     }
     return instance;
 }
@@ -336,9 +316,8 @@ bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
 
     ASSERT(object->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount);
 
-    v8::Handle<v8::Value> type = object->GetInternalField(v8DOMWrapperTypeIndex);
-    ASSERT(type->IsInt32());
-    ASSERT(V8ClassIndex::INVALID_CLASS_INDEX < type->Int32Value() && type->Int32Value() < V8ClassIndex::CLASSINDEX_END);
+    WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
+    ASSERT(V8ClassIndex::INVALID_CLASS_INDEX < typeInfo->index && typeInfo->index < V8ClassIndex::CLASSINDEX_END);
 
     v8::Handle<v8::Value> wrapper = object->GetInternalField(v8DOMWrapperObjectIndex);
     ASSERT(wrapper->IsNumber() || wrapper->IsExternal());
@@ -365,11 +344,10 @@ bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, V8ClassIndex::V8
     v8::Handle<v8::Value> wrapper = object->GetInternalField(v8DOMWrapperObjectIndex);
     ASSERT(wrapper->IsNumber() || wrapper->IsExternal());
 
-    v8::Handle<v8::Value> type = object->GetInternalField(v8DOMWrapperTypeIndex);
-    ASSERT(type->IsInt32());
-    ASSERT(V8ClassIndex::INVALID_CLASS_INDEX < type->Int32Value() && type->Int32Value() < V8ClassIndex::CLASSINDEX_END);
+    WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(v8DOMWrapperTypeIndex));
+    ASSERT(V8ClassIndex::INVALID_CLASS_INDEX < typeInfo->index && typeInfo->index < V8ClassIndex::CLASSINDEX_END);
 
-    return V8ClassIndex::FromInt(type->Int32Value()) == classType;
+    return V8ClassIndex::FromInt(typeInfo->index) == classType;
 }
 
 v8::Handle<v8::Object> V8DOMWrapper::getWrapper(Node* node)
diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h
index baf89f0..4d98daa 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.h
+++ b/WebCore/bindings/v8/V8DOMWrapper.h
@@ -67,11 +67,11 @@ namespace WebCore {
 #endif
 
         // Sets contents of a DOM wrapper.
-        static void setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr)
+        static void setDOMWrapper(v8::Handle<v8::Object> object, WrapperTypeInfo* type, void* cptr)
         {
             ASSERT(object->InternalFieldCount() >= 2);
             object->SetPointerInInternalField(v8DOMWrapperObjectIndex, cptr);
-            object->SetInternalField(v8DOMWrapperTypeIndex, v8::Integer::New(type));
+            object->SetPointerInInternalField(v8DOMWrapperTypeIndex, type);
         }
 
         static v8::Handle<v8::Object> lookupDOMWrapper(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Handle<v8::Object> object)
@@ -79,7 +79,7 @@ namespace WebCore {
             return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(functionTemplate);
         }
 
-        static V8ClassIndex::V8WrapperType domWrapperType(v8::Handle<v8::Object>);
+        static WrapperTypeInfo* domWrapperType(v8::Handle<v8::Object>);
 
         static v8::Handle<v8::Value> convertEventTargetToV8Object(PassRefPtr<EventTarget> eventTarget)
         {
@@ -106,10 +106,10 @@ namespace WebCore {
         // Wrap JS node filter in C++.
         static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>);
 
-        static v8::Local<v8::Function> getConstructorForContext(V8ClassIndex::V8WrapperType, v8::Handle<v8::Context>);
-        static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, v8::Handle<v8::Value> objectPrototype);
-        static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, DOMWindow*);
-        static v8::Local<v8::Function> getConstructor(V8ClassIndex::V8WrapperType, WorkerContext*);
+        static v8::Local<v8::Function> getConstructorForContext(WrapperTypeInfo*, v8::Handle<v8::Context>);
+        static v8::Local<v8::Function> getConstructor(WrapperTypeInfo*, v8::Handle<v8::Value> objectPrototype);
+        static v8::Local<v8::Function> getConstructor(WrapperTypeInfo*, DOMWindow*);
+        static v8::Local<v8::Function> getConstructor(WrapperTypeInfo*, WorkerContext*);
 
         // Set JS wrapper of a DOM object, the caller in charge of increase ref.
         static void setJSWrapperForDOMObject(void*, v8::Persistent<v8::Object>);
@@ -130,7 +130,7 @@ namespace WebCore {
         // Set hidden references in a DOMWindow object of a frame.
         static void setHiddenWindowReference(Frame*, const int internalIndex, v8::Handle<v8::Object>);
 
-        static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl);
+        static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, WrapperTypeInfo*, void* impl);
 
         static v8::Handle<v8::Object> getWrapper(Node*);
     };
diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp
index b478636..81fc8fb 100644
--- a/WebCore/bindings/v8/V8GCController.cpp
+++ b/WebCore/bindings/v8/V8GCController.cpp
@@ -112,7 +112,7 @@ static void enumerateDOMObjectMap(DOMObjectMap& wrapperMap)
 {
     for (DOMObjectMap::iterator it = wrapperMap.begin(), end = wrapperMap.end(); it != end; ++it) {
         v8::Persistent<v8::Object> wrapper(it->second);
-        V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper);
+        WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(wrapper);
         void* object = it->first;
         UNUSED_PARAM(type);
         UNUSED_PARAM(object);
@@ -123,7 +123,7 @@ class DOMObjectVisitor : public DOMWrapperMap<void>::Visitor {
 public:
     void visitDOMWrapper(void* object, v8::Persistent<v8::Object> wrapper)
     {
-        V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper);
+        WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(wrapper);
         UNUSED_PARAM(type);
         UNUSED_PARAM(object);
     }
@@ -181,36 +181,26 @@ class GCPrologueVisitor : public DOMWrapperMap<void>::Visitor {
 public:
     void visitDOMWrapper(void* object, v8::Persistent<v8::Object> wrapper)
     {
-        ASSERT(wrapper.IsWeak());
-        V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper);
-        switch (type) {
-#define MAKE_CASE(TYPE, NAME)                             \
-        case V8ClassIndex::TYPE: {                    \
-            NAME* impl = static_cast<NAME*>(object);  \
-            if (impl->hasPendingActivity())           \
-                wrapper.ClearWeak();                  \
-            break;                                    \
-        }
-    ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-    default:
-        ASSERT_NOT_REACHED();
-#undef MAKE_CASE
+        WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);  
+
+        // Additional handling of message port ensuring that entangled ports also
+        // have their wrappers entangled. This should ideally be handled when the
+        // ports are actually entangled in MessagePort::entangle, but to avoid
+        // forking MessagePort.* this is postponed to GC time. Having this postponed
+        // has the drawback that the wrappers are "entangled/unentangled" for each
+        // GC even though their entaglement most likely is still the same.
+        if (typeInfo->index == V8ClassIndex::MESSAGEPORT) {
+            // Mark each port as in-use if it's entangled. For simplicity's sake, we assume all ports are remotely entangled,
+            // since the Chromium port implementation can't tell the difference.
+            MessagePort* port1 = static_cast<MessagePort*>(object);
+            if (port1->isEntangled() || port1->hasPendingActivity())
+                wrapper.ClearWeak();
+        } else {
+            ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
+            if (activeDOMObject && activeDOMObject->hasPendingActivity())
+                wrapper.ClearWeak();
         }
-
-    // Additional handling of message port ensuring that entangled ports also
-    // have their wrappers entangled. This should ideally be handled when the
-    // ports are actually entangled in MessagePort::entangle, but to avoid
-    // forking MessagePort.* this is postponed to GC time. Having this postponed
-    // has the drawback that the wrappers are "entangled/unentangled" for each
-    // GC even though their entaglement most likely is still the same.
-    if (type == V8ClassIndex::MESSAGEPORT) {
-        // Mark each port as in-use if it's entangled. For simplicity's sake, we assume all ports are remotely entangled,
-        // since the Chromium port implementation can't tell the difference.
-        MessagePort* port1 = static_cast<MessagePort*>(object);
-        if (port1->isEntangled())
-            wrapper.ClearWeak();
     }
-}
 };
 
 class GrouperItem {
@@ -369,30 +359,20 @@ class GCEpilogueVisitor : public DOMWrapperMap<void>::Visitor {
 public:
     void visitDOMWrapper(void* object, v8::Persistent<v8::Object> wrapper)
     {
-        V8ClassIndex::V8WrapperType type = V8DOMWrapper::domWrapperType(wrapper);
-        switch (type) {
-#define MAKE_CASE(TYPE, NAME)                                                   \
-        case V8ClassIndex::TYPE: {                                              \
-          NAME* impl = static_cast<NAME*>(object);                              \
-          if (impl->hasPendingActivity()) {                                     \
-            ASSERT(!wrapper.IsWeak());                                          \
-            wrapper.MakeWeak(impl, &DOMDataStore::weakActiveDOMObjectCallback); \
-          }                                                                     \
-          break;                                                                \
-        }
-ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE)
-        default:
-            ASSERT_NOT_REACHED();
-#undef MAKE_CASE
-        }
-
-        if (type == V8ClassIndex::MESSAGEPORT) {
+        WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
+        if (typeInfo->index == V8ClassIndex::MESSAGEPORT) {
             MessagePort* port1 = static_cast<MessagePort*>(object);
             // We marked this port as reachable in GCPrologueVisitor.  Undo this now since the
             // port could be not reachable in the future if it gets disentangled (and also
             // GCPrologueVisitor expects to see all handles marked as weak).
-            if (!wrapper.IsWeak() && !wrapper.IsNearDeath())
+            if ((!wrapper.IsWeak() && !wrapper.IsNearDeath()) || port1->hasPendingActivity())
                 wrapper.MakeWeak(port1, &DOMDataStore::weakActiveDOMObjectCallback);
+        } else {
+            ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
+            if (activeDOMObject && activeDOMObject->hasPendingActivity()) {
+                ASSERT(!wrapper.IsWeak());
+                wrapper.MakeWeak(activeDOMObject, &DOMDataStore::weakActiveDOMObjectCallback);
+            }
         }
     }
 };
diff --git a/WebCore/bindings/v8/V8Helpers.cpp b/WebCore/bindings/v8/V8Helpers.cpp
index a690017..12b8ff4 100644
--- a/WebCore/bindings/v8/V8Helpers.cpp
+++ b/WebCore/bindings/v8/V8Helpers.cpp
@@ -38,11 +38,6 @@
 
 namespace WebCore {
 
-void wrapNPObject(v8::Handle<v8::Object> object, NPObject* npObject)
-{
-    V8DOMWrapper::setDOMWrapper(object, V8ClassIndex::NPOBJECT, npObject);
-}
-
 v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject)
 {
     V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
diff --git a/WebCore/bindings/v8/V8Helpers.h b/WebCore/bindings/v8/V8Helpers.h
index 469833e..e90f5d6 100644
--- a/WebCore/bindings/v8/V8Helpers.h
+++ b/WebCore/bindings/v8/V8Helpers.h
@@ -37,9 +37,6 @@
 namespace WebCore {
     class V8Proxy;
 
-    // Associates an NPObject with a V8 object.
-    void wrapNPObject(v8::Handle<v8::Object>, NPObject*);
-
     v8::Local<v8::Context> toV8Context(NPP, NPObject*);
 
     V8Proxy* toV8Proxy(NPObject*);
diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp
deleted file mode 100644
index df1f828..0000000
--- a/WebCore/bindings/v8/V8Index.cpp
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "V8Index.h"
-
-#include "V8Attr.h"
-#include "V8BarInfo.h"
-#include "V8BeforeLoadEvent.h"
-#include "V8Blob.h"
-#include "V8WebGLActiveInfo.h"
-#include "V8CanvasRenderingContext.h"
-#include "V8CanvasRenderingContext2D.h"
-#include "V8CanvasGradient.h"
-#include "V8CanvasPattern.h"
-#include "V8CanvasPixelArray.h"
-#include "V8CDATASection.h"
-#include "V8CharacterData.h"
-#include "V8ClientRect.h"
-#include "V8ClientRectList.h"
-#include "V8Clipboard.h"
-#include "V8Comment.h"
-#include "V8CompositionEvent.h"
-#include "V8Console.h"
-#include "V8Counter.h"
-#include "V8CSSStyleDeclaration.h"
-#include "V8CSSRule.h"
-#include "V8CSSStyleRule.h"
-#include "V8CSSCharsetRule.h"
-#include "V8CSSImportRule.h"
-#include "V8CSSMediaRule.h"
-#include "V8CSSFontFaceRule.h"
-#include "V8CSSPageRule.h"
-#include "V8CSSRuleList.h"
-#include "V8CSSPrimitiveValue.h"
-#include "V8CSSValue.h"
-#include "V8CSSValueList.h"
-#include "V8CSSStyleSheet.h"
-#include "V8CSSVariablesDeclaration.h"
-#include "V8CSSVariablesRule.h"
-#include "V8DataGridColumn.h"
-#include "V8DataGridColumnList.h"
-#include "V8Document.h"
-#include "V8DocumentFragment.h"
-#include "V8DocumentType.h"
-#include "V8Element.h"
-#include "V8Entity.h"
-#include "V8EntityReference.h"
-#include "V8File.h"
-#include "V8FileList.h"
-#include "V8History.h"
-#include "V8HTMLAllCollection.h"
-#include "V8HTMLCanvasElement.h"
-#include "V8HTMLCollection.h"
-#include "V8HTMLDocument.h"
-#include "V8HTMLElement.h"
-#include "V8HTMLOptionsCollection.h"
-#include "V8HTMLAnchorElement.h"
-#include "V8HTMLAppletElement.h"
-#include "V8HTMLAreaElement.h"
-#include "V8HTMLBaseElement.h"
-#include "V8HTMLBaseFontElement.h"
-#include "V8HTMLBlockquoteElement.h"
-#include "V8HTMLBodyElement.h"
-#include "V8HTMLBRElement.h"
-#include "V8HTMLButtonElement.h"
-#include "V8HTMLCanvasElement.h"
-#include "V8HTMLModElement.h"
-#include "V8HTMLDataGridCellElement.h"
-#include "V8HTMLDataGridColElement.h"
-#include "V8HTMLDataGridElement.h"
-#include "V8HTMLDataGridRowElement.h"
-#include "V8HTMLDirectoryElement.h"
-#include "V8HTMLDivElement.h"
-#include "V8HTMLDListElement.h"
-#include "V8HTMLEmbedElement.h"
-#include "V8HTMLFieldSetElement.h"
-#include "V8HTMLFormElement.h"
-#include "V8HTMLFontElement.h"
-#include "V8HTMLFrameElement.h"
-#include "V8HTMLFrameSetElement.h"
-#include "V8HTMLHeadingElement.h"
-#include "V8HTMLHeadElement.h"
-#include "V8HTMLHRElement.h"
-#include "V8HTMLHtmlElement.h"
-#include "V8HTMLIFrameElement.h"
-#include "V8HTMLImageElement.h"
-#include "V8HTMLImageElementConstructor.h"
-#include "V8HTMLInputElement.h"
-#include "V8HTMLIsIndexElement.h"
-#include "V8HTMLLabelElement.h"
-#include "V8HTMLLegendElement.h"
-#include "V8HTMLLIElement.h"
-#include "V8HTMLLinkElement.h"
-#include "V8HTMLMapElement.h"
-#include "V8HTMLMarqueeElement.h"
-#include "V8HTMLMenuElement.h"
-#include "V8HTMLMetaElement.h"
-#include "V8HTMLObjectElement.h"
-#include "V8HTMLOListElement.h"
-#include "V8HTMLOptGroupElement.h"
-#include "V8HTMLOptionElement.h"
-#include "V8HTMLOptionElementConstructor.h"
-#include "V8HTMLParagraphElement.h"
-#include "V8HTMLParamElement.h"
-#include "V8HTMLPreElement.h"
-#include "V8HTMLQuoteElement.h"
-#include "V8HTMLScriptElement.h"
-#include "V8HTMLSelectElement.h"
-#include "V8HTMLStyleElement.h"
-#include "V8HTMLTableCaptionElement.h"
-#include "V8HTMLTableColElement.h"
-#include "V8HTMLTableElement.h"
-#include "V8HTMLTableSectionElement.h"
-#include "V8HTMLTableCellElement.h"
-#include "V8HTMLTableRowElement.h"
-#include "V8HTMLTextAreaElement.h"
-#include "V8HTMLTitleElement.h"
-#include "V8HTMLUListElement.h"
-#include "V8ImageData.h"
-#include "V8Media.h"
-#include "V8MediaList.h"
-#include "V8MessageChannel.h"
-#include "V8MessageEvent.h"
-#include "V8MessagePort.h"
-#include "V8NamedNodeMap.h"
-#include "V8Node.h"
-#include "V8NodeList.h"
-#include "V8NodeFilter.h"
-#include "V8Notation.h"
-#include "V8PopStateEvent.h"
-#include "V8ProcessingInstruction.h"
-#include "V8ProgressEvent.h"
-#include "V8StyleSheet.h"
-#include "V8Text.h"
-#include "V8TextEvent.h"
-#include "V8Touch.h"
-#include "V8TouchEvent.h"
-#include "V8TouchList.h"
-#include "V8DOMCoreException.h"
-#include "V8DOMParser.h"
-#include "V8DOMWindow.h"
-#include "V8ErrorEvent.h"
-#include "V8Event.h"
-#include "V8EventException.h"
-#include "V8KeyboardEvent.h"
-#include "V8MouseEvent.h"
-#include "V8ValidityState.h"
-#include "V8WebKitAnimationEvent.h"
-#include "V8WebKitCSSKeyframeRule.h"
-#include "V8WebKitCSSKeyframesRule.h"
-#include "V8WebKitCSSMatrix.h"
-#include "V8WebKitCSSTransformValue.h"
-#include "V8WebKitPoint.h"
-#include "V8WebKitTransitionEvent.h"
-#include "V8WheelEvent.h"
-#include "V8UIEvent.h"
-#include "V8MutationEvent.h"
-#include "V8OverflowEvent.h"
-#include "V8Location.h"
-#include "V8Screen.h"
-#include "V8DOMSelection.h"
-#include "V8Navigator.h"
-#include "V8MimeType.h"
-#include "V8MimeTypeArray.h"
-#include "V8PageTransitionEvent.h"
-#include "V8Plugin.h"
-#include "V8PluginArray.h"
-#include "V8Range.h"
-#include "V8RangeException.h"
-#include "V8Rect.h"
-#include "V8NodeIterator.h"
-#include "V8TextMetrics.h"
-#include "V8TreeWalker.h"
-#include "V8StyleSheetList.h"
-#include "V8DOMImplementation.h"
-#include "V8XMLHttpRequest.h"
-#include "V8XMLHttpRequestException.h"
-#include "V8XMLHttpRequestProgressEvent.h"
-#include "V8XMLHttpRequestUpload.h"
-#include "V8XMLSerializer.h"
-#include "V8RGBColor.h"
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-#include "V8DOMApplicationCache.h"
-#endif
-
-#if ENABLE(DOM_STORAGE)
-#include "V8Storage.h"
-#include "V8StorageEvent.h"
-#endif
-
-#if ENABLE(SVG_ANIMATION)
-#include "V8SVGAnimateColorElement.h"
-#include "V8SVGAnimateElement.h"
-#include "V8SVGAnimateTransformElement.h"
-#include "V8SVGAnimationElement.h"
-#include "V8SVGSetElement.h"
-#endif
-
-#if ENABLE(SVG) && ENABLE(FILTERS)
-#include "V8SVGComponentTransferFunctionElement.h"
-#include "V8SVGFEBlendElement.h"
-#include "V8SVGFEColorMatrixElement.h"
-#include "V8SVGFEComponentTransferElement.h"
-#include "V8SVGFECompositeElement.h"
-#include "V8SVGFEDiffuseLightingElement.h"
-#include "V8SVGFEDisplacementMapElement.h"
-#include "V8SVGFEDistantLightElement.h"
-#include "V8SVGFEFloodElement.h"
-#include "V8SVGFEFuncAElement.h"
-#include "V8SVGFEFuncBElement.h"
-#include "V8SVGFEFuncGElement.h"
-#include "V8SVGFEFuncRElement.h"
-#include "V8SVGFEGaussianBlurElement.h"
-#include "V8SVGFEImageElement.h"
-#include "V8SVGFEMergeElement.h"
-#include "V8SVGFEMergeNodeElement.h"
-#include "V8SVGFEMorphologyElement.h"
-#include "V8SVGFEOffsetElement.h"
-#include "V8SVGFEPointLightElement.h"
-#include "V8SVGFESpecularLightingElement.h"
-#include "V8SVGFESpotLightElement.h"
-#include "V8SVGFETileElement.h"
-#include "V8SVGFETurbulenceElement.h"
-#include "V8SVGFilterElement.h"
-#endif
-
-#if ENABLE(SVG_FONTS)
-#include "V8SVGFontElement.h"
-#include "V8SVGFontFaceElement.h"
-#include "V8SVGFontFaceFormatElement.h"
-#include "V8SVGFontFaceNameElement.h"
-#include "V8SVGFontFaceSrcElement.h"
-#include "V8SVGFontFaceUriElement.h"
-#include "V8SVGMissingGlyphElement.h"
-#endif
-
-#if ENABLE(SVG_FOREIGN_OBJECT)
-#include "V8SVGForeignObjectElement.h"
-#endif
-
-#if ENABLE(SVG_USE)
-#include "V8SVGUseElement.h"
-#endif
-
-#if ENABLE(SVG)
-#include "V8SVGAElement.h"
-#include "V8SVGAltGlyphElement.h"
-#include "V8SVGCircleElement.h"
-#include "V8SVGClipPathElement.h"
-#include "V8SVGCursorElement.h"
-#include "V8SVGDefsElement.h"
-#include "V8SVGDescElement.h"
-#include "V8SVGElement.h"
-#include "V8SVGEllipseElement.h"
-#include "V8SVGException.h"
-#include "V8SVGGElement.h"
-#include "V8SVGGlyphElement.h"
-#include "V8SVGGradientElement.h"
-#include "V8SVGImageElement.h"
-#include "V8SVGLinearGradientElement.h"
-#include "V8SVGLineElement.h"
-#include "V8SVGMarkerElement.h"
-#include "V8SVGMaskElement.h"
-#include "V8SVGMetadataElement.h"
-#include "V8SVGPathElement.h"
-#include "V8SVGPatternElement.h"
-#include "V8SVGPolygonElement.h"
-#include "V8SVGPolylineElement.h"
-#include "V8SVGRadialGradientElement.h"
-#include "V8SVGRectElement.h"
-#include "V8SVGScriptElement.h"
-#include "V8SVGStopElement.h"
-#include "V8SVGStyleElement.h"
-#include "V8SVGSVGElement.h"
-#include "V8SVGSwitchElement.h"
-#include "V8SVGSymbolElement.h"
-#include "V8SVGTextContentElement.h"
-#include "V8SVGTextElement.h"
-#include "V8SVGTextPathElement.h"
-#include "V8SVGTextPositioningElement.h"
-#include "V8SVGTitleElement.h"
-#include "V8SVGTRefElement.h"
-#include "V8SVGTSpanElement.h"
-#include "V8SVGViewElement.h"
-#include "V8SVGAngle.h"
-#include "V8SVGAnimatedAngle.h"
-#include "V8SVGAnimatedBoolean.h"
-#include "V8SVGAnimatedEnumeration.h"
-#include "V8SVGAnimatedInteger.h"
-#include "V8SVGAnimatedLength.h"
-#include "V8SVGAnimatedLengthList.h"
-#include "V8SVGAnimatedNumber.h"
-#include "V8SVGAnimatedNumberList.h"
-#include "V8SVGAnimatedPoints.h"
-#include "V8SVGAnimatedPreserveAspectRatio.h"
-#include "V8SVGAnimatedRect.h"
-#include "V8SVGAnimatedString.h"
-#include "V8SVGAnimatedTransformList.h"
-#include "V8SVGColor.h"
-#include "V8SVGDocument.h"
-#include "V8SVGElementInstance.h"
-#include "V8SVGElementInstanceList.h"
-#include "V8SVGLength.h"
-#include "V8SVGLengthList.h"
-#include "V8SVGMatrix.h"
-#include "V8SVGNumber.h"
-#include "V8SVGNumberList.h"
-#include "V8SVGPaint.h"
-#include "V8SVGPathSeg.h"
-#include "V8SVGPathSegArcAbs.h"
-#include "V8SVGPathSegArcRel.h"
-#include "V8SVGPathSegClosePath.h"
-#include "V8SVGPathSegCurvetoCubicAbs.h"
-#include "V8SVGPathSegCurvetoCubicRel.h"
-#include "V8SVGPathSegCurvetoCubicSmoothAbs.h"
-#include "V8SVGPathSegCurvetoCubicSmoothRel.h"
-#include "V8SVGPathSegCurvetoQuadraticAbs.h"
-#include "V8SVGPathSegCurvetoQuadraticRel.h"
-#include "V8SVGPathSegCurvetoQuadraticSmoothAbs.h"
-#include "V8SVGPathSegCurvetoQuadraticSmoothRel.h"
-#include "V8SVGPathSegLinetoAbs.h"
-#include "V8SVGPathSegLinetoHorizontalAbs.h"
-#include "V8SVGPathSegLinetoHorizontalRel.h"
-#include "V8SVGPathSegLinetoRel.h"
-#include "V8SVGPathSegLinetoVerticalAbs.h"
-#include "V8SVGPathSegLinetoVerticalRel.h"
-#include "V8SVGPathSegList.h"
-#include "V8SVGPathSegMovetoAbs.h"
-#include "V8SVGPathSegMovetoRel.h"
-#include "V8SVGPoint.h"
-#include "V8SVGPointList.h"
-#include "V8SVGPreserveAspectRatio.h"
-#include "V8SVGRect.h"
-#include "V8SVGRenderingIntent.h"
-#include "V8SVGStringList.h"
-#include "V8SVGTransform.h"
-#include "V8SVGTransformList.h"
-#include "V8SVGUnitTypes.h"
-#include "V8SVGZoomEvent.h"
-#endif
-
-#if ENABLE(VIDEO)
-#include "V8HTMLAudioElement.h"
-#include "V8HTMLAudioElementConstructor.h"
-#include "V8HTMLMediaElement.h"
-#include "V8HTMLSourceElement.h"
-#include "V8HTMLVideoElement.h"
-#include "V8MediaError.h"
-#include "V8TimeRanges.h"
-#endif
-
-#if ENABLE(WEB_SOCKETS)
-#include "V8WebSocket.h"
-#endif
-
-#if ENABLE(WORKERS)
-#include "V8AbstractWorker.h"
-#include "V8DedicatedWorkerContext.h"
-#include "V8Worker.h"
-#include "V8WorkerContext.h"
-#include "V8WorkerLocation.h"
-#include "V8WorkerNavigator.h"
-#endif
-
-#if ENABLE(NOTIFICATIONS)
-#include "V8Notification.h"
-#include "V8NotificationCenter.h"
-#endif
-
-#if ENABLE(SHARED_WORKERS)
-#include "V8SharedWorker.h"
-#include "V8SharedWorkerContext.h"
-#endif
-
-#if ENABLE(3D_CANVAS)
-#include "V8WebGLRenderingContext.h"
-#include "V8WebGLArrayBuffer.h"
-#include "V8WebGLArray.h"
-#include "V8WebGLByteArray.h"
-#include "V8WebGLBuffer.h"
-#include "V8WebGLContextAttributes.h"
-#include "V8WebGLFloatArray.h"
-#include "V8WebGLFramebuffer.h"
-#include "V8WebGLIntArray.h"
-#include "V8WebGLProgram.h"
-#include "V8WebGLRenderbuffer.h"
-#include "V8WebGLShader.h"
-#include "V8WebGLShortArray.h"
-#include "V8WebGLTexture.h"
-#include "V8WebGLUniformLocation.h"
-#include "V8WebGLUnsignedByteArray.h"
-#include "V8WebGLUnsignedIntArray.h"
-#include "V8WebGLUnsignedShortArray.h"
-#endif
-
-#if ENABLE(DATABASE)
-#include "V8Database.h"
-#include "V8SQLError.h"
-#include "V8SQLResultSet.h"
-#include "V8SQLResultSetRowList.h"
-#include "V8SQLTransaction.h"
-#endif
-
-#if ENABLE(INDEXED_DATABASE)
-#include "V8IDBDatabaseError.h"
-#include "V8IDBDatabaseException.h"
-#include "V8IDBDatabaseRequest.h"
-#include "V8IDBRequest.h"
-#include "V8IndexedDatabaseRequest.h"
-#endif
-
-#if ENABLE(XPATH)
-#include "V8XPathResult.h"
-#include "V8XPathException.h"
-#include "V8XPathExpression.h"
-#include "V8XPathNSResolver.h"
-#include "V8XPathEvaluator.h"
-#endif
-
-#if ENABLE(XSLT)
-#include "V8XSLTProcessor.h"
-#endif
-
-#if ENABLE(INSPECTOR)
-#include "V8InjectedScriptHost.h"
-#include "V8InspectorBackend.h"
-#include "V8InspectorFrontendHost.h"
-#endif
-
-#if ENABLE(EVENTSOURCE)
-#include "V8EventSource.h"
-#endif
-
-// Geolocation
-#include "V8Coordinates.h"
-#include "V8Geolocation.h"
-#include "V8Geoposition.h"
-#include "V8PositionError.h"
-
-namespace WebCore {
-
-v8::Persistent<v8::FunctionTemplate> V8ClassIndex::getTemplate(V8WrapperType type)
-{
-    switch (type) {
-#define MAKE_CASE(type, name)\
-    case V8ClassIndex::type: return V8##name::GetTemplate();
-    WRAPPER_TYPES(MAKE_CASE)
-#undef MAKE_CASE
-    default:
-        ASSERT_NOT_REACHED();
-        return v8::Persistent<v8::FunctionTemplate>::New(v8::FunctionTemplate::New());
-  }
-}
-
-}  // namespace WebCore
diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h
index b177ce0..969a495 100644
--- a/WebCore/bindings/v8/V8Index.h
+++ b/WebCore/bindings/v8/V8Index.h
@@ -672,10 +672,36 @@ static const int v8DefaultWrapperInternalFieldCount = 2;
             ASSERT(INVALID_CLASS_INDEX <= v && v < CLASSINDEX_END);
             return static_cast<V8WrapperType>(v);
         }
-
-        static v8::Persistent<v8::FunctionTemplate> getTemplate(V8WrapperType type);
     };
 
+    class ActiveDOMObject;
+
+    typedef v8::Persistent<v8::FunctionTemplate> (*GetTemplateFunction)();
+    typedef void (*DerefObjectFunction)(void*);
+    typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Handle<v8::Object>);
+
+    struct WrapperTypeInfo {
+
+        v8::Persistent<v8::FunctionTemplate> getTemplate() { return getTemplateFunction(); }
+
+        void derefObject(void* object)
+        {
+            if (derefObjectFunction) 
+                derefObjectFunction(object);
+        }
+
+        ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object> object)
+        {
+            if (!toActiveDOMObjectFunction)
+                return 0;
+            return toActiveDOMObjectFunction(object);
+        }
+
+        const int index;
+        const GetTemplateFunction getTemplateFunction;
+        const DerefObjectFunction derefObjectFunction;
+        const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
+    };
 }
 
 #endif // V8Index_h
diff --git a/WebCore/bindings/v8/V8NPObject.cpp b/WebCore/bindings/v8/V8NPObject.cpp
index b873d5f..7442bc8 100644
--- a/WebCore/bindings/v8/V8NPObject.cpp
+++ b/WebCore/bindings/v8/V8NPObject.cpp
@@ -54,6 +54,8 @@ enum InvokeFunctionType {
     InvokeDefault = 3
 };
 
+static WrapperTypeInfo npObjectTypeInfo = { V8ClassIndex::ToInt(V8ClassIndex::NPOBJECT), 0, 0, false };
+
 // FIXME: need comments.
 // Params: holder could be HTMLEmbedElement or NPObject
 static v8::Handle<v8::Value> npObjectInvokeImpl(const v8::Arguments& args, InvokeFunctionType functionId)
@@ -375,7 +377,7 @@ v8::Local<v8::Object> createV8ObjectForNPObject(NPObject* object, NPObject* root
     if (value.IsEmpty())
         return value;
 
-    wrapNPObject(value, object);
+    V8DOMWrapper::setDOMWrapper(value, &npObjectTypeInfo, object);
 
     // KJS retains the object as part of its wrapper (see Bindings::CInstance).
     _NPN_RetainObject(object);
@@ -394,7 +396,7 @@ void forgetV8ObjectForNPObject(NPObject* object)
     if (staticNPObjectMap.contains(object)) {
         v8::HandleScope scope;
         v8::Persistent<v8::Object> handle(staticNPObjectMap.get(object));
-        V8DOMWrapper::setDOMWrapper(handle, WebCore::V8ClassIndex::NPOBJECT, 0);
+        V8DOMWrapper::setDOMWrapper(handle, &npObjectTypeInfo, 0);
         staticNPObjectMap.forget(object);
         _NPN_ReleaseObject(object);
     }
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 9baaf3c..7a0c9a0 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -743,21 +743,6 @@ v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args)
     return args.This();
 }
 
-void V8Proxy::bindJsObjectToWindow(Frame* frame, const char* name, int type, v8::Handle<v8::FunctionTemplate> descriptor, void* impl)
-{
-    // Get environment.
-    v8::Handle<v8::Context> v8Context = V8Proxy::mainWorldContext(frame);
-    if (v8Context.IsEmpty())
-        return; // JS not enabled.
-
-    v8::Context::Scope scope(v8Context);
-    v8::Handle<v8::Object> instance = descriptor->GetFunction();
-    V8DOMWrapper::setDOMWrapper(instance, type, impl);
-
-    v8::Handle<v8::Object> global = v8Context->Global();
-    global->Set(v8::String::New(name), instance);
-}
-
 void V8Proxy::processConsoleMessages()
 {
     V8ConsoleMessage::processDelayed();
diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h
index 739fc86..a3da155 100644
--- a/WebCore/bindings/v8/V8Proxy.h
+++ b/WebCore/bindings/v8/V8Proxy.h
@@ -76,7 +76,7 @@ namespace WebCore {
         const char* const name;
         v8::AccessorGetter getter;
         v8::AccessorSetter setter;
-        V8ClassIndex::V8WrapperType data;
+        WrapperTypeInfo* data;
         v8::AccessControl settings;
         v8::PropertyAttribute attribute;
         bool onProto;
@@ -89,7 +89,7 @@ namespace WebCore {
         (attribute.onProto ? proto : instance)->SetAccessor(v8::String::New(attribute.name),
             attribute.getter,
             attribute.setter,
-            attribute.data == V8ClassIndex::INVALID_CLASS_INDEX ? v8::Handle<v8::Value>() : v8::Integer::New(V8ClassIndex::ToInt(attribute.data)),
+            v8::External::Wrap(attribute.data),
             attribute.settings,
             attribute.attribute);
     }
@@ -290,12 +290,8 @@ namespace WebCore {
         // Schedule an error object to be thrown.
         static v8::Handle<v8::Value> throwError(ErrorType, const char* message);
 
-        // Create an instance of a function descriptor and set to the global object
-        // as a named property. Used by v8_test_shell.
-        static void bindJsObjectToWindow(Frame*, const char* name, int type, v8::Handle<v8::FunctionTemplate>, void*);
-
-        template <int tag, typename T>
-        static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&);
+        template <typename T>
+        static v8::Handle<v8::Value> constructDOMObject(const v8::Arguments&, WrapperTypeInfo*);
 
         // Process any pending JavaScript console messages.
         static void processConsoleMessages();
@@ -410,8 +406,8 @@ namespace WebCore {
         IsolatedWorldMap m_isolatedWorlds;
     };
 
-    template <int tag, typename T>
-    v8::Handle<v8::Value> V8Proxy::constructDOMObject(const v8::Arguments& args)
+    template <typename T>
+    v8::Handle<v8::Value> V8Proxy::constructDOMObject(const v8::Arguments& args, WrapperTypeInfo* type)
     {
         if (!args.IsConstructCall())
             return throwError(V8Proxy::TypeError, "DOM object constructor cannot be called as a function.");
@@ -419,7 +415,7 @@ namespace WebCore {
         // Note: it's OK to let this RefPtr go out of scope because we also call
         // SetDOMWrapper(), which effectively holds a reference to obj.
         RefPtr<T> obj = T::create();
-        V8DOMWrapper::setDOMWrapper(args.Holder(), tag, obj.get());
+        V8DOMWrapper::setDOMWrapper(args.Holder(), type, obj.get());
         obj->ref();
         V8DOMWrapper::setJSWrapperForDOMObject(obj.get(), v8::Persistent<v8::Object>::New(args.Holder()));
         return args.Holder();
diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
index d50e876..1ecf1d7 100644
--- a/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
+++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp
@@ -41,8 +41,10 @@
 #include "SharedWorkerContext.h"
 #include "V8Binding.h"
 #include "V8DOMMap.h"
+#include "V8DedicatedWorkerContext.h"
 #include "V8Index.h"
 #include "V8Proxy.h"
+#include "V8SharedWorkerContext.h"
 #include "V8WorkerContext.h"
 #include "Worker.h"
 #include "WorkerContext.h"
@@ -137,10 +139,10 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
     v8::Handle<v8::String> implicitProtoString = v8::String::New("__proto__");
 
     // Create a new JS object and use it as the prototype for the shadow global object.
-    V8ClassIndex::V8WrapperType contextType = V8ClassIndex::DEDICATEDWORKERCONTEXT;
+    WrapperTypeInfo* contextType = &V8DedicatedWorkerContext::info;
 #if ENABLE(SHARED_WORKERS)
     if (!m_workerContext->isDedicatedWorkerContext())
-        contextType = V8ClassIndex::SHAREDWORKERCONTEXT;
+        contextType = &V8SharedWorkerContext::info;
 #endif
     v8::Handle<v8::Function> workerContextConstructor = V8DOMWrapper::getConstructorForContext(contextType, context);
     v8::Local<v8::Object> jsWorkerContext = SafeAllocation::newInstance(workerContextConstructor);
@@ -151,7 +153,7 @@ void WorkerContextExecutionProxy::initContextIfNeeded()
     }
 
     // Wrap the object.
-    V8DOMWrapper::setDOMWrapper(jsWorkerContext, V8ClassIndex::ToInt(contextType), m_workerContext);
+    V8DOMWrapper::setDOMWrapper(jsWorkerContext, contextType, m_workerContext);
 
     V8DOMWrapper::setJSWrapperForDOMObject(m_workerContext, v8::Persistent<v8::Object>::New(jsWorkerContext));
     m_workerContext->ref();
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index 97cdb94..5d392e7 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -55,7 +55,10 @@
 #include "V8BindingState.h"
 #include "V8CustomEventListener.h"
 #include "V8GCForContextDispose.h"
+#include "V8HTMLAudioElementConstructor.h"
 #include "V8HTMLCollection.h"
+#include "V8HTMLImageElementConstructor.h"
+#include "V8HTMLOptionElementConstructor.h"
 #include "V8MessagePortCustom.h"
 #include "V8Node.h"
 #include "V8Proxy.h"
@@ -226,7 +229,7 @@ void V8DOMWindow::openerAccessorSetter(v8::Local<v8::String> name, v8::Local<v8:
 v8::Handle<v8::Value> V8DOMWindow::AudioAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     DOMWindow* window = V8DOMWindow::toNative(info.Holder());
-    return V8DOMWrapper::getConstructor(V8ClassIndex::AUDIO, window);
+    return V8DOMWrapper::getConstructor(&V8HTMLAudioElementConstructor::info, window);
 }
 
 #endif
@@ -234,13 +237,13 @@ v8::Handle<v8::Value> V8DOMWindow::AudioAccessorGetter(v8::Local<v8::String> nam
 v8::Handle<v8::Value> V8DOMWindow::ImageAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     DOMWindow* window = V8DOMWindow::toNative(info.Holder());
-    return V8DOMWrapper::getConstructor(V8ClassIndex::IMAGE, window);
+    return V8DOMWrapper::getConstructor(&V8HTMLImageElementConstructor::info, window);
 }
 
 v8::Handle<v8::Value> V8DOMWindow::OptionAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
 {
     DOMWindow* window = V8DOMWindow::toNative(info.Holder());
-    return V8DOMWrapper::getConstructor(V8ClassIndex::OPTION, window);
+    return V8DOMWrapper::getConstructor(&V8HTMLOptionElementConstructor::info, window);
 }
 
 v8::Handle<v8::Value> V8DOMWindow::addEventListenerCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
index 9b75db8..c65261c 100644
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
@@ -44,6 +44,8 @@
 
 namespace WebCore {
 
+WrapperTypeInfo V8HTMLAudioElementConstructor::info = {V8ClassIndex::ToInt(V8ClassIndex::AUDIO), V8HTMLAudioElementConstructor::GetTemplate, 0, false };
+
 static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.HTMLAudioElement.Contructor");
@@ -69,7 +71,7 @@ static v8::Handle<v8::Value> v8HTMLAudioElementConstructorCallback(const v8::Arg
         src = toWebCoreString(args[0]);
     RefPtr<HTMLAudioElement> audio = HTMLAudioElement::createForJSConstructor(document, src);
 
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::AUDIO), audio.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLAudioElementConstructor::info, audio.get());
     audio->ref();
     V8DOMWrapper::setJSWrapperForDOMNode(audio.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     return args.Holder();
diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
index 711f539..3b34f3a 100755
--- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.h
@@ -31,6 +31,8 @@
 #ifndef V8HTMLAudioElementConstructor_h
 #define V8HTMLAudioElementConstructor_h
 
+#include "V8Index.h"
+
 #include <v8.h>
 
 namespace WebCore {
@@ -38,6 +40,7 @@ namespace WebCore {
 class V8HTMLAudioElementConstructor {
 public:
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+    static WrapperTypeInfo info;
 };
 
 }
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
index 29b4813..da624e2 100644
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp
@@ -44,6 +44,8 @@
 
 namespace WebCore {
 
+WrapperTypeInfo V8HTMLImageElementConstructor::info = {V8ClassIndex::ToInt(V8ClassIndex::IMAGE), V8HTMLImageElementConstructor::GetTemplate, 0, false };
+
 static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.HTMLImageElement.Contructor");
@@ -80,7 +82,7 @@ static v8::Handle<v8::Value> v8HTMLImageElementConstructorCallback(const v8::Arg
     }
 
     RefPtr<HTMLImageElement> image = HTMLImageElement::createForJSConstructor(document, optionalWidth, optionalHeight);
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::IMAGE), image.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLImageElementConstructor::info, image.get());
     image->ref();
     V8DOMWrapper::setJSWrapperForDOMNode(image.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     return args.Holder();
diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
index 19ee944..94669c8 100755
--- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.h
@@ -31,6 +31,8 @@
 #ifndef V8HTMLImageElementConstructor_h
 #define V8HTMLImageElementConstructor_h
 
+#include "V8Index.h"
+
 #include <v8.h>
 
 namespace WebCore {
@@ -38,6 +40,7 @@ namespace WebCore {
 class V8HTMLImageElementConstructor {
 public:
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+    static WrapperTypeInfo info;
 };
 
 }
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
index 1ff1d2e..80170a3 100644
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
@@ -44,6 +44,8 @@
 
 namespace WebCore {
 
+WrapperTypeInfo V8HTMLOptionElementConstructor::info = {V8ClassIndex::ToInt(V8ClassIndex::OPTION), V8HTMLOptionElementConstructor::GetTemplate, 0, false };
+
 static v8::Handle<v8::Value> v8HTMLOptionElementConstructorCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.HTMLOptionElement.Contructor");
@@ -78,7 +80,7 @@ static v8::Handle<v8::Value> v8HTMLOptionElementConstructorCallback(const v8::Ar
     if (ec)
         throwError(ec);
 
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::OPTION), option.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &V8HTMLOptionElementConstructor::info, option.get());
     option->ref();
     V8DOMWrapper::setJSWrapperForDOMNode(option.get(), v8::Persistent<v8::Object>::New(args.Holder()));
     return args.Holder();
diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
index 905a745..dbbd6f9 100755
--- a/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
+++ b/WebCore/bindings/v8/custom/V8HTMLOptionElementConstructor.h
@@ -31,6 +31,8 @@
 #ifndef V8HTMLOptionElementConstructor_h
 #define V8HTMLOptionElementConstructor_h
 
+#include "V8Index.h"
+
 #include <v8.h>
 
 namespace WebCore {
@@ -38,6 +40,7 @@ namespace WebCore {
 class V8HTMLOptionElementConstructor {
 public:
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
+    static WrapperTypeInfo info;
 };
 
 }
diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 8bf0bfa..d45d617 100644
--- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -59,7 +59,6 @@ static void WeakReferenceCallback(v8::Persistent<v8::Value> object, void* parame
 
 static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHost* host)
 {
-    V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INJECTEDSCRIPTHOST;
     v8::Local<v8::Function> function = V8InjectedScriptHost::GetTemplate()->GetFunction();
     if (function.IsEmpty()) {
         // Return if allocation failed.
@@ -70,7 +69,7 @@ static v8::Local<v8::Object> createInjectedScriptHostV8Wrapper(InjectedScriptHos
         // Avoid setting the wrapper if allocation failed.
         return v8::Local<v8::Object>();
     }
-    V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(descriptorType), host);
+    V8DOMWrapper::setDOMWrapper(instance, &V8InjectedScriptHost::info, host);
     // Create a weak reference to the v8 wrapper of InspectorBackend to deref
     // InspectorBackend when the wrapper is garbage collected.
     host->ref();
diff --git a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
index 4fb82ba..06b1a93 100644
--- a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp
@@ -71,7 +71,7 @@ v8::Handle<v8::Value> V8MessageChannel::constructorCallback(const v8::Arguments&
     messageChannel->SetInternalField(V8MessageChannel::port2Index, toV8(obj->port2()));
 
     // Setup the standard wrapper object internal fields.
-    V8DOMWrapper::setDOMWrapper(messageChannel, V8ClassIndex::MESSAGECHANNEL, obj.get());
+    V8DOMWrapper::setDOMWrapper(messageChannel, &info, obj.get());
     return toV8(obj.release(), messageChannel);
 }
 
diff --git a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
index f69675a..2d72c37 100644
--- a/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SharedWorkerCustom.cpp
@@ -80,7 +80,7 @@ v8::Handle<v8::Value> V8SharedWorker::constructorCallback(const v8::Arguments& a
 
     // Setup the standard wrapper object internal fields.
     v8::Handle<v8::Object> wrapperObject = args.Holder();
-    V8DOMWrapper::setDOMWrapper(wrapperObject, V8ClassIndex::SHAREDWORKER, obj.get());
+    V8DOMWrapper::setDOMWrapper(wrapperObject, &info, obj.get());
 
     obj->ref();
     V8DOMWrapper::setJSWrapperForActiveDOMObject(obj.get(), v8::Persistent<v8::Object>::New(wrapperObject));
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
index db0c8c1..d3e6cb5 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayBufferCustom.cpp
@@ -78,7 +78,7 @@ v8::Handle<v8::Value> V8WebGLArrayBuffer::constructorCallback(const v8::Argument
         return v8::Undefined();
     }
     // Transform the holder into a wrapper object for the array.
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::WEBGLARRAYBUFFER), buffer.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, buffer.get());
     return toV8(buffer.release(), args.Holder());
 }
 
diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
index de740ea..b0a85a5 100644
--- a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
+++ b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.h
@@ -42,8 +42,7 @@ namespace WebCore {
 
 // Template function used by the WebGLArray*Constructor callbacks.
 template<class ArrayClass, class ElementType>
-v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args,
-                                          int classIndex)
+v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperTypeInfo* type)
 {
     if (!args.IsConstructCall())
         return throwError("DOM object constructor cannot be called as a function.");
@@ -92,9 +91,9 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args,
         if (!array)
             return throwError("Out-of-range offset and/or length");
         // Transform the holder into a wrapper object for the array.
-        V8DOMWrapper::setDOMWrapper(args.Holder(), classIndex, array.get());
+        V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
         V8DOMWrapper::setIndexedPropertiesToExternalArray(args.Holder(),
-                                                          classIndex,
+                                                          type->index,
                                                           array.get()->baseAddress(),
                                                           array.get()->length());
         return toV8(array.release(), args.Holder());
@@ -127,9 +126,9 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args,
     }
 
     // Transform the holder into a wrapper object for the array.
-    V8DOMWrapper::setDOMWrapper(args.Holder(), classIndex, array.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
     V8DOMWrapper::setIndexedPropertiesToExternalArray(args.Holder(),
-                                                      classIndex,
+                                                      type->index,
                                                       array.get()->baseAddress(),
                                                       array.get()->length());
     return toV8(array.release(), args.Holder());
diff --git a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
index 3544081..853c804 100644
--- a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLByteArray::constructorCallback(const v8::Arguments&
 {
     INC_STATS("DOM.WebGLByteArray.Contructor");
 
-    return constructWebGLArray<WebGLByteArray, signed char>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLBYTEARRAY));
+    return constructWebGLArray<WebGLByteArray, signed char>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLByteArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
index 3c49c31..1ed7cdf 100644
--- a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLFloatArray::constructorCallback(const v8::Arguments
 {
     INC_STATS("DOM.WebGLFloatArray.Contructor");
 
-    return constructWebGLArray<WebGLFloatArray, float>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLFLOATARRAY));
+    return constructWebGLArray<WebGLFloatArray, float>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLFloatArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
index 87a3ce0..3d04533 100644
--- a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLIntArray::constructorCallback(const v8::Arguments&
 {
     INC_STATS("DOM.WebGLIntArray.Contructor");
 
-    return constructWebGLArray<WebGLIntArray, int>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLINTARRAY));
+    return constructWebGLArray<WebGLIntArray, int>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLIntArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
index 034450c..5d13df8 100644
--- a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLShortArray::constructorCallback(const v8::Arguments
 {
     INC_STATS("DOM.WebGLShortArray.Contructor");
 
-    return constructWebGLArray<WebGLShortArray, short>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLSHORTARRAY));
+    return constructWebGLArray<WebGLShortArray, short>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLShortArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
index 7246287..99e61da 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLUnsignedByteArray::constructorCallback(const v8::Ar
 {
     INC_STATS("DOM.WebGLUnsignedByteArray.Contructor");
 
-    return constructWebGLArray<WebGLUnsignedByteArray, unsigned char>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY));
+    return constructWebGLArray<WebGLUnsignedByteArray, unsigned char>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLUnsignedByteArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
index fc0a514..b17a434 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLUnsignedIntArray::constructorCallback(const v8::Arg
 {
     INC_STATS("DOM.WebGLUnsignedIntArray.Contructor");
 
-    return constructWebGLArray<WebGLUnsignedIntArray, unsigned int>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLUNSIGNEDINTARRAY));
+    return constructWebGLArray<WebGLUnsignedIntArray, unsigned int>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLUnsignedIntArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
index 8cdc093..8460d0c 100644
--- a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp
@@ -47,7 +47,7 @@ v8::Handle<v8::Value> V8WebGLUnsignedShortArray::constructorCallback(const v8::A
 {
     INC_STATS("DOM.WebGLUnsignedShortArray.Contructor");
 
-    return constructWebGLArray<WebGLUnsignedShortArray, unsigned short>(args, V8ClassIndex::ToInt(V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY));
+    return constructWebGLArray<WebGLUnsignedShortArray, unsigned short>(args, &info);
 }
 
 v8::Handle<v8::Value> V8WebGLUnsignedShortArray::getCallback(const v8::Arguments& args)
diff --git a/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
index 55518d2..b97d0e8 100644
--- a/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp
@@ -63,7 +63,7 @@ v8::Handle<v8::Value> V8WebKitCSSMatrix::constructorCallback(const v8::Arguments
         throwError(ec);
 
     // Transform the holder into a wrapper object for the matrix.
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::WEBKITCSSMATRIX), matrix.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, matrix.get());
     return toV8(matrix.release(), args.Holder());
 }
 
diff --git a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
index 58f810b..4e814ba 100644
--- a/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8WebKitPointConstructor.cpp
@@ -59,7 +59,7 @@ v8::Handle<v8::Value> V8WebKitPoint::constructorCallback(const v8::Arguments& ar
     }
     PassRefPtr<WebKitPoint> point = WebKitPoint::create(x, y);
     point->ref();
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::WEBKITPOINT, point.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, point.get());
     return args.Holder();
 }
 
diff --git a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
index c3be9f2..b931053 100644
--- a/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WebSocketCustom.cpp
@@ -84,7 +84,7 @@ v8::Handle<v8::Value> V8WebSocket::constructorCallback(const v8::Arguments& args
         return throwError(ec);
 
     // Setup the standard wrapper object internal fields.
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::WEBSOCKET), webSocket.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, webSocket.get());
 
     // Add object to the wrapper map.
     webSocket->ref();
diff --git a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
index 6b41246..dcf73c2 100644
--- a/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerCustom.cpp
@@ -79,7 +79,7 @@ v8::Handle<v8::Value> V8Worker::constructorCallback(const v8::Arguments& args)
 
     // Setup the standard wrapper object internal fields.
     v8::Handle<v8::Object> wrapperObject = args.Holder();
-    V8DOMWrapper::setDOMWrapper(wrapperObject, V8ClassIndex::WORKER, obj.get());
+    V8DOMWrapper::setDOMWrapper(wrapperObject, &info, obj.get());
 
     obj->ref();
     V8DOMWrapper::setJSWrapperForActiveDOMObject(obj.get(), v8::Persistent<v8::Object>::New(wrapperObject));
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
index f50248b..6b5b64f 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
@@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8XMLHttpRequest::constructorCallback(const v8::Arguments&
     if (!context)
         return throwError("XMLHttpRequest constructor's associated context is not available", V8Proxy::ReferenceError);
     RefPtr<XMLHttpRequest> xmlHttpRequest = XMLHttpRequest::create(context);
-    V8DOMWrapper::setDOMWrapper(args.Holder(), V8ClassIndex::ToInt(V8ClassIndex::XMLHTTPREQUEST), xmlHttpRequest.get());
+    V8DOMWrapper::setDOMWrapper(args.Holder(), &info, xmlHttpRequest.get());
 
     // Add object to the wrapper map.
     xmlHttpRequest->ref();
diff --git a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
index 89f804c..b624fcf 100644
--- a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp
@@ -49,7 +49,7 @@ namespace WebCore {
 v8::Handle<v8::Value> V8XSLTProcessor::constructorCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.XSLTProcessor.Constructor");
-    return V8Proxy::constructDOMObject<V8ClassIndex::XSLTPROCESSOR, XSLTProcessor>(args);
+    return V8Proxy::constructDOMObject<XSLTProcessor>(args, &info);
 }
 
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 7c5edaa..28e7c87 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-10  Nate Chapin  <japhet at chromium.org>
+
+        Reviewed by Dimitri Glazkov.
+
+        Wrap and unwrap v8 objects with WrapperTypeInfo instead of V8ClassIndex::V8WrapperType.
+
+        https://bugs.webkit.org/show_bug.cgi?id=35941
+
+        * src/WebBindings.cpp:
+        (WebKit::getRangeImpl):
+        * src/WebDevToolsAgentImpl.cpp:
+        (WebKit::WebDevToolsAgentImpl::createInspectorBackendV8Wrapper):
+        * src/WebDevToolsFrontendImpl.cpp:
+        (WebKit::WebDevToolsFrontendImpl::jsShowContextMenu):
+
 2010-03-10  Garret Kelly  <gdk at chromium.org>
 
         Reviewed by Darin Fisher.
diff --git a/WebKit/chromium/src/WebBindings.cpp b/WebKit/chromium/src/WebBindings.cpp
index 04f2f85..efac618 100644
--- a/WebKit/chromium/src/WebBindings.cpp
+++ b/WebKit/chromium/src/WebBindings.cpp
@@ -284,7 +284,7 @@ static bool getRangeImpl(NPObject* npobj, WebRange* range)
 {
     V8NPObject* v8npobject = reinterpret_cast<V8NPObject*>(npobj);
     v8::Handle<v8::Object> v8object(v8npobject->v8Object);
-    if (V8ClassIndex::RANGE != V8DOMWrapper::domWrapperType(v8object))
+    if (V8ClassIndex::RANGE != V8DOMWrapper::domWrapperType(v8object)->index)
         return false;
 
     Range* native = V8Range::toNative(v8object);
diff --git a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
index 20c3c75..af5062a 100644
--- a/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
+++ b/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
@@ -337,7 +337,6 @@ void WebDevToolsAgentImpl::initDevToolsAgentHost()
 
 v8::Local<v8::Object> WebDevToolsAgentImpl::createInspectorBackendV8Wrapper()
 {
-    V8ClassIndex::V8WrapperType descriptorType = V8ClassIndex::INSPECTORBACKEND;
     v8::Handle<v8::Function> function = V8InspectorBackend::GetTemplate()->GetFunction();
     if (function.IsEmpty()) {
         // Return if allocation failed.
@@ -349,7 +348,7 @@ v8::Local<v8::Object> WebDevToolsAgentImpl::createInspectorBackendV8Wrapper()
         return v8::Local<v8::Object>();
     }
     InspectorBackend* backend = m_webViewImpl->page()->inspectorController()->inspectorBackend();
-    V8DOMWrapper::setDOMWrapper(instance, V8ClassIndex::ToInt(descriptorType), backend);
+    V8DOMWrapper::setDOMWrapper(instance, &V8InspectorBackend::info, backend);
     // Create a weak reference to the v8 wrapper of InspectorBackend to deref
     // InspectorBackend when the wrapper is garbage collected.
     backend->ref();
diff --git a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
index 65667f4..d5b8ebc 100644
--- a/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
+++ b/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
@@ -358,7 +358,7 @@ v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsShowContextMenu(const v8::Argum
         return v8::Undefined();
 
     v8::Local<v8::Object> eventWrapper = v8::Local<v8::Object>::Cast(args[0]);
-    if (V8DOMWrapper::domWrapperType(eventWrapper) != V8ClassIndex::MOUSEEVENT)
+    if (V8DOMWrapper::domWrapperType(eventWrapper)->index != V8ClassIndex::MOUSEEVENT)
         return v8::Undefined();
 
     Event* event = V8Event::toNative(eventWrapper);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list