Changeset 37681 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Oct 18, 2008, 4:08:12 PM (17 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2008-10-18 Darin Adler <Darin Adler>

Reviewed by Oliver Hunt.

Remove casts from JSValue* to derived classes, replacing them with
calls to inline casting functions. These functions are also a bit
better than aidrect cast because they also do a runtime assertion.

Removed use of 0 as for JSValue*, changing call sites to use a
noValue() function instead.

Move things needed by classes derived from JSValue out of the class,
since the classes won't be deriving from JSValue any more soon.

I did most of these changes by changing JSValue to not be JSValue* any
more, then fixing a lot of the compilation problems, then rolling out
the JSValue change.

1.011x as fast on SunSpider (presumably due to some of the Machine.cpp changes)

  • API/APICast.h: Removed unneeded forward declarations.
  • API/JSCallbackObject.h: Added an asCallbackObject function for casting.
  • API/JSCallbackObjectFunctions.h: (JSC::JSCallbackObject::asCallbackObject): Added. (JSC::JSCallbackObject::getOwnPropertySlot): Use asObject. (JSC::JSCallbackObject::call): Use noValue. (JSC::JSCallbackObject::staticValueGetter): Use asCallbackObject. (JSC::JSCallbackObject::staticFunctionGetter): Ditto. (JSC::JSCallbackObject::callbackGetter): Ditto.
  • JavaScriptCore.xcodeproj/project.pbxproj: Added RegExpMatchesArray.h.
  • VM/CTI.cpp: (JSC::CTI::asInteger): Added. For use casting a JSValue to an integer. (JSC::CTI::emitGetArg): Use asInteger. (JSC::CTI::emitGetPutArg): Ditto. (JSC::CTI::getConstantImmediateNumericArg): Ditto. Also use noValue. (JSC::CTI::emitInitRegister): Use asInteger. (JSC::CTI::getDeTaggedConstantImmediate): Ditto. (JSC::CTI::compileOpCallInitializeCallFrame): Ditto. (JSC::CTI::compileOpCall): Ditto. (JSC::CTI::compileOpStrictEq): Ditto. (JSC::CTI::privateCompileMainPass): Ditto. (JSC::CTI::privateCompileGetByIdProto): Ditto. (JSC::CTI::privateCompileGetByIdChain): Ditto. (JSC::CTI::privateCompilePutByIdTransition): Ditto.
  • VM/CTI.h: Rewrite the ARG-related macros to use C++ casts instead of C casts and get rid of some extra parentheses. Addd declaration of asInteger.
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitEqualityOp): Use asString. (JSC::CodeGenerator::emitLoad): Use noValue. (JSC::CodeGenerator::findScopedProperty): Change globalObject argument to JSObject* instead of JSValue*. (JSC::CodeGenerator::emitResolve): Remove unneeded cast. (JSC::CodeGenerator::emitGetScopedVar): Use asCell. (JSC::CodeGenerator::emitPutScopedVar): Ditto.
  • VM/CodeGenerator.h: Changed out argument of findScopedProperty. Also change the JSValueMap to use PtrHash explicitly instead of getting it from DefaultHash.
  • VM/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::toPrimitive): Use noValue.
  • VM/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::next): Ditto.
  • VM/Machine.cpp: (JSC::fastIsNumber): Moved isImmediate check here instead of checking for 0 inside Heap::isNumber. Use asCell and asNumberCell. (JSC::fastToInt32): Ditto. (JSC::fastToUInt32): Ditto. (JSC::jsLess): Use asString. (JSC::jsLessEq): Ditto. (JSC::jsAdd): Ditto. (JSC::jsTypeStringForValue): Use asObject. (JSC::jsIsObjectType): Ditto. (JSC::jsIsFunctionType): Ditto. (JSC::inlineResolveBase): Use noValue. (JSC::Machine::callEval): Use asString. Initialize result to undefined, not 0. (JSC::Machine::Machine): Remove unneeded casts to JSCell*. (JSC::Machine::throwException): Use asObject. (JSC::Machine::debug): Remove explicit calls to the DebuggerCallFrame constructor. (JSC::Machine::checkTimeout): Use noValue. (JSC::cachePrototypeChain): Use asObject. (JSC::Machine::tryCachePutByID): Use asCell. (JSC::Machine::tryCacheGetByID): Use aCell and asObject. (JSC::Machine::privateExecute): Use noValue, asCell, asObject, asString, asArray, asActivation, asFunction. Changed code that creates call frames for host functions to pass 0 for the function pointer -- the call frame needs a JSFunction* and a host function object is not one. This was caught by the assertions in the casting functions. Also remove some unneeded casts in cases where two values are compared. (JSC::Machine::retrieveLastCaller): Use noValue. (JSC::Machine::tryCTICachePutByID): Use asCell. (JSC::Machine::tryCTICacheGetByID): Use aCell and asObject. (JSC::setUpThrowTrampolineReturnAddress): Added this function to restore the PIC-branch-avoidance that was recently lost. (JSC::Machine::cti_op_add): Use asString. (JSC::Machine::cti_op_instanceof): Use asCell and asObject. (JSC::Machine::cti_op_call_JSFunction): Use asFunction. (JSC::Machine::cti_op_call_NotJSFunction): Changed code to pass 0 for the function pointer, since we don't have a JSFunction. Use asObject. (JSC::Machine::cti_op_tear_off_activation): Use asActivation. (JSC::Machine::cti_op_construct_JSConstruct): Use asFunction and asObject. (JSC::Machine::cti_op_construct_NotJSConstruct): use asObject. (JSC::Machine::cti_op_get_by_val): Use asArray and asString. (JSC::Machine::cti_op_resolve_func): Use asPointer; this helps prepare us for a situation where JSValue is not a pointer. (JSC::Machine::cti_op_put_by_val): Use asArray. (JSC::Machine::cti_op_put_by_val_array): Ditto. (JSC::Machine::cti_op_resolve_global): Use asGlobalObject. (JSC::Machine::cti_op_post_inc): Change VM_CHECK_EXCEPTION_2 to VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after that point. Also use asPointer. (JSC::Machine::cti_op_resolve_with_base): Use asPointer. (JSC::Machine::cti_op_post_dec): Change VM_CHECK_EXCEPTION_2 to VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after that point. Also use asPointer. (JSC::Machine::cti_op_call_eval): Use asObject, noValue, and change VM_CHECK_EXCEPTION_ARG to VM_THROW_EXCEPTION_AT_END. (JSC::Machine::cti_op_throw): Change return value to a JSValue*. (JSC::Machine::cti_op_in): Use asObject. (JSC::Machine::cti_op_switch_char): Use asString. (JSC::Machine::cti_op_switch_string): Ditto. (JSC::Machine::cti_op_put_getter): Use asObject. (JSC::Machine::cti_op_put_setter): Ditto. (JSC::Machine::cti_vm_throw): Change return value to a JSValue*. Use noValue.
  • VM/Machine.h: Change return values of both cti_op_throw and cti_vm_throw to JSValue*.
  • VM/Register.h: Remove nullJSValue, which is the same thing as noValue(). Also removed unneeded definition of JSValue.
  • kjs/ArgList.h: Removed unneeded definition of JSValue.
  • kjs/Arguments.h: (JSC::asArguments): Added.
  • kjs/ArrayPrototype.cpp: (JSC::getProperty): Use noValue. (JSC::arrayProtoFuncToString): Use asArray. (JSC::arrayProtoFuncToLocaleString): Ditto. (JSC::arrayProtoFuncConcat): Ditto. (JSC::arrayProtoFuncPop): Ditto. Also removed unneeded initialization of the result, which is set in both sides of the branch. (JSC::arrayProtoFuncPush): Ditto. (JSC::arrayProtoFuncShift): Removed unneeded initialization of the result, which is set in both sides of the branch. (JSC::arrayProtoFuncSort): Use asArray.
  • kjs/BooleanObject.h: (JSC::asBooleanObject): Added.
  • kjs/BooleanPrototype.cpp: (JSC::booleanProtoFuncToString): Use asBooleanObject. (JSC::booleanProtoFuncValueOf): Ditto.
  • kjs/CallData.cpp: (JSC::call): Use asObject and asFunction.
  • kjs/ConstructData.cpp: (JSC::construct): Ditto.
  • kjs/DateConstructor.cpp: (JSC::constructDate): Use asDateInstance.
  • kjs/DateInstance.h: (JSC::asDateInstance): Added.
  • kjs/DatePrototype.cpp: (JSC::dateProtoFuncToString): Use asDateInstance. (JSC::dateProtoFuncToUTCString): Ditto. (JSC::dateProtoFuncToDateString): Ditto. (JSC::dateProtoFuncToTimeString): Ditto. (JSC::dateProtoFuncToLocaleString): Ditto. (JSC::dateProtoFuncToLocaleDateString): Ditto. (JSC::dateProtoFuncToLocaleTimeString): Ditto. (JSC::dateProtoFuncValueOf): Ditto. (JSC::dateProtoFuncGetTime): Ditto. (JSC::dateProtoFuncGetFullYear): Ditto. (JSC::dateProtoFuncGetUTCFullYear): Ditto. (JSC::dateProtoFuncToGMTString): Ditto. (JSC::dateProtoFuncGetMonth): Ditto. (JSC::dateProtoFuncGetUTCMonth): Ditto. (JSC::dateProtoFuncGetDate): Ditto. (JSC::dateProtoFuncGetUTCDate): Ditto. (JSC::dateProtoFuncGetDay): Ditto. (JSC::dateProtoFuncGetUTCDay): Ditto. (JSC::dateProtoFuncGetHours): Ditto. (JSC::dateProtoFuncGetUTCHours): Ditto. (JSC::dateProtoFuncGetMinutes): Ditto. (JSC::dateProtoFuncGetUTCMinutes): Ditto. (JSC::dateProtoFuncGetSeconds): Ditto. (JSC::dateProtoFuncGetUTCSeconds): Ditto. (JSC::dateProtoFuncGetMilliSeconds): Ditto. (JSC::dateProtoFuncGetUTCMilliseconds): Ditto. (JSC::dateProtoFuncGetTimezoneOffset): Ditto. (JSC::dateProtoFuncSetTime): Ditto. (JSC::setNewValueFromTimeArgs): Ditto. (JSC::setNewValueFromDateArgs): Ditto. (JSC::dateProtoFuncSetYear): Ditto. (JSC::dateProtoFuncGetYear): Ditto.
  • kjs/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::thisObject): Use asObject. (JSC::DebuggerCallFrame::evaluate): Use noValue.
  • kjs/DebuggerCallFrame.h: Added a constructor that takes only a callFrame.
  • kjs/ExecState.h: (JSC::ExecState::clearException): Use noValue.
  • kjs/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): Use asFunction. (JSC::functionProtoFuncApply): Use asArguments and asArray.
  • kjs/GetterSetter.cpp: (JSC::GetterSetter::getPrimitiveNumber): Use noValue.
  • kjs/GetterSetter.h: (JSC::asGetterSetter): Added.
  • kjs/InternalFunction.cpp: (JSC::InternalFunction::name): Use asString.
  • kjs/InternalFunction.h: (JSC::asInternalFunction): Added.
  • kjs/JSActivation.cpp: (JSC::JSActivation::argumentsGetter): Use asActivation.
  • kjs/JSActivation.h: (JSC::asActivation): Added.
  • kjs/JSArray.cpp: (JSC::JSArray::putSlowCase): Use noValue. (JSC::JSArray::deleteProperty): Ditto. (JSC::JSArray::increaseVectorLength): Ditto. (JSC::JSArray::setLength): Ditto. (JSC::JSArray::pop): Ditto. (JSC::JSArray::sort): Ditto. (JSC::JSArray::compactForSorting): Ditto.
  • kjs/JSArray.h: (JSC::asArray): Added.
  • kjs/JSCell.cpp: (JSC::JSCell::getJSNumber): Use noValue.
  • kjs/JSCell.h: (JSC::asCell): Added. (JSC::JSValue::asCell): Changed to not preserve const. Given the wide use of JSValue* and JSCell*, it's not really useful to use const. (JSC::JSValue::isNumber): Use asValue. (JSC::JSValue::isString): Ditto. (JSC::JSValue::isGetterSetter): Ditto. (JSC::JSValue::isObject): Ditto. (JSC::JSValue::getNumber): Ditto. (JSC::JSValue::getString): Ditto. (JSC::JSValue::getObject): Ditto. (JSC::JSValue::getCallData): Ditto. (JSC::JSValue::getConstructData): Ditto. (JSC::JSValue::getUInt32): Ditto. (JSC::JSValue::getTruncatedInt32): Ditto. (JSC::JSValue::getTruncatedUInt32): Ditto. (JSC::JSValue::mark): Ditto. (JSC::JSValue::marked): Ditto. (JSC::JSValue::toPrimitive): Ditto. (JSC::JSValue::getPrimitiveNumber): Ditto. (JSC::JSValue::toBoolean): Ditto. (JSC::JSValue::toNumber): Ditto. (JSC::JSValue::toString): Ditto. (JSC::JSValue::toObject): Ditto. (JSC::JSValue::toThisObject): Ditto. (JSC::JSValue::needsThisConversion): Ditto. (JSC::JSValue::toThisString): Ditto. (JSC::JSValue::getJSNumber): Ditto.
  • kjs/JSFunction.cpp: (JSC::JSFunction::argumentsGetter): Use asFunction. (JSC::JSFunction::callerGetter): Ditto. (JSC::JSFunction::lengthGetter): Ditto. (JSC::JSFunction::construct): Use asObject.
  • kjs/JSFunction.h: (JSC::asFunction): Added.
  • kjs/JSGlobalObject.cpp: (JSC::lastInPrototypeChain): Use asObject.
  • kjs/JSGlobalObject.h: (JSC::asGlobalObject): Added. (JSC::ScopeChainNode::globalObject): Use asGlobalObject.
  • kjs/JSImmediate.h: Added noValue, asPointer, and makeValue functions. Use rawValue, makeValue, and noValue consistently instead of doing reinterpret_cast in various functions.
  • kjs/JSNumberCell.h: (JSC::asNumberCell): Added. (JSC::JSValue::uncheckedGetNumber): Use asValue and asNumberCell. (JSC::JSValue::toJSNumber): Use asValue.
  • kjs/JSObject.cpp: (JSC::JSObject::put): Use asObject and asGetterSetter. (JSC::callDefaultValueFunction): Use noValue. (JSC::JSObject::defineGetter): Use asGetterSetter. (JSC::JSObject::defineSetter): Ditto. (JSC::JSObject::lookupGetter): Ditto. Also use asObject. (JSC::JSObject::lookupSetter): Ditto. (JSC::JSObject::hasInstance): Use asObject. (JSC::JSObject::fillGetterPropertySlot): Use asGetterSetter.
  • kjs/JSObject.h: (JSC::JSObject::getDirect): Use noValue. (JSC::asObject): Added. (JSC::JSValue::isObject): Use asValue. (JSC::JSObject::get): Removed unneeded const_cast. (JSC::JSObject::getPropertySlot): Use asObject. (JSC::JSValue::get): Removed unneeded const_cast. Use asValue, asCell, and asObject. (JSC::JSValue::put): Ditto. (JSC::JSObject::allocatePropertyStorageInline): Fixed spelling of "oldPropertStorage".
  • kjs/JSString.cpp: (JSC::JSString::getOwnPropertySlot): Use asObject.
  • kjs/JSString.h: (JSC::asString): Added. (JSC::JSValue::toThisJSString): Use asValue.
  • kjs/JSValue.h: Make PreferredPrimitiveType a top level enum instead of a member of JSValue. Added an asValue function that returns this. Removed overload of asCell for const. Use asValue instead of getting right at this.
  • kjs/ObjectPrototype.cpp: (JSC::objectProtoFuncIsPrototypeOf): Use asObject. (JSC::objectProtoFuncDefineGetter): Ditto. (JSC::objectProtoFuncDefineSetter): Ditto.
  • kjs/PropertySlot.h: (JSC::PropertySlot::PropertySlot): Take a const JSValue* so the callers don't have to worry about const. (JSC::PropertySlot::clearBase): Use noValue. (JSC::PropertySlot::clearValue): Ditto.
  • kjs/RegExpConstructor.cpp: (JSC::regExpConstructorDollar1): Use asRegExpConstructor. (JSC::regExpConstructorDollar2): Ditto. (JSC::regExpConstructorDollar3): Ditto. (JSC::regExpConstructorDollar4): Ditto. (JSC::regExpConstructorDollar5): Ditto. (JSC::regExpConstructorDollar6): Ditto. (JSC::regExpConstructorDollar7): Ditto. (JSC::regExpConstructorDollar8): Ditto. (JSC::regExpConstructorDollar9): Ditto. (JSC::regExpConstructorInput): Ditto. (JSC::regExpConstructorMultiline): Ditto. (JSC::regExpConstructorLastMatch): Ditto. (JSC::regExpConstructorLastParen): Ditto. (JSC::regExpConstructorLeftContext): Ditto. (JSC::regExpConstructorRightContext): Ditto. (JSC::setRegExpConstructorInput): Ditto. (JSC::setRegExpConstructorMultiline): Ditto. (JSC::constructRegExp): Use asObject.
  • kjs/RegExpConstructor.h: (JSC::asRegExpConstructor): Added.
  • kjs/RegExpObject.cpp: (JSC::regExpObjectGlobal): Use asRegExpObject. (JSC::regExpObjectIgnoreCase): Ditto. (JSC::regExpObjectMultiline): Ditto. (JSC::regExpObjectSource): Ditto. (JSC::regExpObjectLastIndex): Ditto. (JSC::setRegExpObjectLastIndex): Ditto. (JSC::callRegExpObject): Ditto.
  • kjs/RegExpObject.h: (JSC::asRegExpObject): Added.
  • kjs/RegExpPrototype.cpp: (JSC::regExpProtoFuncTest): Use asRegExpObject. (JSC::regExpProtoFuncExec): Ditto. (JSC::regExpProtoFuncCompile): Ditto. (JSC::regExpProtoFuncToString): Ditto.
  • kjs/StringObject.h: (JSC::StringObject::internalValue): Use asString. (JSC::asStringObject): Added.
  • kjs/StringPrototype.cpp: (JSC::stringProtoFuncReplace): Use asRegExpObject. (JSC::stringProtoFuncToString): Ue asStringObject. (JSC::stringProtoFuncMatch): Use asRegExpObject. (JSC::stringProtoFuncSearch): Ditto. (JSC::stringProtoFuncSplit): Ditto.
  • kjs/StructureID.cpp: (JSC::StructureID::getEnumerablePropertyNames): Use asObject. (JSC::StructureID::createCachedPrototypeChain): Ditto. (JSC::StructureIDChain::StructureIDChain): Use asCell and asObject.
  • kjs/collector.h: (JSC::Heap::isNumber): Removed null handling. This can only be called on valid cells. (JSC::Heap::cellBlock): Removed overload for const and non-const. Whether the JSCell* is const or not really should have no effect on whether you can modify the collector block it's in.
  • kjs/interpreter.cpp: (JSC::Interpreter::evaluate): Use noValue and noObject.
  • kjs/nodes.cpp: (JSC::FunctionCallResolveNode::emitCode): Use JSObject for the global object rather than JSValue. (JSC::PostfixResolveNode::emitCode): Ditto. (JSC::PrefixResolveNode::emitCode): Ditto. (JSC::ReadModifyResolveNode::emitCode): Ditto. (JSC::AssignResolveNode::emitCode): Ditto.
  • kjs/operations.h: (JSC::equalSlowCaseInline): Use asString, asCell, asNumberCell, (JSC::strictEqualSlowCaseInline): Ditto.

