Make WebCore use jsCast rather than static_cast for casting JSC objects
https://bugs.webkit.org/show_bug.cgi?id=83320

Reviewed by Stephanie Lewis.

Mechanically replace static_cast with jsCast where ever we can.

* WebCore.exp.in:
* bindings/js/DOMWrapperWorld.cpp:
(WebCore::JSStringOwner::finalize):
* bindings/js/DOMWrapperWorld.h:
(WebCore::currentWorld):
* bindings/js/JSArrayBufferCustom.cpp:
(WebCore::JSArrayBufferConstructor::constructJSArrayBuffer):
* bindings/js/JSAudioContextCustom.cpp:
(WebCore::JSAudioContextConstructor::constructJSAudioContext):
* bindings/js/JSCSSRuleListCustom.cpp:
(WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::cssPropertyGetterPixelOrPosPrefixCallback):
(WebCore::cssPropertyGetterCallback):
* bindings/js/JSCSSValueCustom.cpp:
(WebCore::JSCSSValueOwner::isReachableFromOpaqueRoots):
(WebCore::JSCSSValueOwner::finalize):
* bindings/js/JSDOMBinding.cpp:
(WebCore::reportException):
* bindings/js/JSDOMBinding.h:
(WebCore::deprecatedGlobalObjectForPrototype):
(WebCore::getDOMPrototype):
* bindings/js/JSDOMFormDataCustom.cpp:
(WebCore::toHTMLFormElement):
(WebCore::JSDOMFormDataConstructor::constructJSDOMFormData):
* bindings/js/JSDOMMimeTypeArrayCustom.cpp:
(WebCore::JSDOMMimeTypeArray::nameGetter):
* bindings/js/JSDOMPluginArrayCustom.cpp:
(WebCore::JSDOMPluginArray::nameGetter):
* bindings/js/JSDOMPluginCustom.cpp:
(WebCore::JSDOMPlugin::nameGetter):
* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::nameGetter):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::toJSDOMWindow):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::childFrameGetter):
(WebCore::indexGetter):
(WebCore::namedItemGetter):
(WebCore::toDOMWindow):
* bindings/js/JSDOMWindowCustom.h:
(WebCore::asJSDOMWindow):
* bindings/js/JSDOMWindowShell.h:
(WebCore::JSDOMWindowShell::window):
* bindings/js/JSDOMWrapper.h:
(WebCore::JSDOMWrapper::globalObject):
* bindings/js/JSDataViewCustom.cpp:
(WebCore::JSDataViewConstructor::constructJSDataView):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSEventTarget.cpp:
(WebCore):
(WebCore::toEventTarget):
* bindings/js/JSFloat32ArrayCustom.cpp:
(WebCore::JSFloat32ArrayConstructor::constructJSFloat32Array):
* bindings/js/JSFloat64ArrayCustom.cpp:
(WebCore::JSFloat64ArrayConstructor::constructJSFloat64Array):
* bindings/js/JSGeolocationCustom.cpp:
(WebCore::JSGeolocation::getCurrentPosition):
(WebCore::JSGeolocation::watchPosition):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::callHTMLAllCollection):
(WebCore::JSHTMLAllCollection::nameGetter):
* bindings/js/JSHTMLCollectionCustom.cpp:
(WebCore::JSHTMLCollection::nameGetter):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::nameGetter):
* bindings/js/JSHTMLFormElementCustom.cpp:
(WebCore::JSHTMLFormElement::nameGetter):
* bindings/js/JSHTMLFrameSetElementCustom.cpp:
(WebCore::JSHTMLFrameSetElement::nameGetter):
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::remove):
* bindings/js/JSImageConstructor.cpp:
(WebCore::constructImage):
* bindings/js/JSInjectedScriptManager.cpp:
(WebCore::InjectedScriptManager::createInjectedScript):
(WebCore::InjectedScriptManager::discardInjectedScript):
(WebCore::InjectedScriptManager::injectedScriptFor):
* bindings/js/JSInt16ArrayCustom.cpp:
(WebCore::JSInt16ArrayConstructor::constructJSInt16Array):
* bindings/js/JSInt32ArrayCustom.cpp:
(WebCore::JSInt32ArrayConstructor::constructJSInt32Array):
* bindings/js/JSInt8ArrayCustom.cpp:
(WebCore::JSInt8ArrayConstructor::constructJSInt8Array):
* bindings/js/JSLazyEventListener.cpp:
(WebCore::JSLazyEventListener::initializeJSFunction):
* bindings/js/JSNamedNodeMapCustom.cpp:
(WebCore::JSNamedNodeMap::nameGetter):
* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNodeOwner::isReachableFromOpaqueRoots):
(WebCore::JSNodeOwner::finalize):
* bindings/js/JSNodeCustom.h:
(WebCore::toJS):
* bindings/js/JSNodeFilterCustom.cpp:
(WebCore::toNodeFilter):
* bindings/js/JSNodeListCustom.cpp:
(WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
(WebCore::JSNodeList::nameGetter):
* bindings/js/JSPluginElementFunctions.cpp:
(WebCore::runtimeObjectPropertyGetter):
(WebCore::callPlugin):
* bindings/js/JSPopStateEventCustom.cpp:
(WebCore::JSPopStateEvent::state):
* bindings/js/JSSQLTransactionCustom.cpp:
(WebCore::JSSQLTransaction::executeSql):
* bindings/js/JSSharedWorkerCustom.cpp:
(WebCore::JSSharedWorkerConstructor::constructJSSharedWorker):
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::nameGetter):
* bindings/js/JSStyleSheetListCustom.cpp:
(WebCore::JSStyleSheetList::nameGetter):
* bindings/js/JSTextTrackCueCustom.cpp:
(WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots):
* bindings/js/JSTextTrackCustom.cpp:
(WebCore::JSTextTrackOwner::isReachableFromOpaqueRoots):
* bindings/js/JSTextTrackListCustom.cpp:
(WebCore::JSTextTrackListOwner::isReachableFromOpaqueRoots):
* bindings/js/JSTrackCustom.cpp:
(WebCore::toTrack):
* bindings/js/JSUint16ArrayCustom.cpp:
(WebCore::JSUint16ArrayConstructor::constructJSUint16Array):
* bindings/js/JSUint32ArrayCustom.cpp:
(WebCore::JSUint32ArrayConstructor::constructJSUint32Array):
* bindings/js/JSUint8ArrayCustom.cpp:
(WebCore::JSUint8ArrayConstructor::constructJSUint8Array):
* bindings/js/JSUint8ClampedArrayCustom.cpp:
(WebCore::JSUint8ClampedArrayConstructor::constructJSUint8ClampedArray):
* bindings/js/JSWebKitMutationObserverCustom.cpp:
(WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver):
* bindings/js/JSWebKitPointCustom.cpp:
(WebCore::JSWebKitPointConstructor::constructJSWebKitPoint):
* bindings/js/JSWebSocketCustom.cpp:
(WebCore::JSWebSocketConstructor::constructJSWebSocket):
* bindings/js/JSWorkerContextBase.cpp:
(WebCore::toJSDedicatedWorkerContext):
(WebCore::toJSSharedWorkerContext):
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorkerConstructor::constructJSWorker):
* bindings/js/JSXSLTProcessorCustom.cpp:
(WebCore::JSXSLTProcessor::importStylesheet):
(WebCore::JSXSLTProcessor::transformToFragment):
(WebCore::JSXSLTProcessor::transformToDocument):
* bindings/js/ScriptCallStackFactory.cpp:
(WebCore::createScriptCallStackForInspector):
* bindings/js/ScriptControllerMac.mm:
(WebCore::updateStyleIfNeededForBindings):
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::dispatchDidPause):
* bindings/js/ScriptObject.cpp:
(WebCore::ScriptGlobalObject::set):
* bindings/js/ScriptState.cpp:
(WebCore::domWindowFromScriptState):
(WebCore::scriptExecutionContextFromScriptState):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::fillTransferMap):
(WebCore::CloneSerializer::dumpArrayBufferView):
(WebCore::CloneDeserializer::getJSValue):
(WebCore::CloneDeserializer::readTerminal):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject _isSafeScript]):
(+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateGetOwnPropertySlotBody):
(GenerateGetOwnPropertyDescriptorBody):
(GenerateImplementation):
(GenerateCallWith):
(NativeToJSValue):
(GenerateConstructorDefinition):
* bridge/jni/jni_jsobject.h:
* bridge/jni/jni_jsobject.mm:
(JavaJSObject::convertJObjectToValue):
* bridge/jni/jsc/JavaInstanceJSC.cpp:
(JavaInstance::invokeMethod):
* bridge/objc/objc_utility.mm:
(JSC::Bindings::convertValueToObjcValue):
* bridge/runtime_method.cpp:
(JSC::callRuntimeMethod):
* bridge/runtime_object.cpp:
(JSC::Bindings::callRuntimeConstructor):
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::injectInternalsObject):
(WebCoreTestSupport::resetInternalsObject):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113387 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/bindings/js/DOMWrapperWorld.cpp b/Source/WebCore/bindings/js/DOMWrapperWorld.cpp
index d082242..a1f86d4 100644
--- a/Source/WebCore/bindings/js/DOMWrapperWorld.cpp
+++ b/Source/WebCore/bindings/js/DOMWrapperWorld.cpp
@@ -32,7 +32,7 @@
 
 void JSStringOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
 {
-    JSString* jsString = static_cast<JSString*>(handle.get().asCell());
+    JSString* jsString = jsCast<JSString*>(handle.get().asCell());
     StringImpl* stringImpl = static_cast<StringImpl*>(context);
     ASSERT_UNUSED(jsString, m_world->m_stringCache.find(stringImpl)->second.was(jsString));
     m_world->m_stringCache.remove(stringImpl);
diff --git a/Source/WebCore/bindings/js/DOMWrapperWorld.h b/Source/WebCore/bindings/js/DOMWrapperWorld.h
index 010be04..755375d 100644
--- a/Source/WebCore/bindings/js/DOMWrapperWorld.h
+++ b/Source/WebCore/bindings/js/DOMWrapperWorld.h
@@ -91,7 +91,7 @@
 
 inline DOMWrapperWorld* currentWorld(JSC::ExecState* exec)
 {
-    return static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->world();
+    return JSC::jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->world();
 }
 
 } // namespace WebCore
