Ignore:
Timestamp:
Apr 5, 2012, 1:09:33 PM (13 years ago)
Author:
[email protected]
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 JavaScriptCore.
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r110657 r113363  
    506506    JSObject* thisObject = exec->hostThisValue().toThisObject(exec);
    507507    JSObject* unwrappedObject = thisObject->unwrappedObject();
    508     if (!unwrappedObject->isGlobalObject() || static_cast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
     508    if (!unwrappedObject->isGlobalObject() || jsCast<JSGlobalObject*>(unwrappedObject)->evalFunction() != exec->callee())
    509509        return throwVMError(exec, createEvalError(exec, "The \"this\" value passed to eval must be the global object from which eval originated"));
    510510
     
    526526
    527527    EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false);
    528     JSObject* error = eval->compile(exec, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain());
     528    JSObject* error = eval->compile(exec, jsCast<JSGlobalObject*>(unwrappedObject)->globalScopeChain());
    529529    if (error)
    530530        return throwVMError(exec, error);
    531531
    532     return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain()));
     532    return JSValue::encode(exec->interpreter()->execute(eval, exec, thisObject, jsCast<JSGlobalObject*>(unwrappedObject)->globalScopeChain()));
    533533}
    534534
Note: See TracChangeset for help on using the changeset viewer.