JavaScriptCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Oct 2008 16:58:58 +0000 (16:58 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 19 Oct 2008 16:58:58 +0000 (16:58 +0000)
2008-10-18  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Tweak a little more to get closer to where we can make JSValuePtr a class.

        * API/APICast.h:
        (toJS): Change back to JSValue* here, since we're converting the
        pointer type.
        * VM/CTI.cpp:
        (JSC::CTI::unlinkCall): Call asPointer.
        * VM/CTI.h: Cast to JSValue* here, since it's a pointer cast.
        * kjs/DebuggerCallFrame.h:
        (JSC::DebuggerCallFrame::DebuggerCallFrame): Call noValue.
        * kjs/JSGlobalData.cpp:
        (JSC::JSGlobalData::JSGlobalData): Call noValue.
        * kjs/JSImmediate.cpp:
        (JSC::JSImmediate::toObject): Remove unneeded const_cast.
        * kjs/JSWrapperObject.h:
        (JSC::JSWrapperObject::JSWrapperObject): Call noValue.

JavaScriptGlue:

2008-10-18  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Tweak a little more to get closer to where we can make JSValuePtr a class.

        * JSObject.cpp:
        (nativeCallFunction): Call asObject.

        * JSUtils.cpp:
        (KJSValueToJSObject): Use JSValuePtr and asObject.
        (JSObjectKJSValue): Ditto.
        (KJSValueToCFTypeInternal): Ditto.
        (KJSValueToCFType): Ditto.
        * JSUtils.h: Ditto.

        * UserObjectImp.cpp:
        (UserObjectImp::callAsFunction): Use JSValuePtr and asObject.
        (UserObjectImp::userObjectGetter): Ditto.
        (UserObjectImp::getOwnPropertySlot): Ditto.
        (UserObjectImp::put): Ditto.
        (UserObjectImp::toPrimitive): Ditto.
        * UserObjectImp.h: Ditto.

WebCore:

2008-10-18  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Tweak a little more to get closer to where we can make JSValuePtr a class.

        * bindings/js/JSAudioConstructor.cpp:
        (WebCore::JSAudioConstructor::JSAudioConstructor): Use asObject.
        (WebCore::constructAudio): Ditto.
        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
        (WebCore::JSCSSStyleDeclaration::nameGetter): Ditto.

        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
        (WebCore::toHTMLCanvasStyle): Use asString and asObject.
        (WebCore::JSCanvasRenderingContext2D::setFillColor): Ditto.
        (WebCore::JSCanvasRenderingContext2D::setStrokeColor): Ditto.
        (WebCore::JSCanvasRenderingContext2D::drawImage): Ditto.
        (WebCore::JSCanvasRenderingContext2D::drawImageFromRect): Ditto.
        (WebCore::JSCanvasRenderingContext2D::setShadow): Ditto.
        (WebCore::JSCanvasRenderingContext2D::createPattern): Ditto.

        * bindings/js/JSCustomSQLTransactionErrorCallback.cpp:
        (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent): Use JSValuePtr.

        * bindings/js/JSDOMBinding.cpp:
        (WebCore::setDOMException): Use noValue.

        * bindings/js/JSDOMBinding.h:
        (WebCore::getDOMPrototype): Use asObject.

        * bindings/js/JSDOMWindowBase.cpp:
        (WebCore::showModalDialog): Use noValue.
        (jsDOMWindowBaseEvent): Use asObject.
        (jsDOMWindowBaseImage): Ditto.
        (jsDOMWindowBaseMessageChannel): Ditto.
        (jsDOMWindowBaseOption): Ditto.
        (jsDOMWindowBaseXMLHttpRequest): Ditto.
        (jsDOMWindowBaseAudio): Ditto.
        (jsDOMWindowBaseXSLTProcessor): Ditto.
        (WebCore::JSDOMWindowBase::childFrameGetter): Ditto.
        (WebCore::JSDOMWindowBase::indexGetter): Ditto.
        (WebCore::JSDOMWindowBase::namedItemGetter): Ditto.
        (WebCore::JSDOMWindowBase::getOwnPropertySlot): Ditto.
        (WebCore::JSDOMWindowBase::findJSEventListener): Ditto.
        (WebCore::JSDOMWindowBase::findOrCreateJSEventListener): Ditto.
        (WebCore::JSDOMWindowBase::findJSUnprotectedEventListener): Ditto.
        (WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener): Ditto.
        (windowProtoFuncOpen): Use noValue.
        (WebCore::toJSDOMWindow): Use asObject.

        * bindings/js/JSDOMWindowCustom.cpp:
        (WebCore::setTimeoutOrInterval): Use asString.
        (WebCore::toDOMWindow): Use asObject.

        * bindings/js/JSEventListener.cpp:
        (WebCore::JSAbstractEventListener::handleEvent): Use noValue.
        (WebCore::JSLazyEventListener::parseCode): Use asObject.

        * bindings/js/JSHTMLCollectionCustom.cpp:
        (WebCore::JSHTMLCollection::nameGetter): Use asObject.
        * bindings/js/JSHTMLDocumentCustom.cpp:
        (WebCore::JSHTMLDocument::nameGetter): Ditto.
        * bindings/js/JSHTMLElementCustom.cpp:
        (WebCore::JSHTMLElement::pushEventHandlerScope): Ditto.
        * bindings/js/JSHTMLFormElementCustom.cpp:
        (WebCore::JSHTMLFormElement::nameGetter): Ditto.
        * bindings/js/JSHTMLFrameSetElementCustom.cpp:
        (WebCore::JSHTMLFrameSetElement::nameGetter): Ditto.
        * bindings/js/JSHTMLOptionElementConstructor.cpp:
        (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor): Ditto.
        (WebCore::constructHTMLOptionElement): Ditto.
        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
        (WebCore::JSHTMLOptionsCollection::remove): Ditto.
        * bindings/js/JSImageConstructor.cpp:
        (WebCore::JSImageConstructor::JSImageConstructor): Ditto.
        (WebCore::constructImage): Ditto.
        * bindings/js/JSInspectedObjectWrapper.cpp:
        (WebCore::JSInspectedObjectWrapper::wrap): Ditto.
        * bindings/js/JSInspectorCallbackWrapper.cpp:
        (WebCore::JSInspectorCallbackWrapper::wrap): Ditto.

        * bindings/js/JSJavaScriptCallFrameCustom.cpp:
        (WebCore::JSJavaScriptCallFrame::evaluate): Use noValue.

        * bindings/js/JSMessageChannelConstructor.cpp:
        (WebCore::JSMessageChannelConstructor::JSMessageChannelConstructor): Use asObject.
        (WebCore::JSMessageChannelConstructor::construct): Ditto.
        * bindings/js/JSMimeTypeArrayCustom.cpp:
        (WebCore::JSMimeTypeArray::nameGetter): Ditto.
        * bindings/js/JSNamedNodeMapCustom.cpp:
        (WebCore::JSNamedNodeMap::nameGetter): Ditto.
        * bindings/js/JSNamedNodesCollection.cpp:
        (WebCore::JSNamedNodesCollection::lengthGetter): Ditto.
        (WebCore::JSNamedNodesCollection::indexGetter): Ditto.
        * bindings/js/JSNodeFilterCustom.cpp:
        (WebCore::toNodeFilter): Ditto.
        * bindings/js/JSNodeListCustom.cpp:
        (WebCore::JSNodeList::nameGetter): Ditto.
        * bindings/js/JSPluginArrayCustom.cpp:
        (WebCore::JSPluginArray::nameGetter): Ditto.
        * bindings/js/JSPluginCustom.cpp:
        (WebCore::JSPlugin::nameGetter): Ditto.
        * bindings/js/JSPluginElementFunctions.cpp:
        (WebCore::runtimeObjectGetter): Ditto.
        (WebCore::runtimeObjectPropertyGetter): Ditto.
        * bindings/js/JSQuarantinedObjectWrapper.cpp:
        (WebCore::JSQuarantinedObjectWrapper::asWrapper): Ditto.
        (WebCore::JSQuarantinedObjectWrapper::getOwnPropertySlot): Ditto.
        (WebCore::JSQuarantinedObjectWrapper::construct): Ditto.
        * bindings/js/JSRGBColor.cpp:
        (jsRGBColorRed): Ditto.
        (jsRGBColorGreen): Ditto.
        (jsRGBColorBlue): Ditto.

        * bindings/js/JSSQLResultSetRowListCustom.cpp:
        (WebCore::JSSQLResultSetRowList::item): Use noValue.

        * bindings/js/JSStorageCustom.cpp:
        (WebCore::JSStorage::nameGetter): Use asObject.
        (WebCore::JSStorage::deleteProperty): Ditto.
        (WebCore::JSStorage::customPut): Ditto.
        * bindings/js/JSStyleSheetListCustom.cpp:
        (WebCore::JSStyleSheetList::nameGetter): Ditto.
        * bindings/js/JSXMLHttpRequestConstructor.cpp:
        (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor): Ditto.
        * bindings/js/JSXSLTProcessorCustom.cpp:
        (WebCore::JSXSLTProcessor::importStylesheet): Ditto.
        (WebCore::JSXSLTProcessor::transformToFragment): Ditto.
        (WebCore::JSXSLTProcessor::transformToDocument): Ditto.

        * bindings/js/ScriptController.cpp:
        (WebCore::ScriptController::evaluate): Use noValue.
        * bindings/objc/DOMInternal.mm:
        (-[WebScriptObject _initializeScriptDOMNodeImp]): Ditto.

        * bindings/objc/WebScriptObject.mm:
        (-[WebScriptObject evaluateWebScript:]): Use JSValuePtr.
        (-[WebScriptObject valueForKey:]): Ditto.
        (-[WebScriptObject webScriptValueAtIndex:]): Ditto.
        (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
        Use asObject and asString.

        * bindings/scripts/CodeGeneratorJS.pm: Use asObject.

        * bridge/c/c_instance.h: Use JSValuePtr.
        * bridge/c/c_runtime.cpp:
        (JSC::Bindings::CField::setValueToInstance): Ditto.

        * bridge/c/c_utility.cpp:
        (JSC::Bindings::convertValueToNPVariant): Use asObject.

        * bridge/jni/jni_instance.cpp:
        (JavaInstance::booleanValue): Use JSValuePtr.
        (JavaInstance::invokeMethod): Ditto. And noValue.
        * bridge/jni/jni_jsobject.mm:
        (JavaJSObject::getSlot): Ditto.
        (JavaJSObject::convertValueToJObject): Ditto.
        * bridge/jni/jni_runtime.cpp:
        (JavaField::dispatchValueFromInstance): Ditto.
        (JavaField::valueFromInstance): Ditto.
        (JavaField::dispatchSetValueToInstance): Ditto.
        (JavaField::setValueToInstance): Ditto.
        (JavaArray::setValueAt): Ditto.
        (JavaArray::valueAt): Ditto.
        * bridge/jni/jni_runtime.h: Ditto.

        * bridge/jni/jni_utility.cpp:
        (JSC::Bindings::convertArrayInstanceToJavaArray): Take a JSArray*
        instead of a JSValue*.
        (JSC::Bindings::convertValueToJValue): Use asObject and asArray.

        * bridge/objc/objc_class.h: Use JSValuePtr.
        * bridge/objc/objc_instance.h: Ditto.
        * bridge/objc/objc_runtime.h: Ditto.

        * bridge/objc/objc_runtime.mm:
        (JSC::Bindings::callObjCFallbackObject): Use asObject.

        * bridge/objc/objc_utility.h: Use JSValuePtr.
        * bridge/objc/objc_utility.mm:
        (JSC::Bindings::convertValueToObjcValue): Use JSValuePtr and asObject.
        (JSC::Bindings::convertObjcValueToValue): Use jsUndefined() instead of 0.

        * bridge/runtime.cpp:
        (JSC::Bindings::Instance::getValueOfField): Use JSValuePtr.
        (JSC::Bindings::Instance::setValueOfField): Ditto.

        * bridge/runtime_array.cpp:
        (JSC::RuntimeArray::lengthGetter): Use JSValuePtr and asObject.
        (JSC::RuntimeArray::indexGetter): Ditto.
        * bridge/runtime_array.h: Ditto.
        * bridge/runtime_method.cpp:
        (JSC::RuntimeMethod::lengthGetter): Ditto.
        (JSC::callRuntimeMethod): Ditto.
        * bridge/runtime_object.cpp:
        (JSC::RuntimeObjectImp::fallbackObjectGetter): Ditto.
        (JSC::RuntimeObjectImp::fieldGetter): Ditto.
        (JSC::RuntimeObjectImp::methodGetter): Ditto.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::executeScript): Use noValue.

        * page/Console.cpp:
        (WebCore::Console::trace): Use asInternalFunction.

WebKit/mac:

2008-10-18  Darin Adler  <darin@apple.com>

        Reviewed by Oliver Hunt.

        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
          improve performance by eliminating JSValue as a base class for JSCell

        Tweak a little more to get closer to where we can make JSValuePtr a class.

        * WebView/WebScriptDebugDelegate.mm:
        (-[WebScriptCallFrame _convertValueToObjcValue:]): Use JSValuePtr.
        (-[WebScriptCallFrame exception]): Ditto.
        (-[WebScriptCallFrame evaluateWebScript:]): Ditto. And noValue.
        * WebView/WebScriptDebugger.mm:
        (WebScriptDebugger::WebScriptDebugger): Use new DebuggerCallFrame
        constructor that doesn't require explicitly passing an exception.
        * WebView/WebView.mm:
        (aeDescFromJSValue): Use JSValuePtr.
        (-[WebView aeDescByEvaluatingJavaScriptFromString:]): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37705 268f45cc-cd09-0410-ab3c-d52691b4dbfc

80 files changed:
JavaScriptCore/API/APICast.h
JavaScriptCore/ChangeLog
JavaScriptCore/VM/CTI.cpp
JavaScriptCore/VM/CTI.h
JavaScriptCore/kjs/DebuggerCallFrame.h
JavaScriptCore/kjs/JSGlobalData.cpp
JavaScriptCore/kjs/JSImmediate.cpp
JavaScriptCore/kjs/JSWrapperObject.h
JavaScriptGlue/ChangeLog
JavaScriptGlue/JSObject.cpp
JavaScriptGlue/JSUtils.cpp
JavaScriptGlue/JSUtils.h
JavaScriptGlue/UserObjectImp.cpp
JavaScriptGlue/UserObjectImp.h
WebCore/ChangeLog
WebCore/bindings/js/JSAudioConstructor.cpp
WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp
WebCore/bindings/js/JSCustomSQLTransactionErrorCallback.cpp
WebCore/bindings/js/JSDOMBinding.cpp
WebCore/bindings/js/JSDOMBinding.h
WebCore/bindings/js/JSDOMWindowBase.cpp
WebCore/bindings/js/JSDOMWindowCustom.cpp
WebCore/bindings/js/JSEventListener.cpp
WebCore/bindings/js/JSHTMLCollectionCustom.cpp
WebCore/bindings/js/JSHTMLDocumentCustom.cpp
WebCore/bindings/js/JSHTMLElementCustom.cpp
WebCore/bindings/js/JSHTMLFormElementCustom.cpp
WebCore/bindings/js/JSHTMLFrameSetElementCustom.cpp
WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp
WebCore/bindings/js/JSHTMLOptionsCollectionCustom.cpp
WebCore/bindings/js/JSImageConstructor.cpp
WebCore/bindings/js/JSInspectedObjectWrapper.cpp
WebCore/bindings/js/JSInspectorCallbackWrapper.cpp
WebCore/bindings/js/JSJavaScriptCallFrameCustom.cpp
WebCore/bindings/js/JSMessageChannelConstructor.cpp
WebCore/bindings/js/JSMimeTypeArrayCustom.cpp
WebCore/bindings/js/JSNamedNodeMapCustom.cpp
WebCore/bindings/js/JSNamedNodesCollection.cpp
WebCore/bindings/js/JSNodeFilterCustom.cpp
WebCore/bindings/js/JSNodeListCustom.cpp
WebCore/bindings/js/JSPluginArrayCustom.cpp
WebCore/bindings/js/JSPluginCustom.cpp
WebCore/bindings/js/JSPluginElementFunctions.cpp
WebCore/bindings/js/JSQuarantinedObjectWrapper.cpp
WebCore/bindings/js/JSRGBColor.cpp
WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
WebCore/bindings/js/JSStorageCustom.cpp
WebCore/bindings/js/JSStyleSheetListCustom.cpp
WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp
WebCore/bindings/js/JSXSLTProcessorCustom.cpp
WebCore/bindings/js/ScriptController.cpp
WebCore/bindings/objc/DOMInternal.mm
WebCore/bindings/objc/WebScriptObject.mm
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bridge/c/c_instance.h
WebCore/bridge/c/c_runtime.cpp
WebCore/bridge/c/c_utility.cpp
WebCore/bridge/jni/jni_instance.cpp
WebCore/bridge/jni/jni_jsobject.mm
WebCore/bridge/jni/jni_runtime.cpp
WebCore/bridge/jni/jni_runtime.h
WebCore/bridge/jni/jni_utility.cpp
WebCore/bridge/objc/objc_class.h
WebCore/bridge/objc/objc_instance.h
WebCore/bridge/objc/objc_runtime.h
WebCore/bridge/objc/objc_runtime.mm
WebCore/bridge/objc/objc_utility.h
WebCore/bridge/objc/objc_utility.mm
WebCore/bridge/runtime.cpp
WebCore/bridge/runtime_array.cpp
WebCore/bridge/runtime_array.h
WebCore/bridge/runtime_method.cpp
WebCore/bridge/runtime_object.cpp
WebCore/loader/FrameLoader.cpp
WebCore/page/Console.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebView/WebScriptDebugDelegate.mm
WebKit/mac/WebView/WebScriptDebugger.mm
WebKit/mac/WebView/WebView.mm

index c0cf76e..b38b0b0 100644 (file)
@@ -50,7 +50,7 @@ inline JSC::ExecState* toJS(JSGlobalContextRef c)
 
 inline JSC::JSValuePtr toJS(JSValueRef v)
 {
-    return reinterpret_cast<JSC::JSValuePtr>(const_cast<OpaqueJSValue*>(v));
+    return reinterpret_cast<JSC::JSValue*>(const_cast<OpaqueJSValue*>(v));
 }
 
 inline JSC::JSObject* toJS(JSObjectRef o)
index 01fe7f3..be32146 100644 (file)
@@ -1,5 +1,29 @@
 2008-10-18  Darin Adler  <darin@apple.com>
 
+        Reviewed by Oliver Hunt.
+
+        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+          improve performance by eliminating JSValue as a base class for JSCell
+
+        Tweak a little more to get closer to where we can make JSValuePtr a class.
+
+        * API/APICast.h:
+        (toJS): Change back to JSValue* here, since we're converting the
+        pointer type.
+        * VM/CTI.cpp:
+        (JSC::CTI::unlinkCall): Call asPointer.
+        * VM/CTI.h: Cast to JSValue* here, since it's a pointer cast.
+        * kjs/DebuggerCallFrame.h:
+        (JSC::DebuggerCallFrame::DebuggerCallFrame): Call noValue.
+        * kjs/JSGlobalData.cpp:
+        (JSC::JSGlobalData::JSGlobalData): Call noValue.
+        * kjs/JSImmediate.cpp:
+        (JSC::JSImmediate::toObject): Remove unneeded const_cast.
+        * kjs/JSWrapperObject.h:
+        (JSC::JSWrapperObject::JSWrapperObject): Call noValue.
+
+2008-10-18  Darin Adler  <darin@apple.com>
+
         - fix non-all-in-one build
 
         * kjs/completion.h:
index e75131a..58ac42d 100644 (file)
@@ -3098,7 +3098,7 @@ void CTI::unlinkCall(StructureStubInfo* structureStubInfo)
     // When the JSFunction is deleted the pointer embedded in the instruction stream will no longer be valid
     // (and, if a new JSFunction happened to be constructed at the same location, we could get a false positive
     // match).  Reset the check so it no longer matches.
-    reinterpret_cast<void**>(structureStubInfo->hotPathBegin)[-1] = JSImmediate::impossibleValue();
+    reinterpret_cast<void**>(structureStubInfo->hotPathBegin)[-1] = asPointer(JSImmediate::impossibleValue());
 }
 
 void CTI::linkCall(CodeBlock* callerCodeBlock, JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, void* returnAddress, int callerArgCount)
