Title: [113363] trunk/Source/_javascript_Core
Revision
113363
Author
[email protected]
Date
2012-04-05 13:09:33 -0700 (Thu, 05 Apr 2012)

Log Message

Replace static_cast with jsCast when casting JSCell subclasses in JSC
https://bugs.webkit.org/show_bug.cgi?id=83307

Reviewed by Gavin Barraclough.

Replace all usage of static_cast<JSCell subtype*> with jsCast<> in _javascript_Core.
This results in assertions when unsafe casts are performed, but simply leaves
a static_cast<> in release builds.

* API/APICast.h:
(toJS):
* API/JSCallbackConstructor.cpp:
(JSC::constructJSCallback):
* API/JSCallbackFunction.cpp:
(JSC::JSCallbackFunction::call):
* API/JSCallbackObjectFunctions.h:
(JSC::::asCallbackObject):
(JSC::::finishCreation):
(JSC::::construct):
(JSC::::call):
* API/JSObjectRef.cpp:
(JSObjectGetPrivate):
(JSObjectSetPrivate):
(JSObjectGetPrivateProperty):
(JSObjectSetPrivateProperty):
(JSObjectDeletePrivateProperty):
* API/JSValueRef.cpp:
(JSValueIsObjectOfClass):
* API/JSWeakObjectMapRefPrivate.cpp:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::resolve):
(JSC::BytecodeGenerator::resolveConstDecl):
* debugger/DebuggerActivation.cpp:
(JSC::DebuggerActivation::finishCreation):
* dfg/DFGOperations.cpp:
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::privateExecute):
* jit/JITStubs.cpp:
(JSC::DEFINE_STUB_FUNCTION):
* runtime/Executable.h:
(JSC::isHostFunction):
* runtime/JSActivation.h:
(JSC::asActivation):
* runtime/JSArray.cpp:
(JSC::JSArray::defineOwnProperty):
* runtime/JSArray.h:
(JSC::asArray):
* runtime/JSBoundFunction.cpp:
(JSC::boundFunctionCall):
(JSC::boundFunctionConstruct):
* runtime/JSByteArray.h:
(JSC::asByteArray):
* runtime/JSCell.cpp:
(JSC::JSCell::toObject):
* runtime/JSCell.h:
(JSC::jsCast):
* runtime/JSGlobalObject.h:
(JSC::asGlobalObject):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* runtime/JSObject.cpp:
(JSC::JSObject::setPrototypeWithCycleCheck):
(JSC::JSObject::allowsAccessFrom):
(JSC::JSObject::toThisObject):
(JSC::JSObject::unwrappedObject):
* runtime/JSObject.h:
(JSC::asObject):
* runtime/JSPropertyNameIterator.h:
(JSC::Register::propertyNameIterator):
* runtime/JSString.h:
(JSC::asString):
(JSC::JSValue::toString):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncSubstr):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/APICast.h (113362 => 113363)


--- trunk/Source/_javascript_Core/API/APICast.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/APICast.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -69,7 +69,7 @@
     if (!jsCell)
         return JSC::JSValue();
     if (jsCell->isAPIValueWrapper())
-        return static_cast<JSC::JSAPIValueWrapper*>(jsCell)->value();
+        return jsCast<JSC::JSAPIValueWrapper*>(jsCell)->value();
     return jsCell;
 #else
     return JSC::JSValue::decode(reinterpret_cast<JSC::EncodedJSValue>(const_cast<OpaqueJSValue*>(v)));

Modified: trunk/Source/_javascript_Core/API/JSCallbackConstructor.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/API/JSCallbackConstructor.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/JSCallbackConstructor.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -70,7 +70,7 @@
     JSContextRef ctx = toRef(exec);
     JSObjectRef constructorRef = toRef(constructor);
 
-    JSObjectCallAsConstructorCallback callback = static_cast<JSCallbackConstructor*>(constructor)->callback();
+    JSObjectCallAsConstructorCallback callback = jsCast<JSCallbackConstructor*>(constructor)->callback();
     if (callback) {
         int argumentCount = static_cast<int>(exec->argumentCount());
         Vector<JSValueRef, 16> arguments(argumentCount);
@@ -88,7 +88,7 @@
         return JSValue::encode(toJS(result));
     }
     