diff --git a/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp b/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp
index 3ddcf9a..2fa306a 100644
--- a/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp
+++ b/Source/WebCore/bindings/js/JSArrayBufferCustom.cpp
@@ -36,7 +36,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSArrayBufferConstructor::constructJSArrayBuffer(ExecState* exec)
 {
-    JSArrayBufferConstructor* jsConstructor = static_cast<JSArrayBufferConstructor*>(exec->callee());
+    JSArrayBufferConstructor* jsConstructor = jsCast<JSArrayBufferConstructor*>(exec->callee());
 
     int length = 0;
     if (exec->argumentCount() > 0)
diff --git a/Source/WebCore/bindings/js/JSAudioContextCustom.cpp b/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
index cbeb514..9f5e26e 100644
--- a/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
+++ b/Source/WebCore/bindings/js/JSAudioContextCustom.cpp
@@ -51,7 +51,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSAudioContextConstructor::constructJSAudioContext(ExecState* exec)
 {
-    JSAudioContextConstructor* jsConstructor = static_cast<JSAudioContextConstructor*>(exec->callee());
+    JSAudioContextConstructor* jsConstructor = jsCast<JSAudioContextConstructor*>(exec->callee());
     if (!jsConstructor)
         return throwVMError(exec, createReferenceError(exec, "AudioContext constructor callee is unavailable"));
 
diff --git a/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp b/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp
index 28ccb1f..87b69a6 100644
--- a/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp
+++ b/Source/WebCore/bindings/js/JSCSSRuleListCustom.cpp
@@ -37,7 +37,7 @@
 
 bool JSCSSRuleListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSCSSRuleList* jsCSSRuleList = static_cast<JSCSSRuleList*>(handle.get().asCell());
+    JSCSSRuleList* jsCSSRuleList = jsCast<JSCSSRuleList*>(handle.get().asCell());
     if (!jsCSSRuleList->hasCustomProperties())
         return false;
     if (CSSStyleSheet* styleSheet = jsCSSRuleList->impl()->styleSheet())
diff --git a/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
index 61ccd02..7d19c22 100644
--- a/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
+++ b/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
@@ -292,7 +292,7 @@
 
 static JSValue cssPropertyGetterPixelOrPosPrefixCallback(ExecState* exec, JSValue slotBase, unsigned propertyID)
 {
-    return cssPropertyGetterPixelOrPosPrefix(exec, static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)), propertyID);
+    return cssPropertyGetterPixelOrPosPrefix(exec, jsCast<JSCSSStyleDeclaration*>(asObject(slotBase)), propertyID);
 }
 
 static inline JSValue cssPropertyGetter(ExecState* exec, JSCSSStyleDeclaration* thisObj, unsigned propertyID)
@@ -306,7 +306,7 @@
 
 static JSValue cssPropertyGetterCallback(ExecState* exec, JSValue slotBase, unsigned propertyID)
 {
-    return cssPropertyGetter(exec, static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)), propertyID);
+    return cssPropertyGetter(exec, jsCast<JSCSSStyleDeclaration*>(asObject(slotBase)), propertyID);
 }
 
 bool JSCSSStyleDeclaration::getOwnPropertySlotDelegate(ExecState*, const Identifier& propertyIdentifier, PropertySlot& slot)