index 1ee5a92..f6f83e1 100644 (file)
 
 #define ARG_setCallFrame(newCallFrame) (ARGS[CTI_ARGS_callFrame] = (newCallFrame))
 
-#define ARG_src1 static_cast<JSValuePtr>(ARGS[1])
-#define ARG_src2 static_cast<JSValuePtr>(ARGS[2])
-#define ARG_src3 static_cast<JSValuePtr>(ARGS[3])
-#define ARG_src4 static_cast<JSValuePtr>(ARGS[4])
-#define ARG_src5 static_cast<JSValuePtr>(ARGS[5])
+#define ARG_src1 static_cast<JSValue*>(ARGS[1])
+#define ARG_src2 static_cast<JSValue*>(ARGS[2])
+#define ARG_src3 static_cast<JSValue*>(ARGS[3])
+#define ARG_src4 static_cast<JSValue*>(ARGS[4])
+#define ARG_src5 static_cast<JSValue*>(ARGS[5])
 #define ARG_id1 static_cast<Identifier*>(ARGS[1])
 #define ARG_id2 static_cast<Identifier*>(ARGS[2])
 #define ARG_id3 static_cast<Identifier*>(ARGS[3])
index a9e5b5c..b384e44 100644 (file)
@@ -39,7 +39,7 @@ namespace JSC {
 
         DebuggerCallFrame(CallFrame* callFrame)
             : m_callFrame(callFrame)
-            , m_exception(0)
+            , m_exception(noValue())
         {
         }
 
index 45a2f4b..e943f9e 100644 (file)
@@ -60,7 +60,7 @@ extern const HashTable stringTable;
 
 JSGlobalData::JSGlobalData(bool isShared)
     : machine(new Machine)
-    , exception(0)
+    , exception(noValue())
     , arrayTable(new HashTable(JSC::arrayTable))
     , dateTable(new HashTable(JSC::dateTable))
     , mathTable(new HashTable(JSC::mathTable))
index 68eee5d..471205d 100644 (file)
@@ -36,9 +36,9 @@ JSObject* JSImmediate::toObject(JSValuePtr v, ExecState* exec)
 {
     ASSERT(isImmediate(v));
     if (isNumber(v))
-        return constructNumberFromImmediateNumber(exec, const_cast<JSValuePtr>(v));
+        return constructNumberFromImmediateNumber(exec, v);
     if (isBoolean(v))
-        return constructBooleanFromImmediateBoolean(exec, const_cast<JSValuePtr>(v));
+        return constructBooleanFromImmediateBoolean(exec, v);
     
     JSNotAnObjectErrorStub* exception = createNotAnObjectErrorStub(exec, v->isNull());
     exec->setException(exception);
index 0952fbf..42dc3a0 100644 (file)
@@ -43,7 +43,7 @@ namespace JSC {
     
     inline JSWrapperObject::JSWrapperObject(PassRefPtr<StructureID> structure)
         : JSObject(structure)
-        , m_internalValue(0)
+        , m_internalValue(noValue())
     {
     }
     
index 7d4adb6..c8606c7 100644 (file)
@@ -1,5 +1,32 @@
 2008-10-18  Darin Adler  <darin@apple.com>
 
+        Reviewed by Oliver Hunt.
+
+        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+          improve performance by eliminating JSValue as a base class for JSCell
+
+        Tweak a little more to get closer to where we can make JSValuePtr a class.
+
+        * JSObject.cpp:
+        (nativeCallFunction): Call asObject.
+
+        * JSUtils.cpp:
+        (KJSValueToJSObject): Use JSValuePtr and asObject.
+        (JSObjectKJSValue): Ditto.
+        (KJSValueToCFTypeInternal): Ditto.
+        (KJSValueToCFType): Ditto.
+        * JSUtils.h: Ditto.
+
+        * UserObjectImp.cpp:
+        (UserObjectImp::callAsFunction): Use JSValuePtr and asObject.
+        (UserObjectImp::userObjectGetter): Ditto.
+        (UserObjectImp::getOwnPropertySlot): Ditto.
+        (UserObjectImp::put): Ditto.
+        (UserObjectImp::toPrimitive): Ditto.
+        * UserObjectImp.h: Ditto.
+
+2008-10-18  Darin Adler  <darin@apple.com>
+
         Reviewed by Cameron Zwarich.
 
         - next step on https://bugs.webkit.org/show_bug.cgi?id=21732
index ed8a648..ba970a5 100644 (file)
@@ -75,7 +75,7 @@ void JSUserObject::SetProperty(CFStringRef propertyName, JSUserObject* value)
 
 static JSValuePtr  nativeCallFunction(ExecState* exec, JSObject* functionObject, JSValuePtr  thisValue, const ArgList& args)
 {
-    return static_cast<UserObjectImp*>(functionObject)->callAsFunction(exec, static_cast<JSObject*>(thisValue), args);
+    return static_cast<UserObjectImp*>(functionObject)->callAsFunction(exec, asObject(thisValue), args);
 }
 
 CallType JSUserObject::getCallData(CallData& callData)
index 59b6ca0..5845892 100644 (file)
@@ -43,7 +43,7 @@ struct ObjectImpList {
     CFTypeRef data;
 };
 
-static CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpList* inImps);
+static CFTypeRef KJSValueToCFTypeInternal(JSValuePtr inValue, ExecState *exec, ObjectImpList* inImps);
 
 
 //--------------------------------------------------------------------------
@@ -100,12 +100,12 @@ CFStringRef IdentifierToCFString(const Identifier& inIdentifier)
 //--------------------------------------------------------------------------
 // KJSValueToJSObject
 //--------------------------------------------------------------------------
-JSUserObject* KJSValueToJSObject(JSValue *inValue, ExecState *exec)
+JSUserObject* KJSValueToJSObject(JSValuePtr inValue, ExecState *exec)
 {
     JSUserObject* result = 0;
 
     if (inValue->isObject(&UserObjectImp::info)) {
-        UserObjectImp* userObjectImp = static_cast<UserObjectImp *>(inValue);
+        UserObjectImp* userObjectImp = static_cast<UserObjectImp *>(asObject(inValue));
         result = userObjectImp->GetJSUserObject();
         if (result)
             result->Retain();
@@ -126,11 +126,11 @@ JSUserObject* KJSValueToJSObject(JSValue *inValue, ExecState *exec)
 //--------------------------------------------------------------------------
 // JSObjectKJSValue
 //--------------------------------------------------------------------------
-JSValue *JSObjectKJSValue(JSUserObject* ptr)
+JSValuePtr JSObjectKJSValue(JSUserObject* ptr)
 {
     JSLock lock(true);
 
-    JSValue *result = jsUndefined();
+    JSValuePtr result = jsUndefined();
     if (ptr)
     {
         bool handled = false;
@@ -196,7 +196,7 @@ JSValue *JSObjectKJSValue(JSUserObject* ptr)
 // KJSValueToCFTypeInternal
 //--------------------------------------------------------------------------
 // Caller is responsible for releasing the returned CFTypeRef
-CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpList* inImps)
+CFTypeRef KJSValueToCFTypeInternal(JSValuePtr inValue, ExecState *exec, ObjectImpList* inImps)
 {
     if (!inValue)
         return 0;
@@ -238,7 +238,7 @@ CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpL
         if (inValue->isObject())
             {
                             if (inValue->isObject(&UserObjectImp::info)) {
-                                UserObjectImp* userObjectImp = static_cast<UserObjectImp *>(inValue);
+                                UserObjectImp* userObjectImp = static_cast<UserObjectImp *>(asObject(inValue));
                     JSUserObject* ptr = userObjectImp->GetJSUserObject();
                     if (ptr)
                     {
@@ -358,7 +358,7 @@ CFTypeRef KJSValueToCFTypeInternal(JSValue *inValue, ExecState *exec, ObjectImpL
     return 0;
 }
 
-CFTypeRef KJSValueToCFType(JSValue *inValue, ExecState *exec)
+CFTypeRef KJSValueToCFType(JSValuePtr inValue, ExecState *exec)
 {
     return KJSValueToCFTypeInternal(inValue, exec, 0);
 }
index 241ca38..eb3c1f6 100644 (file)
@@ -54,9 +54,9 @@ UString CFStringToUString(CFStringRef inCFString);
 CFStringRef UStringToCFString(const UString& inUString);
 Identifier CFStringToIdentifier(CFStringRef inCFString, ExecState*);
 CFStringRef IdentifierToCFString(const Identifier& inIdentifier);
-JSUserObject *KJSValueToJSObject(JSValue *inValue, ExecState *exec);
-CFTypeRef KJSValueToCFType(JSValue *inValue, ExecState *exec);
-JSValue *JSObjectKJSValue(JSUserObject* ptr);
+JSUserObject *KJSValueToJSObject(JSValuePtr inValue, ExecState *exec);
+CFTypeRef KJSValueToCFType(JSValuePtr inValue, ExecState *exec);
+JSValuePtr JSObjectKJSValue(JSUserObject* ptr);
 CFTypeRef GetCFNull(void);
 
 inline CFTypeRef RetainCFType(CFTypeRef x) { if (x) x = CFRetain(x); return x; }
index 1849466..5176c9f 100644 (file)
@@ -56,9 +56,9 @@ CallType UserObjectImp::getCallData(CallData& callData)
     return fJSUserObject ? fJSUserObject->getCallData(callData) : CallTypeNone;
 }
 
-JSValue *UserObjectImp::callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args)
+JSValuePtr UserObjectImp::callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args)
 {
-    JSValue *result = jsUndefined();
+    JSValuePtr result = jsUndefined();
     JSUserObject* jsThisObj = KJSValueToJSObject(thisObj, exec);
     if (jsThisObj) {
         CFIndex argCount = args.size();
@@ -114,14 +114,14 @@ void UserObjectImp::getPropertyNames(ExecState *exec, PropertyNameArray& propert
 
 JSValuePtr  UserObjectImp::userObjectGetter(ExecState*, const Identifier& propertyName, const PropertySlot& slot)
 {
-    UserObjectImp *thisObj = static_cast<UserObjectImp *>(slot.slotBase());
+    UserObjectImp *thisObj = static_cast<UserObjectImp *>(asObject(slot.slotBase()));
     // getOwnPropertySlot should have guarded against a null fJSUserObject.
     assert(thisObj->fJSUserObject);
     
     CFStringRef cfPropName = IdentifierToCFString(propertyName);
     JSUserObject *jsResult = thisObj->fJSUserObject->CopyProperty(cfPropName);
     ReleaseCFType(cfPropName);
-    JSValue *result = JSObjectKJSValue(jsResult);
+    JSValuePtr result = JSObjectKJSValue(jsResult);
     jsResult->Release();
 
     return result;
@@ -140,7 +140,7 @@ bool UserObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& proper
         jsResult->Release();
         return true;
     } else {
-        JSValue *kjsValue = toPrimitive(exec);
+        JSValuePtr kjsValue = toPrimitive(exec);
         if (!kjsValue->isUndefinedOrNull()) {
             JSObject *kjsObject = kjsValue->toObject(exec);
             if (kjsObject->getPropertySlot(exec, propertyName, slot))
@@ -150,7 +150,7 @@ bool UserObjectImp::getOwnPropertySlot(ExecState *exec, const Identifier& proper
     return JSObject::getOwnPropertySlot(exec, propertyName, slot);
 }
 
-void UserObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr)
+void UserObjectImp::put(ExecState *exec, const Identifier &propertyName, JSValuePtr value, int attr)
 {
     if (!fJSUserObject)
         return;
@@ -169,9 +169,9 @@ JSUserObject* UserObjectImp::GetJSUserObject() const
     return fJSUserObject;
 }
 
-JSValue *UserObjectImp::toPrimitive(ExecState *exec, JSType) const
+JSValuePtr UserObjectImp::toPrimitive(ExecState *exec, JSType) const
 {
-    JSValue *result = jsUndefined();
+    JSValuePtr result = jsUndefined();
     JSUserObject* jsObjPtr = KJSValueToJSObject(toObject(exec), exec);
     CFTypeRef cfValue = jsObjPtr ? jsObjPtr->CopyCFValue() : 0;
     if (cfValue) {
index 4c80dfa..aa348ed 100644 (file)
@@ -47,9 +47,9 @@ public:
 
     virtual void getPropertyNames(ExecState*, PropertyNameArray&);
 
-    virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args);
+    virtual JSValuePtr callAsFunction(ExecState *exec, JSObject *thisObj, const ArgList &args);
     virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
-    virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
+    virtual void put(ExecState *exec, const Identifier &propertyName, JSValuePtr value, int attr = None);
 
     JSValuePtr toPrimitive(ExecState*, JSType preferredType = UnspecifiedType) const;
     virtual bool toBoolean(ExecState *exec) const;
index ef6f766..c0aa42a 100644 (file)
@@ -1,3 +1,211 @@
+2008-10-18  Darin Adler  <darin@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+          improve performance by eliminating JSValue as a base class for JSCell
+
+        Tweak a little more to get closer to where we can make JSValuePtr a class.
+
+        * bindings/js/JSAudioConstructor.cpp:
+        (WebCore::JSAudioConstructor::JSAudioConstructor): Use asObject.
+        (WebCore::constructAudio): Ditto.
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::JSCSSStyleDeclaration::nameGetter): Ditto.
+
+        * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
+        (WebCore::toHTMLCanvasStyle): Use asString and asObject.
+        (WebCore::JSCanvasRenderingContext2D::setFillColor): Ditto.
+        (WebCore::JSCanvasRenderingContext2D::setStrokeColor): Ditto.
+        (WebCore::JSCanvasRenderingContext2D::drawImage): Ditto.
+        (WebCore::JSCanvasRenderingContext2D::drawImageFromRect): Ditto.
+        (WebCore::JSCanvasRenderingContext2D::setShadow): Ditto.
+        (WebCore::JSCanvasRenderingContext2D::createPattern): Ditto.
+
+        * bindings/js/JSCustomSQLTransactionErrorCallback.cpp:
+        (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent): Use JSValuePtr.
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::setDOMException): Use noValue.
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::getDOMPrototype): Use asObject.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::showModalDialog): Use noValue.
+        (jsDOMWindowBaseEvent): Use asObject.
+        (jsDOMWindowBaseImage): Ditto.
+        (jsDOMWindowBaseMessageChannel): Ditto.
+        (jsDOMWindowBaseOption): Ditto.
+        (jsDOMWindowBaseXMLHttpRequest): Ditto.
+        (jsDOMWindowBaseAudio): Ditto.
+        (jsDOMWindowBaseXSLTProcessor): Ditto.
+        (WebCore::JSDOMWindowBase::childFrameGetter): Ditto.
+        (WebCore::JSDOMWindowBase::indexGetter): Ditto.
+        (WebCore::JSDOMWindowBase::namedItemGetter): Ditto.
+        (WebCore::JSDOMWindowBase::getOwnPropertySlot): Ditto.
+        (WebCore::JSDOMWindowBase::findJSEventListener): Ditto.
+        (WebCore::JSDOMWindowBase::findOrCreateJSEventListener): Ditto.
+        (WebCore::JSDOMWindowBase::findJSUnprotectedEventListener): Ditto.
+        (WebCore::JSDOMWindowBase::findOrCreateJSUnprotectedEventListener): Ditto.
+        (windowProtoFuncOpen): Use noValue.
+        (WebCore::toJSDOMWindow): Use asObject.
+
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::setTimeoutOrInterval): Use asString.
+        (WebCore::toDOMWindow): Use asObject.
+
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSAbstractEventListener::handleEvent): Use noValue.
+        (WebCore::JSLazyEventListener::parseCode): Use asObject.
+
+        * bindings/js/JSHTMLCollectionCustom.cpp:
+        (WebCore::JSHTMLCollection::nameGetter): Use asObject.
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::JSHTMLDocument::nameGetter): Ditto.
+        * bindings/js/JSHTMLElementCustom.cpp:
+        (WebCore::JSHTMLElement::pushEventHandlerScope): Ditto.
+        * bindings/js/JSHTMLFormElementCustom.cpp:
+        (WebCore::JSHTMLFormElement::nameGetter): Ditto.
+        * bindings/js/JSHTMLFrameSetElementCustom.cpp:
+        (WebCore::JSHTMLFrameSetElement::nameGetter): Ditto.
+        * bindings/js/JSHTMLOptionElementConstructor.cpp:
+        (WebCore::JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor): Ditto.
+        (WebCore::constructHTMLOptionElement): Ditto.
+        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+        (WebCore::JSHTMLOptionsCollection::remove): Ditto.
+        * bindings/js/JSImageConstructor.cpp:
+        (WebCore::JSImageConstructor::JSImageConstructor): Ditto.
+        (WebCore::constructImage): Ditto.
+        * bindings/js/JSInspectedObjectWrapper.cpp:
+        (WebCore::JSInspectedObjectWrapper::wrap): Ditto.
+        * bindings/js/JSInspectorCallbackWrapper.cpp:
+        (WebCore::JSInspectorCallbackWrapper::wrap): Ditto.
+
+        * bindings/js/JSJavaScriptCallFrameCustom.cpp:
+        (WebCore::JSJavaScriptCallFrame::evaluate): Use noValue.
+
+        * bindings/js/JSMessageChannelConstructor.cpp:
+        (WebCore::JSMessageChannelConstructor::JSMessageChannelConstructor): Use asObject.
+        (WebCore::JSMessageChannelConstructor::construct): Ditto.
+        * bindings/js/JSMimeTypeArrayCustom.cpp:
+        (WebCore::JSMimeTypeArray::nameGetter): Ditto.
+        * bindings/js/JSNamedNodeMapCustom.cpp:
+        (WebCore::JSNamedNodeMap::nameGetter): Ditto.
+        * bindings/js/JSNamedNodesCollection.cpp:
+        (WebCore::JSNamedNodesCollection::lengthGetter): Ditto.
+        (WebCore::JSNamedNodesCollection::indexGetter): Ditto.
+        * bindings/js/JSNodeFilterCustom.cpp:
+        (WebCore::toNodeFilter): Ditto.
+        * bindings/js/JSNodeListCustom.cpp:
+        (WebCore::JSNodeList::nameGetter): Ditto.
+        * bindings/js/JSPluginArrayCustom.cpp:
+        (WebCore::JSPluginArray::nameGetter): Ditto.
+        * bindings/js/JSPluginCustom.cpp:
+        (WebCore::JSPlugin::nameGetter): Ditto.
+        * bindings/js/JSPluginElementFunctions.cpp:
+        (WebCore::runtimeObjectGetter): Ditto.
+        (WebCore::runtimeObjectPropertyGetter): Ditto.
+        * bindings/js/JSQuarantinedObjectWrapper.cpp:
+        (WebCore::JSQuarantinedObjectWrapper::asWrapper): Ditto.
+        (WebCore::JSQuarantinedObjectWrapper::getOwnPropertySlot): Ditto.
+        (WebCore::JSQuarantinedObjectWrapper::construct): Ditto.
+        * bindings/js/JSRGBColor.cpp:
+        (jsRGBColorRed): Ditto.
+        (jsRGBColorGreen): Ditto.
+        (jsRGBColorBlue): Ditto.
+
+        * bindings/js/JSSQLResultSetRowListCustom.cpp:
+        (WebCore::JSSQLResultSetRowList::item): Use noValue.
+
+        * bindings/js/JSStorageCustom.cpp:
+        (WebCore::JSStorage::nameGetter): Use asObject.
+        (WebCore::JSStorage::deleteProperty): Ditto.
+        (WebCore::JSStorage::customPut): Ditto.
+        * bindings/js/JSStyleSheetListCustom.cpp:
+        (WebCore::JSStyleSheetList::nameGetter): Ditto.
+        * bindings/js/JSXMLHttpRequestConstructor.cpp:
+        (WebCore::JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor): Ditto.
+        * bindings/js/JSXSLTProcessorCustom.cpp:
+        (WebCore::JSXSLTProcessor::importStylesheet): Ditto.
+        (WebCore::JSXSLTProcessor::transformToFragment): Ditto.
+        (WebCore::JSXSLTProcessor::transformToDocument): Ditto.
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::evaluate): Use noValue.
+        * bindings/objc/DOMInternal.mm:
+        (-[WebScriptObject _initializeScriptDOMNodeImp]): Ditto.
+
+        * bindings/objc/WebScriptObject.mm:
+        (-[WebScriptObject evaluateWebScript:]): Use JSValuePtr.
+        (-[WebScriptObject valueForKey:]): Ditto.
+        (-[WebScriptObject webScriptValueAtIndex:]): Ditto.
+        (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
+        Use asObject and asString.
+
+        * bindings/scripts/CodeGeneratorJS.pm: Use asObject.
+
+        * bridge/c/c_instance.h: Use JSValuePtr.
+        * bridge/c/c_runtime.cpp:
+        (JSC::Bindings::CField::setValueToInstance): Ditto.
+
+        * bridge/c/c_utility.cpp:
+        (JSC::Bindings::convertValueToNPVariant): Use asObject.
+
+        * bridge/jni/jni_instance.cpp:
+        (JavaInstance::booleanValue): Use JSValuePtr.
+        (JavaInstance::invokeMethod): Ditto. And noValue.
+        * bridge/jni/jni_jsobject.mm:
+        (JavaJSObject::getSlot): Ditto.
+        (JavaJSObject::convertValueToJObject): Ditto.
+        * bridge/jni/jni_runtime.cpp:
+        (JavaField::dispatchValueFromInstance): Ditto.
+        (JavaField::valueFromInstance): Ditto.
+        (JavaField::dispatchSetValueToInstance): Ditto.
+        (JavaField::setValueToInstance): Ditto.
+        (JavaArray::setValueAt): Ditto.
+        (JavaArray::valueAt): Ditto.
+        * bridge/jni/jni_runtime.h: Ditto.
+
+        * bridge/jni/jni_utility.cpp:
+        (JSC::Bindings::convertArrayInstanceToJavaArray): Take a JSArray*
+        instead of a JSValue*.
+        (JSC::Bindings::convertValueToJValue): Use asObject and asArray.
+
+        * bridge/objc/objc_class.h: Use JSValuePtr.
+        * bridge/objc/objc_instance.h: Ditto.
+        * bridge/objc/objc_runtime.h: Ditto.
+
+        * bridge/objc/objc_runtime.mm:
+        (JSC::Bindings::callObjCFallbackObject): Use asObject.
+
+        * bridge/objc/objc_utility.h: Use JSValuePtr.
+        * bridge/objc/objc_utility.mm:
+        (JSC::Bindings::convertValueToObjcValue): Use JSValuePtr and asObject.
+        (JSC::Bindings::convertObjcValueToValue): Use jsUndefined() instead of 0.
+
+        * bridge/runtime.cpp:
+        (JSC::Bindings::Instance::getValueOfField): Use JSValuePtr.
+        (JSC::Bindings::Instance::setValueOfField): Ditto.
+
+        * bridge/runtime_array.cpp:
+        (JSC::RuntimeArray::lengthGetter): Use JSValuePtr and asObject.
+        (JSC::RuntimeArray::indexGetter): Ditto.
+        * bridge/runtime_array.h: Ditto.
+        * bridge/runtime_method.cpp:
+        (JSC::RuntimeMethod::lengthGetter): Ditto.
+        (JSC::callRuntimeMethod): Ditto.
+        * bridge/runtime_object.cpp:
+        (JSC::RuntimeObjectImp::fallbackObjectGetter): Ditto.
+        (JSC::RuntimeObjectImp::fieldGetter): Ditto.
+        (JSC::RuntimeObjectImp::methodGetter): Ditto.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::executeScript): Use noValue.
+
+        * page/Console.cpp:
+        (WebCore::Console::trace): Use asInternalFunction.
+
 2008-10-19  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Timothy Hatcher.
index 2b834d1..9746843 100644 (file)
@@ -42,7 +42,7 @@ const ClassInfo JSAudioConstructor::s_info = { "AudioConstructor", 0, 0, 0 };
 
 JSAudioConstructor::JSAudioConstructor(ExecState* exec, Document* document)
     : DOMObject(JSAudioConstructor::createStructureID(exec->lexicalGlobalObject()->objectPrototype()))
-    , m_document(static_cast<JSDocument*>(toJS(exec, document)))
+    , m_document(static_cast<JSDocument*>(asObject(toJS(exec, document))))
 {
     putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);
 }
@@ -56,7 +56,7 @@ static JSObject* constructAudio(ExecState* exec, JSObject* constructor, const Ar
         audio->setSrc(args.at(exec, 0)->toString(exec));
         audio->scheduleLoad();
     }
-    return static_cast<JSObject*>(toJS(exec, audio.release()));
+    return asObject(toJS(exec, audio.release()));
 }
 
 ConstructType JSAudioConstructor::getConstructData(ConstructData& constructData)
index 81f5b5b..15fcd49 100644 (file)
@@ -129,7 +129,7 @@ bool JSCSSStyleDeclaration::canGetItemsForName(ExecState*, CSSStyleDeclaration*,
 // but you should also be able to enumerate them.
 JSValuePtr JSCSSStyleDeclaration::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSCSSStyleDeclaration* thisObj = static_cast<JSCSSStyleDeclaration*>(slot.slotBase());
+    JSCSSStyleDeclaration* thisObj = static_cast<JSCSSStyleDeclaration*>(asObject(slot.slotBase()));
 
     // Set up pixelOrPos boolean to handle the fact that
     // pixelTop returns "CSS Top" as number value in unit pixels
index 313b1f8..ba3c388 100644 (file)
@@ -52,10 +52,10 @@ static JSValuePtr toJS(ExecState* exec, CanvasStyle* style)
 static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState* exec, JSValuePtr value)
 {
     if (value->isString())
-        return CanvasStyle::create(static_cast<JSString*>(value)->value());
+        return CanvasStyle::create(asString(value)->value());
     if (!value->isObject())
         return 0;
-    JSObject* object = static_cast<JSObject*>(value);
+    JSObject* object = asObject(value);
     if (object->inherits(&JSCanvasGradient::s_info))
         return CanvasStyle::create(static_cast<JSCanvasGradient*>(object)->impl());
     if (object->inherits(&JSCanvasPattern::s_info))
@@ -96,13 +96,13 @@ JSValuePtr JSCanvasRenderingContext2D::setFillColor(ExecState* exec, const ArgLi
     switch (args.size()) {
         case 1:
             if (args.at(exec, 0)->isString())
-                context->setFillColor(static_cast<JSString*>(args.at(exec, 0))->value());
+                context->setFillColor(asString(args.at(exec, 0))->value());
             else
                 context->setFillColor(args.at(exec, 0)->toFloat(exec));
             break;
         case 2:
             if (args.at(exec, 0)->isString())
-                context->setFillColor(static_cast<JSString*>(args.at(exec, 0))->value(), args.at(exec, 1)->toFloat(exec));
+                context->setFillColor(asString(args.at(exec, 0))->value(), args.at(exec, 1)->toFloat(exec));
             else
                 context->setFillColor(args.at(exec, 0)->toFloat(exec), args.at(exec, 1)->toFloat(exec));
             break;
@@ -133,13 +133,13 @@ JSValuePtr JSCanvasRenderingContext2D::setStrokeColor(ExecState* exec, const Arg
     switch (args.size()) {
         case 1:
             if (args.at(exec, 0)->isString())
-                context->setStrokeColor(static_cast<JSString*>(args.at(exec, 0))->value());
+                context->setStrokeColor(asString(args.at(exec, 0))->value());
             else
                 context->setStrokeColor(args.at(exec, 0)->toFloat(exec));
             break;
         case 2:
             if (args.at(exec, 0)->isString())
-                context->setStrokeColor(static_cast<JSString*>(args.at(exec, 0))->value(), args.at(exec, 1)->toFloat(exec));
+                context->setStrokeColor(asString(args.at(exec, 0))->value(), args.at(exec, 1)->toFloat(exec));
             else
                 context->setStrokeColor(args.at(exec, 0)->toFloat(exec), args.at(exec, 1)->toFloat(exec));
             break;
@@ -185,11 +185,11 @@ JSValuePtr JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList&
     JSValuePtr value = args.at(exec, 0);
     if (!value->isObject())
         return throwError(exec, TypeError);
-    JSObject* o = static_cast<JSObject*>(value);
+    JSObject* o = asObject(value);
     
     ExceptionCode ec = 0;
     if (o->inherits(&JSHTMLImageElement::s_info)) {
-        HTMLImageElement* imgElt = static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(args.at(exec, 0))->impl());
+        HTMLImageElement* imgElt = static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl());
         switch (args.size()) {
             case 3:
                 context->drawImage(imgElt, args.at(exec, 1)->toFloat(exec), args.at(exec, 2)->toFloat(exec));
@@ -210,7 +210,7 @@ JSValuePtr JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList&
                 return throwError(exec, SyntaxError);
         }
     } else if (o->inherits(&JSHTMLCanvasElement::s_info)) {
-        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(args.at(exec, 0))->impl());
+        HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(o)->impl());
         switch (args.size()) {
             case 3:
                 context->drawImage(canvas, args.at(exec, 1)->toFloat(exec), args.at(exec, 2)->toFloat(exec));
@@ -232,7 +232,6 @@ JSValuePtr JSCanvasRenderingContext2D::drawImage(ExecState* exec, const ArgList&
         }
     } else {
         setDOMException(exec, TYPE_MISMATCH_ERR);
-        return 0;
     }
     
     return jsUndefined();    
@@ -245,11 +244,11 @@ JSValuePtr JSCanvasRenderingContext2D::drawImageFromRect(ExecState* exec, const
     JSValuePtr value = args.at(exec, 0);
     if (!value->isObject())
         return throwError(exec, TypeError);
-    JSObject* o = static_cast<JSObject*>(value);
+    JSObject* o = asObject(value);
     
     if (!o->inherits(&JSHTMLImageElement::s_info))
         return throwError(exec, TypeError);
-    context->drawImageFromRect(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(args.at(exec, 0))->impl()),
+    context->drawImageFromRect(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()),
                                args.at(exec, 1)->toFloat(exec), args.at(exec, 2)->toFloat(exec),
                                args.at(exec, 3)->toFloat(exec), args.at(exec, 4)->toFloat(exec),
                                args.at(exec, 5)->toFloat(exec), args.at(exec, 6)->toFloat(exec),
@@ -270,7 +269,7 @@ JSValuePtr JSCanvasRenderingContext2D::setShadow(ExecState* exec, const ArgList&
         case 4:
             if (args.at(exec, 3)->isString())
                 context->setShadow(args.at(exec, 0)->toFloat(exec), args.at(exec, 1)->toFloat(exec),
-                                   args.at(exec, 2)->toFloat(exec), static_cast<JSString*>(args.at(exec, 3))->value());
+                                   args.at(exec, 2)->toFloat(exec), asString(args.at(exec, 3))->value());
             else
                 context->setShadow(args.at(exec, 0)->toFloat(exec), args.at(exec, 1)->toFloat(exec),
                                    args.at(exec, 2)->toFloat(exec), args.at(exec, 3)->toFloat(exec));
@@ -278,7 +277,7 @@ JSValuePtr JSCanvasRenderingContext2D::setShadow(ExecState* exec, const ArgList&
         case 5:
             if (args.at(exec, 3)->isString())
                 context->setShadow(args.at(exec, 0)->toFloat(exec), args.at(exec, 1)->toFloat(exec),
-                                   args.at(exec, 2)->toFloat(exec), static_cast<JSString*>(args.at(exec, 3))->value(),
+                                   args.at(exec, 2)->toFloat(exec), asString(args.at(exec, 3))->value(),
                                    args.at(exec, 4)->toFloat(exec));
             else
                 context->setShadow(args.at(exec, 0)->toFloat(exec), args.at(exec, 1)->toFloat(exec),
@@ -311,12 +310,12 @@ JSValuePtr JSCanvasRenderingContext2D::createPattern(ExecState* exec, const ArgL
     JSValuePtr value = args.at(exec, 0);
     if (!value->isObject())
         return throwError(exec, TypeError);
-    JSObject* o = static_cast<JSObject*>(value);
+    JSObject* o = asObject(value);
 
     if (o->inherits(&JSHTMLImageElement::s_info)) {
         ExceptionCode ec;
         JSValuePtr pattern = toJS(exec,
-            context->createPattern(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(args.at(exec, 0))->impl()),
+            context->createPattern(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(o)->impl()),
                                    valueToStringWithNullCheck(exec, args.at(exec, 1)), ec).get());
         setDOMException(exec, ec);
         return pattern;
@@ -324,13 +323,13 @@ JSValuePtr JSCanvasRenderingContext2D::createPattern(ExecState* exec, const ArgL
     if (o->inherits(&JSHTMLCanvasElement::s_info)) {
         ExceptionCode ec;
         JSValuePtr pattern = toJS(exec,
-            context->createPattern(static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(args.at(exec, 0))->impl()),
+            context->createPattern(static_cast<HTMLCanvasElement*>(static_cast<JSHTMLElement*>(o)->impl()),
                 valueToStringWithNullCheck(exec, args.at(exec, 1)), ec).get());
         setDOMException(exec, ec);
         return pattern;
     }
     setDOMException(exec, TYPE_MISMATCH_ERR);
-    return 0;
+    return jsUndefined();
 }
 
 JSValuePtr JSCanvasRenderingContext2D::putImageData(ExecState* exec, const ArgList& args)
index 6959487..dc29874 100644 (file)
@@ -77,7 +77,7 @@ bool JSCustomSQLTransactionErrorCallback::handleEvent(SQLError* error)
     ArgList args;
     args.append(toJS(exec, error));
 
-    JSValue *result;
+    JSValuePtr result;
     globalObject->startTimeoutCheck();
     result = call(exec, function, callType, callData, m_callback, args);
     globalObject->stopTimeoutCheck();
index 728b1cc..1a85a7c 100644 (file)
@@ -378,7 +378,7 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
     ExceptionCodeDescription description;
     getExceptionCodeDescription(ec, description);
 
-    JSValuePtr errorObject = 0;
+    JSValuePtr errorObject = noValue();
     switch (description.type) {
         case DOMExceptionType:
             errorObject = toJS(exec, DOMCoreException::create(description));
index e0bfda9..c3f32e1 100644 (file)
@@ -85,7 +85,7 @@ namespace WebCore {
     }
     template<class WrapperClass> inline JSC::JSObject* getDOMPrototype(JSC::ExecState* exec)
     {
-        return static_cast<JSC::JSObject*>(getDOMStructure<WrapperClass>(exec)->storedPrototype());
+        return static_cast<JSC::JSObject*>(asObject(getDOMStructure<WrapperClass>(exec)->storedPrototype()));
     }
     template<class ConstructorClass> inline JSC::JSObject* getDOMConstructor(JSC::ExecState* exec)
     {
index bee734e..c13f5f9 100644 (file)
@@ -386,7 +386,7 @@ static JSValuePtr showModalDialog(ExecState* exec, Frame* frame, const String& u
 
     // Get the return value either just before clearing the dialog window's
     // properties (in JSDOMWindowBase::clear), or when on return from runModal.
-    JSValuePtr returnValue = 0;
+    JSValuePtr returnValue = noValue();
     dialogWindow->setReturnValueSlot(&returnValue);
     dialogFrame->page()->chrome()->runModal();
     dialogWindow->setReturnValueSlot(0);
@@ -422,49 +422,49 @@ JSValuePtr jsDOMWindowBaseCrypto(ExecState*, const Identifier&, const PropertySl
 
 JSValuePtr jsDOMWindowBaseEvent(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->currentEvent())
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->currentEvent())
         return jsUndefined();
-    return toJS(exec, static_cast<JSDOMWindowBase*>(slot.slotBase())->currentEvent());
+    return toJS(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->currentEvent());
 }
 
 JSValuePtr jsDOMWindowBaseImage(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
-    return getDOMConstructor<JSImageConstructor>(exec, static_cast<JSDOMWindowBase*>(slot.slotBase()));
+    return getDOMConstructor<JSImageConstructor>(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase())));
 }
 
 JSValuePtr jsDOMWindowBaseMessageChannel(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
-    return getDOMConstructor<JSMessageChannelConstructor>(exec, static_cast<JSDOMWindowBase*>(slot.slotBase()));
+    return getDOMConstructor<JSMessageChannelConstructor>(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase())));
 }
 
 JSValuePtr jsDOMWindowBaseOption(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
-    return getDOMConstructor<JSHTMLOptionElementConstructor>(exec, static_cast<JSDOMWindowBase*>(slot.slotBase()));
+    return getDOMConstructor<JSHTMLOptionElementConstructor>(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase())));
 }
 
 JSValuePtr jsDOMWindowBaseXMLHttpRequest(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
-    return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, static_cast<JSDOMWindowBase*>(slot.slotBase()));
+    return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase())));
 }
 
 JSValuePtr jsDOMWindowBaseAudio(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
 #if ENABLE(VIDEO)
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
     if (!MediaPlayer::isAvailable())
         return jsUndefined();
-    return getDOMConstructor<JSAudioConstructor>(exec, static_cast<JSDOMWindowBase*>(slot.slotBase()));
+    return getDOMConstructor<JSAudioConstructor>(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase())));
 #else
     return jsUndefined();
 #endif