-    return JSValue::encode(toJS(JSObjectMake(ctx, static_cast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
+    return JSValue::encode(toJS(JSObjectMake(ctx, jsCast<JSCallbackConstructor*>(constructor)->classRef(), 0)));
 }
 
 ConstructType JSCallbackConstructor::getConstructData(JSCell*, ConstructData& constructData)

Modified: trunk/Source/_javascript_Core/API/JSCallbackFunction.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/API/JSCallbackFunction.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/JSCallbackFunction.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -70,7 +70,7 @@
     JSValueRef result;
     {
         APICallbackShim callbackShim(exec);
-        result = static_cast<JSCallbackFunction*>(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
+        result = jsCast<JSCallbackFunction*>(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
     }
     if (exception)
         throwError(exec, toJS(exec, exception));

Modified: trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h (113362 => 113363)


--- trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/JSCallbackObjectFunctions.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -46,7 +46,7 @@
 inline JSCallbackObject<Parent>* JSCallbackObject<Parent>::asCallbackObject(JSValue value)
 {
     ASSERT(asObject(value)->inherits(&s_info));
-    return static_cast<JSCallbackObject*>(asObject(value));
+    return jsCast<JSCallbackObject*>(asObject(value));
 }
 
 template <class Parent>
@@ -80,7 +80,7 @@
     ASSERT(Parent::inherits(&s_info));
     ASSERT(Parent::isGlobalObject());
     Base::finishCreation(globalData);
-    init(static_cast<JSGlobalObject*>(this)->globalExec());
+    init(jsCast<JSGlobalObject*>(this)->globalExec());
 }
 
 template <class Parent>
@@ -354,7 +354,7 @@
     JSContextRef execRef = toRef(exec);
     JSObjectRef constructorRef = toRef(constructor);
     
-    for (JSClassRef jsClass = static_cast<JSCallbackObject<Parent>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
+    for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(constructor)->classRef(); jsClass; jsClass = jsClass->parentClass) {
         if (JSObjectCallAsConstructorCallback callAsConstructor = jsClass->callAsConstructor) {
             int argumentCount = static_cast<int>(exec->argumentCount());
             Vector<JSValueRef, 16> arguments(argumentCount);
@@ -420,7 +420,7 @@
     JSObjectRef functionRef = toRef(exec->callee());
     JSObjectRef thisObjRef = toRef(exec->hostThisValue().toThisObject(exec));
     
-    for (JSClassRef jsClass = static_cast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
+    for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) {
         if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) {
             int argumentCount = static_cast<int>(exec->argumentCount());
             Vector<JSValueRef, 16> arguments(argumentCount);

Modified: trunk/Source/_javascript_Core/API/JSObjectRef.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/API/JSObjectRef.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/JSObjectRef.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -341,9 +341,9 @@
     JSObject* jsObject = toJS(object);
     
     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
-        return static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
+        return jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivate();
     if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
-        return static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivate();
+        return jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivate();
     
     return 0;
 }
@@ -353,11 +353,11 @@
     JSObject* jsObject = toJS(object);
     
     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info)) {
-        static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
+        jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivate(data);
         return true;
     }
     if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
-        static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivate(data);
+        jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivate(data);
         return true;
     }
         
@@ -372,9 +372,9 @@
     JSValue result;
     Identifier name(propertyName->identifier(&exec->globalData()));
     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
-        result = static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
+        result = jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->getPrivateProperty(name);
     else if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
-        result = static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivateProperty(name);
+        result = jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->getPrivateProperty(name);
     return toRef(exec, result);
 }
 
@@ -386,11 +386,11 @@
     JSValue jsValue = value ? toJS(exec, value) : JSValue();
     Identifier name(propertyName->identifier(&exec->globalData()));
     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info)) {
-        static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
+        jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
         return true;
     }
     if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