diff --git a/Source/WebCore/bindings/js/JSCSSValueCustom.cpp b/Source/WebCore/bindings/js/JSCSSValueCustom.cpp
index 0efb4bb..3771e49 100644
--- a/Source/WebCore/bindings/js/JSCSSValueCustom.cpp
+++ b/Source/WebCore/bindings/js/JSCSSValueCustom.cpp
@@ -52,7 +52,7 @@
 
 bool JSCSSValueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void* context, SlotVisitor& visitor)
 {
-    JSCSSValue* jsCSSValue = static_cast<JSCSSValue*>(handle.get().asCell());
+    JSCSSValue* jsCSSValue = jsCast<JSCSSValue*>(handle.get().asCell());
     if (!jsCSSValue->hasCustomProperties())
         return false;
     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
@@ -64,7 +64,7 @@
 
 void JSCSSValueOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
 {
-    JSCSSValue* jsCSSValue = static_cast<JSCSSValue*>(handle.get().asCell());
+    JSCSSValue* jsCSSValue = jsCast<JSCSSValue*>(handle.get().asCell());
     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
     world->m_cssValueRoots.remove(jsCSSValue->impl());
     uncacheWrapper(world, jsCSSValue->impl(), jsCSSValue);
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp
index c11f601..346c267 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp
@@ -160,7 +160,7 @@
     if (ExceptionBase* exceptionBase = toExceptionBase(exception))
         errorMessage = stringToUString(exceptionBase->message() + ": "  + exceptionBase->description());
 
-    ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
+    ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
 
     // scriptExecutionContext can be null when the relevant global object is a stale inner window object.
     // It's harmless to return here without reporting the exception to the log and the debugger in this case.
diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h
index 98746e9..aef89d2 100644
--- a/Source/WebCore/bindings/js/JSDOMBinding.h
+++ b/Source/WebCore/bindings/js/JSDOMBinding.h
@@ -104,7 +104,7 @@
         // FIXME: Callers to this function should be using the global object
         // from which the object is being created, instead of assuming the lexical one.
         // e.g. subframe.document.body should use the subframe's global object, not the lexical one.
-        return static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
+        return JSC::jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
     }
 
     template<class WrapperClass> inline JSC::Structure* getDOMStructure(JSC::ExecState* exec, JSDOMGlobalObject* globalObject)
@@ -122,7 +122,7 @@
 
     template<class WrapperClass> inline JSC::JSObject* getDOMPrototype(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject)
     {
-        return static_cast<JSC::JSObject*>(asObject(getDOMStructure<WrapperClass>(exec, static_cast<JSDOMGlobalObject*>(globalObject))->storedPrototype()));
+        return JSC::jsCast<JSC::JSObject*>(asObject(getDOMStructure<WrapperClass>(exec, JSC::jsCast<JSDOMGlobalObject*>(globalObject))->storedPrototype()));
     }
 
     // Overload these functions to provide a fast path for wrapper access.
diff --git a/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp b/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp
index 65c1cf4..7be9332 100644
--- a/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMFormDataCustom.cpp
@@ -43,12 +43,12 @@
 
 static HTMLFormElement* toHTMLFormElement(JSC::JSValue value)
 {
-    return value.inherits(&JSHTMLFormElement::s_info) ? static_cast<HTMLFormElement*>(static_cast<JSHTMLFormElement*>(asObject(value))->impl()) : 0;
+    return value.inherits(&JSHTMLFormElement::s_info) ? static_cast<HTMLFormElement*>(jsCast<JSHTMLFormElement*>(asObject(value))->impl()) : 0;
 }
 
 EncodedJSValue JSC_HOST_CALL JSDOMFormDataConstructor::constructJSDOMFormData(ExecState* exec)
 {
-    JSDOMFormDataConstructor* jsConstructor = static_cast<JSDOMFormDataConstructor*>(exec->callee());
+    JSDOMFormDataConstructor* jsConstructor = jsCast<JSDOMFormDataConstructor*>(exec->callee());
 
     HTMLFormElement* form = 0;
     if (exec->argumentCount() > 0)
diff --git a/Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp b/Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp
index dcd4c5a..bd8a342 100644
--- a/Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMMimeTypeArrayCustom.cpp
@@ -35,7 +35,7 @@
 
 JSValue JSDOMMimeTypeArray::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSDOMMimeTypeArray* thisObj = static_cast<JSDOMMimeTypeArray*>(asObject(slotBase));
+    JSDOMMimeTypeArray* thisObj = jsCast<JSDOMMimeTypeArray*>(asObject(slotBase));
     return toJS(exec, thisObj->globalObject(), thisObj->impl()->namedItem(identifierToAtomicString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp b/Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp
index 036a5a3..12a2d7a 100644
--- a/Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMPluginArrayCustom.cpp
@@ -35,7 +35,7 @@
 
 JSValue JSDOMPluginArray::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSDOMPluginArray* thisObj = static_cast<JSDOMPluginArray*>(asObject(slotBase));
+    JSDOMPluginArray* thisObj = jsCast<JSDOMPluginArray*>(asObject(slotBase));
     return toJS(exec, thisObj->globalObject(), thisObj->impl()->namedItem(identifierToAtomicString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSDOMPluginCustom.cpp b/Source/WebCore/bindings/js/JSDOMPluginCustom.cpp
index 32b76ed..061da3a 100644
--- a/Source/WebCore/bindings/js/JSDOMPluginCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMPluginCustom.cpp
@@ -34,7 +34,7 @@
 
 JSValue JSDOMPlugin::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSDOMPlugin* thisObj = static_cast<JSDOMPlugin*>(asObject(slotBase));
+    JSDOMPlugin* thisObj = jsCast<JSDOMPlugin*>(asObject(slotBase));
     return toJS(exec, thisObj->globalObject(), thisObj->impl()->namedItem(identifierToAtomicString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp b/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
index 7c599c5..56871c2 100644
--- a/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
@@ -42,7 +42,7 @@
 
 JSValue JSDOMStringMap::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSDOMStringMap* thisObj = static_cast<JSDOMStringMap*>(asObject(slotBase));
+    JSDOMStringMap* thisObj = jsCast<JSDOMStringMap*>(asObject(slotBase));
     return jsString(exec, thisObj->impl()->item(identifierToAtomicString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
index 160465f..39e0ec1 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -237,9 +237,9 @@
         return 0;
     const ClassInfo* classInfo = asObject(value)->classInfo();
     if (classInfo == &JSDOMWindow::s_info)
-        return static_cast<JSDOMWindow*>(asObject(value));
+        return jsCast<JSDOMWindow*>(asObject(value));
     if (classInfo == &JSDOMWindowShell::s_info)
-        return static_cast<JSDOMWindowShell*>(asObject(value))->window();
+        return jsCast<JSDOMWindowShell*>(asObject(value))->window();
     return 0;
 }
 
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
index be551bf..4e9f206 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -99,17 +99,17 @@
 
 static JSValue childFrameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    return toJS(exec, static_cast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(identifierToAtomicString(propertyName))->domWindow());
+    return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(identifierToAtomicString(propertyName))->domWindow());
 }
 
 static JSValue indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
 {
-    return toJS(exec, static_cast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(index)->domWindow());
+    return toJS(exec, jsCast<JSDOMWindow*>(asObject(slotBase))->impl()->frame()->tree()->scopedChild(index)->domWindow());
 }
 
 static JSValue namedItemGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSDOMWindowBase* thisObj = static_cast<JSDOMWindow*>(asObject(slotBase));
+    JSDOMWindowBase* thisObj = jsCast<JSDOMWindow*>(asObject(slotBase));
     Document* document = thisObj->impl()->frame()->document();
 
     ASSERT(thisObj->allowsAccessFrom(exec));
@@ -663,9 +663,9 @@
         return 0;
     JSObject* object = asObject(value);
     if (object->inherits(&JSDOMWindow::s_info))
-        return static_cast<JSDOMWindow*>(object)->impl();
+        return jsCast<JSDOMWindow*>(object)->impl();
     if (object->inherits(&JSDOMWindowShell::s_info))
-        return static_cast<JSDOMWindowShell*>(object)->impl();
+        return jsCast<JSDOMWindowShell*>(object)->impl();
     return 0;
 }
 
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.h b/Source/WebCore/bindings/js/JSDOMWindowCustom.h
index 7551fe4..57e8166 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.h
@@ -28,7 +28,7 @@
 
 inline JSDOMWindow* asJSDOMWindow(JSC::JSGlobalObject* globalObject)
 {
-    return static_cast<JSDOMWindow*>(globalObject);
+    return JSC::jsCast<JSDOMWindow*>(globalObject);
 }
  
 inline const JSDOMWindow* asJSDOMWindow(const JSC::JSGlobalObject* globalObject)
diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.h b/Source/WebCore/bindings/js/JSDOMWindowShell.h
index b7c7501..f1e2739 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowShell.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowShell.h
@@ -43,7 +43,7 @@
         JSDOMWindowShell(PassRefPtr<DOMWindow>, JSC::Structure*, DOMWrapperWorld*);
         static void destroy(JSCell*);
 
-        JSDOMWindow* window() const { return static_cast<JSDOMWindow*>(m_unwrappedObject.get()); }
+        JSDOMWindow* window() const { return JSC::jsCast<JSDOMWindow*>(m_unwrappedObject.get()); }
         void setWindow(JSC::JSGlobalData& globalData, JSDOMWindow* window)
         {
             ASSERT_ARG(window, window);
diff --git a/Source/WebCore/bindings/js/JSDOMWrapper.h b/Source/WebCore/bindings/js/JSDOMWrapper.h
index 74f156a..f0a8a3a 100644
--- a/Source/WebCore/bindings/js/JSDOMWrapper.h
+++ b/Source/WebCore/bindings/js/JSDOMWrapper.h
@@ -33,7 +33,7 @@
 public:
     JSDOMGlobalObject* globalObject() const
     {
-        return static_cast<JSDOMGlobalObject*>(JSC::JSNonFinalObject::globalObject());
+        return JSC::jsCast<JSDOMGlobalObject*>(JSC::JSNonFinalObject::globalObject());
     }
 
     ScriptExecutionContext* scriptExecutionContext() const
diff --git a/Source/WebCore/bindings/js/JSDataViewCustom.cpp b/Source/WebCore/bindings/js/JSDataViewCustom.cpp
index 87d4458..ab79c83 100644
--- a/Source/WebCore/bindings/js/JSDataViewCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDataViewCustom.cpp
@@ -58,7 +58,7 @@
         return JSValue::encode(jsUndefined());
     }
 
-    JSDataViewConstructor* jsConstructor = static_cast<JSDataViewConstructor*>(exec->callee());
+    JSDataViewConstructor* jsConstructor = jsCast<JSDataViewConstructor*>(exec->callee());
     return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), view.get())));
 }
 
diff --git a/Source/WebCore/bindings/js/JSEventListener.cpp b/Source/WebCore/bindings/js/JSEventListener.cpp
index 5836900..fa996e5 100644
--- a/Source/WebCore/bindings/js/JSEventListener.cpp
+++ b/Source/WebCore/bindings/js/JSEventListener.cpp
@@ -87,7 +87,7 @@
 
     Frame* frame = 0;
     if (scriptExecutionContext->isDocument()) {
-        JSDOMWindow* window = static_cast<JSDOMWindow*>(globalObject);
+        JSDOMWindow* window = jsCast<JSDOMWindow*>(globalObject);
         frame = window->impl()->frame();
         if (!frame)
             return;
diff --git a/Source/WebCore/bindings/js/JSEventTarget.cpp b/Source/WebCore/bindings/js/JSEventTarget.cpp
index 45fad7f..66e1576 100644
--- a/Source/WebCore/bindings/js/JSEventTarget.cpp
+++ b/Source/WebCore/bindings/js/JSEventTarget.cpp
@@ -66,12 +66,12 @@
 
 #define TRY_TO_UNWRAP_WITH_INTERFACE(interfaceName) \
     if (value.inherits(&JS##interfaceName::s_info)) \
-        return static_cast<interfaceName*>(static_cast<JS##interfaceName*>(asObject(value))->impl());
+        return static_cast<interfaceName*>(jsCast<JS##interfaceName*>(asObject(value))->impl());
 
 EventTarget* toEventTarget(JSC::JSValue value)
 {
     if (value.inherits(&JSDOMWindowShell::s_info))
-        return static_cast<JSDOMWindowShell*>(asObject(value))->impl();
+        return jsCast<JSDOMWindowShell*>(asObject(value))->impl();
 
     DOM_EVENT_TARGET_INTERFACES_FOR_EACH(TRY_TO_UNWRAP_WITH_INTERFACE)
     return 0;
diff --git a/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
index ed3b112..cade52e 100644
--- a/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSFloat32ArrayConstructor::constructJSFloat32Array(ExecState* exec)
 {
-    JSFloat32ArrayConstructor* jsConstructor = static_cast<JSFloat32ArrayConstructor*>(exec->callee());
+    JSFloat32ArrayConstructor* jsConstructor = jsCast<JSFloat32ArrayConstructor*>(exec->callee());
     RefPtr<Float32Array> array = constructArrayBufferView<Float32Array, float>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSFloat64ArrayCustom.cpp b/Source/WebCore/bindings/js/JSFloat64ArrayCustom.cpp
index fbd82b5..15619e3 100644
--- a/Source/WebCore/bindings/js/JSFloat64ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSFloat64ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSFloat64ArrayConstructor::constructJSFloat64Array(ExecState* exec)
 {
-    JSFloat64ArrayConstructor* jsConstructor = static_cast<JSFloat64ArrayConstructor*>(exec->callee());
+    JSFloat64ArrayConstructor* jsConstructor = jsCast<JSFloat64ArrayConstructor*>(exec->callee());
     RefPtr<Float64Array> array = constructArrayBufferView<Float64Array, double>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSGeolocationCustom.cpp b/Source/WebCore/bindings/js/JSGeolocationCustom.cpp
index 8a91856..57fb180 100644
--- a/Source/WebCore/bindings/js/JSGeolocationCustom.cpp
+++ b/Source/WebCore/bindings/js/JSGeolocationCustom.cpp
@@ -101,12 +101,12 @@
 {
     // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions
 
-    RefPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<JSPositionCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0));
+    RefPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<JSPositionCallback>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0));
     if (exec->hadException())
         return jsUndefined();
     ASSERT(positionCallback);
 
-    RefPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1), CallbackAllowUndefined | CallbackAllowNull);
+    RefPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1), CallbackAllowUndefined | CallbackAllowNull);
     if (exec->hadException())
         return jsUndefined();
 
@@ -123,12 +123,12 @@
 {
     // Arguments: PositionCallback, (optional)PositionErrorCallback, (optional)PositionOptions
 
-    RefPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<JSPositionCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0));
+    RefPtr<PositionCallback> positionCallback = createFunctionOnlyCallback<JSPositionCallback>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(0));
     if (exec->hadException())
         return jsUndefined();
     ASSERT(positionCallback);
 