@@ -473,7 +473,7 @@ JSValuePtr jsDOMWindowBaseAudio(ExecState* exec, const Identifier&, const Proper
 JSValuePtr jsDOMWindowBaseXSLTProcessor(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
 #if ENABLE(XSLT)
-    if (!static_cast<JSDOMWindowBase*>(slot.slotBase())->allowsAccessFrom(exec))
+    if (!static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))
         return jsUndefined();
     return getDOMConstructor<JSXSLTProcessorConstructor>(exec);
 #else
@@ -485,17 +485,17 @@ namespace WebCore {
 
 JSValuePtr JSDOMWindowBase::childFrameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    return toJS(exec, static_cast<JSDOMWindowBase*>(slot.slotBase())->impl()->frame()->tree()->child(AtomicString(propertyName))->domWindow());
+    return toJS(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->impl()->frame()->tree()->child(AtomicString(propertyName))->domWindow());
 }
 
 JSValuePtr JSDOMWindowBase::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    return toJS(exec, static_cast<JSDOMWindowBase*>(slot.slotBase())->impl()->frame()->tree()->child(slot.index())->domWindow());
+    return toJS(exec, static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()))->impl()->frame()->tree()->child(slot.index())->domWindow());
 }
 
 JSValuePtr JSDOMWindowBase::namedItemGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSDOMWindowBase* thisObj = static_cast<JSDOMWindowBase*>(slot.slotBase());