-        static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
+        jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->setPrivateProperty(exec->globalData(), name, jsValue);
         return true;
     }
     return false;
@@ -403,11 +403,11 @@
     JSObject* jsObject = toJS(object);
     Identifier name(propertyName->identifier(&exec->globalData()));
     if (jsObject->inherits(&JSCallbackObject<JSGlobalObject>::s_info)) {
-        static_cast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
+        jsCast<JSCallbackObject<JSGlobalObject>*>(jsObject)->deletePrivateProperty(name);
         return true;
     }
     if (jsObject->inherits(&JSCallbackObject<JSNonFinalObject>::s_info)) {
-        static_cast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->deletePrivateProperty(name);
+        jsCast<JSCallbackObject<JSNonFinalObject>*>(jsObject)->deletePrivateProperty(name);
         return true;
     }
     return false;

Modified: trunk/Source/_javascript_Core/API/JSValueRef.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/API/JSValueRef.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/JSValueRef.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -130,9 +130,9 @@
     
     if (JSObject* o = jsValue.getObject()) {
         if (o->inherits(&JSCallbackObject<JSGlobalObject>::s_info))
-            return static_cast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
+            return jsCast<JSCallbackObject<JSGlobalObject>*>(o)->inherits(jsClass);
         if (o->inherits(&JSCallbackObject<JSNonFinalObject>::s_info))
-            return static_cast<JSCallbackObject<JSNonFinalObject>*>(o)->inherits(jsClass);
+            return jsCast<JSCallbackObject<JSNonFinalObject>*>(o)->inherits(jsClass);
     }
     return false;
 }

Modified: trunk/Source/_javascript_Core/API/JSWeakObjectMapRefPrivate.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/API/JSWeakObjectMapRefPrivate.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/API/JSWeakObjectMapRefPrivate.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -65,7 +65,7 @@
 {
     ExecState* exec = toJS(ctx);
     APIEntryShim entryShim(exec);
-    return toRef(static_cast<JSObject*>(map->map().get(key)));
+    return toRef(jsCast<JSObject*>(map->map().get(key)));
 }
 
 void JSWeakObjectMapRemove(JSContextRef ctx, JSWeakObjectMapRef map, void* key)

Modified: trunk/Source/_javascript_Core/ChangeLog (113362 => 113363)