-    RefPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1), CallbackAllowUndefined | CallbackAllowNull);
+    RefPtr<PositionErrorCallback> positionErrorCallback = createFunctionOnlyCallback<JSPositionErrorCallback>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->argument(1), CallbackAllowUndefined | CallbackAllowNull);
     if (exec->hadException())
         return jsUndefined();
 
diff --git a/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
index 3626cdc..f98c176 100644
--- a/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
@@ -64,7 +64,7 @@
         return JSValue::encode(jsUndefined());
 
     // Do not use thisObj here. It can be the JSHTMLDocument, in the document.forms(i) case.
-    JSHTMLAllCollection* jsCollection = static_cast<JSHTMLAllCollection*>(exec->callee());
+    JSHTMLAllCollection* jsCollection = jsCast<JSHTMLAllCollection*>(exec->callee());
     HTMLAllCollection* collection = static_cast<HTMLAllCollection*>(jsCollection->impl());
 
     // Also, do we need the TypeError test here ?
@@ -106,7 +106,7 @@
 
 JSValue JSHTMLAllCollection::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSHTMLAllCollection* thisObj = static_cast<JSHTMLAllCollection*>(asObject(slotBase));
+    JSHTMLAllCollection* thisObj = jsCast<JSHTMLAllCollection*>(asObject(slotBase));
     return getNamedItems(exec, thisObj, propertyName);
 }
 
diff --git a/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
index d3f936f..74e924f 100644
--- a/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLCollectionCustom.cpp
@@ -65,7 +65,7 @@
 
 JSValue JSHTMLCollection::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSHTMLCollection* thisObj = static_cast<JSHTMLCollection*>(asObject(slotBase));
+    JSHTMLCollection* thisObj = jsCast<JSHTMLCollection*>(asObject(slotBase));
     return getNamedItems(exec, thisObj, propertyName);
 }
 
diff --git a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
index e64e243..5d2e83c 100644
--- a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
@@ -59,7 +59,7 @@
 
 JSValue JSHTMLDocument::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSHTMLDocument* thisObj = static_cast<JSHTMLDocument*>(asObject(slotBase));
+    JSHTMLDocument* thisObj = jsCast<JSHTMLDocument*>(asObject(slotBase));
     HTMLDocument* document = static_cast<HTMLDocument*>(thisObj->impl());
 
     HTMLCollection* collection = document->documentNamedItems(identifierToAtomicString(propertyName));
diff --git a/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
index 757b502..3087cd4 100644
--- a/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
@@ -46,7 +46,7 @@
 
 JSValue JSHTMLFormElement::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSHTMLElement* jsForm = static_cast<JSHTMLFormElement*>(asObject(slotBase));
+    JSHTMLElement* jsForm = jsCast<JSHTMLFormElement*>(asObject(slotBase));
     HTMLFormElement* form = static_cast<HTMLFormElement*>(jsForm->impl());
 
     Vector<RefPtr<Node> > namedItems;
diff --git a/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
index 07bac61..95093c9 100644
--- a/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
@@ -49,7 +49,7 @@
 
 JSValue JSHTMLFrameSetElement::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    HTMLElement* element = static_cast<JSHTMLElement*>(asObject(slotBase))->impl();