WebCore:

2008-10-18 Darin Adler <Darin Adler>

Reviewed by Oliver Hunt.

Update for change to make PreferredPrimitiveType no longer
a member of JSValue.

  • bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::defaultValue): Removed JSValue:: prefix.
  • bridge/jni/jni_instance.cpp: (JavaInstance::defaultValue): Ditto.
  • bridge/objc/objc_instance.mm: (ObjcInstance::defaultValue): Ditto.
  • bridge/qt/qt_instance.cpp: (JSC::Bindings::QtInstance::defaultValue): Ditto.
  • bridge/runtime.h: Ditto. Also removed typedef.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CTI.cpp

    r37678 r37681  
    178178}
    179179
     180inline uintptr_t CTI::asInteger(JSValue* value)
     181{
     182    return reinterpret_cast<uintptr_t>(value);
     183}
     184
    180185// get arg puts an arg from the SF register array into a h/w register
    181186ALWAYS_INLINE void CTI::emitGetArg(int src, X86Assembler::RegisterID dst)
     
    184189    if (isConstant(src)) {
    185190        JSValue* js = getConstant(m_callFrame, src);
    186         m_jit.movl_i32r(reinterpret_cast<unsigned>(js), dst);
     191        m_jit.movl_i32r(asInteger(js), dst);
    187192    } else
    188193        m_jit.movl_mr(src * sizeof(Register), X86::edi, dst);
     
    194199    if (isConstant(src)) {
    195200        JSValue* js = getConstant(m_callFrame, src);
    196         m_jit.movl_i32m(reinterpret_cast<unsigned>(js), offset + sizeof(void*), X86::esp);
     201        m_jit.movl_i32m(asInteger(js), offset + sizeof(void*), X86::esp);
    197202    } else {
    198203        m_jit.movl_mr(src * sizeof(Register), X86::edi, scratch);
     
    216221    if (isConstant(src)) {
    217222        JSValue* js = getConstant(m_callFrame, src);
    218         return JSImmediate::isNumber(js) ? js : 0;
     223        return JSImmediate::isNumber(js) ? js : noValue();
    219224    }
    220     return 0;
     225    return noValue();
    221226}
    222227
     
    254259ALWAYS_INLINE void CTI::emitInitRegister(unsigned dst)
    255260{
    256     m_jit.movl_i32m(reinterpret_cast<unsigned>(jsUndefined()), dst * sizeof(Register), X86::edi);
     261    m_jit.movl_i32m(asInteger(jsUndefined()), dst * sizeof(Register), X86::edi);
    257262    // FIXME: #ifndef NDEBUG, Write the correct m_type to the register.
    258263}
     
    443448{
    444449    ASSERT(JSImmediate::isNumber(imm));
    445     return reinterpret_cast<unsigned>(imm) & ~JSImmediate::TagBitTypeInteger;
     450    return asInteger(imm) & ~JSImmediate::TagBitTypeInteger;
    446451}
    447452
     
    534539    emitGetArg(callee, X86::ecx); // Load callee JSFunction into ecx
    535540    m_jit.movl_rm(X86::eax, RegisterFile::CodeBlock * static_cast<int>(sizeof(Register)), X86::edx); // callee CodeBlock was returned in eax
    536     m_jit.movl_i32m(reinterpret_cast<unsigned>(nullJSValue), RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register)), X86::edx);
     541    m_jit.movl_i32m(asInteger(noValue()), RegisterFile::OptionalCalleeArguments * static_cast<int>(sizeof(Register)), X86::edx);
    537542    m_jit.movl_rm(X86::ecx, RegisterFile::Callee * static_cast<int>(sizeof(Register)), X86::edx);
    538543
     
    573578        if (thisVal == missingThisObjectMarker()) {
    574579            // FIXME: should this be loaded dynamically off m_callFrame?
    575             m_jit.movl_i32m(reinterpret_cast<unsigned>(m_callFrame->globalThisValue()), firstArg * sizeof(Register), X86::edi);
     580            m_jit.movl_i32m(asInteger(m_callFrame->globalThisValue()), firstArg * sizeof(Register), X86::edi);
    576581        } else {
    577582            emitGetArg(thisVal, X86::eax);
     
    587592
    588593        emitCTICall(i, Machine::cti_op_call_eval);
    589         m_jit.cmpl_i32r(reinterpret_cast<unsigned>(JSImmediate::impossibleValue()), X86::eax);
     594        m_jit.cmpl_i32r(asInteger(JSImmediate::impossibleValue()), X86::eax);
    590595        wasEval = m_jit.emitUnlinkedJne();
    591596    }
     
    594599    // This deliberately leaves the callee in ecx, used when setting up the stack frame below
    595600    emitGetArg(callee, X86::ecx);
    596     m_jit.cmpl_i32r(reinterpret_cast<unsigned>(JSImmediate::impossibleValue()), X86::ecx);
     601    m_jit.cmpl_i32r(asInteger(JSImmediate::impossibleValue()), X86::ecx);
    597602    X86Assembler::JmpDst addressOfLinkedFunctionCheck = m_jit.label();
    598603    m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJne(), i));
     
    621626    // Fast version of stack frame initialization, directly relative to edi.
    622627    // Note that this omits to set up RegisterFile::CodeBlock, which is set in the callee
    623     m_jit.movl_i32m(reinterpret_cast<unsigned>(nullJSValue), (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register)), X86::edi);
     628    m_jit.movl_i32m(asInteger(noValue()), (registerOffset + RegisterFile::OptionalCalleeArguments) * static_cast<int>(sizeof(Register)), X86::edi);
    624629    m_jit.movl_rm(X86::ecx, (registerOffset + RegisterFile::Callee) * static_cast<int>(sizeof(Register)), X86::edi);
    625630    m_jit.movl_mr(OBJECT_OFFSET(JSFunction, m_scopeChain) + OBJECT_OFFSET(ScopeChain, m_node), X86::ecx, X86::edx); // newScopeChain
     
    671676    m_jit.setz_r(X86::ecx);
    672677    m_jit.movzbl_rr(X86::ecx, X86::ecx); // ecx is now 1 if edx was nonimmediate
    673     m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::edx);
     678    m_jit.cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::edx);
    674679    m_jit.sete_r(X86::edx);
    675680    m_jit.movzbl_rr(X86::edx, X86::edx); // edx is now 1 if edx was the 0 immediate
     
    678683    m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJnz(), i));
    679684
    680     m_jit.movl_i32r(reinterpret_cast<uint32_t>(jsBoolean(negated)), X86::eax);
     685    m_jit.movl_i32r(asInteger(jsBoolean(negated)), X86::eax);
    681686
    682687    X86Assembler::JmpSrc firstWasNotImmediate = m_jit.emitUnlinkedJmp();
     
    684689    m_jit.link(secondNotImmediate, m_jit.label());
    685690    // check that eax is not the zero immediate (we know it must be immediate)
    686     m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::eax);
     691    m_jit.cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::eax);
    687692    m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJe(), i));
    688693
    689     m_jit.movl_i32r(reinterpret_cast<uint32_t>(jsBoolean(negated)), X86::eax);
     694    m_jit.movl_i32r(asInteger(jsBoolean(negated)), X86::eax);
    690695
    691696    m_jit.link(bothWereImmediates, m_jit.label());
     
    955960            unsigned src = instruction[i + 2].u.operand;
    956961            if (isConstant(src))
    957                 m_jit.movl_i32r(reinterpret_cast<unsigned>(getConstant(m_callFrame, src)), X86::edx);
     962                m_jit.movl_i32r(asInteger(getConstant(m_callFrame, src)), X86::edx);
    958963            else
    959964                emitGetArg(src, X86::edx);
     
    10381043                emitGetArg(instruction[i + 1].u.operand, X86::edx);
    10391044                emitJumpSlowCaseIfNotImmNum(X86::edx, i);
    1040                 m_jit.cmpl_i32r(reinterpret_cast<unsigned>(src2imm), X86::edx);
     1045                m_jit.cmpl_i32r(asInteger(src2imm), X86::edx);
    10411046                m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJl(), i + 3 + target));
    10421047            } else {
     
    10591064                emitGetArg(instruction[i + 1].u.operand, X86::edx);
    10601065                emitJumpSlowCaseIfNotImmNum(X86::edx, i);
    1061                 m_jit.cmpl_i32r(reinterpret_cast<unsigned>(src2imm), X86::edx);
     1066                m_jit.cmpl_i32r(asInteger(src2imm), X86::edx);
    10621067                m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJle(), i + 3 + target));
    10631068            } else {
     
    11711176
    11721177            // optimistically load true result
    1173             m_jit.movl_i32r(reinterpret_cast<int32_t>(jsBoolean(true)), X86::eax);
     1178            m_jit.movl_i32r(asInteger(jsBoolean(true)), X86::eax);
    11741179
    11751180            X86Assembler::JmpDst loop = m_jit.label();
     
    11821187            X86Assembler::JmpSrc exit = m_jit.emitUnlinkedJe();
    11831188
    1184             m_jit.cmpl_i32r(reinterpret_cast<int32_t>(jsNull()), X86::ecx);
     1189            m_jit.cmpl_i32r(asInteger(jsNull()), X86::ecx);
    11851190            X86Assembler::JmpSrc goToLoop = m_jit.emitUnlinkedJne();
    11861191            m_jit.link(goToLoop, loop);
    11871192
    1188             m_jit.movl_i32r(reinterpret_cast<int32_t>(jsBoolean(false)), X86::eax);
     1193            m_jit.movl_i32r(asInteger(jsBoolean(false)), X86::eax);
    11891194
    11901195            m_jit.link(exit, m_jit.label());
     
    12501255        case op_get_global_var: {
    12511256            JSVariableObject* globalObject = static_cast<JSVariableObject*>(instruction[i + 2].u.jsCell);
    1252             m_jit.movl_i32r(reinterpret_cast<unsigned>(globalObject), X86::eax);
     1257            m_jit.movl_i32r(asInteger(globalObject), X86::eax);
    12531258            emitGetVariableObjectRegister(X86::eax, instruction[i + 3].u.operand, X86::eax);
    12541259            emitPutResult(instruction[i + 1].u.operand, X86::eax);
     
    12581263        case op_put_global_var: {
    12591264            JSVariableObject* globalObject = static_cast<JSVariableObject*>(instruction[i + 1].u.jsCell);
    1260             m_jit.movl_i32r(reinterpret_cast<unsigned>(globalObject), X86::eax);
     1265            m_jit.movl_i32r(asInteger(globalObject), X86::eax);
    12611266            emitGetArg(instruction[i + 3].u.operand, X86::edx);
    12621267            emitPutVariableObjectRegister(X86::edx, X86::eax, instruction[i + 2].u.operand);
     
    14441449            emitGetArg(instruction[i + 1].u.operand, X86::eax);
    14451450
    1446             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::eax);
     1451            m_jit.cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::eax);
    14471452            X86Assembler::JmpSrc isZero = m_jit.emitUnlinkedJe();
    14481453            m_jit.testl_i32r(JSImmediate::TagBitTypeInteger, X86::eax);
    14491454            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJne(), i + 2 + target));
    14501455
    1451             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::trueImmediate()), X86::eax);
     1456            m_jit.cmpl_i32r(asInteger(JSImmediate::trueImmediate()), X86::eax);
    14521457            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJe(), i + 2 + target));
    1453             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::falseImmediate()), X86::eax);
     1458            m_jit.cmpl_i32r(asInteger(JSImmediate::falseImmediate()), X86::eax);
    14541459            m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJne(), i));
    14551460
     
    14841489        case op_resolve_global: {
    14851490            // Fast case
    1486             unsigned globalObject = reinterpret_cast<unsigned>(instruction[i + 2].u.jsCell);
     1491            unsigned globalObject = asInteger(instruction[i + 2].u.jsCell);
    14871492            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
    14881493            void* structureIDAddr = reinterpret_cast<void*>(instruction + i + 4);
     
    15321537                emitGetArg(instruction[i + 1].u.operand, X86::edx);
    15331538                emitJumpSlowCaseIfNotImmNum(X86::edx, i);
    1534                 m_jit.cmpl_i32r(reinterpret_cast<unsigned>(src2imm), X86::edx);
     1539                m_jit.cmpl_i32r(asInteger(src2imm), X86::edx);
    15351540                m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJge(), i + 3 + target));
    15361541            } else {
     
    15591564            emitGetArg(instruction[i + 1].u.operand, X86::eax);
    15601565
    1561             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::eax);
     1566            m_jit.cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::eax);
    15621567            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJe(), i + 2 + target));
    15631568            m_jit.testl_i32r(JSImmediate::TagBitTypeInteger, X86::eax);
    15641569            X86Assembler::JmpSrc isNonZero = m_jit.emitUnlinkedJne();
    15651570
    1566             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::falseImmediate()), X86::eax);
     1571            m_jit.cmpl_i32r(asInteger(JSImmediate::falseImmediate()), X86::eax);
    15671572            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJe(), i + 2 + target));
    1568             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::trueImmediate()), X86::eax);
     1573            m_jit.cmpl_i32r(asInteger(JSImmediate::trueImmediate()), X86::eax);
    15691574            m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJne(), i));
    15701575
     
    15871592        case op_unexpected_load: {
    15881593            JSValue* v = m_codeBlock->unexpectedConstants[instruction[i + 2].u.operand];
    1589             m_jit.movl_i32r(reinterpret_cast<unsigned>(v), X86::eax);
     1594            m_jit.movl_i32r(asInteger(v), X86::eax);
    15901595            emitPutResult(instruction[i + 1].u.operand);
    15911596            i += 3;
     
    16401645                emitGetArg(src2, X86::eax);
    16411646                emitJumpSlowCaseIfNotImmNum(X86::eax, i);
    1642                 m_jit.andl_i32r(reinterpret_cast<unsigned>(value), X86::eax); // FIXME: make it more obvious this is relying on the format of JSImmediate
     1647                m_jit.andl_i32r(asInteger(value), X86::eax); // FIXME: make it more obvious this is relying on the format of JSImmediate
    16431648                emitPutResult(dst);
    16441649            } else if (JSValue* value = getConstantImmediateNumericArg(src2)) {
    16451650                emitGetArg(src1, X86::eax);
    16461651                emitJumpSlowCaseIfNotImmNum(X86::eax, i);
    1647                 m_jit.andl_i32r(reinterpret_cast<unsigned>(value), X86::eax);
     1652                m_jit.andl_i32r(asInteger(value), X86::eax);
    16481653                emitPutResult(dst);
    16491654            } else {
     
    17131718            emitGetArg(instruction[i + 1].u.operand, X86::eax);
    17141719
    1715             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::zeroImmediate()), X86::eax);
     1720            m_jit.cmpl_i32r(asInteger(JSImmediate::zeroImmediate()), X86::eax);
    17161721            X86Assembler::JmpSrc isZero = m_jit.emitUnlinkedJe();
    17171722            m_jit.testl_i32r(JSImmediate::TagBitTypeInteger, X86::eax);
    17181723            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJne(), i + 2 + target));
    17191724
    1720             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::trueImmediate()), X86::eax);
     1725            m_jit.cmpl_i32r(asInteger(JSImmediate::trueImmediate()), X86::eax);
    17211726            m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJe(), i + 2 + target));
    1722             m_jit.cmpl_i32r(reinterpret_cast<uint32_t>(JSImmediate::falseImmediate()), X86::eax);
     1727            m_jit.cmpl_i32r(asInteger(JSImmediate::falseImmediate()), X86::eax);
    17231728            m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJne(), i));
    17241729
     
    19841989            JSValue* message = m_codeBlock->unexpectedConstants[instruction[i + 3].u.operand];
    19851990            emitPutArgConstant(instruction[i + 2].u.operand, 0);
    1986             emitPutArgConstant(reinterpret_cast<unsigned>(message), 4);
     1991            emitPutArgConstant(asInteger(message), 4);
    19871992            emitPutArgConstant(m_codeBlock->lineNumberForVPC(&instruction[i]), 8);
    19881993            emitCTICall(i, Machine::cti_op_new_error);
     
    28462851    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a StructureID that is
    28472852    // referencing the prototype object - let's speculatively load it's table nice and early!)
    2848     JSObject* protoObject = static_cast<JSObject*>(structureID->prototypeForLookup(m_callFrame));
     2853    JSObject* protoObject = asObject(structureID->prototypeForLookup(m_callFrame));
    28492854    PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage;
    28502855    m_jit.movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx);
     
    28892894    // The prototype object definitely exists (if this stub exists the CodeBlock is referencing a StructureID that is
    28902895    // referencing the prototype object - let's speculatively load it's table nice and early!)
    2891     JSObject* protoObject = static_cast<JSObject*>(structureID->prototypeForLookup(m_callFrame));
     2896    JSObject* protoObject = asObject(structureID->prototypeForLookup(m_callFrame));
    28922897    PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage;
    28932898    m_jit.movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx);
     
    29382943    JSObject* protoObject = 0;
    29392944    for (unsigned i = 0; i<count; ++i) {
    2940         protoObject = static_cast<JSObject*>(currStructureID->prototypeForLookup(m_callFrame));
     2945        protoObject = asObject(currStructureID->prototypeForLookup(m_callFrame));
    29412946        currStructureID = chainEntries[i].get();
    29422947
     
    30253030    for (RefPtr<StructureID>* it = sIDC->head(); *it; ++it) {
    30263031        // null check the prototype
    3027         m_jit.cmpl_i32r(reinterpret_cast<intptr_t> (jsNull()), X86::ecx);
     3032        m_jit.cmpl_i32r(asInteger(jsNull()), X86::ecx);
    30283033        successCases.append(m_jit.emitUnlinkedJe());
    30293034
Note: See TracChangeset for help on using the changeset viewer.