+    JSDOMWindowBase* thisObj = static_cast<JSDOMWindowBase*>(asObject(slot.slotBase()));
     Document* doc = thisObj->impl()->frame()->document();
     ASSERT(thisObj->allowsAccessFrom(exec));
     ASSERT(doc);
@@ -548,7 +548,7 @@ bool JSDOMWindowBase::getOwnPropertySlot(ExecState* exec, const Identifier& prop
     // precedence over the index and name getters.  
     JSValuePtr proto = prototype();
     if (proto->isObject()) {
-        if (static_cast<JSObject*>(proto)->getPropertySlot(exec, propertyName, slot)) {
+        if (asObject(proto)->getPropertySlot(exec, propertyName, slot)) {
             if (!allowsAccessFrom(exec))
                 slot.setUndefined();
             return true;
@@ -714,7 +714,7 @@ JSEventListener* JSDOMWindowBase::findJSEventListener(JSValuePtr val, bool attac
 {
     if (!val->isObject())
         return 0;
-    JSObject* object = static_cast<JSObject*>(val);
+    JSObject* object = asObject(val);
     ListenersMap& listeners = attachedToEventTargetNode ? d()->jsEventListenersAttachedToEventTargetNodes : d()->jsEventListeners;
     return listeners.get(object);
 }
@@ -728,7 +728,7 @@ PassRefPtr<JSEventListener> JSDOMWindowBase::findOrCreateJSEventListener(ExecSta
         return 0;
 
     // The JSEventListener constructor adds it to our jsEventListeners map.
-    return JSEventListener::create(static_cast<JSObject*>(val), static_cast<JSDOMWindow*>(this), attachedToEventTargetNode).get();
+    return JSEventListener::create(asObject(val), static_cast<JSDOMWindow*>(this), attachedToEventTargetNode).get();
 }
 
 JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(ExecState* exec, JSValuePtr val, bool attachedToEventTargetNode)
@@ -737,7 +737,7 @@ JSUnprotectedEventListener* JSDOMWindowBase::findJSUnprotectedEventListener(Exec
         return 0;
 
     UnprotectedListenersMap& listeners = attachedToEventTargetNode ? d()->jsUnprotectedEventListenersAttachedToEventTargetNodes : d()->jsUnprotectedEventListeners;
-    return listeners.get(static_cast<JSObject*>(val));
+    return listeners.get(asObject(val));
 }
 
 PassRefPtr<JSUnprotectedEventListener> JSDOMWindowBase::findOrCreateJSUnprotectedEventListener(ExecState* exec, JSValuePtr val, bool attachedToEventTargetNode)
@@ -749,7 +749,7 @@ PassRefPtr<JSUnprotectedEventListener> JSDOMWindowBase::findOrCreateJSUnprotecte
         return 0;
 
     // The JSUnprotectedEventListener constructor adds it to our jsUnprotectedEventListeners map.
-    return JSUnprotectedEventListener::create(static_cast<JSObject*>(val), static_cast<JSDOMWindow*>(this), attachedToEventTargetNode).get();
+    return JSUnprotectedEventListener::create(asObject(val), static_cast<JSDOMWindow*>(this), attachedToEventTargetNode).get();
 }
 
 void JSDOMWindowBase::clearHelperObjectProperties()
@@ -861,7 +861,7 @@ JSValuePtr windowProtoFuncOpen(ExecState* exec, JSObject*, JSValuePtr thisValue,
     windowFeatures.height = windowRect.height();
     windowFeatures.width = windowRect.width();
 
-    frame = createWindow(exec, frame, urlString, frameName, windowFeatures, 0);
+    frame = createWindow(exec, frame, urlString, frameName, windowFeatures, noValue());
 
     if (!frame)
         return jsUndefined();
@@ -1079,11 +1079,11 @@ JSDOMWindow* toJSDOMWindow(JSValuePtr value)
 {
     if (!value->isObject())
         return 0;
-    const ClassInfo* classInfo = static_cast<JSObject*>(value)->classInfo();
+    const ClassInfo* classInfo = asObject(value)->classInfo();
     if (classInfo == &JSDOMWindow::s_info)
-        return static_cast<JSDOMWindow*>(value);
+        return static_cast<JSDOMWindow*>(asObject(value));
     if (classInfo == &JSDOMWindowShell::s_info)
-        return static_cast<JSDOMWindowShell*>(value)->window();
+        return static_cast<JSDOMWindowShell*>(asObject(value))->window();
     return 0;
 }
 
index 18aa192..1d4f4bc 100644 (file)
@@ -200,7 +200,7 @@ static JSValuePtr setTimeoutOrInterval(ExecState* exec, JSDOMWindow* window, con
     JSValuePtr v = args.at(exec, 0);
     int delay = args.at(exec, 1)->toInt32(exec);
     if (v->isString())
-        return jsNumber(exec, window->installTimeout(static_cast<JSString*>(v)->value(), delay, timeout));
+        return jsNumber(exec, window->installTimeout(asString(v)->value(), delay, timeout));
     CallData callData;
     if (v->getCallData(callData) == CallTypeNone)
         return jsUndefined();
@@ -310,12 +310,15 @@ JSValuePtr JSDOMWindow::removeEventListener(ExecState* exec, const ArgList& args
     return jsUndefined();
 }
 
-DOMWindow* toDOMWindow(JSValuePtr val)
+DOMWindow* toDOMWindow(JSValuePtr value)
 {
-    if (val->isObject(&JSDOMWindow::s_info))
-        return static_cast<JSDOMWindow*>(val)->impl();
-    if (val->isObject(&JSDOMWindowShell::s_info))
-        return static_cast<JSDOMWindowShell*>(val)->impl();
+    if (!value->isObject())
+        return 0;
+    JSObject* object = asObject(value);
+    if (object->inherits(&JSDOMWindow::s_info))
+        return static_cast<JSDOMWindow*>(object)->impl();
+    if (object->inherits(&JSDOMWindowShell::s_info))
+        return static_cast<JSDOMWindowShell*>(object)->impl();
     return 0;
 }
 
index b51a9af..7382ba3 100644 (file)
@@ -71,7 +71,7 @@ void JSAbstractEventListener::handleEvent(Event* event, bool isWindowEvent)
     CallData callData;
     CallType callType = handleEventFunction->getCallData(callData);
     if (callType == CallTypeNone) {
-        handleEventFunction = 0;
+        handleEventFunction = noValue();
         callType = listener->getCallData(callData);
     }
 
@@ -299,7 +299,7 @@ void JSLazyEventListener::parseCode() const
 
         JSValuePtr thisObj = toJS(exec, m_originalNode);
         if (thisObj->isObject()) {
-            static_cast<JSEventTargetNode*>(thisObj)->pushEventHandlerScope(exec, scope);
+            static_cast<JSEventTargetNode*>(asObject(thisObj))->pushEventHandlerScope(exec, scope);
             listenerAsFunction->setScope(scope);
         }
     }
index fbaa2f6..7ff5392 100644 (file)
@@ -104,7 +104,7 @@ bool JSHTMLCollection::canGetItemsForName(ExecState* exec, HTMLCollection* thisO
 
 JSValuePtr JSHTMLCollection::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLCollection* thisObj = static_cast<JSHTMLCollection*>(slot.slotBase());
+    JSHTMLCollection* thisObj = static_cast<JSHTMLCollection*>(asObject(slot.slotBase()));
     return getNamedItems(exec, thisObj->impl(), propertyName);
 }
 
index 20371fe..26c297d 100644 (file)
@@ -53,7 +53,7 @@ bool JSHTMLDocument::canGetItemsForName(ExecState*, HTMLDocument* document, cons
 
 JSValuePtr JSHTMLDocument::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLDocument* thisObj = static_cast<JSHTMLDocument*>(slot.slotBase());
+    JSHTMLDocument* thisObj = static_cast<JSHTMLDocument*>(asObject(slot.slotBase()));
     HTMLDocument* document = static_cast<HTMLDocument*>(thisObj->impl());
 
     String name = propertyName;
index a2bab6c..3345764 100644 (file)
@@ -38,14 +38,14 @@ void JSHTMLElement::pushEventHandlerScope(ExecState* exec, ScopeChain& scope) co
     HTMLElement* element = impl();
 
     // The document is put on first, fall back to searching it only after the element and form.
-    scope.push(static_cast<JSObject*>(toJS(exec, element->ownerDocument())));
+    scope.push(asObject(toJS(exec, element->ownerDocument())));
 
     // The form is next, searched before the document, but after the element itself.
     if (HTMLFormElement* form = element->form())
-        scope.push(static_cast<JSObject*>(toJS(exec, form)));
+        scope.push(asObject(toJS(exec, form)));
 
     // The element is on top, searched first.
-    scope.push(static_cast<JSObject*>(toJS(exec, element)));
+    scope.push(asObject(toJS(exec, element)));
 }
 
 } // namespace WebCore
index 338b99f..3face97 100644 (file)
@@ -43,7 +43,7 @@ bool JSHTMLFormElement::canGetItemsForName(ExecState* exec, HTMLFormElement* for
 
 JSValuePtr JSHTMLFormElement::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    HTMLFormElement* form = static_cast<HTMLFormElement*>(static_cast<JSHTMLElement*>(slot.slotBase())->impl());
+    HTMLFormElement* form = static_cast<HTMLFormElement*>(static_cast<JSHTMLElement*>(asObject(slot.slotBase()))->impl());
     
     Vector<RefPtr<Node> > namedItems;
     form->getNamedElements(propertyName, namedItems);
index 6a91e9f..7870af8 100644 (file)
@@ -48,7 +48,7 @@ bool JSHTMLFrameSetElement::canGetItemsForName(ExecState*, HTMLFrameSetElement*
 
 JSValuePtr JSHTMLFrameSetElement::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slot.slotBase()));
     HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl());
 
     Node* frame = element->children()->namedItem(propertyName);
index d00f923..42a5e05 100644 (file)
@@ -35,7 +35,7 @@ const ClassInfo JSHTMLOptionElementConstructor::s_info = { "OptionConstructor",
 
 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* document)
     : DOMObject(JSHTMLOptionElementConstructor::createStructureID(exec->lexicalGlobalObject()->objectPrototype()))
-    , m_document(static_cast<JSDocument*>(toJS(exec, document)))
+    , m_document(static_cast<JSDocument*>(asObject(toJS(exec, document))))
 {
     putDirect(exec->propertyNames().length, jsNumber(exec, 4), ReadOnly|DontDelete|DontEnum);
 }
@@ -66,7 +66,7 @@ static JSObject* constructHTMLOptionElement(ExecState* exec, JSObject* construct
         return 0;
     }
 
-    return static_cast<JSObject*>(toJS(exec, element.release()));
+    return asObject(toJS(exec, element.release()));
 }
 
 ConstructType JSHTMLOptionElementConstructor::getConstructData(ConstructData& constructData)
index c170241..d60483d 100644 (file)
@@ -91,7 +91,7 @@ JSValuePtr JSHTMLOptionsCollection::add(ExecState* exec, const ArgList& args)
 JSValuePtr JSHTMLOptionsCollection::remove(ExecState* exec, const ArgList& args)
 {
     HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
-    JSHTMLSelectElement* base = static_cast<JSHTMLSelectElement*>(toJS(exec, imp->base()));
+    JSHTMLSelectElement* base = static_cast<JSHTMLSelectElement*>(asObject(toJS(exec, imp->base())));
     return base->remove(exec, args);
 }
 
index 7057060..d63ad01 100644 (file)
@@ -34,7 +34,7 @@ const ClassInfo JSImageConstructor::s_info = { "ImageConstructor", 0, 0, 0 };
 
 JSImageConstructor::JSImageConstructor(ExecState* exec, Document* document)
     : DOMObject(JSImageConstructor::createStructureID(exec->lexicalGlobalObject()->objectPrototype()))
-    , m_document(static_cast<JSDocument*>(toJS(exec, document)))
+    , m_document(static_cast<JSDocument*>(asObject(toJS(exec, document))))
 {
 }
 
@@ -65,7 +65,7 @@ static JSObject* constructImage(ExecState* exec, JSObject* constructor, const Ar
         image->setWidth(width);
     if (heightSet)
         image->setHeight(height);
-    return static_cast<JSObject*>(toJS(exec, image.release()));
+    return asObject(toJS(exec, image.release()));
 }
 
 ConstructType JSImageConstructor::getConstructData(ConstructData& constructData)
index fb04fbb..5564f9a 100644 (file)
@@ -51,7 +51,7 @@ JSValuePtr JSInspectedObjectWrapper::wrap(ExecState* unwrappedExec, JSValuePtr u
     if (!unwrappedValue->isObject())
         return unwrappedValue;
 
-    JSObject* unwrappedObject = static_cast<JSObject*>(unwrappedValue);
+    JSObject* unwrappedObject = asObject(unwrappedValue);
 
     if (unwrappedObject->inherits(&JSInspectedObjectWrapper::s_info))
         return unwrappedObject;
@@ -65,7 +65,7 @@ JSValuePtr JSInspectedObjectWrapper::wrap(ExecState* unwrappedExec, JSValuePtr u
 
     if (prototype->isNull())
         return new (unwrappedExec) JSInspectedObjectWrapper(unwrappedExec, unwrappedObject, JSQuarantinedObjectWrapper::createStructureID(jsNull()));
-    return new (unwrappedExec) JSInspectedObjectWrapper(unwrappedExec, unwrappedObject, JSQuarantinedObjectWrapper::createStructureID(static_cast<JSObject*>(wrap(unwrappedExec, prototype))));
+    return new (unwrappedExec) JSInspectedObjectWrapper(unwrappedExec, unwrappedObject, JSQuarantinedObjectWrapper::createStructureID(asObject(wrap(unwrappedExec, prototype))));
 }
 
 JSInspectedObjectWrapper::JSInspectedObjectWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, PassRefPtr<StructureID> structureID)
index e873ca4..2fbcd56 100644 (file)
@@ -49,7 +49,7 @@ JSValuePtr JSInspectorCallbackWrapper::wrap(ExecState* unwrappedExec, JSValuePtr
     if (!unwrappedValue->isObject())
         return unwrappedValue;
 
-    JSObject* unwrappedObject = static_cast<JSObject*>(unwrappedValue);
+    JSObject* unwrappedObject = asObject(unwrappedValue);
 
     if (unwrappedObject->inherits(&JSInspectorCallbackWrapper::s_info))
         return unwrappedObject;
@@ -62,7 +62,7 @@ JSValuePtr JSInspectorCallbackWrapper::wrap(ExecState* unwrappedExec, JSValuePtr
 
     if (prototype->isNull())
         return new (unwrappedExec) JSInspectorCallbackWrapper(unwrappedExec, unwrappedObject, unwrappedExec->globalData().nullProtoStructureID);
-    return new (unwrappedExec) JSInspectorCallbackWrapper(unwrappedExec, unwrappedObject, static_cast<JSObject*>(wrap(unwrappedExec, prototype))->inheritorID());
+    return new (unwrappedExec) JSInspectorCallbackWrapper(unwrappedExec, unwrappedObject, asObject(wrap(unwrappedExec, prototype))->inheritorID());
 }
 
 JSInspectorCallbackWrapper::JSInspectorCallbackWrapper(ExecState* unwrappedExec, JSObject* unwrappedObject, PassRefPtr<StructureID> structureID)
index 9d24824..1b998ce 100644 (file)
@@ -35,7 +35,7 @@ namespace WebCore {
 
 JSValuePtr JSJavaScriptCallFrame::evaluate(ExecState* exec, const ArgList& args)
 {
-    JSValuePtr exception = 0;
+    JSValuePtr exception = noValue();
     JSValuePtr result = impl()->evaluate(args.at(exec, 0)->toString(exec), exception);
 
     if (exception)
index 1a87a0a..ed14fcd 100644 (file)
@@ -38,7 +38,7 @@ const ClassInfo JSMessageChannelConstructor::s_info = { "MessageChannelConstruct
 
 JSMessageChannelConstructor::JSMessageChannelConstructor(ExecState* exec, Document* document)
     : DOMObject(JSMessageChannelConstructor::createStructureID(exec->lexicalGlobalObject()->objectPrototype()))
-    , m_document(static_cast<JSDocument*>(toJS(exec, document)))
+    , m_document(static_cast<JSDocument*>(asObject(toJS(exec, document))))
 {
     putDirect(exec->propertyNames().prototype, JSMessageChannelPrototype::self(exec), None);
 }
@@ -55,7 +55,7 @@ ConstructType JSMessageChannelConstructor::getConstructData(ConstructData& const
 
 JSObject* JSMessageChannelConstructor::construct(ExecState* exec, JSObject* constructor, const ArgList&)
 {
-    return static_cast<JSObject*>(toJS(exec, MessageChannel::create(static_cast<JSMessageChannelConstructor*>(constructor)->document())));
+    return asObject(toJS(exec, MessageChannel::create(static_cast<JSMessageChannelConstructor*>(constructor)->document())));
 }
 
 void JSMessageChannelConstructor::mark()
index 128eb75..96323fa 100644 (file)
@@ -33,7 +33,7 @@ bool JSMimeTypeArray::canGetItemsForName(ExecState*, MimeTypeArray* mimeTypeArra
 
 JSValuePtr JSMimeTypeArray::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSMimeTypeArray* thisObj = static_cast<JSMimeTypeArray*>(slot.slotBase());
+    JSMimeTypeArray* thisObj = static_cast<JSMimeTypeArray*>(asObject(slot.slotBase()));
     return toJS(exec, thisObj->impl()->nameGetter(propertyName));
 }
 
index f167e5e..e7b0764 100644 (file)
@@ -43,7 +43,7 @@ bool JSNamedNodeMap::canGetItemsForName(ExecState*, NamedNodeMap* impl, const Id
 
 JSValuePtr JSNamedNodeMap::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(slot.slotBase());
+    JSNamedNodeMap* thisObj = static_cast<JSNamedNodeMap*>(asObject(slot.slotBase()));
     return toJS(exec, thisObj->impl()->getNamedItem(propertyName));
 }
 
index 5f6889a..f536646 100644 (file)
@@ -50,13 +50,13 @@ JSNamedNodesCollection::JSNamedNodesCollection(ExecState* exec, const Vector<Ref
 
 JSValuePtr JSNamedNodesCollection::lengthGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSNamedNodesCollection* thisObj = static_cast<JSNamedNodesCollection*>(slot.slotBase());
+    JSNamedNodesCollection* thisObj = static_cast<JSNamedNodesCollection*>(asObject(slot.slotBase()));
     return jsNumber(exec, thisObj->m_nodes->size());
 }
 
 JSValuePtr JSNamedNodesCollection::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSNamedNodesCollection *thisObj = static_cast<JSNamedNodesCollection*>(slot.slotBase());
+    JSNamedNodesCollection *thisObj = static_cast<JSNamedNodesCollection*>(asObject(slot.slotBase()));
     return toJS(exec, (*thisObj->m_nodes)[slot.index()].get());
 }
 
index b040d76..bca6e3a 100644 (file)
@@ -49,7 +49,7 @@ JSValuePtr JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args)
 PassRefPtr<NodeFilter> toNodeFilter(JSValuePtr value)
 {
     if (value->isObject(&JSNodeFilter::s_info))
-        return static_cast<JSNodeFilter*>(value)->impl();
+        return static_cast<JSNodeFilter*>(asObject(value))->impl();
 
     return NodeFilter::create(JSNodeFilterCondition::create(value));
 }
index da44791..a67887e 100644 (file)
@@ -58,7 +58,7 @@ bool JSNodeList::canGetItemsForName(ExecState*, NodeList* impl, const Identifier
 
 JSValuePtr JSNodeList::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSNodeList* thisObj = static_cast<JSNodeList*>(slot.slotBase());
+    JSNodeList* thisObj = static_cast<JSNodeList*>(asObject(slot.slotBase()));
     return toJS(exec, thisObj->impl()->itemWithName(propertyName));
 }
 
index d2f2e2c..55fbc51 100644 (file)
@@ -33,7 +33,7 @@ bool JSPluginArray::canGetItemsForName(ExecState*, PluginArray* pluginArray, con
 
 JSValuePtr JSPluginArray::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSPluginArray* thisObj = static_cast<JSPluginArray*>(slot.slotBase());
+    JSPluginArray* thisObj = static_cast<JSPluginArray*>(asObject(slot.slotBase()));
     return toJS(exec, thisObj->impl()->nameGetter(propertyName));
 }
 
index 87dea10..2bde2da 100644 (file)
@@ -33,7 +33,7 @@ bool JSPlugin::canGetItemsForName(ExecState*, Plugin* plugin, const Identifier&
 
 JSValuePtr JSPlugin::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSPlugin* thisObj = static_cast<JSPlugin*>(slot.slotBase());
+    JSPlugin* thisObj = static_cast<JSPlugin*>(asObject(slot.slotBase()));
     return toJS(exec, thisObj->impl()->nameGetter(propertyName));
 }
 
index dd84d17..584393b 100644 (file)
@@ -62,7 +62,7 @@ static RuntimeObjectImp* getRuntimeObject(ExecState* exec, Node* node)
 
 JSValuePtr runtimeObjectGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slot.slotBase()));
     HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl());
     RuntimeObjectImp* runtimeObject = getRuntimeObject(exec, element);
     return runtimeObject ? runtimeObject : jsUndefined();
@@ -70,7 +70,7 @@ JSValuePtr runtimeObjectGetter(ExecState* exec, const Identifier& propertyName,
 
 JSValuePtr runtimeObjectPropertyGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
+    JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(asObject(slot.slotBase()));
     HTMLElement* element = static_cast<HTMLElement*>(thisObj->impl());
     RuntimeObjectImp* runtimeObject = getRuntimeObject(exec, element);
     if (!runtimeObject)
index 94b3cf3..8e9b855 100644 (file)
@@ -41,7 +41,7 @@ JSQuarantinedObjectWrapper* JSQuarantinedObjectWrapper::asWrapper(JSValuePtr val
     if (!value->isObject())
         return 0;
 
-    JSObject* object = static_cast<JSObject*>(value);
+    JSObject* object = asObject(value);
 
     if (!object->inherits(&JSQuarantinedObjectWrapper::s_info))
         return 0;
@@ -112,7 +112,7 @@ bool JSQuarantinedObjectWrapper::getOwnPropertySlot(ExecState* exec, const Ident
     bool result = m_unwrappedObject->getOwnPropertySlot(unwrappedExecState(), identifier, unwrappedSlot);
     if (result) {
         JSValuePtr unwrappedValue = unwrappedSlot.getValue(unwrappedExecState(), identifier);
-        slot.setCustom(static_cast<JSObject*>(wrapOutgoingValue(unwrappedExecState(), unwrappedValue)), cachedValueGetter);
+        slot.setCustom(asObject(wrapOutgoingValue(unwrappedExecState(), unwrappedValue)), cachedValueGetter);
     }
 
     transferExceptionToExecState(exec);
@@ -131,7 +131,7 @@ bool JSQuarantinedObjectWrapper::getOwnPropertySlot(ExecState* exec, unsigned id
     bool result = m_unwrappedObject->getOwnPropertySlot(unwrappedExecState(), identifier, unwrappedSlot);
     if (result) {
         JSValuePtr unwrappedValue = unwrappedSlot.getValue(unwrappedExecState(), identifier);
-        slot.setCustom(static_cast<JSObject*>(wrapOutgoingValue(unwrappedExecState(), unwrappedValue)), cachedValueGetter);
+        slot.setCustom(asObject(wrapOutgoingValue(unwrappedExecState(), unwrappedValue)), cachedValueGetter);
     }
 
     transferExceptionToExecState(exec);
@@ -201,7 +201,7 @@ JSObject* JSQuarantinedObjectWrapper::construct(ExecState* exec, JSObject* const
 
     JSValuePtr resultValue = wrapper->wrapOutgoingValue(wrapper->unwrappedExecState(), unwrappedResult);
     ASSERT(resultValue->isObject());
-    JSObject* result = static_cast<JSObject*>(resultValue);
+    JSObject* result = asObject(resultValue);
 
     wrapper->transferExceptionToExecState(exec);
 
index c6ff2d4..91fe4b3 100644 (file)
@@ -70,16 +70,16 @@ using namespace WebCore;
 
 JSValuePtr jsRGBColorRed(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    return toJS(exec, CSSPrimitiveValue::create((static_cast<JSRGBColor*>(slot.slotBase())->impl() >> 16) & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
+    return toJS(exec, CSSPrimitiveValue::create((static_cast<JSRGBColor*>(asObject(slot.slotBase()))->impl() >> 16) & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
 }
 
 JSValuePtr jsRGBColorGreen(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    return toJS(exec, CSSPrimitiveValue::create((static_cast<JSRGBColor*>(slot.slotBase())->impl() >> 8) & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
+    return toJS(exec, CSSPrimitiveValue::create((static_cast<JSRGBColor*>(asObject(slot.slotBase()))->impl() >> 8) & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
 }
 
 JSValuePtr jsRGBColorBlue(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    return toJS(exec, CSSPrimitiveValue::create(static_cast<JSRGBColor*>(slot.slotBase())->impl() & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
+    return toJS(exec, CSSPrimitiveValue::create(static_cast<JSRGBColor*>(asObject(slot.slotBase()))->impl() & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
 }
 
index 31f27a3..8c01d0c 100644 (file)
@@ -56,7 +56,7 @@ JSValuePtr JSSQLResultSetRowList::item(ExecState* exec, const ArgList& args)
     unsigned valuesIndex = index * numColumns;
     for (unsigned i = 0; i < numColumns; i++) {
         const SQLValue& value = m_impl->values()[valuesIndex + i];
-        JSValuePtr jsValue = 0;
+        JSValuePtr jsValue = noValue();
 
         switch (value.type()) {
             case SQLValue::StringValue:
index 648769b..d7b1e5e 100644 (file)
@@ -43,7 +43,7 @@ bool JSStorage::canGetItemsForName(ExecState*, Storage* impl, const Identifier&
 
 JSValuePtr JSStorage::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSStorage* thisObj = static_cast<JSStorage*>(slot.slotBase());
+    JSStorage* thisObj = static_cast<JSStorage*>(asObject(slot.slotBase()));
     return jsStringOrNull(exec, thisObj->impl()->getItem(propertyName));
 }
 
@@ -57,7 +57,7 @@ bool JSStorage::deleteProperty(ExecState* exec, const Identifier& propertyName)
         return false;
         
     JSValuePtr prototype = this->prototype();
-    if (prototype->isObject() && static_cast<JSObject*>(prototype)->hasProperty(exec, propertyName))
+    if (prototype->isObject() && asObject(prototype)->hasProperty(exec, propertyName))
         return false;
 
     m_impl->removeItem(propertyName);
@@ -84,7 +84,7 @@ bool JSStorage::customPut(ExecState* exec, const Identifier& propertyName, JSVal
         return false;
         
     JSValuePtr prototype = this->prototype();
-    if (prototype->isObject() && static_cast<JSObject*>(prototype)->hasProperty(exec, propertyName))
+    if (prototype->isObject() && asObject(prototype)->hasProperty(exec, propertyName))
         return false;
     
     String stringValue = valueToStringWithNullCheck(exec, value);
index 8f8dbe1..ea41687 100644 (file)
@@ -42,7 +42,7 @@ bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheet
 
 JSValuePtr JSStyleSheetList::nameGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(slot.slotBase());
+    JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(asObject(slot.slotBase()));
     HTMLStyleElement* element = thisObj->impl()->getNamedItem(propertyName);
     ASSERT(element);
     return toJS(exec, element->sheet());
index 0180c1c..5e8d58b 100644 (file)
@@ -34,7 +34,7 @@ const ClassInfo JSXMLHttpRequestConstructor::s_info = { "XMLHttpRequestConstruct
 
 JSXMLHttpRequestConstructor::JSXMLHttpRequestConstructor(ExecState* exec, Document* document)
     : DOMObject(JSXMLHttpRequestConstructor::createStructureID(exec->lexicalGlobalObject()->objectPrototype()))
-    , m_document(static_cast<JSDocument*>(toJS(exec, document)))
+    , m_document(static_cast<JSDocument*>(asObject(toJS(exec, document))))
 {
     putDirect(exec->propertyNames().prototype, JSXMLHttpRequestPrototype::self(exec), None);
 }
index ae408e9..cdd5d1f 100644 (file)
@@ -50,7 +50,7 @@ JSValuePtr JSXSLTProcessor::importStylesheet(ExecState* exec, const ArgList& arg
 {
     JSValuePtr nodeVal = args.at(exec, 0);
     if (nodeVal->isObject(&JSNode::s_info)) {
-        JSNode* node = static_cast<JSNode*>(nodeVal);
+        JSNode* node = static_cast<JSNode*>(asObject(nodeVal));
         impl()->importStylesheet(node->impl());
         return jsUndefined();
     }
@@ -63,8 +63,8 @@ JSValuePtr JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList&
     JSValuePtr nodeVal = args.at(exec, 0);
     JSValuePtr docVal = args.at(exec, 1);
     if (nodeVal->isObject(&JSNode::s_info) && docVal->isObject(&JSDocument::s_info)) {
-        WebCore::Node* node = static_cast<JSNode*>(nodeVal)->impl();
-        Document* doc = static_cast<Document*>(static_cast<JSDocument*>(docVal)->impl());
+        WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl();
+        Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl());
         return toJS(exec, impl()->transformToFragment(node, doc).get());
     }
     // Throw exception?
@@ -75,7 +75,7 @@ JSValuePtr JSXSLTProcessor::transformToDocument(ExecState* exec, const ArgList&
 {
     JSValuePtr nodeVal = args.at(exec, 0);
     if (nodeVal->isObject(&JSNode::s_info)) {
-        JSNode* node = static_cast<JSNode*>(nodeVal);
+        JSNode* node = static_cast<JSNode*>(asObject(nodeVal));
         RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl());
         if (resultDocument)
             return toJS(exec, resultDocument.get());
index 6e4e2fa..789ea95 100644 (file)
@@ -121,7 +121,7 @@ JSValuePtr ScriptController::evaluate(const String& sourceURL, int baseLine, con
         m_frame->domWindow()->console()->reportException(exec, comp.value());
 
     m_sourceURL = savedSourceURL;
-    return 0;
+    return noValue();
 }
 
 void ScriptController::clearWindowShell()
index bda56e1..f0b6305 100644 (file)
@@ -117,7 +117,7 @@ void removeDOMWrapper(DOMObjectInternal* impl)
     JSC::ExecState *exec = frame->script()->globalObject()->globalExec();
     
     // Get (or create) a cached JS object for the DOM node.
-    JSC::JSObject *scriptImp = static_cast<JSC::JSObject*>(WebCore::toJS(exec, nodeImpl));
+    JSC::JSObject *scriptImp = asObject(WebCore::toJS(exec, nodeImpl));
 
     JSC::Bindings::RootObject* rootObject = frame->script()->bindingRootObject();
 
index c98f823..2cdd3aa 100644 (file)
@@ -326,7 +326,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     ExecState* exec = [self _rootObject]->globalObject()->globalExec();
     ASSERT(!exec->hadException());
 
-    JSValue *result;
+    JSValuePtr result;
     JSLock lock(false);
     
     [self _rootObject]->globalObject()->startTimeoutCheck();
@@ -390,7 +390,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
         // leaving the lock permanently held
         JSLock lock(false);
         
-        JSValue *result = [self _imp]->get(exec, Identifier(exec, String(key)));
+        JSValuePtr result = [self _imp]->get(exec, Identifier(exec, String(key)));
         
         if (exec->hadException()) {
             addExceptionToConsole(exec);
@@ -456,7 +456,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     ASSERT(!exec->hadException());
 
     JSLock lock(false);
-    JSValue *result = [self _imp]->get(exec, index);
+    JSValuePtr result = [self _imp]->get(exec, index);
 
     if (exec->hadException()) {
         addExceptionToConsole(exec);
@@ -508,14 +508,14 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
 + (id)_convertValueToObjcValue:(JSValuePtr)value originRootObject:(RootObject*)originRootObject rootObject:(RootObject*)rootObject
 {
     if (value->isObject()) {
-        JSObject* object = static_cast<JSObject*>(value);
+        JSObject* object = asObject(value);
         ExecState* exec = rootObject->globalObject()->globalExec();
         JSLock lock(false);
         
         if (object->classInfo() != &RuntimeObjectImp::s_info) {
             JSValuePtr runtimeObject = object->get(exec, Identifier(exec, "__apple_runtime_object"));
             if (runtimeObject && runtimeObject->isObject())
-                object = static_cast<RuntimeObjectImp*>(runtimeObject);
+                object = asObject(runtimeObject);
         }
 
         if (object->classInfo() == &RuntimeObjectImp::s_info) {
@@ -530,7 +530,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     }
 
     if (value->isString()) {
-        const UString& u = static_cast<JSString*>(value)->value();
+        const UString& u = asString(value)->value();
         return [NSString stringWithCharacters:u.data() length:u.size()];
     }
 
index 07b2de3..13bd7c0 100644 (file)
@@ -258,7 +258,7 @@ sub GenerateGetOwnPropertySlotBody
 
     if ($interfaceName eq "NamedNodeMap" or $interfaceName eq "HTMLCollection") {
         push(@getOwnPropertySlotImpl, "    ${namespaceMaybe}JSValuePtr proto = prototype();\n");
-        push(@getOwnPropertySlotImpl, "    if (proto->isObject() && static_cast<${namespaceMaybe}JSObject*>(proto)->hasProperty(exec, propertyName))\n");
+        push(@getOwnPropertySlotImpl, "    if (proto->isObject() && static_cast<${namespaceMaybe}JSObject*>(asObject(proto))->hasProperty(exec, propertyName))\n");
         push(@getOwnPropertySlotImpl, "        return false;\n\n");
     }
 
@@ -1004,21 +1004,21 @@ sub GenerateImplementation
                 if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && 
                         !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurity"} &&
                         !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurityOnGet"}) {
-                    push(@implContent, "    if (!static_cast<$className*>(slot.slotBase())->allowsAccessFrom(exec))\n");
+                    push(@implContent, "    if (!static_cast<$className*>(asObject(slot.slotBase()))->allowsAccessFrom(exec))\n");
                     push(@implContent, "        return jsUndefined();\n");
                 }
 
                 if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"CustomGetter"}) {
-                    push(@implContent, "    return static_cast<$className*>(slot.slotBase())->$implGetterFunctionName(exec);\n");
+                    push(@implContent, "    return static_cast<$className*>(asObject(slot.slotBase()))->$implGetterFunctionName(exec);\n");
                 } elsif ($attribute->signature->extendedAttributes->{"CheckNodeSecurity"}) {
                     $implIncludes{"JSDOMBinding.h"} = 1;
-                    push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(slot.slotBase())->impl());\n");
-                    push(@implContent, "    return checkNodeSecurity(exec, imp->$implGetterFunctionName()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName()", "static_cast<$className*>(slot.slotBase())") . " : jsUndefined();\n");
+                    push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
+                    push(@implContent, "    return checkNodeSecurity(exec, imp->$implGetterFunctionName()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName()", "static_cast<$className*>(asObject(slot.slotBase()))") . " : jsUndefined();\n");
                 } elsif ($attribute->signature->extendedAttributes->{"CheckFrameSecurity"}) {
                     $implIncludes{"Document.h"} = 1;
                     $implIncludes{"JSDOMBinding.h"} = 1;
-                    push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(slot.slotBase())->impl());\n");
-                    push(@implContent, "    return checkNodeSecurity(exec, imp->contentDocument()) ? " . NativeToJSValue($attribute->signature,  0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName()", "static_cast<$className*>(slot.slotBase())") . " : jsUndefined();\n");
+                    push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
+                    push(@implContent, "    return checkNodeSecurity(exec, imp->contentDocument()) ? " . NativeToJSValue($attribute->signature,  0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName()", "static_cast<$className*>(asObject(slot.slotBase()))") . " : jsUndefined();\n");
                 } elsif ($type eq "EventListener") {
                     $implIncludes{"JSEventListener.h"} = 1;
                     $implIncludes{"EventListener.h"} = 1;
@@ -1028,7 +1028,7 @@ sub GenerateImplementation
                     } else {
                         $listenerType = "JSUnprotectedEventListener";
                     }
-                    push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(slot.slotBase())->impl());\n");
+                    push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
                     push(@implContent, "    if (${listenerType}* listener = static_cast<${listenerType}*>(imp->$implGetterFunctionName())) {\n");
                     push(@implContent, "        if (JSObject* listenerObj = listener->listenerObj())\n");
                     push(@implContent, "            return listenerObj;\n");
@@ -1040,15 +1040,15 @@ sub GenerateImplementation
                     push(@implContent, "    return JS" . $constructorType . "::getConstructor(exec);\n");
                 } elsif (!@{$attribute->getterExceptions}) {
                     if ($podType) {
-                        push(@implContent, "    $podType imp(*static_cast<$className*>(slot.slotBase())->impl());\n");
+                        push(@implContent, "    $podType imp(*static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
                         if ($podType eq "float") { # Special case for JSSVGNumber
-                            push(@implContent, "    return " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp", "static_cast<$className*>(slot.slotBase())") . ";\n");
+                            push(@implContent, "    return " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
                         } else {
-                            push(@implContent, "    return " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName()", "static_cast<$className*>(slot.slotBase())") . ";\n");
+                            push(@implContent, "    return " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName()", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
                         }
                     } else {
-                        push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(slot.slotBase())->impl());\n");
-                        my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName()", "static_cast<$className*>(slot.slotBase())");
+                        push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
+                        my $jsType = NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName()", "static_cast<$className*>(asObject(slot.slotBase()))");
                         if ($codeGenerator->IsSVGAnimatedType($type)) {
                             push(@implContent, "    RefPtr<$type> obj = $jsType;\n");
                             push(@implContent, "    return toJS(exec, obj.get(), imp);\n");
@@ -1060,11 +1060,11 @@ sub GenerateImplementation
                     push(@implContent, "    ExceptionCode ec = 0;\n");
 
                     if ($podType) {
-                        push(@implContent, "    $podType imp(*static_cast<$className*>(slot.slotBase())->impl());\n");
-                        push(@implContent, "    JSC::JSValuePtr result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName(ec)", "static_cast<$className*>(slot.slotBase())") . ";\n");
+                        push(@implContent, "    $podType imp(*static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
+                        push(@implContent, "    JSC::JSValuePtr result = " . NativeToJSValue($attribute->signature, 0, $implClassName, "", "imp.$implGetterFunctionName(ec)", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
                     } else {
-                        push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(slot.slotBase())->impl());\n");
-                        push(@implContent, "    JSC::JSValuePtr result = " . NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName(ec)", "static_cast<$className*>(slot.slotBase())") . ";\n");
+                        push(@implContent, "    $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(asObject(slot.slotBase()))->impl());\n");
+                        push(@implContent, "    JSC::JSValuePtr result = " . NativeToJSValue($attribute->signature, 0, $implClassName, $implClassNameForValueConversion, "imp->$implGetterFunctionName(ec)", "static_cast<$className*>(asObject(slot.slotBase()))") . ";\n");
                     }
 
                     push(@implContent, "    setDOMException(exec, ec);\n");
@@ -1079,7 +1079,7 @@ sub GenerateImplementation
 
                 push(@implContent, "JSValuePtr ${constructorFunctionName}(ExecState* exec, const Identifier&, const PropertySlot& slot)\n");
                 push(@implContent, "{\n");
-                push(@implContent, "    return static_cast<$className*>(slot.slotBase())->getConstructor(exec);\n");
+                push(@implContent, "    return static_cast<$className*>(asObject(slot.slotBase()))->getConstructor(exec);\n");
                 push(@implContent, "}\n");
             }
         }
@@ -1247,7 +1247,7 @@ sub GenerateImplementation
             } else {
                 push(@implContent, "    if (!thisValue->isObject(&${className}::s_info))\n");
                 push(@implContent, "        return throwError(exec, TypeError);\n");
-                push(@implContent, "    $className* castedThisObj = static_cast<$className*>(thisValue);\n");
+                push(@implContent, "    $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n");
             }
 
             if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && 
@@ -1359,9 +1359,9 @@ sub GenerateImplementation
     }
 
     if ($dataNode->extendedAttributes->{"HasIndexGetter"}) {
-        push(@implContent, "\nJSValue* ${className}::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)\n");
+        push(@implContent, "\nJSValuePtr ${className}::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)\n");
         push(@implContent, "{\n");
-        push(@implContent, "    ${className}* thisObj = static_cast<$className*>(slot.slotBase());\n");
+        push(@implContent, "    ${className}* thisObj = static_cast<$className*>(asObject(slot.slotBase()));\n");
         if (IndexGetterReturnsStrings($implClassName)) {
             $implIncludes{"KURL.h"} = 1;
             push(@implContent, "    return jsStringOrNull(exec, thisObj->impl()->item(slot.index()));\n");
@@ -1397,14 +1397,14 @@ sub GenerateImplementation
 
     if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateNativeConverter"}) and !$dataNode->extendedAttributes->{"CustomNativeConverter"}) {
         if ($podType) {
-            push(@implContent, "$podType to${interfaceName}(JSC::JSValuePtr val)\n");
+            push(@implContent, "$podType to${interfaceName}(JSC::JSValuePtr value)\n");
         } else {
-            push(@implContent, "$implClassName* to${interfaceName}(JSC::JSValuePtr val)\n");
+            push(@implContent, "$implClassName* to${interfaceName}(JSC::JSValuePtr value)\n");
         }
 
         push(@implContent, "{\n");
 
-        push(@implContent, "    return val->isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(val)->impl() : ");
+        push(@implContent, "    return value->isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : ");
         if ($podType and $podType ne "float") {
             push(@implContent, "$podType();\n}\n");
         } else {
@@ -1864,7 +1864,7 @@ EOF
 $implContent .= << "EOF";
     static JSObject* construct(ExecState* exec, JSObject*, const ArgList&)
     {
-        return static_cast<JSObject*>(toJS(exec, ${interfaceName}::create()));
+        return asObject(toJS(exec, ${interfaceName}::create()));
     }
     virtual ConstructType getConstructData(ConstructData& constructData)
     {
index 17ef786..5bce478 100644 (file)
@@ -53,9 +53,9 @@ public:
     virtual JSValuePtr valueOf(ExecState*) const;
     virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const;
     
-    virtual JSValue *invokeMethod (ExecState *exec, const MethodList &method, const ArgList &args);
+    virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList&);
     virtual bool supportsInvokeDefaultMethod() const;
-    virtual JSValue *invokeDefaultMethod (ExecState *exec, const ArgList &args);
+    virtual JSValuePtr invokeDefaultMethod(ExecState*, const ArgList&);
     virtual void getPropertyNames(ExecState*, PropertyNameArray&);
 
     JSValuePtr stringValue(ExecState*) const;
index 6ff8322..ed71aae 100644 (file)
@@ -75,7 +75,7 @@ JSValuePtr CField::valueFromInstance(ExecState* exec, const Instance* inst) cons
     return jsUndefined();
 }
 
-void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValue *aValue) const
+void CField::setValueToInstance(ExecState *exec, const Instance *inst, JSValuePtr aValue) const
 {
     const CInstance* instance = static_cast<const CInstance*>(inst);
     NPObject* obj = instance->getObject();
index abd9cd9..1977fe0 100644 (file)
@@ -84,9 +84,9 @@ void convertValueToNPVariant(ExecState* exec, JSValuePtr value, NPVariant* resul
     } else if (value->isNull()) {
         NULL_TO_NPVARIANT(*result);
     } else if (value->isObject()) {
-        JSObject* object = static_cast<JSObject*>(value);
+        JSObject* object = asObject(value);
         if (object->classInfo() == &RuntimeObjectImp::s_info) {
-            RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(value);
+            RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(object);
             CInstance* instance = static_cast<CInstance*>(imp->getInternalInstance());
             if (instance) {
                 NPObject* obj = instance->getObject();
index ed88432..ffea91b 100644 (file)
@@ -98,17 +98,17 @@ JSValuePtr JavaInstance::numberValue(ExecState* exec) const
     return jsNumber(exec, doubleValue);
 }
 
-JSValue *JavaInstance::booleanValue() const
+JSValuePtr JavaInstance::booleanValue() const
 {
     jboolean booleanValue = callJNIMethod<jboolean>(_instance->_instance, "booleanValue", "()Z");
     return jsBoolean(booleanValue);
 }
 
-JSValue *JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args)
+JSValuePtr JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodList, const ArgList &args)
 {
     int i, count = args.size();
     jvalue *jArgs;
-    JSValue *resultValue;
+    JSValuePtr resultValue;
     Method *method = 0;
     size_t numMethods = methodList.size();
     
@@ -141,7 +141,7 @@ JSValue *JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodLi
         
     for (i = 0; i < count; i++) {
         JavaParameter* aParameter = jMethod->parameterAt(i);
-        jArgs[i] = convertValueToJValue (exec, args.at(exec, i), aParameter->getJNIType(), aParameter->type());
+        jArgs[i] = convertValueToJValue(exec, args.at(exec, i), aParameter->getJNIType(), aParameter->type());
         JS_LOG("arg[%d] = %s\n", i, args.at(exec, i)->toString(exec).ascii());
     }
         
@@ -157,7 +157,7 @@ JSValue *JavaInstance::invokeMethod (ExecState *exec, const MethodList &methodLi
     bool handled = false;
     if (rootObject->nativeHandle()) {
         jobject obj = _instance->_instance;
-        JSValue *exceptionDescription = NULL;
+        JSValuePtr exceptionDescription = noValue();
         const char *callingURL = 0;  // FIXME, need to propagate calling URL to Java
         handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs, result, callingURL, exceptionDescription);
         if (exceptionDescription) {
index 21dddb2..2015a93 100644 (file)
@@ -397,7 +397,7 @@ jobject JavaJSObject::getSlot(jint index) const
     ExecState* exec = rootObject->globalObject()->globalExec();
 
     JSLock lock(false);
-    JSValue *result = _imp->get (exec, (unsigned)index);
+    JSValuePtr result = _imp->get(exec, index);
 
     return convertValueToJObject(result);
 }
@@ -485,7 +485,7 @@ jlong JavaJSObject::createNative(jlong nativeHandle)
     return nativeHandle;
 }
 
-jobject JavaJSObject::convertValueToJObject (JSValue *value) const
+jobject JavaJSObject::convertValueToJObject(JSValuePtr value) const
 {
     JSLock lock(false);
     
@@ -527,14 +527,14 @@ jobject JavaJSObject::convertValueToJObject (JSValue *value) const
         jlong nativeHandle;
         
         if (value->isObject()) {
-            JSObject *imp = static_cast<JSObject*>(value);
+            JSObject* imp = asObject(value);
             
             // We either have a wrapper around a Java instance or a JavaScript
             // object.  If we have a wrapper around a Java instance, return that
             // instance, otherwise create a new Java JavaJSObject with the JSObject*
             // as it's nativeHandle.
             if (imp->classInfo() && strcmp(imp->classInfo()->className, "RuntimeObject") == 0) {
-                RuntimeObjectImp *runtimeImp = static_cast<RuntimeObjectImp*>(value);
+                RuntimeObjectImp* runtimeImp = static_cast<RuntimeObjectImp*>(imp);
                 JavaInstance *runtimeInstance = static_cast<JavaInstance *>(runtimeImp->getInternalInstance());
                 if (!runtimeInstance)
                     return 0;
index 5f3cddd..87e5648 100644 (file)
@@ -93,7 +93,7 @@ jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance
         {
             RootObject* rootObject = instance->rootObject();
             if (rootObject && rootObject->nativeHandle()) {
-                JSValue *exceptionDescription = NULL;
+                JSValuePtr exceptionDescription = noValue();
                 jvalue args[1];
                 
                 args[0].l = jinstance;
@@ -106,11 +106,11 @@ jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance
     return result;
 }
 
-JSValue *JavaField::valueFromInstance(ExecState *exec, const Instance *i) const 
+JSValuePtr JavaField::valueFromInstance(ExecState* exec, const Instance* i) const 
 {
     const JavaInstance *instance = static_cast<const JavaInstance *>(i);
 
-    JSValue *jsresult = jsUndefined();
+    JSValuePtr jsresult = jsUndefined();
     
     switch (_JNIType) {
         case array_type:
@@ -175,7 +175,7 @@ void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance *
         {
             RootObject* rootObject = instance->rootObject();
             if (rootObject && rootObject->nativeHandle()) {
-                JSValue *exceptionDescription = NULL;
+                JSValuePtr exceptionDescription = noValue();
                 jvalue args[2];
                 jvalue result;
                 
@@ -189,7 +189,7 @@ void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance *
     }
 }
 
-void JavaField::setValueToInstance(ExecState *exec, const Instance *i, JSValue *aValue) const
+void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValuePtr aValue) const
 {
     const JavaInstance *instance = static_cast<const JavaInstance *>(i);
     jvalue javaValue = convertValueToJValue (exec, aValue, _JNIType, type());
@@ -386,7 +386,7 @@ RootObject* JavaArray::rootObject() const
     return _rootObject && _rootObject->isValid() ? _rootObject.get() : 0;
 }
 
-void JavaArray::setValueAt(ExecState *exec, unsigned int index, JSValue *aValue) const
+void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValuePtr aValue) const
 {
     JNIEnv *env = getJNIEnv();
     char *javaClassName = 0;
@@ -454,7 +454,7 @@ void JavaArray::setValueAt(ExecState *exec, unsigned int index, JSValue *aValue)
 }
 
 
-JSValue *JavaArray::valueAt(ExecState *exec, unsigned int index) const
+JSValuePtr JavaArray::valueAt(ExecState* exec, unsigned index) const
 {
     JNIEnv *env = getJNIEnv();
     JNIType arrayType = JNITypeFromPrimitiveType(_type[1]);
index 85145b7..23c4cff 100644 (file)
@@ -112,8 +112,8 @@ class JavaField : public Field
 public:
     JavaField (JNIEnv *env, jobject aField);
 
-    virtual JSValue *valueFromInstance(ExecState *exec, const Instance *instance) const;
-    virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValue *aValue) const;
+    virtual JSValuePtr valueFromInstance(ExecState *exec, const Instance *instance) const;
+    virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValuePtr aValue) const;
     
     virtual const char *name() const { return _name.UTF8String(); }
     virtual RuntimeType type() const { return _type.UTF8String(); }
@@ -168,8 +168,8 @@ public:
 
     RootObject* rootObject() const;
 
-    virtual void setValueAt(ExecState *exec, unsigned int index, JSValue *aValue) const;
-    virtual JSValue *valueAt(ExecState *exec, unsigned int index) const;
+    virtual void setValueAt(ExecState *exec, unsigned int index, JSValuePtr aValue) const;
+    virtual JSValuePtr valueAt(ExecState *exec, unsigned int index) const;
     virtual unsigned int getLength() const;
     
     jobject javaArray() const { return _array->_instance; }
index ab6d790..da1ce00 100644 (file)
@@ -347,14 +347,12 @@ jvalue getJNIField( jobject obj, JNIType type, const char *name, const char *sig
     return result;
 }
 
-static jobject convertArrayInstanceToJavaArray(ExecState *exec, JSValue *value, const char *javaClassName)
+static jobject convertArrayInstanceToJavaArray(ExecState* exec, JSArray* jsArray, const char* javaClassName)
 {
-
     JNIEnv *env = getJNIEnv();
     // As JS Arrays can contain a mixture of objects, assume we can convert to
     // the requested Java Array type requested, unless the array type is some object array
     // other than a string.
-    JSArray *jsArray = static_cast<JSArray *>(value);
     unsigned length = jsArray->length();
     jobjectArray jarray = 0;
     
@@ -470,7 +468,7 @@ static jobject convertArrayInstanceToJavaArray(ExecState *exec, JSValue *value,
 }
 
 
-jvalue convertValueToJValue (ExecState *exec, JSValue *value, JNIType _JNIType, const char *javaClassName)
+jvalue convertValueToJValue(ExecState* exec, JSValuePtr value, JNIType _JNIType, const char* javaClassName)
 {
     JSLock lock(false);
     
@@ -483,22 +481,22 @@ jvalue convertValueToJValue (ExecState *exec, JSValue *value, JNIType _JNIType,
             
             // First see if we have a Java instance.
             if (value->isObject()){
-                JSObject *objectImp = static_cast<JSObject*>(value);
+                JSObject* objectImp = asObject(value);
                 if (objectImp->classInfo() == &RuntimeObjectImp::s_info) {
-                    RuntimeObjectImp *imp = static_cast<RuntimeObjectImp *>(value);
+                    RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(objectImp);
                     JavaInstance *instance = static_cast<JavaInstance*>(imp->getInternalInstance());
                     if (instance)
                         result.l = instance->javaInstance();
                 }
                 else if (objectImp->classInfo() == &RuntimeArray::s_info) {
                 // Input is a JavaScript Array that was originally created from a Java Array
-                    RuntimeArray *imp = static_cast<RuntimeArray *>(value);
+                    RuntimeArray* imp = static_cast<RuntimeArray*>(objectImp);
                     JavaArray *array = static_cast<JavaArray*>(imp->getConcreteArray());
                     result.l = array->javaArray();
                 } 
                 else if (objectImp->classInfo() == &JSArray::info) {
                     // Input is a Javascript Array. We need to create it to a Java Array.
-                    result.l = convertArrayInstanceToJavaArray(exec, value, javaClassName);
+                    result.l = convertArrayInstanceToJavaArray(exec, asArray(value), javaClassName);
                 }
             }
             
index ec8e7d3..f118761 100644 (file)
@@ -45,7 +45,7 @@ public:
     virtual MethodList methodsNamed(const Identifier&, Instance *instance) const;
     virtual Field *fieldNamed(const Identifier&, Instance *instance) const;
 
-    virtual JSValue *fallbackObject(ExecState *exec, Instance *instance, const Identifier &propertyName);
+    virtual JSValuePtr fallbackObject(ExecState *exec, Instance *instance, const Identifier &propertyName);
     
     ClassStructPtr isa() { return _isa; }
     
index bbe7d31..9d23828 100644 (file)
@@ -51,12 +51,12 @@ public:
     virtual JSValuePtr valueOf(ExecState*) const;
     virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const;
     
-    virtual JSValue *invokeMethod(ExecState *exec, const MethodList &method, const ArgList &args);
+    virtual JSValuePtr invokeMethod(ExecState*, const MethodList&, const ArgList&);
     virtual bool supportsInvokeDefaultMethod() const;
-    virtual JSValue *invokeDefaultMethod(ExecState *exec, const ArgList &args);
+    virtual JSValuePtr invokeDefaultMethod(ExecState*, const ArgList&);
 
     virtual bool supportsSetValueOfUndefinedField();
-    virtual void setValueOfUndefinedField(ExecState *exec, const Identifier &property, JSValue *aValue);
+    virtual void setValueOfUndefinedField(ExecState*, const Identifier&, JSValuePtr);
     
     virtual JSValuePtr getValueOfUndefinedField(ExecState*, const Identifier& property) const;
 
index 2188468..dda5acf 100644 (file)
@@ -44,8 +44,8 @@ public:
     ObjcField(IvarStructPtr);
     ObjcField(CFStringRef name);
     
-    virtual JSValue *valueFromInstance(ExecState *exec, const Instance *instance) const;
-    virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValue *aValue) const;
+    virtual JSValuePtr valueFromInstance(ExecState*, const Instance*) const;
+    virtual void setValueToInstance(ExecState*, const Instance*, JSValuePtr) const;
     
     virtual const char *name() const;
         
@@ -79,13 +79,13 @@ class ObjcArray : public Array {
 public:
     ObjcArray(ObjectStructPtr, PassRefPtr<RootObject>);
 
-    virtual void setValueAt(ExecState *exec, unsigned int index, JSValue *aValue) const;
-    virtual JSValue *valueAt(ExecState *exec, unsigned int index) const;
+    virtual void setValueAt(ExecState *exec, unsigned int index, JSValuePtr aValue) const;
+    virtual JSValuePtr valueAt(ExecState *exec, unsigned int index) const;
     virtual unsigned int getLength() const;
     
     ObjectStructPtr getObjcArray() const { return _array.get(); }
 
-    static JSValue *convertObjcArrayToArray(ExecState *exec, ObjectStructPtr anObject);
+    static JSValuePtr convertObjcArrayToArray(ExecState *exec, ObjectStructPtr anObject);
 
 private:
     RetainPtr<ObjectStructPtr> _array;
index e2d4dba..f6663a8 100644 (file)
@@ -231,7 +231,7 @@ static JSValuePtr callObjCFallbackObject(ExecState* exec, JSObject* function, JS
 
     JSValuePtr result = jsUndefined();
 
-    RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(thisValue);
+    RuntimeObjectImp* imp = static_cast<RuntimeObjectImp*>(asObject(thisValue));
     Instance* instance = imp->getInternalInstance();
 
     if (!instance)
index 5f8a01e..9185626 100644 (file)
@@ -73,9 +73,9 @@ typedef enum {
 
 class RootObject;
 
-ObjcValue convertValueToObjcValue(ExecState *exec, JSValue *value, ObjcValueType type);
+ObjcValue convertValueToObjcValue(ExecState*, JSValuePtr, ObjcValueType);
 JSValuePtr convertNSStringToString(ExecState* exec, NSString *nsstring);
-JSValue *convertObjcValueToValue(ExecState *exec, void *buffer, ObjcValueType type, RootObject*);
+JSValuePtr convertObjcValueToValue(ExecState*, void* buffer, ObjcValueType, RootObject*);
 ObjcValueType objcValueTypeForType(const char *type);
 
 bool convertJSMethodNameToObjc(const char *JSName, char *buffer, size_t bufferSize);
index 0a56724..deba1be 100644 (file)
@@ -126,7 +126,7 @@ bool convertJSMethodNameToObjc(const char *JSName, char *buffer, size_t bufferSi
     [], other       exception
 
 */
-ObjcValue convertValueToObjcValue(ExecState *exec, JSValue *value, ObjcValueType type)
+ObjcValue convertValueToObjcValue(ExecState* exec, JSValuePtr value, ObjcValueType type)
 {
     ObjcValue result;
     double d = 0;
@@ -142,8 +142,8 @@ ObjcValue convertValueToObjcValue(ExecState *exec, JSValue *value, ObjcValueType
             RootObject* originRootObject = findRootObject(originGlobalObject);
 
             JSGlobalObject* globalObject = 0;
-            if (value->isObject() && static_cast<JSObject*>(value)->isGlobalObject())
-                globalObject = static_cast<JSGlobalObject*>(value);
+            if (value->isObject() && asObject(value)->isGlobalObject())
+                globalObject = static_cast<JSGlobalObject*>(asObject(value));
 
             if (!globalObject)
                 globalObject = originGlobalObject;
@@ -285,7 +285,7 @@ JSValuePtr convertObjcValueToValue(ExecState* exec, void* buffer, ObjcValueType
             ASSERT(false);
     }
     
-    return 0;
+    return jsUndefined();
 }
 
 ObjcValueType objcValueTypeForType(const char *type)
index 7f69a24..82e86b5 100644 (file)
@@ -78,12 +78,12 @@ void Instance::end()
     virtualEnd();
 }
 
-JSValue *Instance::getValueOfField(ExecState *exec, const Field *aField) const
+JSValuePtr Instance::getValueOfField(ExecState* exec, const Field* aField) const
 {
     return aField->valueFromInstance(exec, this);
 }
 
-void Instance::setValueOfField(ExecState *exec, const Field *aField, JSValue *aValue) const
+void Instance::setValueOfField(ExecState* exec, const Field* aField, JSValuePtr aValue) const
 {
     aField->setValueToInstance(exec, this, aValue);
 }
index 1f01664..64789b8 100644 (file)
@@ -42,15 +42,15 @@ RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* a)
 {
 }
 
-JSValue *RuntimeArray::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
+JSValuePtr RuntimeArray::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    RuntimeArray *thisObj = static_cast<RuntimeArray *>(slot.slotBase());
+    RuntimeArray* thisObj = static_cast<RuntimeArray*>(asObject(slot.slotBase()));
     return jsNumber(exec, thisObj->getLength());
 }
 
-JSValue *RuntimeArray::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
+JSValuePtr RuntimeArray::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    RuntimeArray *thisObj = static_cast<RuntimeArray *>(slot.slotBase());
+    RuntimeArray* thisObj = static_cast<RuntimeArray*>(asObject(slot.slotBase()));
     return thisObj->getConcreteArray()->valueAt(exec, slot.index());
 }
 
index 597aab5..d929d4b 100644 (file)
@@ -37,8 +37,8 @@ public:
     
     virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
     virtual bool getOwnPropertySlot(ExecState *, unsigned, PropertySlot&);
-    virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, PutPropertySlot&);
-    virtual void put(ExecState *exec, unsigned propertyName, JSValue *value);
+    virtual void put(ExecState*, const Identifier& propertyName, JSValuePtr, PutPropertySlot&);
+    virtual void put(ExecState*, unsigned propertyName, JSValuePtr);
     
     virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
     virtual bool deleteProperty(ExecState *exec, unsigned propertyName);
index de51a28..654fa44 100644 (file)
@@ -47,9 +47,9 @@ RuntimeMethod::RuntimeMethod(ExecState* exec, const Identifier& ident, Bindings:
 {
 }
 
-JSValue *RuntimeMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
+JSValuePtr RuntimeMethod::lengthGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
 {
-    RuntimeMethod *thisObj = static_cast<RuntimeMethod *>(slot.slotBase());
+    RuntimeMethod* thisObj = static_cast<RuntimeMethod*>(asObject(slot.slotBase()));
 
     // Ick!  There may be more than one method with this name.  Arbitrarily
     // just pick the first method.  The fundamental problem here is that 
@@ -80,13 +80,13 @@ static JSValuePtr callRuntimeMethod(ExecState* exec, JSObject* function, JSValue
     RuntimeObjectImp* imp;
 
     if (thisValue->isObject(&RuntimeObjectImp::s_info)) {
-        imp = static_cast<RuntimeObjectImp*>(thisValue);
+        imp = static_cast<RuntimeObjectImp*>(asObject(thisValue));
     } else {
         // If thisObj is the DOM object for a plugin, get the corresponding
         // runtime object from the DOM object.
         JSValuePtr value = thisValue->get(exec, Identifier(exec, "__apple_runtime_object"));
         if (value->isObject(&RuntimeObjectImp::s_info))    
-            imp = static_cast<RuntimeObjectImp*>(value);
+            imp = static_cast<RuntimeObjectImp*>(asObject(value));
         else
             return throwError(exec, TypeError);
     }
index c60c6f1..1aee9ee 100644 (file)
@@ -68,7 +68,7 @@ void RuntimeObjectImp::invalidate()
 
 JSValuePtr RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase());
+    RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase()));
     RefPtr<Instance> instance = thisObj->instance;
 
     if (!instance)
@@ -86,7 +86,7 @@ JSValuePtr RuntimeObjectImp::fallbackObjectGetter(ExecState* exec, const Identif
 
 JSValuePtr RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {    
-    RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase());
+    RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase()));
     RefPtr<Instance> instance = thisObj->instance;
 
     if (!instance)
@@ -96,7 +96,7 @@ JSValuePtr RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& prop
 
     Class *aClass = instance->getClass();
     Field* aField = aClass->fieldNamed(propertyName, instance.get());
-    JSValue *result = instance->getValueOfField(exec, aField); 
+    JSValuePtr result = instance->getValueOfField(exec, aField); 
     
     instance->end();
             
@@ -105,7 +105,7 @@ JSValuePtr RuntimeObjectImp::fieldGetter(ExecState* exec, const Identifier& prop
 
 JSValuePtr RuntimeObjectImp::methodGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 {
-    RuntimeObjectImp *thisObj = static_cast<RuntimeObjectImp *>(slot.slotBase());
+    RuntimeObjectImp* thisObj = static_cast<RuntimeObjectImp*>(asObject(slot.slotBase()));
     RefPtr<Instance> instance = thisObj->instance;
 
     if (!instance)
index 109ce58..5d7acd3 100644 (file)
@@ -785,7 +785,7 @@ JSValuePtr FrameLoader::executeScript(const String& script, bool forceUserGestur
 JSValuePtr FrameLoader::executeScript(const String& url, int baseLine, const String& script)
 {
     if (!m_frame->script()->isEnabled() || m_frame->script()->isPaused())
-        return 0;
+        return noValue();
 
     bool wasRunningScript = m_isRunningScript;
     m_isRunningScript = true;
index 869021d..0affa90 100644 (file)
@@ -292,7 +292,7 @@ void Console::trace(ExecState* exec)
     ArgList args;
     while (!func->isNull()) {
         args.append(func);
-        func = exec->machine()->retrieveCaller(exec, static_cast<InternalFunction*>(func));
+        func = exec->machine()->retrieveCaller(exec, asInternalFunction(func));
     }
     
     page->inspectorController()->addMessageToConsole(JSMessageSource, TraceMessageLevel, exec, args, 0, String());
index 73d2bb7..5be6572 100644 (file)
@@ -1,3 +1,23 @@
+2008-10-18  Darin Adler  <darin@apple.com>
+
+        Reviewed by Oliver Hunt.
+
+        - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
+          improve performance by eliminating JSValue as a base class for JSCell
+
+        Tweak a little more to get closer to where we can make JSValuePtr a class.
+
+        * WebView/WebScriptDebugDelegate.mm:
+        (-[WebScriptCallFrame _convertValueToObjcValue:]): Use JSValuePtr.
+        (-[WebScriptCallFrame exception]): Ditto.
+        (-[WebScriptCallFrame evaluateWebScript:]): Ditto. And noValue.
+        * WebView/WebScriptDebugger.mm:
+        (WebScriptDebugger::WebScriptDebugger): Use new DebuggerCallFrame
+        constructor that doesn't require explicitly passing an exception.
+        * WebView/WebView.mm:
+        (aeDescFromJSValue): Use JSValuePtr.
+        (-[WebView aeDescByEvaluatingJavaScriptFromString:]): Ditto.
+
 2008-10-18  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by Sam Weinig.
index 0c989c1..5212331 100644 (file)
@@ -53,7 +53,7 @@ NSString * const WebScriptErrorLineNumberKey = @"WebScriptErrorLineNumber";
 
 @interface WebScriptCallFrame (WebScriptDebugDelegateInternal)
 
-- (id)_convertValueToObjcValue:(JSValue *)value;
+- (id)_convertValueToObjcValue:(JSValuePtr)value;
 
 @end
 
@@ -109,7 +109,7 @@ NSString * const WebScriptErrorLineNumberKey = @"WebScriptErrorLineNumber";
     _private->debuggerCallFrame = 0;
 }
 
-- (id)_convertValueToObjcValue:(JSValue *)value
+- (id)_convertValueToObjcValue:(JSValuePtr)value
 {
     if (!value)
         return nil;
@@ -204,7 +204,7 @@ NSString * const WebScriptErrorLineNumberKey = @"WebScriptErrorLineNumber";
     if (!_private->debuggerCallFrame)
         return nil;
 
-    JSValue* exception = _private->debuggerCallFrame->exception();
+    JSValuePtr exception = _private->debuggerCallFrame->exception();
     return exception ? [self _convertValueToObjcValue:exception] : nil;
 }
 
@@ -221,8 +221,8 @@ NSString * const WebScriptErrorLineNumberKey = @"WebScriptErrorLineNumber";
 
     JSLock lock(false);
 
-    JSValue* exception = 0;
-    JSValue* result = _private->debuggerCallFrame->evaluate(String(script), exception);
+    JSValuePtr exception = noValue();
+    JSValuePtr result = _private->debuggerCallFrame->evaluate(String(script), exception);
     if (exception)
         return [self _convertValueToObjcValue:exception];
     return result ? [self _convertValueToObjcValue:result] : nil;
index b5dc79b..11749e1 100644 (file)
@@ -80,8 +80,7 @@ WebScriptDebugger::WebScriptDebugger(JSGlobalObject* globalObject)
     : m_callingDelegate(false)
 {
     attach(globalObject);
-    DebuggerCallFrame globalCallFrame(globalObject->globalExec(), 0);
-    callEvent(globalCallFrame, 0, -1);
+    callEvent(globalObject->globalExec(), 0, -1);
 }
 
 // callbacks - relay to delegate
index b25788a..c7ebd1e 100644 (file)
@@ -3559,7 +3559,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
     return coreFrame->shouldClose();
 }
 
-static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue* jsValue)
+static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValuePtr jsValue)
 {
     NSAppleEventDescriptor* aeDesc = 0;
     if (jsValue->isBoolean())
@@ -3601,7 +3601,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue* jsVal
                 return aeDesc;
             }
         }
-        JSValue* primitive = object->toPrimitive(exec);
+        JSValuePtr primitive = object->toPrimitive(exec);
         if (exec->hadException()) {
             exec->clearException();
             return [NSAppleEventDescriptor nullDescriptor];
@@ -3621,7 +3621,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue* jsVal
         return nil;
     if (!coreFrame->document())
         return nil;
-    JSValue* result = coreFrame->loader()->executeScript(script, true);
+    JSValuePtr result = coreFrame->loader()->executeScript(script, true);
     if (!result) // FIXME: pass errors
         return 0;
     JSLock lock(false);