Commit 5a49442f authored by darin@apple.com's avatar darin@apple.com

JavaScriptCore:

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

        Reviewed by Oliver Hunt.

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

        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.exp: Updated.

        * 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@apple.com>

        Reviewed by Oliver Hunt.

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

        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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9c9096fd
......@@ -29,13 +29,6 @@
#include "ustring.h"
#include "ExecState.h"
namespace JSC {
class ExecState;
class JSValue;
class JSObject;
class PropertyNameArray;
}
typedef const struct OpaqueJSContextGroup* JSContextGroupRef;
typedef const struct OpaqueJSContext* JSContextRef;
typedef struct OpaqueJSContext* JSGlobalContextRef;
......
......@@ -77,6 +77,8 @@ private:
void init(ExecState*);
static JSCallbackObject* asCallbackObject(JSValue*);
static JSValue* call(ExecState*, JSObject* functionObject, JSValue* thisValue, const ArgList&);
static JSObject* construct(ExecState*, JSObject* constructor, const ArgList&);
......
......@@ -39,6 +39,13 @@
namespace JSC {
template <class Base>
inline JSCallbackObject<Base>* JSCallbackObject<Base>::asCallbackObject(JSValue* value)
{
ASSERT(asObject(value)->inherits(&info));
return static_cast<JSCallbackObject*>(asObject(value));
}
template <class Base>
JSCallbackObject<Base>::JSCallbackObject(ExecState* exec, PassRefPtr<StructureID> structure, JSClassRef jsClass, void* data)
: Base(structure)
......@@ -123,7 +130,7 @@ bool JSCallbackObject<Base>::getOwnPropertySlot(ExecState* exec, const Identifie
// cache the value so we don't have to compute it again
// FIXME: This violates the PropertySlot design a little bit.
// We should either use this optimization everywhere, or nowhere.
slot.setCustom(reinterpret_cast<JSObject*>(toJS(value)), cachedValueGetter);
slot.setCustom(asObject(toJS(value)), cachedValueGetter);
return true;
}
}
......@@ -318,7 +325,7 @@ JSValue* JSCallbackObject<Base>::call(ExecState* exec, JSObject* functionObject,
}
ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here
return 0;
return noValue();
}
template <class Base>
......@@ -433,8 +440,7 @@ JSValue* JSCallbackObject<Base>::cachedValueGetter(ExecState*, const Identifier&
template <class Base>
JSValue* JSCallbackObject<Base>::staticValueGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
ASSERT(slot.slotBase()->isObject(&JSCallbackObject::info));
JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase());
JSCallbackObject* thisObj = asCallbackObject(slot.slotBase());
JSObjectRef thisRef = toRef(thisObj);
RefPtr<OpaqueJSString> propertyNameRef;
......@@ -456,8 +462,7 @@ JSValue* JSCallbackObject<Base>::staticValueGetter(ExecState* exec, const Identi
template <class Base>
JSValue* JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
ASSERT(slot.slotBase()->isObject(&JSCallbackObject::info));
JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase());
JSCallbackObject* thisObj = asCallbackObject(slot.slotBase());
// Check for cached or override property.
PropertySlot slot2(thisObj);
......@@ -482,8 +487,7 @@ JSValue* JSCallbackObject<Base>::staticFunctionGetter(ExecState* exec, const Ide
template <class Base>
JSValue* JSCallbackObject<Base>::callbackGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
{
ASSERT(slot.slotBase()->isObject(&JSCallbackObject::info));
JSCallbackObject* thisObj = static_cast<JSCallbackObject*>(slot.slotBase());
JSCallbackObject* thisObj = asCallbackObject(slot.slotBase());
JSObjectRef thisRef = toRef(thisObj);
RefPtr<OpaqueJSString> propertyNameRef;
......
2008-10-18 Darin Adler <darin@apple.com>
Reviewed by Oliver Hunt.
- first step of https://bugs.webkit.org/show_bug.cgi?id=21732
improve performance by eliminating JSValue as a base class for JSCell
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.exp: Updated.
* 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.
2008-10-18 Cameron Zwarich <zwarich@apple.com>
Reviewed by Oliver Hunt.
......
......@@ -337,7 +337,7 @@ __ZNK3JSC7UString8toUInt32EPb
__ZNK3JSC7UString8toUInt32EPbb
__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj
__ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_7JSValue22PreferredPrimitiveTypeE
__ZNK3JSC8JSObject12defaultValueEPNS_9ExecStateENS_22PreferredPrimitiveTypeE
__ZNK3JSC8JSObject12toThisObjectEPNS_9ExecStateE
__ZNK3JSC8JSObject14toGlobalObjectEPNS_9ExecStateE
__ZNK3JSC8JSObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj
......
......@@ -554,6 +554,7 @@
93AA4F770957251F0084B3A7 /* AlwaysInline.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = AlwaysInline.h; sourceTree = "<group>"; tabWidth = 8; };
93ADFCE60CCBD7AC00D30B08 /* JSArray.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArray.cpp; sourceTree = "<group>"; };
93B6A0DE0AA64DA40076DE27 /* GetPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GetPtr.h; sourceTree = "<group>"; };
93CEDDFB0EA91EE600258EBE /* RegExpMatchesArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExpMatchesArray.h; sourceTree = "<group>"; };
93E26BD308B1514100F85226 /* pcre_xclass.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pcre_xclass.cpp; path = pcre/pcre_xclass.cpp; sourceTree = "<group>"; tabWidth = 8; };
93E26BE508B1517100F85226 /* pcre_internal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = pcre_internal.h; path = pcre/pcre_internal.h; sourceTree = "<group>"; tabWidth = 8; };
93E26BFC08B151D400F85226 /* ucpinternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = ucpinternal.h; path = pcre/ucpinternal.h; sourceTree = "<group>"; tabWidth = 8; };
......@@ -1203,6 +1204,7 @@
F692A87E0255597D01FF60F7 /* regexp.h */,
BCD202BD0E1706A7002C7E82 /* RegExpConstructor.cpp */,
BCD202BE0E1706A7002C7E82 /* RegExpConstructor.h */,
93CEDDFB0EA91EE600258EBE /* RegExpMatchesArray.h */,
F692A87B0255597D01FF60F7 /* RegExpObject.cpp */,
F692A87C0255597D01FF60F7 /* RegExpObject.h */,
BCD202BF0E1706A7002C7E82 /* RegExpPrototype.cpp */,
......
......@@ -177,13 +177,18 @@ ALWAYS_INLINE JSValue* CTI::getConstant(CallFrame* callFrame, int src)
return m_codeBlock->constantRegisters[src - m_codeBlock->numVars].jsValue(callFrame);
}
inline uintptr_t CTI::asInteger(JSValue* value)
{
return reinterpret_cast<uintptr_t>(value);
}
// get arg puts an arg from the SF register array into a h/w register
ALWAYS_INLINE void CTI::emitGetArg(int src, X86Assembler::RegisterID dst)
{
// TODO: we want to reuse values that are already in registers if we can - add a register allocator!
if (isConstant(src)) {
JSValue* js = getConstant(m_callFrame, src);
m_jit.movl_i32r(reinterpret_cast<unsigned>(js), dst);
m_jit.movl_i32r(asInteger(js), dst);
} else
m_jit.movl_mr(src * sizeof(Register), X86::edi, dst);
}
......@@ -193,7 +198,7 @@ ALWAYS_INLINE void CTI::emitGetPutArg(unsigned src, unsigned offset, X86Assemble
{
if (isConstant(src)) {
JSValue* js = getConstant(m_callFrame, src);
m_jit.movl_i32m(reinterpret_cast<unsigned>(js), offset + sizeof(void*), X86::esp);
m_jit.movl_i32m(asInteger(js), offset + sizeof(void*), X86::esp);
} else {
m_jit.movl_mr(src * sizeof(Register), X86::edi, scratch);
m_jit.movl_rm(scratch, offset + sizeof(void*), X86::esp);
......@@ -215,9 +220,9 @@ ALWAYS_INLINE JSValue* CTI::getConstantImmediateNumericArg(unsigned src)
{
if (isConstant(src)) {
JSValue* js = getConstant(m_callFrame, src);
return JSImmediate::isNumber(js) ? js : 0;
return JSImmediate::isNumber(js) ? js : noValue();
}
return 0;
return noValue();
}
ALWAYS_INLINE void CTI::emitPutCTIParam(void* value, unsigned name)
......@@ -253,7 +258,7 @@ ALWAYS_INLINE void CTI::emitPutResult(unsigned dst, X86Assembler::RegisterID fro
ALWAYS_INLINE void CTI::emitInitRegister(unsigned dst)
{
m_jit.movl_i32m(reinterpret_cast<unsigned>(jsUndefined()), dst * sizeof(Register), X86::edi);
m_jit.movl_i32m(asInteger(jsUndefined()), dst * sizeof(Register), X86::edi);
// FIXME: #ifndef NDEBUG, Write the correct m_type to the register.
}
......@@ -442,7 +447,7 @@ ALWAYS_INLINE void CTI::emitJumpSlowCaseIfNotImmNums(X86Assembler::RegisterID re
ALWAYS_INLINE unsigned CTI::getDeTaggedConstantImmediate(JSValue* imm)
{
ASSERT(JSImmediate::isNumber(imm));
return reinterpret_cast<unsigned>(imm) & ~JSImmediate::TagBitTypeInteger;
return asInteger(imm) & ~JSImmediate::TagBitTypeInteger;
}
ALWAYS_INLINE void CTI::emitFastArithDeTagImmediate(X86Assembler::RegisterID reg)
......@@ -533,7 +538,7 @@ void CTI::compileOpCallInitializeCallFrame(unsigned callee, unsigned argCount)
{
emitGetArg(callee, X86::ecx); // Load callee JSFunction into ecx