+    HTMLElement* element = jsCast<JSHTMLElement*>(asObject(slotBase))->impl();
     Node* frameElement = element->children()->namedItem(identifierToAtomicString(propertyName));
     if (Document* document = static_cast<HTMLFrameElement*>(frameElement)->contentDocument()) {
         if (JSDOMWindowShell* window = toJSDOMWindowShell(document->frame(), currentWorld(exec)))
diff --git a/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp b/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
index d98602a..480b88a 100644
--- a/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
@@ -91,7 +91,7 @@
 JSValue JSHTMLOptionsCollection::remove(ExecState* exec)
 {
     HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
-    JSHTMLSelectElement* base = static_cast<JSHTMLSelectElement*>(asObject(toJS(exec, globalObject(), imp->base())));
+    JSHTMLSelectElement* base = jsCast<JSHTMLSelectElement*>(asObject(toJS(exec, globalObject(), imp->base())));
     return base->remove(exec);
 }
 
diff --git a/Source/WebCore/bindings/js/JSImageConstructor.cpp b/Source/WebCore/bindings/js/JSImageConstructor.cpp
index 956c961..9a61160 100644
--- a/Source/WebCore/bindings/js/JSImageConstructor.cpp
+++ b/Source/WebCore/bindings/js/JSImageConstructor.cpp
@@ -49,7 +49,7 @@
 
 static EncodedJSValue JSC_HOST_CALL constructImage(ExecState* exec)
 {
-    JSImageConstructor* jsConstructor = static_cast<JSImageConstructor*>(exec->callee());
+    JSImageConstructor* jsConstructor = jsCast<JSImageConstructor*>(exec->callee());
     Document* document = jsConstructor->document();
     if (!document)
         return throwVMError(exec, createReferenceError(exec, "Image constructor associated document is unavailable"));
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
index 500737d..249993f 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
@@ -54,7 +54,7 @@
     JSLock lock(SilenceAssertionsOnly);
 
     SourceCode sourceCode = makeSource(stringToUString(source));
-    JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+    JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
     JSValue globalThisValue = scriptState->globalThisValue();
 
     JSValue evaluationException;
@@ -80,14 +80,14 @@
 
 void InjectedScriptManager::discardInjectedScript(ScriptState* scriptState)
 {
-    JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+    JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
     globalObject->setInjectedScript(0);
 }
 
 InjectedScript InjectedScriptManager::injectedScriptFor(ScriptState* scriptState)
 {
     JSLock lock(SilenceAssertionsOnly);
-    JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+    JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
     JSObject* injectedScript = globalObject->injectedScript();
     if (injectedScript)
         return InjectedScript(ScriptObject(scriptState, injectedScript), m_inspectedStateAccessCheck);
diff --git a/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
index 76aaba0..bc77a6d 100644
--- a/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSInt16ArrayConstructor::constructJSInt16Array(ExecState* exec)
 {
-    JSInt16ArrayConstructor* jsConstructor = static_cast<JSInt16ArrayConstructor*>(exec->callee());
+    JSInt16ArrayConstructor* jsConstructor = jsCast<JSInt16ArrayConstructor*>(exec->callee());
     RefPtr<Int16Array> array = constructArrayBufferView<Int16Array, short>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
index 43390b1..d85287f 100644
--- a/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSInt32ArrayConstructor::constructJSInt32Array(ExecState* exec)
 {
-    JSInt32ArrayConstructor* jsConstructor = static_cast<JSInt32ArrayConstructor*>(exec->callee());
+    JSInt32ArrayConstructor* jsConstructor = jsCast<JSInt32ArrayConstructor*>(exec->callee());
     RefPtr<Int32Array> array = constructArrayBufferView<Int32Array, int>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
index bb7fe8a..b6e1507 100644
--- a/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp
@@ -51,7 +51,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSInt8ArrayConstructor::constructJSInt8Array(ExecState* exec)
 {
-    JSInt8ArrayConstructor* jsConstructor = static_cast<JSInt8ArrayConstructor*>(exec->callee());
+    JSInt8ArrayConstructor* jsConstructor = jsCast<JSInt8ArrayConstructor*>(exec->callee());
     RefPtr<Int8Array> array = constructArrayBufferView<Int8Array, signed char>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSLazyEventListener.cpp b/Source/WebCore/bindings/js/JSLazyEventListener.cpp
index 4e30012..f11bf90 100644
--- a/Source/WebCore/bindings/js/JSLazyEventListener.cpp
+++ b/Source/WebCore/bindings/js/JSLazyEventListener.cpp
@@ -104,7 +104,7 @@
         return 0;
     }
 
-    JSFunction* listenerAsFunction = static_cast<JSFunction*>(jsFunction);
+    JSFunction* listenerAsFunction = jsCast<JSFunction*>(jsFunction);
     if (m_originalNode) {
         if (!wrapper()) {
             // Ensure that 'node' has a JavaScript wrapper to mark the event listener we're creating.
@@ -115,7 +115,7 @@
 
         // Add the event's home element to the scope
         // (and the document, and the form - see JSHTMLElement::eventHandlerScope)
-        listenerAsFunction->setScope(exec->globalData(), static_cast<JSNode*>(wrapper())->pushEventHandlerScope(exec, listenerAsFunction->scope()));
+        listenerAsFunction->setScope(exec->globalData(), jsCast<JSNode*>(wrapper())->pushEventHandlerScope(exec, listenerAsFunction->scope()));
     }
 
     // Since we only parse once, there's no need to keep data used for parsing around anymore.
diff --git a/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp b/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
index 871f06a..b128032 100644
--- a/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
@@ -42,7 +42,7 @@
 
 JSValue JSNamedNodeMap::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(asObject(slotBase));
+    JSNamedNodeMap* thisObj = jsCast<JSNamedNodeMap*>(asObject(slotBase));
     return toJS(exec, thisObj->globalObject(), thisObj->impl()->getNamedItem(identifierToString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSNodeCustom.cpp b/Source/WebCore/bindings/js/JSNodeCustom.cpp
index 7cdd5fc..394d0f3 100644
--- a/Source/WebCore/bindings/js/JSNodeCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNodeCustom.cpp
@@ -132,13 +132,13 @@
 
 bool JSNodeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSNode* jsNode = static_cast<JSNode*>(handle.get().asCell());
+    JSNode* jsNode = jsCast<JSNode*>(handle.get().asCell());
     return isReachableFromDOM(jsNode, jsNode->impl(), visitor);
 }
 
 void JSNodeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
 {
-    JSNode* jsNode = static_cast<JSNode*>(handle.get().asCell());
+    JSNode* jsNode = jsCast<JSNode*>(handle.get().asCell());
     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
     uncacheWrapper(world, jsNode->impl(), jsNode);
     jsNode->releaseImpl();
diff --git a/Source/WebCore/bindings/js/JSNodeCustom.h b/Source/WebCore/bindings/js/JSNodeCustom.h
index 518b21d..dd242e3 100644
--- a/Source/WebCore/bindings/js/JSNodeCustom.h
+++ b/Source/WebCore/bindings/js/JSNodeCustom.h
@@ -61,7 +61,7 @@
     if (!node)
         return JSC::jsNull();
 
-    JSNode* wrapper = static_cast<JSNode*>(getCachedWrapper(currentWorld(exec), node));
+    JSNode* wrapper = JSC::jsCast<JSNode*>(getCachedWrapper(currentWorld(exec), node));
     if (wrapper)
         return wrapper;
 
diff --git a/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp b/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
index f402342..3d9cf3d 100644
--- a/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
@@ -49,7 +49,7 @@
 PassRefPtr<NodeFilter> toNodeFilter(JSGlobalData& globalData, JSValue value)
 {
     if (value.inherits(&JSNodeFilter::s_info))
-        return static_cast<JSNodeFilter*>(asObject(value))->impl();
+        return jsCast<JSNodeFilter*>(asObject(value))->impl();
 
     RefPtr<NodeFilter> result = NodeFilter::create();
     result->setCondition(JSNodeFilterCondition::create(globalData, result.get(), value));
diff --git a/Source/WebCore/bindings/js/JSNodeListCustom.cpp b/Source/WebCore/bindings/js/JSNodeListCustom.cpp
index 5602d24..725e053 100644
--- a/Source/WebCore/bindings/js/JSNodeListCustom.cpp
+++ b/Source/WebCore/bindings/js/JSNodeListCustom.cpp
@@ -38,7 +38,7 @@
 
 bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSNodeList* jsNodeList = static_cast<JSNodeList*>(handle.get().asCell());
+    JSNodeList* jsNodeList = jsCast<JSNodeList*>(handle.get().asCell());
     if (!jsNodeList->hasCustomProperties())
         return false;
     if (!jsNodeList->impl()->isDynamicNodeList())
@@ -53,7 +53,7 @@
 
 JSValue JSNodeList::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSNodeList* thisObj = static_cast<JSNodeList*>(asObject(slotBase));
+    JSNodeList* thisObj = jsCast<JSNodeList*>(asObject(slotBase));
     return toJS(exec, thisObj->globalObject(), thisObj->impl()->itemWithName(identifierToAtomicString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp b/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp
index 2d6553a..83819e3 100644
--- a/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp
+++ b/Source/WebCore/bindings/js/JSPluginElementFunctions.cpp
@@ -102,7 +102,7 @@
     
 JSValue runtimeObjectPropertyGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSHTMLElement* element = static_cast<JSHTMLElement*>(asObject(slotBase));
+    JSHTMLElement* element = jsCast<JSHTMLElement*>(asObject(slotBase));
     JSObject* scriptObject = pluginScriptObject(exec, element);
     if (!scriptObject)
         return jsUndefined();
@@ -151,7 +151,7 @@
 
 static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec)
 {
-    JSHTMLElement* element = static_cast<JSHTMLElement*>(exec->callee());
+    JSHTMLElement* element = jsCast<JSHTMLElement*>(exec->callee());
 
     // Get the plug-in script object.
     JSObject* scriptObject = pluginScriptObject(exec, element);
diff --git a/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp b/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp
index f01f84b..3de2807 100644
--- a/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp
+++ b/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp
@@ -70,7 +70,7 @@
     JSValue result;
 
     if (isSameState) {
-        JSHistory* jsHistory = static_cast<JSHistory*>(toJS(exec, globalObject(), history).asCell());
+        JSHistory* jsHistory = jsCast<JSHistory*>(toJS(exec, globalObject(), history).asCell());
         result = jsHistory->state(exec);
     } else
         result = event->serializedState()->deserialize(exec, globalObject(), 0);
diff --git a/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp b/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp
index 30aae1b..a3c198f 100644
--- a/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp
+++ b/Source/WebCore/bindings/js/JSSQLTransactionCustom.cpp
@@ -96,7 +96,7 @@
             return jsUndefined();
         }
 
-        callback = JSSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
+        callback = JSSQLStatementCallback::create(object, jsCast<JSDOMGlobalObject*>(globalObject()));
     }
 
     RefPtr<SQLStatementErrorCallback> errorCallback;
@@ -107,7 +107,7 @@
             return jsUndefined();
         }
 
-        errorCallback = JSSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
+        errorCallback = JSSQLStatementErrorCallback::create(object, jsCast<JSDOMGlobalObject*>(globalObject()));
     }
 
     ExceptionCode ec = 0;
diff --git a/Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp b/Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp
index fb8dc18..2827bbf 100644
--- a/Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp
+++ b/Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp
@@ -57,7 +57,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSSharedWorkerConstructor::constructJSSharedWorker(ExecState* exec)
 {
-    JSSharedWorkerConstructor* jsConstructor = static_cast<JSSharedWorkerConstructor*>(exec->callee());
+    JSSharedWorkerConstructor* jsConstructor = jsCast<JSSharedWorkerConstructor*>(exec->callee());
 
     if (exec->argumentCount() < 1)
         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
diff --git a/Source/WebCore/bindings/js/JSStorageCustom.cpp b/Source/WebCore/bindings/js/JSStorageCustom.cpp
index 31be269..a4b9089 100644
--- a/Source/WebCore/bindings/js/JSStorageCustom.cpp
+++ b/Source/WebCore/bindings/js/JSStorageCustom.cpp
@@ -41,7 +41,7 @@
 
 JSValue JSStorage::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSStorage* thisObj = static_cast<JSStorage*>(asObject(slotBase));
+    JSStorage* thisObj = jsCast<JSStorage*>(asObject(slotBase));
     return jsStringOrNull(exec, thisObj->impl()->getItem(identifierToString(propertyName)));
 }
 
diff --git a/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp b/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp
index a2c8b67..c05eef5 100644
--- a/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp
+++ b/Source/WebCore/bindings/js/JSStyleSheetListCustom.cpp
@@ -42,7 +42,7 @@
 
 JSValue JSStyleSheetList::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)
 {
-    JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(asObject(slotBase));
+    JSStyleSheetList* thisObj = jsCast<JSStyleSheetList*>(asObject(slotBase));
     HTMLStyleElement* element = thisObj->impl()->getNamedItem(identifierToString(propertyName));
     ASSERT(element);
     return toJS(exec, thisObj->globalObject(), element->sheet());
diff --git a/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp b/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp
index c6de15f..5dd9dca 100644
--- a/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp
+++ b/Source/WebCore/bindings/js/JSTextTrackCueCustom.cpp
@@ -36,7 +36,7 @@
 
 bool JSTextTrackCueOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTextTrackCue* jsTextTrackCue = static_cast<JSTextTrackCue*>(handle.get().asCell());
+    JSTextTrackCue* jsTextTrackCue = jsCast<JSTextTrackCue*>(handle.get().asCell());
     TextTrackCue* textTrackCue = static_cast<TextTrackCue*>(jsTextTrackCue->impl());
 
     // If the cue is firing event listeners, its wrapper is reachable because
diff --git a/Source/WebCore/bindings/js/JSTextTrackCustom.cpp b/Source/WebCore/bindings/js/JSTextTrackCustom.cpp
index 613bbe3..5d64124 100644
--- a/Source/WebCore/bindings/js/JSTextTrackCustom.cpp
+++ b/Source/WebCore/bindings/js/JSTextTrackCustom.cpp
@@ -37,7 +37,7 @@
 
 bool JSTextTrackOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTextTrack* jsTextTrack = static_cast<JSTextTrack*>(handle.get().asCell());
+    JSTextTrack* jsTextTrack = jsCast<JSTextTrack*>(handle.get().asCell());
     TextTrack* textTrack = static_cast<TextTrack*>(jsTextTrack->impl());
 
     // If the cue is firing event listeners, its wrapper is reachable because
diff --git a/Source/WebCore/bindings/js/JSTextTrackListCustom.cpp b/Source/WebCore/bindings/js/JSTextTrackListCustom.cpp
index 8fc1e56..a967fe1 100644
--- a/Source/WebCore/bindings/js/JSTextTrackListCustom.cpp
+++ b/Source/WebCore/bindings/js/JSTextTrackListCustom.cpp
@@ -36,7 +36,7 @@
 
 bool JSTextTrackListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 {
-    JSTextTrackList* jsTextTrackList = static_cast<JSTextTrackList*>(handle.get().asCell());
+    JSTextTrackList* jsTextTrackList = jsCast<JSTextTrackList*>(handle.get().asCell());
     TextTrackList* textTrackList = static_cast<TextTrackList*>(jsTextTrackList->impl());
 
     // If the list is firing event listeners, its wrapper is reachable because
diff --git a/Source/WebCore/bindings/js/JSTrackCustom.cpp b/Source/WebCore/bindings/js/JSTrackCustom.cpp
index 1d9ca00..7b97945 100644
--- a/Source/WebCore/bindings/js/JSTrackCustom.cpp
+++ b/Source/WebCore/bindings/js/JSTrackCustom.cpp
@@ -42,7 +42,7 @@
 
     JSObject* object = asObject(value);
     if (object->inherits(&JSTextTrack::s_info))
-        return static_cast<JSTextTrack*>(object)->impl();
+        return jsCast<JSTextTrack*>(object)->impl();
     
     // FIXME: Fill in additional tests and casts here for VideoTrack and AudioTrack when 
     // they have been added to WebCore.
diff --git a/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
index a21d351..47b4402 100644
--- a/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSUint16ArrayConstructor::constructJSUint16Array(ExecState* exec)
 {
-    JSUint16ArrayConstructor* jsConstructor = static_cast<JSUint16ArrayConstructor*>(exec->callee());
+    JSUint16ArrayConstructor* jsConstructor = jsCast<JSUint16ArrayConstructor*>(exec->callee());
     RefPtr<Uint16Array> array = constructArrayBufferView<Uint16Array, unsigned short>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
index 8288044..aa8b826 100644
--- a/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSUint32ArrayConstructor::constructJSUint32Array(ExecState* exec)
 {
-    JSUint32ArrayConstructor* jsConstructor = static_cast<JSUint32ArrayConstructor*>(exec->callee());
+    JSUint32ArrayConstructor* jsConstructor = jsCast<JSUint32ArrayConstructor*>(exec->callee());
     RefPtr<Uint32Array> array = constructArrayBufferView<Uint32Array, unsigned int>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
index 0b28647..6a4fa1d 100644
--- a/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSUint8ArrayConstructor::constructJSUint8Array(ExecState* exec)
 {
-    JSUint8ArrayConstructor* jsConstructor = static_cast<JSUint8ArrayConstructor*>(exec->callee());
+    JSUint8ArrayConstructor* jsConstructor = jsCast<JSUint8ArrayConstructor*>(exec->callee());
     RefPtr<Uint8Array> array = constructArrayBufferView<Uint8Array, unsigned char>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSUint8ClampedArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint8ClampedArrayCustom.cpp
index 1566d04..2d5ca78 100644
--- a/Source/WebCore/bindings/js/JSUint8ClampedArrayCustom.cpp
+++ b/Source/WebCore/bindings/js/JSUint8ClampedArrayCustom.cpp
@@ -50,7 +50,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSUint8ClampedArrayConstructor::constructJSUint8ClampedArray(ExecState* exec)
 {
-    JSUint8ClampedArrayConstructor* jsConstructor = static_cast<JSUint8ClampedArrayConstructor*>(exec->callee());
+    JSUint8ClampedArrayConstructor* jsConstructor = jsCast<JSUint8ClampedArrayConstructor*>(exec->callee());
     RefPtr<Uint8ClampedArray> array = constructArrayBufferView<Uint8ClampedArray, unsigned char>(exec);
     if (!array.get())
         // Exception has already been thrown.
diff --git a/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp b/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp
index 455f4d4..adfcf07 100644
--- a/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp
+++ b/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp
@@ -59,7 +59,7 @@
         return JSValue::encode(jsUndefined());
     }
 
-    JSWebKitMutationObserverConstructor* jsConstructor = static_cast<JSWebKitMutationObserverConstructor*>(exec->callee());
+    JSWebKitMutationObserverConstructor* jsConstructor = jsCast<JSWebKitMutationObserverConstructor*>(exec->callee());
     RefPtr<MutationCallback> callback = JSMutationCallback::create(object, jsConstructor->globalObject());
     return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), WebKitMutationObserver::create(callback.release()))));
 }
diff --git a/Source/WebCore/bindings/js/JSWebKitPointCustom.cpp b/Source/WebCore/bindings/js/JSWebKitPointCustom.cpp
index e1b20ce..aa14e65 100644
--- a/Source/WebCore/bindings/js/JSWebKitPointCustom.cpp
+++ b/Source/WebCore/bindings/js/JSWebKitPointCustom.cpp
@@ -34,7 +34,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSWebKitPointConstructor::constructJSWebKitPoint(ExecState* exec)
 {
-    JSWebKitPointConstructor* jsConstructor = static_cast<JSWebKitPointConstructor*>(exec->callee());
+    JSWebKitPointConstructor* jsConstructor = jsCast<JSWebKitPointConstructor*>(exec->callee());
 
     float x = 0;
     float y = 0;
diff --git a/Source/WebCore/bindings/js/JSWebSocketCustom.cpp b/Source/WebCore/bindings/js/JSWebSocketCustom.cpp
index c8e0069..71ad57a 100644
--- a/Source/WebCore/bindings/js/JSWebSocketCustom.cpp
+++ b/Source/WebCore/bindings/js/JSWebSocketCustom.cpp
@@ -52,7 +52,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSWebSocketConstructor::constructJSWebSocket(ExecState* exec)
 {
-    JSWebSocketConstructor* jsConstructor = static_cast<JSWebSocketConstructor*>(exec->callee());
+    JSWebSocketConstructor* jsConstructor = jsCast<JSWebSocketConstructor*>(exec->callee());
     ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
     if (!context)
         return throwVMError(exec, createReferenceError(exec, "WebSocket constructor associated document is unavailable"));
diff --git a/Source/WebCore/bindings/js/JSWorkerContextBase.cpp b/Source/WebCore/bindings/js/JSWorkerContextBase.cpp
index e79c6e4..2c13a9d 100644
--- a/Source/WebCore/bindings/js/JSWorkerContextBase.cpp
+++ b/Source/WebCore/bindings/js/JSWorkerContextBase.cpp
@@ -93,7 +93,7 @@
         return 0;
     const ClassInfo* classInfo = asObject(value)->classInfo();
     if (classInfo == &JSDedicatedWorkerContext::s_info)
-        return static_cast<JSDedicatedWorkerContext*>(asObject(value));
+        return jsCast<JSDedicatedWorkerContext*>(asObject(value));
     return 0;
 }
 
@@ -104,7 +104,7 @@
         return 0;
     const ClassInfo* classInfo = asObject(value)->classInfo();
     if (classInfo == &JSSharedWorkerContext::s_info)
-        return static_cast<JSSharedWorkerContext*>(asObject(value));
+        return jsCast<JSSharedWorkerContext*>(asObject(value));
     return 0;
 }
 #endif
diff --git a/Source/WebCore/bindings/js/JSWorkerCustom.cpp b/Source/WebCore/bindings/js/JSWorkerCustom.cpp
index ca0f761..70bd887 100644
--- a/Source/WebCore/bindings/js/JSWorkerCustom.cpp
+++ b/Source/WebCore/bindings/js/JSWorkerCustom.cpp
@@ -52,7 +52,7 @@
 
 EncodedJSValue JSC_HOST_CALL JSWorkerConstructor::constructJSWorker(ExecState* exec)
 {
-    JSWorkerConstructor* jsConstructor = static_cast<JSWorkerConstructor*>(exec->callee());
+    JSWorkerConstructor* jsConstructor = jsCast<JSWorkerConstructor*>(exec->callee());
 
     if (!exec->argumentCount())
         return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
diff --git a/Source/WebCore/bindings/js/JSXSLTProcessorCustom.cpp b/Source/WebCore/bindings/js/JSXSLTProcessorCustom.cpp
index da80097..70b6980 100644
--- a/Source/WebCore/bindings/js/JSXSLTProcessorCustom.cpp
+++ b/Source/WebCore/bindings/js/JSXSLTProcessorCustom.cpp
@@ -50,7 +50,7 @@
 {
     JSValue nodeVal = exec->argument(0);
     if (nodeVal.inherits(&JSNode::s_info)) {
-        JSNode* node = static_cast<JSNode*>(asObject(nodeVal));
+        JSNode* node = jsCast<JSNode*>(asObject(nodeVal));
         impl()->importStylesheet(node->impl());
         return jsUndefined();
     }
@@ -63,8 +63,8 @@
     JSValue nodeVal = exec->argument(0);
     JSValue docVal = exec->argument(1);
     if (nodeVal.inherits(&JSNode::s_info) && docVal.inherits(&JSDocument::s_info)) {
-        WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl();
-        Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl());
+        WebCore::Node* node = jsCast<JSNode*>(asObject(nodeVal))->impl();
+        Document* doc = static_cast<Document*>(jsCast<JSDocument*>(asObject(docVal))->impl());
         return toJS(exec, globalObject(), impl()->transformToFragment(node, doc).get());
     }
     // Throw exception?
@@ -75,7 +75,7 @@
 {
     JSValue nodeVal = exec->argument(0);
     if (nodeVal.inherits(&JSNode::s_info)) {
-        JSNode* node = static_cast<JSNode*>(asObject(nodeVal));
+        JSNode* node = jsCast<JSNode*>(asObject(nodeVal));
         RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl());
         if (resultDocument)
             return toJS(exec, globalObject(), resultDocument.get());
diff --git a/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp b/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp
index 63ebe62..ccf673f 100644
--- a/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp
+++ b/Source/WebCore/bindings/js/ScriptCallStackFactory.cpp
@@ -90,7 +90,7 @@
 {
     size_t maxStackSize = 1;
     if (InspectorInstrumentation::hasFrontends()) {
-        ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
+        ScriptExecutionContext* scriptExecutionContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
         if (InspectorInstrumentation::hasFrontendForScriptContext(scriptExecutionContext))
             maxStackSize = ScriptCallStack::maxCallStackSizeToCapture;
     }
diff --git a/Source/WebCore/bindings/js/ScriptControllerMac.mm b/Source/WebCore/bindings/js/ScriptControllerMac.mm
index f7ad3ff..50a5a7e 100644
--- a/Source/WebCore/bindings/js/ScriptControllerMac.mm
+++ b/Source/WebCore/bindings/js/ScriptControllerMac.mm
@@ -148,7 +148,7 @@
     if (!rootObject)
         return;
 
-    JSDOMWindow* window = static_cast<JSDOMWindow*>(rootObject);
+    JSDOMWindow* window = JSC::jsCast<JSDOMWindow*>(rootObject);
     if (!window)
         return;
 
diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
index 10ded70..1d6117c 100644
--- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp
+++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp
@@ -211,7 +211,7 @@
     JSValue jsCallFrame;
     {
         if (m_currentCallFrame->isValid() && globalObject->inherits(&JSDOMGlobalObject::s_info)) {
-            JSDOMGlobalObject* domGlobalObject = static_cast<JSDOMGlobalObject*>(globalObject);
+            JSDOMGlobalObject* domGlobalObject = jsCast<JSDOMGlobalObject*>(globalObject);
             JSLock lock(SilenceAssertionsOnly);
             jsCallFrame = toJS(state, domGlobalObject, m_currentCallFrame.get());
         } else
diff --git a/Source/WebCore/bindings/js/ScriptObject.cpp b/Source/WebCore/bindings/js/ScriptObject.cpp
index 6760e47..1fcd9cb 100644
--- a/Source/WebCore/bindings/js/ScriptObject.cpp
+++ b/Source/WebCore/bindings/js/ScriptObject.cpp
@@ -70,7 +70,7 @@
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value)
 {
     JSLock lock(SilenceAssertionsOnly);
-    JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+    JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
     globalObject->putDirect(scriptState->globalData(), Identifier(scriptState, name), toJS(scriptState, globalObject, value));
     return handleException(scriptState);
 }
@@ -78,7 +78,7 @@
 bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InjectedScriptHost* value)
 {
     JSLock lock(SilenceAssertionsOnly);
-    JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
+    JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
     globalObject->putDirect(scriptState->globalData(), Identifier(scriptState, name), toJS(scriptState, globalObject, value));
     return handleException(scriptState);
 }
diff --git a/Source/WebCore/bindings/js/ScriptState.cpp b/Source/WebCore/bindings/js/ScriptState.cpp
index eb66bdc..780ca4d 100644
--- a/Source/WebCore/bindings/js/ScriptState.cpp
+++ b/Source/WebCore/bindings/js/ScriptState.cpp
@@ -68,7 +68,7 @@
     JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject();
     if (!globalObject->inherits(&JSDOMWindowBase::s_info))
         return 0;
-    return static_cast<JSDOMWindowBase*>(globalObject)->impl();
+    return JSC::jsCast<JSDOMWindowBase*>(globalObject)->impl();
 }
 
 ScriptExecutionContext* scriptExecutionContextFromScriptState(ScriptState* scriptState)
@@ -76,7 +76,7 @@
     JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject();
     if (!globalObject->inherits(&JSDOMGlobalObject::s_info))
         return 0;
-    return static_cast<JSDOMGlobalObject*>(globalObject)->scriptExecutionContext();
+    return JSC::jsCast<JSDOMGlobalObject*>(globalObject)->scriptExecutionContext();
 }
 
 bool evalEnabled(ScriptState* scriptState)
diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
index b259290..316408b 100644
--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -370,7 +370,7 @@
     {
         if (!input)
             return;
-        JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject());
+        JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject());
         for (size_t i = 0; i < input->size(); i++) {
             JSC::JSValue value = toJS(m_exec, globalObject, input->at(i).get());
             JSC::JSObject* obj = value.getObject();
@@ -539,7 +539,7 @@
             code = ValidationError;
             return true;
         }
-        JSValue bufferObj = toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject()), arrayBuffer.get());
+        JSValue bufferObj = toJS(m_exec, jsCast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject()), arrayBuffer.get());
         return dumpIfTerminal(bufferObj, code);
     }
 
@@ -1350,7 +1350,7 @@
     template<class T>
     JSValue getJSValue(T* nativeObj)
     {
-        return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), nativeObj);
+        return toJS(m_exec, jsCast<JSDOMGlobalObject*>(m_globalObject), nativeObj);
     }
 
     JSValue readTerminal()