--- trunk/Source/_javascript_Core/ChangeLog	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-04-05 20:09:33 UTC (rev 113363)
@@ -1,3 +1,81 @@
+2012-04-05  Oliver Hunt  <[email protected]>
+
+        Replace static_cast with jsCast when casting JSCell subclasses in JSC
+        https://bugs.webkit.org/show_bug.cgi?id=83307
+
+        Reviewed by Gavin Barraclough.
+
+        Replace all usage of static_cast<JSCell subtype*> with jsCast<> in _javascript_Core.
+        This results in assertions when unsafe casts are performed, but simply leaves
+        a static_cast<> in release builds.
+
+        * API/APICast.h:
+        (toJS):
+        * API/JSCallbackConstructor.cpp:
+        (JSC::constructJSCallback):
+        * API/JSCallbackFunction.cpp:
+        (JSC::JSCallbackFunction::call):
+        * API/JSCallbackObjectFunctions.h:
+        (JSC::::asCallbackObject):
+        (JSC::::finishCreation):
+        (JSC::::construct):
+        (JSC::::call):
+        * API/JSObjectRef.cpp:
+        (JSObjectGetPrivate):
+        (JSObjectSetPrivate):
+        (JSObjectGetPrivateProperty):
+        (JSObjectSetPrivateProperty):
+        (JSObjectDeletePrivateProperty):
+        * API/JSValueRef.cpp:
+        (JSValueIsObjectOfClass):
+        * API/JSWeakObjectMapRefPrivate.cpp:
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::resolve):
+        (JSC::BytecodeGenerator::resolveConstDecl):
+        * debugger/DebuggerActivation.cpp:
+        (JSC::DebuggerActivation::finishCreation):
+        * dfg/DFGOperations.cpp:
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::execute):
+        (JSC::Interpreter::privateExecute):
+        * jit/JITStubs.cpp:
+        (JSC::DEFINE_STUB_FUNCTION):
+        * runtime/Executable.h:
+        (JSC::isHostFunction):
+        * runtime/JSActivation.h:
+        (JSC::asActivation):
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::defineOwnProperty):
+        * runtime/JSArray.h:
+        (JSC::asArray):
+        * runtime/JSBoundFunction.cpp:
+        (JSC::boundFunctionCall):
+        (JSC::boundFunctionConstruct):
+        * runtime/JSByteArray.h:
+        (JSC::asByteArray):
+        * runtime/JSCell.cpp:
+        (JSC::JSCell::toObject):
+        * runtime/JSCell.h:
+        (JSC::jsCast):
+        * runtime/JSGlobalObject.h:
+        (JSC::asGlobalObject):
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncEval):
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::setPrototypeWithCycleCheck):
+        (JSC::JSObject::allowsAccessFrom):
+        (JSC::JSObject::toThisObject):
+        (JSC::JSObject::unwrappedObject):
+        * runtime/JSObject.h:
+        (JSC::asObject):
+        * runtime/JSPropertyNameIterator.h:
+        (JSC::Register::propertyNameIterator):
+        * runtime/JSString.h:
+        (JSC::asString):
+        (JSC::JSValue::toString):
+        * runtime/StringPrototype.cpp:
+        (JSC::stringProtoFuncSubstr):
+
 2012-04-05  Benjamin Poulain  <[email protected]>
 
         Make something faster than JSStringBuilder for joining an array of JSValue

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -1185,7 +1185,7 @@
             flags |= ResolveResult::DynamicFlag;
             break;
         }        
-        JSVariableObject* currentVariableObject = static_cast<JSVariableObject*>(currentScope);
+        JSVariableObject* currentVariableObject = jsCast<JSVariableObject*>(currentScope);
         SymbolTableEntry entry = currentVariableObject->symbolTable().get(property.impl());
 
         // Found the property
@@ -1242,7 +1242,7 @@
         JSObject* currentScope = iter->get();
         if (!currentScope->isVariableObject())
             continue;
-        JSVariableObject* currentVariableObject = static_cast<JSVariableObject*>(currentScope);
+        JSVariableObject* currentVariableObject = jsCast<JSVariableObject*>(currentScope);
         SymbolTableEntry entry = currentVariableObject->symbolTable().get(property.impl());
         if (entry.isNull())
             continue;

Modified: trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/debugger/DebuggerActivation.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -44,7 +44,7 @@
     Base::finishCreation(globalData);
     ASSERT(activation);
     ASSERT(activation->isActivationObject());
-    m_activation.set(globalData, this, static_cast<JSActivation*>(activation));
+    m_activation.set(globalData, this, jsCast<JSActivation*>(activation));
 }
 
 void DebuggerActivation::visitChildren(JSCell* cell, SlotVisitor& visitor)

Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -253,7 +253,7 @@
     JSGlobalData* globalData = &exec->globalData();
     NativeCallFrameTracer tracer(globalData, exec);
     
-    return createThis(exec, prototype, static_cast<JSFunction*>(constructor));
+    return createThis(exec, prototype, jsCast<JSFunction*>(constructor));
 }
 
 JSCell* DFG_OPERATION operationNewObject(ExecState* exec)
@@ -1025,7 +1025,7 @@
 {
     ASSERT(activation);
     ASSERT(activation->inherits(&JSActivation::s_info));
-    static_cast<JSActivation*>(activation)->tearOff(exec->globalData());
+    jsCast<JSActivation*>(activation)->tearOff(exec->globalData());
 }
 
 JSCell* DFG_OPERATION operationNewFunction(ExecState* exec, JSCell* functionExecutable)

Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -1514,7 +1514,7 @@
     for (ScopeChainNode* node = scopeChain; ; node = node->next.get()) {
         ASSERT(node);
         if (node->object->isVariableObject() && !node->object->isStaticScopeObject()) {
-            variableObject = static_cast<JSVariableObject*>(node->object.get());
+            variableObject = jsCast<JSVariableObject*>(node->object.get());
             break;
         }
     }
@@ -2883,7 +2883,7 @@
             ASSERT_UNUSED(end, iter != end);
         }
         ASSERT((*iter)->isVariableObject());
-        JSVariableObject* scope = static_cast<JSVariableObject*>(iter->get());
+        JSVariableObject* scope = jsCast<JSVariableObject*>(iter->get());
         callFrame->uncheckedR(dst) = scope->registerAt(index).get();
         ASSERT(callFrame->r(dst).jsValue());
         vPC += OPCODE_LENGTH(op_get_scoped_var);
@@ -2914,7 +2914,7 @@
         }
 
         ASSERT((*iter)->isVariableObject());
-        JSVariableObject* scope = static_cast<JSVariableObject*>(iter->get());
+        JSVariableObject* scope = jsCast<JSVariableObject*>(iter->get());
         ASSERT(callFrame->r(value).jsValue());
         scope->registerAt(index).set(*globalData, scope, callFrame->r(value).jsValue());
         vPC += OPCODE_LENGTH(op_put_scoped_var);

Modified: trunk/Source/_javascript_Core/jit/JITStubs.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/jit/JITStubs.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/jit/JITStubs.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -2949,20 +2949,20 @@
 
     if (cell1->isString()) {
         if (src2.isInt32())
-            return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == src2.asInt32();
+            return jsToNumber(jsCast<JSString*>(cell1)->value(stackFrame.callFrame)) == src2.asInt32();
             
         if (src2.isDouble())
-            return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == src2.asDouble();
+            return jsToNumber(jsCast<JSString*>(cell1)->value(stackFrame.callFrame)) == src2.asDouble();
 
         if (src2.isTrue())
-            return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == 1.0;
+            return jsToNumber(jsCast<JSString*>(cell1)->value(stackFrame.callFrame)) == 1.0;
 
         if (src2.isFalse())
-            return jsToNumber(static_cast<JSString*>(cell1)->value(stackFrame.callFrame)) == 0.0;
+            return jsToNumber(jsCast<JSString*>(cell1)->value(stackFrame.callFrame)) == 0.0;
 
         JSCell* cell2 = src2.asCell();
         if (cell2->isString())
-            return static_cast<JSString*>(cell1)->value(stackFrame.callFrame) == static_cast<JSString*>(cell2)->value(stackFrame.callFrame);
+            return jsCast<JSString*>(cell1)->value(stackFrame.callFrame) == jsCast<JSString*>(cell2)->value(stackFrame.callFrame);
 
         src2 = asObject(cell2)->toPrimitive(stackFrame.callFrame);
         CHECK_FOR_EXCEPTION();

Modified: trunk/Source/_javascript_Core/runtime/Executable.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/Executable.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/Executable.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -721,7 +721,7 @@
 
     inline bool isHostFunction(JSValue value, NativeFunction nativeFunction)
     {
-        JSFunction* function = static_cast<JSFunction*>(getJSFunction(value));
+        JSFunction* function = jsCast<JSFunction*>(getJSFunction(value));
         if (!function || !function->isHostFunction())
             return false;
         return function->nativeFunction() == nativeFunction;

Modified: trunk/Source/_javascript_Core/runtime/JSActivation.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSActivation.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSActivation.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -102,7 +102,7 @@
     inline JSActivation* asActivation(JSValue value)
     {
         ASSERT(asObject(value)->inherits(&JSActivation::s_info));
-        return static_cast<JSActivation*>(asObject(value));
+        return jsCast<JSActivation*>(asObject(value));
     }
     
     ALWAYS_INLINE JSActivation* Register::activation() const

Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSArray.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -545,7 +545,7 @@
 // Defined in ES5.1 15.4.5.1
 bool JSArray::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
 {
-    JSArray* array = static_cast<JSArray*>(object);
+    JSArray* array = jsCast<JSArray*>(object);
 
     // 3. If P is "length", then
     if (propertyName == exec->propertyNames().length) {

Modified: trunk/Source/_javascript_Core/runtime/JSArray.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSArray.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSArray.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -339,7 +339,7 @@
     inline JSArray* asArray(JSCell* cell)
     {
         ASSERT(cell->inherits(&JSArray::s_info));
-        return static_cast<JSArray*>(cell);
+        return jsCast<JSArray*>(cell);
     }
 
     inline JSArray* asArray(JSValue value)

Modified: trunk/Source/_javascript_Core/runtime/JSBoundFunction.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSBoundFunction.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSBoundFunction.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -38,7 +38,7 @@
 
 EncodedJSValue JSC_HOST_CALL boundFunctionCall(ExecState* exec)
 {
-    JSBoundFunction* boundFunction = static_cast<JSBoundFunction*>(exec->callee());
+    JSBoundFunction* boundFunction = jsCast<JSBoundFunction*>(exec->callee());
 
     ASSERT(isJSArray(boundFunction->boundArgs())); // Currently this is true!
     JSArray* boundArgs = asArray(boundFunction->boundArgs());
@@ -58,7 +58,7 @@
 
 EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec)
 {
-    JSBoundFunction* boundFunction = static_cast<JSBoundFunction*>(exec->callee());
+    JSBoundFunction* boundFunction = jsCast<JSBoundFunction*>(exec->callee());
 
     ASSERT(isJSArray(boundFunction->boundArgs())); // Currently this is true!
     JSArray* boundArgs = asArray(boundFunction->boundArgs());

Modified: trunk/Source/_javascript_Core/runtime/JSByteArray.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSByteArray.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSByteArray.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -123,7 +123,7 @@
     JSByteArray* asByteArray(JSValue value);
     inline JSByteArray* asByteArray(JSValue value)
     {
-        return static_cast<JSByteArray*>(value.asCell());
+        return jsCast<JSByteArray*>(value.asCell());
     }
 
     inline bool isJSByteArray(JSValue v) { return v.isCell() && v.asCell()->classInfo() == &JSByteArray::s_info; }

Modified: trunk/Source/_javascript_Core/runtime/JSCell.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSCell.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSCell.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -159,7 +159,7 @@
     if (isString())
         return static_cast<const JSString*>(this)->toObject(exec, globalObject);
     ASSERT(isObject());
-    return static_cast<JSObject*>(const_cast<JSCell*>(this));
+    return jsCast<JSObject*>(const_cast<JSCell*>(this));
 }
 
 void slowValidateCell(JSCell* cell)

Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSCell.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -351,14 +351,14 @@
     template<typename To, typename From>
     inline To jsCast(From* from)
     {
-        ASSERT(!from || from->inherits(&WTF::RemovePointer<To>::Type::s_info));
+        ASSERT(!from || from->JSCell::inherits(&WTF::RemovePointer<To>::Type::s_info));
         return static_cast<To>(from);
     }
 
     template<typename To>
     inline To jsCast(JSValue from)
     {
-        ASSERT(from.isCell() && from.asCell()->inherits(&WTF::RemovePointer<To>::Type::s_info));
+        ASSERT(from.isCell() && from.asCell()->JSCell::inherits(&WTF::RemovePointer<To>::Type::s_info));
         return static_cast<To>(from.asCell());
     }
 

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -358,7 +358,7 @@
     inline JSGlobalObject* asGlobalObject(JSValue value)
     {
         ASSERT(asObject(value)->isGlobalObject());
-        return static_cast<JSGlobalObject*>(asObject(value));
+        return jsCast<JSGlobalObject*>(asObject(value));
     }
 
     inline void JSGlobalObject::setRegisters(WriteBarrier<Unknown>* registers, PassOwnArrayPtr<WriteBarrier<Unknown> > registerArray, size_t count)

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObjectFunctions.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -505,7 +505,7 @@
 {
     JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
     JSObject* unwrappedObject = thisObject->unwrappedObject();
-    if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
+    if (!unwrappedObject->isGlobalObject() || jsCast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
         return throwVMError(exec, createEvalError(exec, "The \"this\" value passed to eval must be the global object from which eval originated"));
 
     JSValue x = exec->argument(0);
@@ -525,11 +525,11 @@
     }
 
     EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false);
-    JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain());
+    JSObject* error = eval->compile(exec, jsCast<JSGlobalObject*>(unwrappedObject)->globalScopeChain());
     if (error)
         return throwVMError(exec, error);
 
-    return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain()));
+    return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, jsCast<JSGlobalObject*>(unwrappedObject)->globalScopeChain()));
 }
 
 EncodedJSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec)

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -203,7 +203,7 @@
 {
     JSValue checkFor = this;
     if (this->isGlobalObject())
-        checkFor = static_cast<JSGlobalObject*>(this)->globalExec()->thisValue();
+        checkFor = jsCast<JSGlobalObject*>(this)->globalExec()->thisValue();
 
     JSValue nextPrototype = prototype;
     while (nextPrototype && nextPrototype.isObject()) {
@@ -217,7 +217,7 @@
 
 bool JSObject::allowsAccessFrom(ExecState* exec)
 {
-    JSGlobalObject* globalObject = isGlobalThis() ? static_cast<JSGlobalThis*>(this)->unwrappedObject() : this->globalObject();
+    JSGlobalObject* globalObject = isGlobalThis() ? jsCast<JSGlobalThis*>(this)->unwrappedObject() : this->globalObject();
     return globalObject->globalObjectMethodTable()->allowsAccessFrom(globalObject, exec);
 }
 
@@ -445,13 +445,13 @@
 
 JSObject* JSObject::toThisObject(JSCell* cell, ExecState*)
 {
-    return static_cast<JSObject*>(cell);
+    return jsCast<JSObject*>(cell);
 }
 
 JSObject* JSObject::unwrappedObject()
 {
     if (isGlobalThis())
-        return static_cast<JSGlobalThis*>(this)->unwrappedObject();
+        return jsCast<JSGlobalThis*>(this)->unwrappedObject();
     return this;
 }
 

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -474,7 +474,7 @@
 inline JSObject* asObject(JSCell* cell)
 {
     ASSERT(cell->isObject());
-    return static_cast<JSObject*>(cell);
+    return jsCast<JSObject*>(cell);
 }
 
 inline JSObject* asObject(JSValue value)

Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameIterator.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -121,7 +121,7 @@
 
     ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
     {
-        return static_cast<JSPropertyNameIterator*>(jsValue().asCell());
+        return jsCast<JSPropertyNameIterator*>(jsValue().asCell());
     }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSString.h (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/JSString.h	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/JSString.h	2012-04-05 20:09:33 UTC (rev 113363)
@@ -277,7 +277,7 @@
     inline JSString* asString(JSValue value)
     {
         ASSERT(value.asCell()->isString());
-        return static_cast<JSString*>(value.asCell());
+        return jsCast<JSString*>(value.asCell());
     }
 
     inline JSString* jsEmptyString(JSGlobalData* globalData)
@@ -458,7 +458,7 @@
     inline JSString* JSValue::toString(ExecState* exec) const
     {
         if (isString())
-            return static_cast<JSString*>(asCell());
+            return jsCast<JSString*>(asCell());
         return toStringSlowCase(exec);
     }
 

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (113362 => 113363)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2012-04-05 20:03:24 UTC (rev 113362)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2012-04-05 20:09:33 UTC (rev 113363)
@@ -1103,7 +1103,7 @@
     JSString* jsString = 0;
     UString uString;
     if (thisValue.isString()) {
-        jsString = static_cast<JSString*>(thisValue.asCell());
+        jsString = jsCast<JSString*>(thisValue.asCell());
         len = jsString->length();
     } else if (thisValue.isUndefinedOrNull()) {
         // CheckObjectCoercible
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to