@@ -1393,7 +1393,7 @@
                 return JSValue();
             if (!m_isDOMGlobalObject)
                 return jsNull();
-            return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), file.get());
+            return toJS(m_exec, jsCast<JSDOMGlobalObject*>(m_globalObject), file.get());
         }
         case FileListTag: {
             unsigned length = 0;
diff --git a/Source/WebCore/bindings/objc/WebScriptObject.mm b/Source/WebCore/bindings/objc/WebScriptObject.mm
index d0df7bf..aeef941 100644
--- a/Source/WebCore/bindings/objc/WebScriptObject.mm
+++ b/Source/WebCore/bindings/objc/WebScriptObject.mm
@@ -221,7 +221,7 @@
     if (!_private->originRootObject->isValid())
         return false;
 
-    return static_cast<JSDOMWindowBase*>(root->globalObject())->allowsAccessFrom(_private->originRootObject->globalObject());
+    return jsCast<JSDOMWindowBase*>(root->globalObject())->allowsAccessFrom(_private->originRootObject->globalObject());
 }
 
 - (void)dealloc
@@ -519,7 +519,7 @@
 
         if (object->inherits(&JSHTMLElement::s_info)) {
             // Plugin elements cache the instance internally.
-            HTMLElement* el = static_cast<JSHTMLElement*>(object)->impl();
+            HTMLElement* el = jsCast<JSHTMLElement*>(object)->impl();
             ObjcInstance* instance = static_cast<ObjcInstance*>(pluginInstance(el));
             if (instance)
                 return instance->getObject();
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index f77878c..4ece20a 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -392,7 +392,7 @@
 
     if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") {
         push(@getOwnPropertySlotImpl, "    ${namespaceMaybe}JSValue proto = thisObject->prototype();\n");
-        push(@getOwnPropertySlotImpl, "    if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
+        push(@getOwnPropertySlotImpl, "    if (proto.isObject() && jsCast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
         push(@getOwnPropertySlotImpl, "        return false;\n\n");
     }
 
@@ -484,7 +484,7 @@
     
     if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection" or $interfaceName eq "HTMLAllCollection") {
         push(@getOwnPropertyDescriptorImpl, "    ${namespaceMaybe}JSValue proto = thisObject->prototype();\n");
-        push(@getOwnPropertyDescriptorImpl, "    if (proto.isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
+        push(@getOwnPropertyDescriptorImpl, "    if (proto.isObject() && jsCast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
         push(@getOwnPropertyDescriptorImpl, "        return false;\n\n");
     }
     
@@ -1676,7 +1676,7 @@
 
                 push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue slotBase, const Identifier&)\n");
                 push(@implContent, "{\n");
-                push(@implContent, "    ${className}* castedThis = static_cast<$className*>(asObject(slotBase));\n");
+                push(@implContent, "    ${className}* castedThis = jsCast<$className*>(asObject(slotBase));\n");
 
                 if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) {
                     $needsMarkChildren = 1;
@@ -1795,7 +1795,7 @@
 
                 push(@implContent, "JSValue ${constructorFunctionName}(ExecState* exec, JSValue slotBase, const Identifier&)\n");
                 push(@implContent, "{\n");
-                push(@implContent, "    ${className}* domObject = static_cast<$className*>(asObject(slotBase));\n");
+                push(@implContent, "    ${className}* domObject = jsCast<$className*>(asObject(slotBase));\n");
 
                 if ($dataNode->extendedAttributes->{"CheckSecurity"}) {
                     push(@implContent, "    if (!domObject->allowsAccessFrom(exec))\n");
@@ -1870,19 +1870,19 @@
 
                         if ($dataNode->extendedAttributes->{"CheckSecurity"} && !$attribute->signature->extendedAttributes->{"DoNotCheckSecurity"}) {
                             if ($interfaceName eq "DOMWindow") {
-                                push(@implContent, "    if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
+                                push(@implContent, "    if (!jsCast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
                             } else {
-                                push(@implContent, "    if (!shouldAllowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n");
+                                push(@implContent, "    if (!shouldAllowAccessToFrame(exec, jsCast<$className*>(thisObject)->impl()->frame()))\n");
                             }
                             push(@implContent, "        return;\n");
                         }
 
                         if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) {
-                            push(@implContent, "    static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n");
+                            push(@implContent, "    jsCast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n");
                         } elsif ($type eq "EventListener") {
                             $implIncludes{"JSEventListener.h"} = 1;
                             push(@implContent, "    UNUSED_PARAM(exec);\n");
-                            push(@implContent, "    ${className}* castedThis = static_cast<${className}*>(thisObject);\n");
+                            push(@implContent, "    ${className}* castedThis = jsCast<${className}*>(thisObject);\n");
                             my $windowEventListener = $attribute->signature->extendedAttributes->{"JSWindowEventListener"};
                             if ($windowEventListener) {
                                 push(@implContent, "    JSDOMGlobalObject* globalObject = castedThis->globalObject();\n");
@@ -1906,15 +1906,15 @@
                             push(@implContent, "    // Shadowing a built-in constructor\n");
                             if ($interfaceName eq "DOMWindow" && $className eq "JSblah") {
                                 # FIXME: This branch never executes and should be removed.
-                                push(@implContent, "    static_cast<$className*>(thisObject)->putDirect(exec->globalData(), exec->propertyNames().constructor, value);\n");
+                                push(@implContent, "    jsCast<$className*>(thisObject)->putDirect(exec->globalData(), exec->propertyNames().constructor, value);\n");
                             } else {
-                                push(@implContent, "    static_cast<$className*>(thisObject)->putDirect(exec->globalData(), Identifier(exec, \"$name\"), value);\n");
+                                push(@implContent, "    jsCast<$className*>(thisObject)->putDirect(exec->globalData(), Identifier(exec, \"$name\"), value);\n");
                             }
                         } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
                             push(@implContent, "    // Shadowing a built-in object\n");
-                            push(@implContent, "    static_cast<$className*>(thisObject)->putDirect(exec->globalData(), Identifier(exec, \"$name\"), value);\n");
+                            push(@implContent, "    jsCast<$className*>(thisObject)->putDirect(exec->globalData(), Identifier(exec, \"$name\"), value);\n");
                         } else {
-                            push(@implContent, "    $className* castedThis = static_cast<$className*>(thisObject);\n");
+                            push(@implContent, "    $className* castedThis = jsCast<$className*>(thisObject);\n");
                             push(@implContent, "    $implType* impl = static_cast<$implType*>(castedThis->impl());\n");
                             push(@implContent, "    ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions};
 
@@ -1995,9 +1995,9 @@
                 push(@implContent, "{\n");
                 if ($dataNode->extendedAttributes->{"CheckSecurity"}) {
                     if ($interfaceName eq "DOMWindow") {
-                        push(@implContent, "    if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
+                        push(@implContent, "    if (!jsCast<$className*>(thisObject)->allowsAccessFrom(exec))\n");
                     } else {
-                        push(@implContent, "    if (!shouldAllowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n");
+                        push(@implContent, "    if (!shouldAllowAccessToFrame(exec, jsCast<$className*>(thisObject)->impl()->frame()))\n");
                     }
                     push(@implContent, "        return;\n");
                 }
@@ -2005,7 +2005,7 @@
                 push(@implContent, "    // Shadowing a built-in constructor\n");
 
                 if ($interfaceName eq "DOMWindow") {
-                    push(@implContent, "    static_cast<$className*>(thisObject)->putDirect(exec->globalData(), exec->propertyNames().constructor, value);\n");
+                    push(@implContent, "    jsCast<$className*>(thisObject)->putDirect(exec->globalData(), exec->propertyNames().constructor, value);\n");
                 } else {
                     die "No way to handle interface with ReplaceableConstructor extended attribute: $interfaceName";
                 }
@@ -2029,7 +2029,7 @@
 
     if (!$dataNode->extendedAttributes->{"OmitConstructor"}) {
         push(@implContent, "JSValue ${className}::getConstructor(ExecState* exec, JSGlobalObject* globalObject)\n{\n");
-        push(@implContent, "    return getDOMConstructor<${className}Constructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));\n");
+        push(@implContent, "    return getDOMConstructor<${className}Constructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));\n");
         push(@implContent, "}\n\n");
     }
 
@@ -2095,7 +2095,7 @@
                     push(@implContent, "    JSValue thisValue = exec->hostThisValue();\n");
                     push(@implContent, "    if (!thisValue.inherits(&${className}::s_info))\n");
                     push(@implContent, "        return throwVMTypeError(exec);\n");
-                    push(@implContent, "    $className* castedThis = static_cast<$className*>(asObject(thisValue));\n");
+                    push(@implContent, "    $className* castedThis = jsCast<$className*>(asObject(thisValue));\n");
                 }
 
                 push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(castedThis, &${className}::s_info);\n");
@@ -2213,7 +2213,7 @@
     if ($dataNode->extendedAttributes->{"IndexedGetter"}) {
         push(@implContent, "\nJSValue ${className}::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    ${className}* thisObj = static_cast<$className*>(asObject(slotBase));\n");
+        push(@implContent, "    ${className}* thisObj = jsCast<$className*>(asObject(slotBase));\n");
         push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);\n");
         if (IndexGetterReturnsStrings($implClassName)) {
             $implIncludes{"KURL.h"} = 1;
@@ -2252,7 +2252,7 @@
             push(@implContent, "}\n\n");
             push(@implContent, "JSValue ${className}::nameGetter(ExecState* exec, JSValue slotBase, const Identifier& propertyName)\n");
             push(@implContent, "{\n");
-            push(@implContent, "    ${className}* thisObj = static_cast<$className*>(asObject(slotBase));\n");
+            push(@implContent, "    ${className}* thisObj = jsCast<$className*>(asObject(slotBase));\n");
             push(@implContent, "    return toJS(exec, thisObj->globalObject(), static_cast<$implClassName*>(thisObj->impl())->namedItem(identifierToAtomicString(propertyName)));\n");
             push(@implContent, "}\n\n");
         }
@@ -2272,7 +2272,7 @@
 
         push(@implContent, "bool JS${implClassName}Owner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    JS${implClassName}* js${implClassName} = static_cast<JS${implClassName}*>(handle.get().asCell());\n");
+        push(@implContent, "    JS${implClassName}* js${implClassName} = jsCast<JS${implClassName}*>(handle.get().asCell());\n");
         # All ActiveDOMObjects implement hasPendingActivity(), but not all of them
         # increment their C++ reference counts when hasPendingActivity() becomes
         # true. As a result, ActiveDOMObjects can be prematurely destroyed before
@@ -2329,7 +2329,7 @@
          $dataNode->extendedAttributes->{"ActiveDOMObject"})) {
         push(@implContent, "void JS${implClassName}Owner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    JS${implClassName}* js${implClassName} = static_cast<JS${implClassName}*>(handle.get().asCell());\n");
+        push(@implContent, "    JS${implClassName}* js${implClassName} = jsCast<JS${implClassName}*>(handle.get().asCell());\n");
         push(@implContent, "    DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);\n");
         push(@implContent, "    uncacheWrapper(world, js${implClassName}->impl(), js${implClassName});\n");
         push(@implContent, "    js${implClassName}->releaseImpl();\n");
@@ -2350,7 +2350,7 @@
     if ((!$hasParent or $dataNode->extendedAttributes->{"JSGenerateToNativeObject"}) and !$dataNode->extendedAttributes->{"JSCustomToNativeObject"}) {
         push(@implContent, "$implType* to${interfaceName}(JSC::JSValue value)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    return value.inherits(&${className}::s_info) ? static_cast<$className*>(asObject(value))->impl() : 0");
+        push(@implContent, "    return value.inherits(&${className}::s_info) ? jsCast<$className*>(asObject(value))->impl() : 0");
         push(@implContent, ";\n}\n");
     }
 
@@ -2373,7 +2373,7 @@
         push(@callWithArgs, "exec");
     }
     if ($codeGenerator->ExtendedAttributeContains($callWith, "ScriptExecutionContext")) {
-        push(@$outputArray, "    ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n");
+        push(@$outputArray, "    ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();\n");
         push(@$outputArray, "    if (!scriptContext)\n");
         push(@$outputArray, "        return" . ($returnValue ? " " . $returnValue : "") . ";\n");
         push(@callWithArgs, "scriptContext");
@@ -3081,7 +3081,7 @@
     if ($globalObject) {
         return "toJS(exec, $globalObject, WTF::getPtr($value))";
     } else {
-        return "toJS(exec, static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), WTF::getPtr($value))";
+        return "toJS(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), WTF::getPtr($value))";
     }
 }
 
@@ -3483,12 +3483,12 @@
 
         push(@$outputArray, "bool ${constructorClassName}::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
         push(@$outputArray, "{\n");
-        push(@$outputArray, "    return getStatic${kind}Slot<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, static_cast<${constructorClassName}*>(cell), propertyName, slot);\n");
+        push(@$outputArray, "    return getStatic${kind}Slot<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, jsCast<${constructorClassName}*>(cell), propertyName, slot);\n");
         push(@$outputArray, "}\n\n");
 
         push(@$outputArray, "bool ${constructorClassName}::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)\n");
         push(@$outputArray, "{\n");
-        push(@$outputArray, "    return getStatic${kind}Descriptor<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, static_cast<${constructorClassName}*>(object), propertyName, descriptor);\n");
+        push(@$outputArray, "    return getStatic${kind}Descriptor<${constructorClassName}, JSDOMWrapper>(exec, &${constructorClassName}Table, jsCast<${constructorClassName}*>(object), propertyName, descriptor);\n");
         push(@$outputArray, "}\n\n");
     }
 
@@ -3500,7 +3500,7 @@
             push(@$outputArray, <<END);
 EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)
 {
-    ${constructorClassName}* jsConstructor = static_cast<${constructorClassName}*>(exec->callee());
+    ${constructorClassName}* jsConstructor = jsCast<${constructorClassName}*>(exec->callee());
 
     ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
     if (!executionContext)
@@ -3561,7 +3561,7 @@
             push(@$outputArray, "EncodedJSValue JSC_HOST_CALL ${constructorClassName}::construct${className}(ExecState* exec)\n");
             push(@$outputArray, "{\n");
 
-            push(@$outputArray, "    ${constructorClassName}* castedThis = static_cast<${constructorClassName}*>(exec->callee());\n");
+            push(@$outputArray, "    ${constructorClassName}* castedThis = jsCast<${constructorClassName}*>(exec->callee());\n");
 
             my $function = $dataNode->constructor;
             my @constructorArgList;