source: webkit/trunk/JavaScriptCore/runtime/JSObject.h@ 39670

Last change on this file since 39670 was 39670, checked in by [email protected], 16 years ago

JavaScriptCore:

2009-01-05 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Replace all uses of JSValue* with a new smart pointer type, JSValuePtr.


A JavaScript value may be a heap object or boxed primitive, represented by a
pointer, or may be an unboxed immediate value, such as an integer. Since a
value may dynamically need to contain either a pointer value or an immediate,
we encode immediates as pointer values (since all valid JSCell pointers are
allocated at alligned addesses, unaligned addresses are available to encode
immediates). As such all JavaScript values are represented using a JSValue*.

This implementation is encumbered by a number of constraints. It ties the
JSValue representation to the size of pointer on the platform, which, for
example, means that we currently can represent different ranges of integers
as immediates on x86 and x86-64. It also prevents us from overloading the
to-boolean conversion used to test for noValue() - effectively forcing us
to represent noValue() as 0. This would potentially be problematic were we
to wish to encode integer values differently (e.g. were we to use the v8
encoding, where pointers are tagged with 1 and integers with 0, then the
immediate integer 0 would conflict with noValue()).

This patch replaces all usage of JSValue* with a new class, JSValuePtr,
which encapsulates the pointer. JSValuePtr maintains the same interface as
JSValue*, overloading operator-> and operator bool such that previous
operations in the code on variables of type JSValue* are still supported.

In order to provide a ProtectPtr<> type with support for the new value
representation (without using the internal JSValue type directly), a new
ProtectJSValuePtr type has been added, equivalent to the previous type
ProtectPtr<JSValue>.

This patch is likely the first in a sequence of three changes. With the
value now encapsulated it will likely make sense to migrate the functionality
from JSValue into JSValuePtr, such that the internal pointer representation
need not be exposed. Through migrating the functionality to the wrapper
class the existing JSValue should be rendered redundant, and the class is
likely to be removed (the JSValuePtr now wrapping a pointer to a JSCell).
At this stage it will likely make sense to rename JSValuePtr to JSValue.

https://bugs.webkit.org/show_bug.cgi?id=23114

  • API/APICast.h: (toJS): (toRef):
  • API/JSBase.cpp: (JSEvaluateScript):
  • API/JSCallbackConstructor.h: (JSC::JSCallbackConstructor::createStructure):
  • API/JSCallbackFunction.cpp: (JSC::JSCallbackFunction::call):
  • API/JSCallbackFunction.h: (JSC::JSCallbackFunction::createStructure):
  • API/JSCallbackObject.h: (JSC::JSCallbackObject::createStructure):
  • API/JSCallbackObjectFunctions.h: (JSC::::asCallbackObject): (JSC::::put): (JSC::::hasInstance): (JSC::::call): (JSC::::staticValueGetter): (JSC::::staticFunctionGetter): (JSC::::callbackGetter):
  • API/JSContextRef.cpp:
  • API/JSObjectRef.cpp: (JSObjectMakeConstructor): (JSObjectSetPrototype): (JSObjectGetProperty): (JSObjectSetProperty): (JSObjectGetPropertyAtIndex): (JSObjectSetPropertyAtIndex):
  • API/JSValueRef.cpp: (JSValueGetType): (JSValueIsUndefined): (JSValueIsNull): (JSValueIsBoolean): (JSValueIsNumber): (JSValueIsString): (JSValueIsObject): (JSValueIsObjectOfClass): (JSValueIsEqual): (JSValueIsStrictEqual): (JSValueIsInstanceOfConstructor): (JSValueToBoolean): (JSValueToNumber): (JSValueToStringCopy): (JSValueToObject): (JSValueProtect): (JSValueUnprotect):
  • JavaScriptCore.exp:
  • bytecode/CodeBlock.cpp: (JSC::valueToSourceString): (JSC::constantName): (JSC::CodeBlock::dump):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::getConstant): (JSC::CodeBlock::addUnexpectedConstant): (JSC::CodeBlock::unexpectedConstant):
  • bytecode/EvalCodeCache.h: (JSC::EvalCodeCache::get):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::addConstant): (JSC::BytecodeGenerator::addUnexpectedConstant): (JSC::BytecodeGenerator::emitLoad): (JSC::BytecodeGenerator::emitLoadJSV): (JSC::BytecodeGenerator::emitGetScopedVar): (JSC::BytecodeGenerator::emitPutScopedVar): (JSC::BytecodeGenerator::emitNewError): (JSC::keyForImmediateSwitch):
  • bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::JSValueHashTraits::constructDeletedValue): (JSC::BytecodeGenerator::JSValueHashTraits::isDeletedValue):
  • debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::evaluate):
  • debugger/DebuggerCallFrame.h: (JSC::DebuggerCallFrame::DebuggerCallFrame): (JSC::DebuggerCallFrame::exception):
  • interpreter/CallFrame.cpp: (JSC::CallFrame::thisValue):
  • interpreter/CallFrame.h: (JSC::ExecState::setException): (JSC::ExecState::exception): (JSC::ExecState::exceptionSlot): (JSC::ExecState::hadException):
  • interpreter/Interpreter.cpp: (JSC::fastIsNumber): (JSC::fastToInt32): (JSC::fastToUInt32): (JSC::jsLess): (JSC::jsLessEq): (JSC::jsAddSlowCase): (JSC::jsAdd): (JSC::jsTypeStringForValue): (JSC::jsIsObjectType): (JSC::jsIsFunctionType): (JSC::Interpreter::resolve): (JSC::Interpreter::resolveSkip): (JSC::Interpreter::resolveGlobal): (JSC::inlineResolveBase): (JSC::Interpreter::resolveBase): (JSC::Interpreter::resolveBaseAndProperty): (JSC::Interpreter::resolveBaseAndFunc): (JSC::isNotObject): (JSC::Interpreter::callEval): (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::throwException): (JSC::Interpreter::execute): (JSC::Interpreter::checkTimeout): (JSC::Interpreter::createExceptionScope): (JSC::cachePrototypeChain): (JSC::Interpreter::tryCachePutByID): (JSC::countPrototypeChainEntriesAndCheckForProxies): (JSC::Interpreter::tryCacheGetByID): (JSC::Interpreter::privateExecute): (JSC::Interpreter::retrieveArguments): (JSC::Interpreter::retrieveCaller): (JSC::Interpreter::retrieveLastCaller): (JSC::Interpreter::tryCTICachePutByID): (JSC::Interpreter::tryCTICacheGetByID): (JSC::returnToThrowTrampoline): (JSC::Interpreter::cti_op_convert_this): (JSC::Interpreter::cti_op_add): (JSC::Interpreter::cti_op_pre_inc): (JSC::Interpreter::cti_op_loop_if_less): (JSC::Interpreter::cti_op_loop_if_lesseq): (JSC::Interpreter::cti_op_get_by_id_generic): (JSC::Interpreter::cti_op_get_by_id): (JSC::Interpreter::cti_op_get_by_id_second): (JSC::Interpreter::cti_op_get_by_id_self_fail): (JSC::Interpreter::cti_op_get_by_id_proto_list): (JSC::Interpreter::cti_op_get_by_id_proto_list_full): (JSC::Interpreter::cti_op_get_by_id_proto_fail): (JSC::Interpreter::cti_op_get_by_id_array_fail): (JSC::Interpreter::cti_op_get_by_id_string_fail): (JSC::Interpreter::cti_op_instanceof): (JSC::Interpreter::cti_op_del_by_id): (JSC::Interpreter::cti_op_mul): (JSC::Interpreter::cti_op_call_NotJSFunction): (JSC::Interpreter::cti_op_resolve): (JSC::Interpreter::cti_op_construct_NotJSConstruct): (JSC::Interpreter::cti_op_get_by_val): (JSC::Interpreter::cti_op_resolve_func): (JSC::Interpreter::cti_op_sub): (JSC::Interpreter::cti_op_put_by_val): (JSC::Interpreter::cti_op_put_by_val_array): (JSC::Interpreter::cti_op_lesseq): (JSC::Interpreter::cti_op_loop_if_true): (JSC::Interpreter::cti_op_negate): (JSC::Interpreter::cti_op_resolve_base): (JSC::Interpreter::cti_op_resolve_skip): (JSC::Interpreter::cti_op_resolve_global): (JSC::Interpreter::cti_op_div): (JSC::Interpreter::cti_op_pre_dec): (JSC::Interpreter::cti_op_jless): (JSC::Interpreter::cti_op_not): (JSC::Interpreter::cti_op_jtrue): (JSC::Interpreter::cti_op_post_inc): (JSC::Interpreter::cti_op_eq): (JSC::Interpreter::cti_op_lshift): (JSC::Interpreter::cti_op_bitand): (JSC::Interpreter::cti_op_rshift): (JSC::Interpreter::cti_op_bitnot): (JSC::Interpreter::cti_op_resolve_with_base): (JSC::Interpreter::cti_op_mod): (JSC::Interpreter::cti_op_less): (JSC::Interpreter::cti_op_neq): (JSC::Interpreter::cti_op_post_dec): (JSC::Interpreter::cti_op_urshift): (JSC::Interpreter::cti_op_bitxor): (JSC::Interpreter::cti_op_bitor): (JSC::Interpreter::cti_op_call_eval): (JSC::Interpreter::cti_op_throw): (JSC::Interpreter::cti_op_next_pname): (JSC::Interpreter::cti_op_typeof): (JSC::Interpreter::cti_op_is_undefined): (JSC::Interpreter::cti_op_is_boolean): (JSC::Interpreter::cti_op_is_number): (JSC::Interpreter::cti_op_is_string): (JSC::Interpreter::cti_op_is_object): (JSC::Interpreter::cti_op_is_function): (JSC::Interpreter::cti_op_stricteq): (JSC::Interpreter::cti_op_nstricteq): (JSC::Interpreter::cti_op_to_jsnumber): (JSC::Interpreter::cti_op_in): (JSC::Interpreter::cti_op_switch_imm): (JSC::Interpreter::cti_op_switch_char): (JSC::Interpreter::cti_op_switch_string): (JSC::Interpreter::cti_op_del_by_val): (JSC::Interpreter::cti_op_new_error): (JSC::Interpreter::cti_vm_throw):
  • interpreter/Interpreter.h: (JSC::Interpreter::isJSArray): (JSC::Interpreter::isJSString):
  • interpreter/Register.h: (JSC::Register::): (JSC::Register::Register): (JSC::Register::jsValue): (JSC::Register::getJSValue):
  • jit/JIT.cpp: (JSC::): (JSC::JIT::compileOpStrictEq): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases):
  • jit/JIT.h: (JSC::): (JSC::JIT::execute):
  • jit/JITArithmetic.cpp: (JSC::JIT::compileFastArith_op_rshift): (JSC::JIT::compileFastArithSlow_op_rshift):
  • jit/JITCall.cpp: (JSC::JIT::unlinkCall): (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCall):
  • jit/JITInlineMethods.h: (JSC::JIT::emitGetVirtualRegister): (JSC::JIT::getConstantOperand): (JSC::JIT::isOperandConstant31BitImmediateInt): (JSC::JIT::emitPutJITStubArgFromVirtualRegister): (JSC::JIT::emitInitRegister):
  • jit/JITPropertyAccess.cpp: (JSC::resizePropertyStorage): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompileGetByIdSelf): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompilePutByIdReplace):
  • jsc.cpp: (functionPrint): (functionDebug): (functionGC): (functionVersion): (functionRun): (functionLoad): (functionReadline): (functionQuit):
  • parser/Nodes.cpp: (JSC::NullNode::emitBytecode): (JSC::ArrayNode::emitBytecode): (JSC::FunctionCallValueNode::emitBytecode): (JSC::FunctionCallResolveNode::emitBytecode): (JSC::VoidNode::emitBytecode): (JSC::ConstDeclNode::emitCodeSingle): (JSC::ReturnNode::emitBytecode): (JSC::processClauseList): (JSC::EvalNode::emitBytecode): (JSC::FunctionBodyNode::emitBytecode): (JSC::ProgramNode::emitBytecode):
  • profiler/ProfileGenerator.cpp: (JSC::ProfileGenerator::addParentForConsoleStart):
  • profiler/Profiler.cpp: (JSC::Profiler::willExecute): (JSC::Profiler::didExecute): (JSC::Profiler::createCallIdentifier):
  • profiler/Profiler.h:
  • runtime/ArgList.cpp: (JSC::ArgList::slowAppend):
  • runtime/ArgList.h: (JSC::ArgList::at): (JSC::ArgList::append):
  • runtime/Arguments.cpp: (JSC::Arguments::put):
  • runtime/Arguments.h: (JSC::Arguments::createStructure): (JSC::asArguments):
  • runtime/ArrayConstructor.cpp: (JSC::callArrayConstructor):
  • runtime/ArrayPrototype.cpp: (JSC::getProperty): (JSC::putProperty): (JSC::arrayProtoFuncToString): (JSC::arrayProtoFuncToLocaleString): (JSC::arrayProtoFuncJoin): (JSC::arrayProtoFuncConcat): (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncPush): (JSC::arrayProtoFuncReverse): (JSC::arrayProtoFuncShift): (JSC::arrayProtoFuncSlice): (JSC::arrayProtoFuncSort): (JSC::arrayProtoFuncSplice): (JSC::arrayProtoFuncUnShift): (JSC::arrayProtoFuncFilter): (JSC::arrayProtoFuncMap): (JSC::arrayProtoFuncEvery): (JSC::arrayProtoFuncForEach): (JSC::arrayProtoFuncSome): (JSC::arrayProtoFuncIndexOf): (JSC::arrayProtoFuncLastIndexOf):
  • runtime/BooleanConstructor.cpp: (JSC::callBooleanConstructor): (JSC::constructBooleanFromImmediateBoolean):
  • runtime/BooleanConstructor.h:
  • runtime/BooleanObject.h: (JSC::asBooleanObject):
  • runtime/BooleanPrototype.cpp: (JSC::booleanProtoFuncToString): (JSC::booleanProtoFuncValueOf):
  • runtime/CallData.cpp: (JSC::call):
  • runtime/CallData.h:
  • runtime/Collector.cpp: (JSC::Heap::protect): (JSC::Heap::unprotect): (JSC::Heap::heap): (JSC::Heap::collect):
  • runtime/Collector.h:
  • runtime/Completion.cpp: (JSC::evaluate):
  • runtime/Completion.h: (JSC::Completion::Completion): (JSC::Completion::value): (JSC::Completion::setValue): (JSC::Completion::isValueCompletion):
  • runtime/ConstructData.cpp: (JSC::construct):
  • runtime/ConstructData.h:
  • runtime/DateConstructor.cpp: (JSC::constructDate): (JSC::callDate): (JSC::dateParse): (JSC::dateNow): (JSC::dateUTC):
  • runtime/DateInstance.h: (JSC::asDateInstance):
  • runtime/DatePrototype.cpp: (JSC::dateProtoFuncToString): (JSC::dateProtoFuncToUTCString): (JSC::dateProtoFuncToDateString): (JSC::dateProtoFuncToTimeString): (JSC::dateProtoFuncToLocaleString): (JSC::dateProtoFuncToLocaleDateString): (JSC::dateProtoFuncToLocaleTimeString): (JSC::dateProtoFuncValueOf): (JSC::dateProtoFuncGetTime): (JSC::dateProtoFuncGetFullYear): (JSC::dateProtoFuncGetUTCFullYear): (JSC::dateProtoFuncToGMTString): (JSC::dateProtoFuncGetMonth): (JSC::dateProtoFuncGetUTCMonth): (JSC::dateProtoFuncGetDate): (JSC::dateProtoFuncGetUTCDate): (JSC::dateProtoFuncGetDay): (JSC::dateProtoFuncGetUTCDay): (JSC::dateProtoFuncGetHours): (JSC::dateProtoFuncGetUTCHours): (JSC::dateProtoFuncGetMinutes): (JSC::dateProtoFuncGetUTCMinutes): (JSC::dateProtoFuncGetSeconds): (JSC::dateProtoFuncGetUTCSeconds): (JSC::dateProtoFuncGetMilliSeconds): (JSC::dateProtoFuncGetUTCMilliseconds): (JSC::dateProtoFuncGetTimezoneOffset): (JSC::dateProtoFuncSetTime): (JSC::setNewValueFromTimeArgs): (JSC::setNewValueFromDateArgs): (JSC::dateProtoFuncSetMilliSeconds): (JSC::dateProtoFuncSetUTCMilliseconds): (JSC::dateProtoFuncSetSeconds): (JSC::dateProtoFuncSetUTCSeconds): (JSC::dateProtoFuncSetMinutes): (JSC::dateProtoFuncSetUTCMinutes): (JSC::dateProtoFuncSetHours): (JSC::dateProtoFuncSetUTCHours): (JSC::dateProtoFuncSetDate): (JSC::dateProtoFuncSetUTCDate): (JSC::dateProtoFuncSetMonth): (JSC::dateProtoFuncSetUTCMonth): (JSC::dateProtoFuncSetFullYear): (JSC::dateProtoFuncSetUTCFullYear): (JSC::dateProtoFuncSetYear): (JSC::dateProtoFuncGetYear):
  • runtime/DatePrototype.h: (JSC::DatePrototype::createStructure):
  • runtime/ErrorConstructor.cpp: (JSC::callErrorConstructor):
  • runtime/ErrorPrototype.cpp: (JSC::errorProtoFuncToString):
  • runtime/ExceptionHelpers.cpp: (JSC::createInterruptedExecutionException): (JSC::createError): (JSC::createStackOverflowError): (JSC::createUndefinedVariableError): (JSC::createErrorMessage): (JSC::createInvalidParamError): (JSC::createNotAConstructorError): (JSC::createNotAFunctionError):
  • runtime/ExceptionHelpers.h:
  • runtime/FunctionConstructor.cpp: (JSC::callFunctionConstructor):
  • runtime/FunctionPrototype.cpp: (JSC::callFunctionPrototype): (JSC::functionProtoFuncToString): (JSC::functionProtoFuncApply): (JSC::functionProtoFuncCall):
  • runtime/FunctionPrototype.h: (JSC::FunctionPrototype::createStructure):
  • runtime/GetterSetter.cpp: (JSC::GetterSetter::toPrimitive): (JSC::GetterSetter::getPrimitiveNumber):
  • runtime/GetterSetter.h: (JSC::asGetterSetter):
  • runtime/InitializeThreading.cpp:
  • runtime/InternalFunction.h: (JSC::InternalFunction::createStructure): (JSC::asInternalFunction):
  • runtime/JSActivation.cpp: (JSC::JSActivation::getOwnPropertySlot): (JSC::JSActivation::put): (JSC::JSActivation::putWithAttributes): (JSC::JSActivation::argumentsGetter):
  • runtime/JSActivation.h: (JSC::JSActivation::createStructure): (JSC::asActivation):
  • runtime/JSArray.cpp: (JSC::storageSize): (JSC::JSArray::JSArray): (JSC::JSArray::getOwnPropertySlot): (JSC::JSArray::put): (JSC::JSArray::putSlowCase): (JSC::JSArray::deleteProperty): (JSC::JSArray::getPropertyNames): (JSC::JSArray::setLength): (JSC::JSArray::pop): (JSC::JSArray::push): (JSC::JSArray::mark): (JSC::JSArray::sort): (JSC::JSArray::compactForSorting): (JSC::JSArray::checkConsistency): (JSC::constructArray):
  • runtime/JSArray.h: (JSC::JSArray::getIndex): (JSC::JSArray::setIndex): (JSC::JSArray::createStructure): (JSC::asArray):
  • runtime/JSCell.cpp: (JSC::JSCell::put): (JSC::JSCell::getJSNumber):
  • runtime/JSCell.h: (JSC::asCell): (JSC::JSValue::asCell): (JSC::JSValue::toPrimitive): (JSC::JSValue::getPrimitiveNumber): (JSC::JSValue::getJSNumber):
  • runtime/JSFunction.cpp: (JSC::JSFunction::call): (JSC::JSFunction::argumentsGetter): (JSC::JSFunction::callerGetter): (JSC::JSFunction::lengthGetter): (JSC::JSFunction::getOwnPropertySlot): (JSC::JSFunction::put): (JSC::JSFunction::construct):
  • runtime/JSFunction.h: (JSC::JSFunction::createStructure): (JSC::asFunction):
  • runtime/JSGlobalData.h:
  • runtime/JSGlobalObject.cpp: (JSC::markIfNeeded): (JSC::JSGlobalObject::put): (JSC::JSGlobalObject::putWithAttributes): (JSC::JSGlobalObject::reset): (JSC::JSGlobalObject::resetPrototype):
  • runtime/JSGlobalObject.h: (JSC::JSGlobalObject::createStructure): (JSC::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo): (JSC::asGlobalObject): (JSC::Structure::prototypeForLookup):
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::encode): (JSC::decode): (JSC::globalFuncEval): (JSC::globalFuncParseInt): (JSC::globalFuncParseFloat): (JSC::globalFuncIsNaN): (JSC::globalFuncIsFinite): (JSC::globalFuncDecodeURI): (JSC::globalFuncDecodeURIComponent): (JSC::globalFuncEncodeURI): (JSC::globalFuncEncodeURIComponent): (JSC::globalFuncEscape): (JSC::globalFuncUnescape): (JSC::globalFuncJSCPrint):
  • runtime/JSGlobalObjectFunctions.h:
  • runtime/JSImmediate.cpp: (JSC::JSImmediate::toThisObject): (JSC::JSImmediate::toObject): (JSC::JSImmediate::prototype): (JSC::JSImmediate::toString):
  • runtime/JSImmediate.h: (JSC::JSImmediate::isImmediate): (JSC::JSImmediate::isNumber): (JSC::JSImmediate::isPositiveNumber): (JSC::JSImmediate::isBoolean): (JSC::JSImmediate::isUndefinedOrNull): (JSC::JSImmediate::isNegative): (JSC::JSImmediate::isEitherImmediate): (JSC::JSImmediate::isAnyImmediate): (JSC::JSImmediate::areBothImmediate): (JSC::JSImmediate::areBothImmediateNumbers): (JSC::JSImmediate::andImmediateNumbers): (JSC::JSImmediate::xorImmediateNumbers): (JSC::JSImmediate::orImmediateNumbers): (JSC::JSImmediate::rightShiftImmediateNumbers): (JSC::JSImmediate::canDoFastAdditiveOperations): (JSC::JSImmediate::addImmediateNumbers): (JSC::JSImmediate::subImmediateNumbers): (JSC::JSImmediate::incImmediateNumber): (JSC::JSImmediate::decImmediateNumber): (JSC::JSImmediate::makeValue): (JSC::JSImmediate::makeInt): (JSC::JSImmediate::makeBool): (JSC::JSImmediate::makeUndefined): (JSC::JSImmediate::makeNull): (JSC::JSImmediate::intValue): (JSC::JSImmediate::uintValue): (JSC::JSImmediate::boolValue): (JSC::JSImmediate::rawValue): (JSC::JSImmediate::trueImmediate): (JSC::JSImmediate::falseImmediate): (JSC::JSImmediate::undefinedImmediate): (JSC::JSImmediate::nullImmediate): (JSC::JSImmediate::zeroImmediate): (JSC::JSImmediate::oneImmediate): (JSC::JSImmediate::impossibleValue): (JSC::JSImmediate::toBoolean): (JSC::JSImmediate::getTruncatedUInt32): (JSC::JSImmediate::from): (JSC::JSImmediate::getTruncatedInt32): (JSC::JSImmediate::toDouble): (JSC::JSImmediate::getUInt32): (JSC::jsNull): (JSC::jsBoolean): (JSC::jsUndefined): (JSC::JSValue::isUndefined): (JSC::JSValue::isNull): (JSC::JSValue::isUndefinedOrNull): (JSC::JSValue::isBoolean): (JSC::JSValue::getBoolean): (JSC::JSValue::toInt32): (JSC::JSValue::toUInt32): (JSC::toInt32): (JSC::toUInt32):
  • runtime/JSNotAnObject.cpp: (JSC::JSNotAnObject::toPrimitive): (JSC::JSNotAnObject::getPrimitiveNumber): (JSC::JSNotAnObject::put):
  • runtime/JSNotAnObject.h: (JSC::JSNotAnObject::createStructure):
  • runtime/JSNumberCell.cpp: (JSC::JSNumberCell::toPrimitive): (JSC::JSNumberCell::getPrimitiveNumber): (JSC::JSNumberCell::getJSNumber): (JSC::jsNumberCell): (JSC::jsNaN):
  • runtime/JSNumberCell.h: (JSC::JSNumberCell::createStructure): (JSC::asNumberCell): (JSC::jsNumber): (JSC::JSValue::toJSNumber):
  • runtime/JSObject.cpp: (JSC::JSObject::mark): (JSC::JSObject::put): (JSC::JSObject::putWithAttributes): (JSC::callDefaultValueFunction): (JSC::JSObject::getPrimitiveNumber): (JSC::JSObject::defaultValue): (JSC::JSObject::defineGetter): (JSC::JSObject::defineSetter): (JSC::JSObject::lookupGetter): (JSC::JSObject::lookupSetter): (JSC::JSObject::hasInstance): (JSC::JSObject::toNumber): (JSC::JSObject::toString): (JSC::JSObject::fillGetterPropertySlot):
  • runtime/JSObject.h: (JSC::JSObject::getDirect): (JSC::JSObject::getDirectLocation): (JSC::JSObject::offsetForLocation): (JSC::JSObject::locationForOffset): (JSC::JSObject::getDirectOffset): (JSC::JSObject::putDirectOffset): (JSC::JSObject::createStructure): (JSC::asObject): (JSC::JSObject::prototype): (JSC::JSObject::setPrototype): (JSC::JSObject::inlineGetOwnPropertySlot): (JSC::JSObject::getOwnPropertySlotForWrite): (JSC::JSObject::getPropertySlot): (JSC::JSObject::get): (JSC::JSObject::putDirect): (JSC::JSObject::putDirectWithoutTransition): (JSC::JSObject::toPrimitive): (JSC::JSValue::get): (JSC::JSValue::put): (JSC::JSObject::allocatePropertyStorageInline):
  • runtime/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::toPrimitive): (JSC::JSPropertyNameIterator::getPrimitiveNumber):
  • runtime/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::create): (JSC::JSPropertyNameIterator::next):
  • runtime/JSStaticScopeObject.cpp: (JSC::JSStaticScopeObject::put): (JSC::JSStaticScopeObject::putWithAttributes):
  • runtime/JSStaticScopeObject.h: (JSC::JSStaticScopeObject::JSStaticScopeObject): (JSC::JSStaticScopeObject::createStructure):
  • runtime/JSString.cpp: (JSC::JSString::toPrimitive): (JSC::JSString::getPrimitiveNumber): (JSC::JSString::getOwnPropertySlot):
  • runtime/JSString.h: (JSC::JSString::createStructure): (JSC::asString):
  • runtime/JSValue.h: (JSC::JSValuePtr::makeImmediate): (JSC::JSValuePtr::immediateValue): (JSC::JSValuePtr::JSValuePtr): (JSC::JSValuePtr::operator->): (JSC::JSValuePtr::hasValue): (JSC::JSValuePtr::operator==): (JSC::JSValuePtr::operator!=): (JSC::JSValuePtr::encode): (JSC::JSValuePtr::decode): (JSC::JSValue::asValue): (JSC::noValue): (JSC::operator==): (JSC::operator!=):
  • runtime/JSVariableObject.h: (JSC::JSVariableObject::symbolTablePut): (JSC::JSVariableObject::symbolTablePutWithAttributes):
  • runtime/JSWrapperObject.cpp: (JSC::JSWrapperObject::mark):
  • runtime/JSWrapperObject.h: (JSC::JSWrapperObject::internalValue): (JSC::JSWrapperObject::setInternalValue):
  • runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot):
  • runtime/Lookup.h: (JSC::lookupPut):
  • runtime/MathObject.cpp: (JSC::mathProtoFuncAbs): (JSC::mathProtoFuncACos): (JSC::mathProtoFuncASin): (JSC::mathProtoFuncATan): (JSC::mathProtoFuncATan2): (JSC::mathProtoFuncCeil): (JSC::mathProtoFuncCos): (JSC::mathProtoFuncExp): (JSC::mathProtoFuncFloor): (JSC::mathProtoFuncLog): (JSC::mathProtoFuncMax): (JSC::mathProtoFuncMin): (JSC::mathProtoFuncPow): (JSC::mathProtoFuncRandom): (JSC::mathProtoFuncRound): (JSC::mathProtoFuncSin): (JSC::mathProtoFuncSqrt): (JSC::mathProtoFuncTan):
  • runtime/MathObject.h: (JSC::MathObject::createStructure):
  • runtime/NativeErrorConstructor.cpp: (JSC::callNativeErrorConstructor):
  • runtime/NumberConstructor.cpp: (JSC::numberConstructorNaNValue): (JSC::numberConstructorNegInfinity): (JSC::numberConstructorPosInfinity): (JSC::numberConstructorMaxValue): (JSC::numberConstructorMinValue): (JSC::callNumberConstructor):
  • runtime/NumberConstructor.h: (JSC::NumberConstructor::createStructure):
  • runtime/NumberObject.cpp: (JSC::NumberObject::getJSNumber): (JSC::constructNumberFromImmediateNumber):
  • runtime/NumberObject.h:
  • runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToString): (JSC::numberProtoFuncToLocaleString): (JSC::numberProtoFuncValueOf): (JSC::numberProtoFuncToFixed): (JSC::numberProtoFuncToExponential): (JSC::numberProtoFuncToPrecision):
  • runtime/ObjectConstructor.cpp: (JSC::constructObject): (JSC::callObjectConstructor):
  • runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncValueOf): (JSC::objectProtoFuncHasOwnProperty): (JSC::objectProtoFuncIsPrototypeOf): (JSC::objectProtoFuncDefineGetter): (JSC::objectProtoFuncDefineSetter): (JSC::objectProtoFuncLookupGetter): (JSC::objectProtoFuncLookupSetter): (JSC::objectProtoFuncPropertyIsEnumerable): (JSC::objectProtoFuncToLocaleString): (JSC::objectProtoFuncToString):
  • runtime/ObjectPrototype.h:
  • runtime/Operations.cpp: (JSC::equal): (JSC::equalSlowCase): (JSC::strictEqual): (JSC::strictEqualSlowCase): (JSC::throwOutOfMemoryError):
  • runtime/Operations.h: (JSC::equalSlowCaseInline): (JSC::strictEqualSlowCaseInline):
  • runtime/PropertySlot.cpp: (JSC::PropertySlot::functionGetter):
  • runtime/PropertySlot.h: (JSC::PropertySlot::PropertySlot): (JSC::PropertySlot::getValue): (JSC::PropertySlot::putValue): (JSC::PropertySlot::setValueSlot): (JSC::PropertySlot::setValue): (JSC::PropertySlot::setCustom): (JSC::PropertySlot::setCustomIndex): (JSC::PropertySlot::slotBase): (JSC::PropertySlot::setBase): (JSC::PropertySlot::):
  • runtime/Protect.h: (JSC::gcProtect): (JSC::gcUnprotect): (JSC::ProtectedPtr::ProtectedPtr): (JSC::ProtectedPtr::operator JSValuePtr): (JSC::ProtectedJSValuePtr::ProtectedJSValuePtr): (JSC::ProtectedJSValuePtr::get): (JSC::ProtectedJSValuePtr::operator JSValuePtr): (JSC::ProtectedJSValuePtr::operator->): (JSC::::ProtectedPtr): (JSC::::~ProtectedPtr): (JSC::::operator): (JSC::ProtectedJSValuePtr::~ProtectedJSValuePtr): (JSC::ProtectedJSValuePtr::operator=): (JSC::operator==): (JSC::operator!=):
  • runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::getBackref): (JSC::RegExpConstructor::getLastParen): (JSC::RegExpConstructor::getLeftContext): (JSC::RegExpConstructor::getRightContext): (JSC::regExpConstructorDollar1): (JSC::regExpConstructorDollar2): (JSC::regExpConstructorDollar3): (JSC::regExpConstructorDollar4): (JSC::regExpConstructorDollar5): (JSC::regExpConstructorDollar6): (JSC::regExpConstructorDollar7): (JSC::regExpConstructorDollar8): (JSC::regExpConstructorDollar9): (JSC::regExpConstructorInput): (JSC::regExpConstructorMultiline): (JSC::regExpConstructorLastMatch): (JSC::regExpConstructorLastParen): (JSC::regExpConstructorLeftContext): (JSC::regExpConstructorRightContext): (JSC::RegExpConstructor::put): (JSC::setRegExpConstructorInput): (JSC::setRegExpConstructorMultiline): (JSC::constructRegExp): (JSC::callRegExpConstructor):
  • runtime/RegExpConstructor.h: (JSC::RegExpConstructor::createStructure): (JSC::asRegExpConstructor):
  • runtime/RegExpMatchesArray.h: (JSC::RegExpMatchesArray::put):
  • runtime/RegExpObject.cpp: (JSC::regExpObjectGlobal): (JSC::regExpObjectIgnoreCase): (JSC::regExpObjectMultiline): (JSC::regExpObjectSource): (JSC::regExpObjectLastIndex): (JSC::RegExpObject::put): (JSC::setRegExpObjectLastIndex): (JSC::RegExpObject::test): (JSC::RegExpObject::exec): (JSC::callRegExpObject):
  • runtime/RegExpObject.h: (JSC::RegExpObject::createStructure): (JSC::asRegExpObject):
  • runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncTest): (JSC::regExpProtoFuncExec): (JSC::regExpProtoFuncCompile): (JSC::regExpProtoFuncToString):
  • runtime/StringConstructor.cpp: (JSC::stringFromCharCodeSlowCase): (JSC::stringFromCharCode): (JSC::callStringConstructor):
  • runtime/StringObject.cpp: (JSC::StringObject::put):
  • runtime/StringObject.h: (JSC::StringObject::createStructure): (JSC::asStringObject):
  • runtime/StringObjectThatMasqueradesAsUndefined.h: (JSC::StringObjectThatMasqueradesAsUndefined::createStructure):
  • runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): (JSC::stringProtoFuncToString): (JSC::stringProtoFuncCharAt): (JSC::stringProtoFuncCharCodeAt): (JSC::stringProtoFuncConcat): (JSC::stringProtoFuncIndexOf): (JSC::stringProtoFuncLastIndexOf): (JSC::stringProtoFuncMatch): (JSC::stringProtoFuncSearch): (JSC::stringProtoFuncSlice): (JSC::stringProtoFuncSplit): (JSC::stringProtoFuncSubstr): (JSC::stringProtoFuncSubstring): (JSC::stringProtoFuncToLowerCase): (JSC::stringProtoFuncToUpperCase): (JSC::stringProtoFuncLocaleCompare): (JSC::stringProtoFuncBig): (JSC::stringProtoFuncSmall): (JSC::stringProtoFuncBlink): (JSC::stringProtoFuncBold): (JSC::stringProtoFuncFixed): (JSC::stringProtoFuncItalics): (JSC::stringProtoFuncStrike): (JSC::stringProtoFuncSub): (JSC::stringProtoFuncSup): (JSC::stringProtoFuncFontcolor): (JSC::stringProtoFuncFontsize): (JSC::stringProtoFuncAnchor): (JSC::stringProtoFuncLink):
  • runtime/Structure.cpp: (JSC::Structure::Structure): (JSC::Structure::changePrototypeTransition): (JSC::Structure::createCachedPrototypeChain):
  • runtime/Structure.h: (JSC::Structure::create): (JSC::Structure::setPrototypeWithoutTransition): (JSC::Structure::storedPrototype):

JavaScriptGlue:

2009-01-05 Gavin Barraclough <[email protected]>

Rubber Stamped by Oliver Hunt.

Replace all uses of JSValue* with new wrapper class, JSValuePtr.
See JavaScriptCore/ChangeLog for more detailed description.

  • JSObject.cpp: (nativeCallFunction):
  • JSUtils.cpp: (KJSValueToJSObject): (JSObjectKJSValue): (KJSValueToCFTypeInternal): (KJSValueToCFType):
  • JSUtils.h:
  • JSValueWrapper.cpp: (JSValueWrapper::JSValueWrapper): (JSValueWrapper::GetValue): (JSValueWrapper::JSObjectCopyProperty): (JSValueWrapper::JSObjectSetProperty): (JSValueWrapper::JSObjectCallFunction):
  • JSValueWrapper.h:
  • UserObjectImp.cpp: (UserObjectImp::callAsFunction): (UserObjectImp::userObjectGetter): (UserObjectImp::getOwnPropertySlot): (UserObjectImp::put): (UserObjectImp::toPrimitive):
  • UserObjectImp.h: (UserObjectImp::createStructure):

WebCore:

2009-01-05 Gavin Barraclough <[email protected]>

Rubber Stamped by Oliver Hunt.

Replace all uses of JSValue* with new wrapper class, JSValuePtr.
See JavaScriptCore/ChangeLog for more detailed description.

  • bindings/js/JSAttrCustom.cpp: (WebCore::JSAttr::setValue):
  • bindings/js/JSCSSRuleCustom.cpp: (WebCore::toJS):
  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::nameGetter): (WebCore::JSCSSStyleDeclaration::customPut):
  • bindings/js/JSCSSValueCustom.cpp: (WebCore::toJS):
  • bindings/js/JSCanvasPixelArrayCustom.h: (WebCore::JSCanvasPixelArray::getByIndex): (WebCore::JSCanvasPixelArray::indexSetter):
  • bindings/js/JSCanvasRenderingContext2DCustom.cpp: (WebCore::toJS): (WebCore::toHTMLCanvasStyle): (WebCore::JSCanvasRenderingContext2D::strokeStyle): (WebCore::JSCanvasRenderingContext2D::setStrokeStyle): (WebCore::JSCanvasRenderingContext2D::fillStyle): (WebCore::JSCanvasRenderingContext2D::setFillStyle): (WebCore::JSCanvasRenderingContext2D::setFillColor): (WebCore::JSCanvasRenderingContext2D::setStrokeColor): (WebCore::JSCanvasRenderingContext2D::strokeRect): (WebCore::JSCanvasRenderingContext2D::drawImage): (WebCore::JSCanvasRenderingContext2D::drawImageFromRect): (WebCore::JSCanvasRenderingContext2D::setShadow): (WebCore::JSCanvasRenderingContext2D::createPattern): (WebCore::JSCanvasRenderingContext2D::putImageData): (WebCore::JSCanvasRenderingContext2D::fillText): (WebCore::JSCanvasRenderingContext2D::strokeText):
  • bindings/js/JSClipboardCustom.cpp: (WebCore::JSClipboard::types): (WebCore::JSClipboard::clearData): (WebCore::JSClipboard::getData): (WebCore::JSClipboard::setData): (WebCore::JSClipboard::setDragImage):
  • bindings/js/JSConsoleCustom.cpp: (WebCore::JSConsole::profiles):
  • bindings/js/JSCustomPositionCallback.cpp: (WebCore::JSCustomPositionCallback::handleEvent):
  • bindings/js/JSCustomPositionErrorCallback.cpp: (WebCore::JSCustomPositionErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementCallback.cpp: (WebCore::JSCustomSQLStatementCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementErrorCallback.cpp: (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionCallback.cpp: (WebCore::JSCustomSQLTransactionCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionErrorCallback.cpp: (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
  • bindings/js/JSCustomVoidCallback.cpp: (WebCore::JSCustomVoidCallback::handleEvent): (WebCore::toVoidCallback):
  • bindings/js/JSCustomVoidCallback.h:
  • bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::create): (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
  • bindings/js/JSCustomXPathNSResolver.h:
  • bindings/js/JSDOMApplicationCacheCustom.cpp: (WebCore::JSDOMApplicationCache::add): (WebCore::JSDOMApplicationCache::remove): (WebCore::JSDOMApplicationCache::addEventListener): (WebCore::JSDOMApplicationCache::removeEventListener):
  • bindings/js/JSDOMBinding.cpp: (WebCore::jsStringOrNull): (WebCore::jsOwnedStringOrNull): (WebCore::jsStringOrUndefined): (WebCore::jsStringOrFalse): (WebCore::valueToStringWithNullCheck): (WebCore::valueToStringWithUndefinedOrNullCheck): (WebCore::reportException): (WebCore::reportCurrentException): (WebCore::setDOMException): (WebCore::objectToStringFunctionGetter):
  • bindings/js/JSDOMBinding.h: (WebCore::getDOMObjectWrapper): (WebCore::getDOMNodeWrapper): (WebCore::toJS):
  • bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::findJSEventListener): (WebCore::JSDOMGlobalObject::findOrCreateJSEventListener): (WebCore::JSDOMGlobalObject::findJSUnprotectedEventListener): (WebCore::JSDOMGlobalObject::findOrCreateJSUnprotectedEventListener):
  • bindings/js/JSDOMGlobalObject.h:
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::createWindow): (WebCore::showModalDialog): (jsDOMWindowBaseCrypto): (jsDOMWindowBaseEvent): (jsDOMWindowBaseImage): (jsDOMWindowBaseMessageChannel): (jsDOMWindowBaseOption): (jsDOMWindowBaseXMLHttpRequest): (jsDOMWindowBaseAudio): (jsDOMWindowBaseWorker): (jsDOMWindowBaseXSLTProcessor): (setJSDOMWindowBaseEvent): (setJSDOMWindowBaseAudio): (setJSDOMWindowBaseImage): (setJSDOMWindowBaseMessageChannel): (setJSDOMWindowBaseOption): (setJSDOMWindowBaseWorker): (setJSDOMWindowBaseXMLHttpRequest): (setJSDOMWindowBaseXSLTProcessor): (WebCore::JSDOMWindowBase::childFrameGetter): (WebCore::JSDOMWindowBase::indexGetter): (WebCore::JSDOMWindowBase::namedItemGetter): (WebCore::JSDOMWindowBase::getOwnPropertySlot): (WebCore::JSDOMWindowBase::put): (WebCore::JSDOMWindowBase::clear): (windowProtoFuncOpen): (windowProtoFuncShowModalDialog): (windowProtoFuncNotImplemented): (WebCore::JSDOMWindowBase::setReturnValueSlot): (WebCore::JSDOMWindowBase::installTimeout): (WebCore::toJS): (WebCore::toJSDOMWindow):
  • bindings/js/JSDOMWindowBase.h:
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::lookupGetter): (WebCore::JSDOMWindow::lookupSetter): (WebCore::JSDOMWindow::setLocation): (WebCore::JSDOMWindow::postMessage): (WebCore::setTimeoutOrInterval): (WebCore::JSDOMWindow::setTimeout): (WebCore::JSDOMWindow::clearTimeout): (WebCore::JSDOMWindow::setInterval): (WebCore::JSDOMWindow::clearInterval): (WebCore::JSDOMWindow::atob): (WebCore::JSDOMWindow::btoa): (WebCore::JSDOMWindow::addEventListener): (WebCore::JSDOMWindow::removeEventListener): (WebCore::toDOMWindow): (WebCore::nonCachingStaticCloseFunctionGetter): (WebCore::nonCachingStaticBlurFunctionGetter): (WebCore::nonCachingStaticFocusFunctionGetter): (WebCore::nonCachingStaticPostMessageFunctionGetter):
  • bindings/js/JSDOMWindowCustom.h: (WebCore::JSDOMWindow::customPut):
  • bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::put): (WebCore::JSDOMWindowShell::putWithAttributes): (WebCore::JSDOMWindowShell::lookupGetter): (WebCore::JSDOMWindowShell::lookupSetter): (WebCore::toJS):
  • bindings/js/JSDOMWindowShell.h: (WebCore::JSDOMWindowShell::createStructure):
  • bindings/js/JSDatabaseCustom.cpp: (WebCore::JSDatabase::changeVersion): (WebCore::JSDatabase::transaction):
  • bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::location): (WebCore::JSDocument::setLocation): (WebCore::toJS):
  • bindings/js/JSElementCustom.cpp: (WebCore::JSElement::setAttribute): (WebCore::JSElement::setAttributeNode): (WebCore::JSElement::setAttributeNS): (WebCore::JSElement::setAttributeNodeNS): (WebCore::toJSNewlyCreated):
  • bindings/js/JSEventCustom.cpp: (WebCore::JSEvent::clipboardData): (WebCore::toJS):
  • bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent): (WebCore::eventParameterName): (WebCore::JSLazyEventListener::parseCode):
  • bindings/js/JSEventTarget.cpp: (WebCore::toJS):
  • bindings/js/JSEventTarget.h:
  • bindings/js/JSEventTargetBase.h:
  • bindings/js/JSEventTargetNodeCustom.cpp: (WebCore::JSEventTargetNode::addEventListener): (WebCore::JSEventTargetNode::removeEventListener):
  • bindings/js/JSGeolocationCustom.cpp: (WebCore::createPositionOptions): (WebCore::JSGeolocation::getCurrentPosition): (WebCore::JSGeolocation::watchPosition):
  • bindings/js/JSHTMLAllCollection.h: (WebCore::JSHTMLAllCollection::createStructure):
  • bindings/js/JSHTMLAppletElementCustom.cpp: (WebCore::JSHTMLAppletElement::customPut): (WebCore::JSHTMLAppletElement::nameGetter):
  • bindings/js/JSHTMLCollectionCustom.cpp: (WebCore::getNamedItems): (WebCore::callHTMLCollection): (WebCore::JSHTMLCollection::nameGetter): (WebCore::JSHTMLCollection::item): (WebCore::JSHTMLCollection::namedItem): (WebCore::toJS):
  • bindings/js/JSHTMLDocumentCustom.cpp: (WebCore::JSHTMLDocument::nameGetter): (WebCore::JSHTMLDocument::all): (WebCore::JSHTMLDocument::setAll): (WebCore::JSHTMLDocument::open): (WebCore::JSHTMLDocument::write): (WebCore::JSHTMLDocument::writeln):
  • bindings/js/JSHTMLEmbedElementCustom.cpp: (WebCore::JSHTMLEmbedElement::customPut): (WebCore::JSHTMLEmbedElement::nameGetter):
  • bindings/js/JSHTMLFormElementCustom.cpp: (WebCore::JSHTMLFormElement::nameGetter):
  • bindings/js/JSHTMLFrameElementCustom.cpp: (WebCore::JSHTMLFrameElement::setSrc): (WebCore::JSHTMLFrameElement::setLocation):
  • bindings/js/JSHTMLFrameSetElementCustom.cpp: (WebCore::JSHTMLFrameSetElement::nameGetter):
  • bindings/js/JSHTMLIFrameElementCustom.cpp: (WebCore::JSHTMLIFrameElement::setSrc):
  • bindings/js/JSHTMLInputElementCustom.cpp: (WebCore::JSHTMLInputElement::selectionStart): (WebCore::JSHTMLInputElement::selectionEnd):
  • bindings/js/JSHTMLObjectElementCustom.cpp: (WebCore::JSHTMLObjectElement::customPut): (WebCore::JSHTMLObjectElement::nameGetter):
  • bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::length): (WebCore::JSHTMLOptionsCollection::setLength): (WebCore::JSHTMLOptionsCollection::indexSetter): (WebCore::JSHTMLOptionsCollection::add): (WebCore::JSHTMLOptionsCollection::remove):
  • bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::JSHTMLSelectElement::remove): (WebCore::selectIndexSetter): (WebCore::JSHTMLSelectElement::indexSetter):
  • bindings/js/JSHTMLSelectElementCustom.h:
  • bindings/js/JSHistoryCustom.cpp: (WebCore::nonCachingStaticBackFunctionGetter): (WebCore::nonCachingStaticForwardFunctionGetter): (WebCore::nonCachingStaticGoFunctionGetter): (WebCore::JSHistory::customPut):
  • bindings/js/JSImageDataCustom.cpp: (WebCore::toJS):
  • bindings/js/JSInspectedObjectWrapper.cpp: (WebCore::JSInspectedObjectWrapper::wrap): (WebCore::JSInspectedObjectWrapper::prepareIncomingValue):
  • bindings/js/JSInspectedObjectWrapper.h: (WebCore::JSInspectedObjectWrapper::wrapOutgoingValue):
  • bindings/js/JSInspectorCallbackWrapper.cpp: (WebCore::JSInspectorCallbackWrapper::wrap): (WebCore::JSInspectorCallbackWrapper::prepareIncomingValue):
  • bindings/js/JSInspectorCallbackWrapper.h: (WebCore::JSInspectorCallbackWrapper::wrapOutgoingValue):
  • bindings/js/JSJavaScriptCallFrameCustom.cpp: (WebCore::JSJavaScriptCallFrame::evaluate): (WebCore::JSJavaScriptCallFrame::thisObject): (WebCore::JSJavaScriptCallFrame::type): (WebCore::JSJavaScriptCallFrame::scopeChain):
  • bindings/js/JSLocationCustom.cpp: (WebCore::nonCachingStaticReplaceFunctionGetter): (WebCore::nonCachingStaticReloadFunctionGetter): (WebCore::nonCachingStaticAssignFunctionGetter): (WebCore::JSLocation::customPut): (WebCore::JSLocation::setHref): (WebCore::JSLocation::setProtocol): (WebCore::JSLocation::setHost): (WebCore::JSLocation::setHostname): (WebCore::JSLocation::setPort): (WebCore::JSLocation::setPathname): (WebCore::JSLocation::setSearch): (WebCore::JSLocation::setHash): (WebCore::JSLocation::replace): (WebCore::JSLocation::reload): (WebCore::JSLocation::assign): (WebCore::JSLocation::toString):
  • bindings/js/JSMessageChannelConstructor.h:
  • bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::startConversation): (WebCore::JSMessagePort::addEventListener): (WebCore::JSMessagePort::removeEventListener):
  • bindings/js/JSMimeTypeArrayCustom.cpp: (WebCore::JSMimeTypeArray::nameGetter):
  • bindings/js/JSNamedNodeMapCustom.cpp: (WebCore::JSNamedNodeMap::nameGetter):
  • bindings/js/JSNamedNodesCollection.cpp: (WebCore::JSNamedNodesCollection::lengthGetter): (WebCore::JSNamedNodesCollection::indexGetter):
  • bindings/js/JSNamedNodesCollection.h: (WebCore::JSNamedNodesCollection::createStructure):
  • bindings/js/JSNavigatorCustom.cpp: (WebCore::needsYouTubeQuirk): (WebCore::JSNavigator::appVersion):
  • bindings/js/JSNodeCustom.cpp: (WebCore::JSNode::insertBefore): (WebCore::JSNode::replaceChild): (WebCore::JSNode::removeChild): (WebCore::JSNode::appendChild): (WebCore::createWrapper): (WebCore::toJSNewlyCreated): (WebCore::toJS):
  • bindings/js/JSNodeFilterCondition.cpp: (WebCore::JSNodeFilterCondition::JSNodeFilterCondition): (WebCore::JSNodeFilterCondition::acceptNode):
  • bindings/js/JSNodeFilterCondition.h: (WebCore::JSNodeFilterCondition::create):
  • bindings/js/JSNodeFilterCustom.cpp: (WebCore::JSNodeFilter::acceptNode): (WebCore::toNodeFilter):
  • bindings/js/JSNodeIteratorCustom.cpp: (WebCore::JSNodeIterator::nextNode): (WebCore::JSNodeIterator::previousNode):
  • bindings/js/JSNodeListCustom.cpp: (WebCore::callNodeList): (WebCore::JSNodeList::nameGetter):
  • bindings/js/JSPluginArrayCustom.cpp: (WebCore::JSPluginArray::nameGetter):
  • bindings/js/JSPluginCustom.cpp: (WebCore::JSPlugin::nameGetter):
  • bindings/js/JSPluginElementFunctions.cpp: (WebCore::runtimeObjectGetter): (WebCore::runtimeObjectPropertyGetter): (WebCore::runtimeObjectCustomPut): (WebCore::callPlugin):
  • bindings/js/JSPluginElementFunctions.h:
  • bindings/js/JSQuarantinedObjectWrapper.cpp: (WebCore::JSQuarantinedObjectWrapper::asWrapper): (WebCore::JSQuarantinedObjectWrapper::cachedValueGetter): (WebCore::JSQuarantinedObjectWrapper::getOwnPropertySlot): (WebCore::JSQuarantinedObjectWrapper::put): (WebCore::JSQuarantinedObjectWrapper::construct): (WebCore::JSQuarantinedObjectWrapper::hasInstance): (WebCore::JSQuarantinedObjectWrapper::call):
  • bindings/js/JSQuarantinedObjectWrapper.h: (WebCore::JSQuarantinedObjectWrapper::createStructure):
  • bindings/js/JSRGBColor.cpp: (WebCore::getJSRGBColor): (jsRGBColorRed): (jsRGBColorGreen): (jsRGBColorBlue):
  • bindings/js/JSRGBColor.h: (WebCore::JSRGBColor::createStructure):
  • bindings/js/JSSQLResultSetRowListCustom.cpp: (WebCore::JSSQLResultSetRowList::item):
  • bindings/js/JSSQLTransactionCustom.cpp: (WebCore::JSSQLTransaction::executeSql):
  • bindings/js/JSSVGElementInstanceCustom.cpp: (WebCore::JSSVGElementInstance::addEventListener): (WebCore::JSSVGElementInstance::removeEventListener):
  • bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value): (WebCore::JSSVGLength::convertToSpecifiedUnits):
  • bindings/js/JSSVGMatrixCustom.cpp: (WebCore::JSSVGMatrix::multiply): (WebCore::JSSVGMatrix::inverse): (WebCore::JSSVGMatrix::translate): (WebCore::JSSVGMatrix::scale): (WebCore::JSSVGMatrix::scaleNonUniform): (WebCore::JSSVGMatrix::rotate): (WebCore::JSSVGMatrix::rotateFromVector): (WebCore::JSSVGMatrix::flipX): (WebCore::JSSVGMatrix::flipY): (WebCore::JSSVGMatrix::skewX): (WebCore::JSSVGMatrix::skewY):
  • bindings/js/JSSVGPathSegCustom.cpp: (WebCore::toJS):
  • bindings/js/JSSVGPathSegListCustom.cpp: (WebCore::JSSVGPathSegList::clear): (WebCore::JSSVGPathSegList::initialize): (WebCore::JSSVGPathSegList::getItem): (WebCore::JSSVGPathSegList::insertItemBefore): (WebCore::JSSVGPathSegList::replaceItem): (WebCore::JSSVGPathSegList::removeItem): (WebCore::JSSVGPathSegList::appendItem):
  • bindings/js/JSSVGPointListCustom.cpp: (WebCore::finishGetter): (WebCore::finishSetter): (WebCore::finishSetterReadOnlyResult): (WebCore::JSSVGPointList::clear): (WebCore::JSSVGPointList::initialize): (WebCore::JSSVGPointList::getItem): (WebCore::JSSVGPointList::insertItemBefore): (WebCore::JSSVGPointList::replaceItem): (WebCore::JSSVGPointList::removeItem): (WebCore::JSSVGPointList::appendItem):
  • bindings/js/JSSVGTransformListCustom.cpp: (WebCore::finishGetter): (WebCore::finishSetter): (WebCore::finishSetterReadOnlyResult): (WebCore::JSSVGTransformList::clear): (WebCore::JSSVGTransformList::initialize): (WebCore::JSSVGTransformList::getItem): (WebCore::JSSVGTransformList::insertItemBefore): (WebCore::JSSVGTransformList::replaceItem): (WebCore::JSSVGTransformList::removeItem): (WebCore::JSSVGTransformList::appendItem):
  • bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::nameGetter): (WebCore::JSStorage::deleteProperty): (WebCore::JSStorage::customPut):
  • bindings/js/JSStyleSheetCustom.cpp: (WebCore::toJS):
  • bindings/js/JSStyleSheetListCustom.cpp: (WebCore::JSStyleSheetList::nameGetter):
  • bindings/js/JSTextCustom.cpp: (WebCore::toJSNewlyCreated):
  • bindings/js/JSTreeWalkerCustom.cpp: (WebCore::JSTreeWalker::parentNode): (WebCore::JSTreeWalker::firstChild): (WebCore::JSTreeWalker::lastChild): (WebCore::JSTreeWalker::nextSibling): (WebCore::JSTreeWalker::previousSibling): (WebCore::JSTreeWalker::previousNode): (WebCore::JSTreeWalker::nextNode):
  • bindings/js/JSWorkerContextBase.cpp: (WebCore::JSWorkerContextBase::put):
  • bindings/js/JSWorkerContextBase.h:
  • bindings/js/JSWorkerContextCustom.cpp: (WebCore::JSWorkerContext::self): (WebCore::JSWorkerContext::setSelf): (WebCore::JSWorkerContext::addEventListener): (WebCore::JSWorkerContext::removeEventListener):
  • bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorker::addEventListener): (WebCore::JSWorker::removeEventListener):
  • bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::open): (WebCore::JSXMLHttpRequest::setRequestHeader): (WebCore::JSXMLHttpRequest::send): (WebCore::JSXMLHttpRequest::getResponseHeader): (WebCore::JSXMLHttpRequest::overrideMimeType): (WebCore::JSXMLHttpRequest::addEventListener): (WebCore::JSXMLHttpRequest::removeEventListener): (WebCore::JSXMLHttpRequest::responseText):
  • bindings/js/JSXMLHttpRequestUploadCustom.cpp: (WebCore::JSXMLHttpRequestUpload::addEventListener): (WebCore::JSXMLHttpRequestUpload::removeEventListener):
  • bindings/js/JSXSLTProcessorCustom.cpp: (WebCore::JSXSLTProcessor::importStylesheet): (WebCore::JSXSLTProcessor::transformToFragment): (WebCore::JSXSLTProcessor::transformToDocument): (WebCore::JSXSLTProcessor::setParameter): (WebCore::JSXSLTProcessor::getParameter): (WebCore::JSXSLTProcessor::removeParameter):
  • bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::ScheduledAction): (WebCore::ScheduledAction::execute):
  • bindings/js/ScheduledAction.h:
  • bindings/js/ScriptCallStack.cpp: (WebCore::ScriptCallStack::ScriptCallStack): (WebCore::ScriptCallStack::initialize):
  • bindings/js/ScriptController.cpp: (WebCore::ScriptController::createScriptObjectForPluginElement):
  • bindings/js/ScriptValue.cpp: (WebCore::ScriptValue::getString): (WebCore::ScriptValue::isNull): (WebCore::ScriptValue::isUndefined):
  • bindings/js/ScriptValue.h: (WebCore::ScriptValue::ScriptValue): (WebCore::ScriptValue::jsValue):
  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (-[WebScriptObject evaluateWebScript:]): (-[WebScriptObject valueForKey:]): (-[WebScriptObject webScriptValueAtIndex:]): (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
  • bindings/objc/WebScriptObjectPrivate.h:
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/NP_jsobject.cpp: (_NPN_InvokeDefault): (_NPN_Invoke): (_NPN_Evaluate): (_NPN_GetProperty): (_NPN_HasMethod): (_NPN_Construct):
  • bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::invokeMethod): (JSC::Bindings::CInstance::invokeDefaultMethod): (JSC::Bindings::CInstance::invokeConstruct): (JSC::Bindings::CInstance::defaultValue): (JSC::Bindings::CInstance::stringValue): (JSC::Bindings::CInstance::numberValue): (JSC::Bindings::CInstance::booleanValue): (JSC::Bindings::CInstance::valueOf):
  • bridge/c/c_instance.h:
  • bridge/c/c_runtime.cpp: (JSC::Bindings::CField::valueFromInstance): (JSC::Bindings::CField::setValueToInstance):
  • bridge/c/c_runtime.h:
  • bridge/c/c_utility.cpp: (JSC::Bindings::convertValueToNPVariant): (JSC::Bindings::convertNPVariantToValue):
  • bridge/c/c_utility.h:
  • bridge/jni/jni_instance.cpp: (JavaInstance::stringValue): (JavaInstance::numberValue): (JavaInstance::booleanValue): (JavaInstance::invokeMethod): (JavaInstance::defaultValue): (JavaInstance::valueOf):
  • bridge/jni/jni_instance.h:
  • bridge/jni/jni_jsobject.h:
  • bridge/jni/jni_jsobject.mm: (JavaJSObject::call): (JavaJSObject::eval): (JavaJSObject::getMember): (JavaJSObject::getSlot): (JavaJSObject::convertValueToJObject): (JavaJSObject::convertJObjectToValue):
  • bridge/jni/jni_objc.mm: (JSC::Bindings::dispatchJNICall):
  • bridge/jni/jni_runtime.cpp: (JavaArray::convertJObjectToArray): (JavaField::dispatchValueFromInstance): (JavaField::valueFromInstance): (JavaField::dispatchSetValueToInstance): (JavaField::setValueToInstance): (JavaArray::setValueAt): (JavaArray::valueAt):
  • bridge/jni/jni_runtime.h:
  • bridge/jni/jni_utility.cpp: (JSC::Bindings::convertArrayInstanceToJavaArray): (JSC::Bindings::convertValueToJValue):
  • bridge/jni/jni_utility.h:
  • bridge/objc/WebScriptObject.h:
  • bridge/objc/objc_class.h:
  • bridge/objc/objc_class.mm: (JSC::Bindings::ObjcClass::fallbackObject):
  • bridge/objc/objc_instance.h:
  • bridge/objc/objc_instance.mm: (ObjcInstance::invokeMethod): (ObjcInstance::invokeDefaultMethod): (ObjcInstance::setValueOfUndefinedField): (ObjcInstance::getValueOfUndefinedField): (ObjcInstance::defaultValue): (ObjcInstance::stringValue): (ObjcInstance::numberValue): (ObjcInstance::booleanValue): (ObjcInstance::valueOf):
  • bridge/objc/objc_runtime.h: (JSC::Bindings::ObjcFallbackObjectImp::createStructure):
  • bridge/objc/objc_runtime.mm: (JSC::Bindings::ObjcField::valueFromInstance): (JSC::Bindings::convertValueToObjcObject): (JSC::Bindings::ObjcField::setValueToInstance): (JSC::Bindings::ObjcArray::setValueAt): (JSC::Bindings::ObjcArray::valueAt): (JSC::Bindings::ObjcFallbackObjectImp::put): (JSC::Bindings::callObjCFallbackObject): (JSC::Bindings::ObjcFallbackObjectImp::defaultValue):
  • bridge/objc/objc_utility.h:
  • bridge/objc/objc_utility.mm: (JSC::Bindings::convertValueToObjcValue): (JSC::Bindings::convertNSStringToString): (JSC::Bindings::convertObjcValueToValue):
  • bridge/runtime.cpp: (JSC::Bindings::Instance::getValueOfField): (JSC::Bindings::Instance::setValueOfField):
  • bridge/runtime.h: (JSC::Bindings::Class::fallbackObject): (JSC::Bindings::Instance::getValueOfUndefinedField): (JSC::Bindings::Instance::setValueOfUndefinedField): (JSC::Bindings::Instance::invokeDefaultMethod): (JSC::Bindings::Instance::invokeConstruct): (JSC::Bindings::Instance::valueOf):
  • bridge/runtime_array.cpp: (JSC::RuntimeArray::lengthGetter): (JSC::RuntimeArray::indexGetter): (JSC::RuntimeArray::put):
  • bridge/runtime_array.h: (JSC::RuntimeArray::createStructure):
  • bridge/runtime_method.cpp: (JSC::RuntimeMethod::lengthGetter): (JSC::callRuntimeMethod):
  • bridge/runtime_method.h: (JSC::RuntimeMethod::createStructure):
  • bridge/runtime_object.cpp: (JSC::RuntimeObjectImp::fallbackObjectGetter): (JSC::RuntimeObjectImp::fieldGetter): (JSC::RuntimeObjectImp::methodGetter): (JSC::RuntimeObjectImp::put): (JSC::RuntimeObjectImp::defaultValue): (JSC::callRuntimeObject): (JSC::callRuntimeConstructor):
  • bridge/runtime_object.h: (JSC::RuntimeObjectImp::createStructure):
  • inspector/InspectorController.cpp:
  • inspector/JavaScriptCallFrame.cpp: (WebCore::JavaScriptCallFrame::evaluate):
  • inspector/JavaScriptCallFrame.h:
  • inspector/JavaScriptProfile.cpp: (WebCore::toJS):
  • inspector/JavaScriptProfile.h:
  • inspector/JavaScriptProfileNode.cpp: (WebCore::toJS):
  • inspector/JavaScriptProfileNode.h:
  • xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::dropProtection):

WebKit/mac:

2009-01-05 Gavin Barraclough <[email protected]>

Rubber Stamped by Oliver Hunt.

Replace all uses of JSValue* with new wrapper class, JSValuePtr.
See JavaScriptCore/ChangeLog for more detailed description.

  • WebView/WebFrame.mm: (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
  • WebView/WebScriptDebugDelegate.mm: (-[WebScriptCallFrame _convertValueToObjcValue:]): (-[WebScriptCallFrame exception]): (-[WebScriptCallFrame evaluateWebScript:]):
  • WebView/WebView.mm: (aeDescFromJSValue): (-[WebView aeDescByEvaluatingJavaScriptFromString:]):
  • Property svn:eol-style set to native
File size: 20.5 KB
Line 
1/*
2 * Copyright (C) 1999-2001 Harri Porten ([email protected])
3 * Copyright (C) 2001 Peter Kelly ([email protected])
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef JSObject_h
24#define JSObject_h
25
26#include "ArgList.h"
27#include "ClassInfo.h"
28#include "CommonIdentifiers.h"
29#include "CallFrame.h"
30#include "JSNumberCell.h"
31#include "PropertySlot.h"
32#include "PutPropertySlot.h"
33#include "ScopeChain.h"
34#include "Structure.h"
35
36namespace JSC {
37
38 class InternalFunction;
39 class PropertyNameArray;
40 class Structure;
41 struct HashEntry;
42 struct HashTable;
43
44 // ECMA 262-3 8.6.1
45 // Property attributes
46 enum Attribute {
47 None = 0,
48 ReadOnly = 1 << 1, // property can be only read, not written
49 DontEnum = 1 << 2, // property doesn't appear in (for .. in ..)
50 DontDelete = 1 << 3, // property can't be deleted
51 Function = 1 << 4, // property is a function - only used by static hashtables
52 };
53
54 typedef JSValuePtr* PropertyStorage;
55
56 class JSObject : public JSCell {
57 friend class BatchedTransitionOptimizer;
58 friend class JIT;
59 friend class JSCell;
60
61 public:
62 explicit JSObject(PassRefPtr<Structure>);
63
64 virtual void mark();
65
66 // The inline virtual destructor cannot be the first virtual function declared
67 // in the class as it results in the vtable being generated as a weak symbol
68 virtual ~JSObject();
69
70 bool inherits(const ClassInfo* classInfo) const { return JSCell::isObject(classInfo); }
71
72 JSValuePtr prototype() const;
73 void setPrototype(JSValuePtr prototype);
74
75 void setStructure(PassRefPtr<Structure>);
76 Structure* inheritorID();
77
78 PropertyStorage& propertyStorage() { return m_propertyStorage; }
79
80 virtual UString className() const;
81
82 JSValuePtr get(ExecState*, const Identifier& propertyName) const;
83 JSValuePtr get(ExecState*, unsigned propertyName) const;
84
85 bool getPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
86 bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
87
88 virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
89 virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
90
91 virtual void put(ExecState*, const Identifier& propertyName, JSValuePtr value, PutPropertySlot&);
92 virtual void put(ExecState*, unsigned propertyName, JSValuePtr value);
93
94 virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValuePtr value, unsigned attributes);
95 virtual void putWithAttributes(ExecState*, unsigned propertyName, JSValuePtr value, unsigned attributes);
96
97 bool propertyIsEnumerable(ExecState*, const Identifier& propertyName) const;
98
99 bool hasProperty(ExecState*, const Identifier& propertyName) const;
100 bool hasProperty(ExecState*, unsigned propertyName) const;
101 bool hasOwnProperty(ExecState*, const Identifier& propertyName) const;
102
103 virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
104 virtual bool deleteProperty(ExecState*, unsigned propertyName);
105
106 virtual JSValuePtr defaultValue(ExecState*, PreferredPrimitiveType) const;
107
108 virtual bool hasInstance(ExecState*, JSValuePtr, JSValuePtr prototypeProperty);
109
110 virtual void getPropertyNames(ExecState*, PropertyNameArray&);
111
112 virtual JSValuePtr toPrimitive(ExecState*, PreferredPrimitiveType = NoPreference) const;
113 virtual bool getPrimitiveNumber(ExecState*, double& number, JSValuePtr& value);
114 virtual bool toBoolean(ExecState*) const;
115 virtual double toNumber(ExecState*) const;
116 virtual UString toString(ExecState*) const;
117 virtual JSObject* toObject(ExecState*) const;
118
119 virtual JSObject* toThisObject(ExecState*) const;
120 virtual JSObject* unwrappedObject();
121
122 virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const;
123
124 // This get function only looks at the property map.
125 JSValuePtr getDirect(const Identifier& propertyName) const
126 {
127 size_t offset = m_structure->get(propertyName);
128 return offset != WTF::notFound ? m_propertyStorage[offset] : noValue();
129 }
130
131 JSValuePtr* getDirectLocation(const Identifier& propertyName)
132 {
133 size_t offset = m_structure->get(propertyName);
134 return offset != WTF::notFound ? locationForOffset(offset) : 0;
135 }
136
137 JSValuePtr* getDirectLocation(const Identifier& propertyName, unsigned& attributes)
138 {
139 size_t offset = m_structure->get(propertyName, attributes);
140 return offset != WTF::notFound ? locationForOffset(offset) : 0;
141 }
142
143 size_t offsetForLocation(JSValuePtr* location)
144 {
145 return location - m_propertyStorage;
146 }
147
148 JSValuePtr* locationForOffset(size_t offset)
149 {
150 return &m_propertyStorage[offset];
151 }
152
153 void transitionTo(Structure*);
154
155 void removeDirect(const Identifier& propertyName);
156 bool hasCustomProperties() { return !m_structure->isEmpty(); }
157 bool hasGetterSetterProperties() { return m_structure->hasGetterSetterProperties(); }
158
159 void putDirect(const Identifier& propertyName, JSValuePtr value, unsigned attr = 0);
160 void putDirect(const Identifier& propertyName, JSValuePtr value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
161 void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);
162 void putDirectWithoutTransition(const Identifier& propertyName, JSValuePtr value, unsigned attr = 0);
163 void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0);
164
165 // Fast access to known property offsets.
166 JSValuePtr getDirectOffset(size_t offset) { return m_propertyStorage[offset]; }
167 void putDirectOffset(size_t offset, JSValuePtr value) { m_propertyStorage[offset] = value; }
168
169 void fillGetterPropertySlot(PropertySlot&, JSValuePtr* location);
170
171 virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction);
172 virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction);
173 virtual JSValuePtr lookupGetter(ExecState*, const Identifier& propertyName);
174 virtual JSValuePtr lookupSetter(ExecState*, const Identifier& propertyName);
175
176 virtual bool isGlobalObject() const { return false; }
177 virtual bool isVariableObject() const { return false; }
178 virtual bool isWatchdogException() const { return false; }
179 virtual bool isNotAnObjectErrorStub() const { return false; }
180
181 void allocatePropertyStorage(size_t oldSize, size_t newSize);
182 void allocatePropertyStorageInline(size_t oldSize, size_t newSize);
183 bool usingInlineStorage() const { return m_propertyStorage == m_inlineStorage; }
184
185 static const size_t inlineStorageCapacity = 2;
186 static const size_t nonInlineBaseStorageCapacity = 16;
187
188 static PassRefPtr<Structure> createStructure(JSValuePtr prototype)
189 {
190 return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot));
191 }
192
193 protected:
194 bool getOwnPropertySlotForWrite(ExecState*, const Identifier&, PropertySlot&, bool& slotIsWriteable);
195
196 private:
197 bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
198
199 const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const;
200 Structure* createInheritorID();
201
202 RefPtr<Structure> m_inheritorID;
203
204 PropertyStorage m_propertyStorage;
205 JSValuePtr m_inlineStorage[inlineStorageCapacity];
206 };
207
208 JSObject* asObject(JSValuePtr);
209
210 JSObject* constructEmptyObject(ExecState*);
211
212inline JSObject* asObject(JSValuePtr value)
213{
214 ASSERT(asCell(value)->isObject());
215 return static_cast<JSObject*>(asCell(value));
216}
217
218inline JSObject::JSObject(PassRefPtr<Structure> structure)
219 : JSCell(structure.releaseRef()) // ~JSObject balances this ref()
220 , m_propertyStorage(m_inlineStorage)
221{
222 ASSERT(m_structure);
223 ASSERT(m_structure->propertyStorageCapacity() == inlineStorageCapacity);
224 ASSERT(m_structure->isEmpty());
225 ASSERT(prototype()->isNull() || Heap::heap(this) == Heap::heap(prototype()));
226}
227
228inline JSObject::~JSObject()
229{
230 ASSERT(m_structure);
231 if (m_propertyStorage != m_inlineStorage)
232 delete [] m_propertyStorage;
233 m_structure->deref();
234}
235
236inline JSValuePtr JSObject::prototype() const
237{
238 return m_structure->storedPrototype();
239}
240
241inline void JSObject::setPrototype(JSValuePtr prototype)
242{
243 ASSERT(prototype);
244 RefPtr<Structure> newStructure = Structure::changePrototypeTransition(m_structure, prototype);
245 setStructure(newStructure.release());
246}
247
248inline void JSObject::setStructure(PassRefPtr<Structure> structure)
249{
250 m_structure->deref();
251 m_structure = structure.releaseRef(); // ~JSObject balances this ref()
252}
253
254inline Structure* JSObject::inheritorID()
255{
256 if (m_inheritorID)
257 return m_inheritorID.get();
258 return createInheritorID();
259}
260
261inline bool JSCell::isObject(const ClassInfo* info) const
262{
263 for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) {
264 if (ci == info)
265 return true;
266 }
267 return false;
268}
269
270// this method is here to be after the inline declaration of JSCell::isObject
271inline bool JSValue::isObject(const ClassInfo* classInfo) const
272{
273 return !JSImmediate::isImmediate(asValue()) && asCell()->isObject(classInfo);
274}
275
276ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
277{
278 if (JSValuePtr* location = getDirectLocation(propertyName)) {
279 if (m_structure->hasGetterSetterProperties() && location[0]->isGetterSetter())
280 fillGetterPropertySlot(slot, location);
281 else
282 slot.setValueSlot(this, location, offsetForLocation(location));
283 return true;
284 }
285
286 // non-standard Netscape extension
287 if (propertyName == exec->propertyNames().underscoreProto) {
288 slot.setValue(prototype());
289 return true;
290 }
291
292 return false;
293}
294
295ALWAYS_INLINE bool JSObject::getOwnPropertySlotForWrite(ExecState* exec, const Identifier& propertyName, PropertySlot& slot, bool& slotIsWriteable)
296{
297 unsigned attributes;
298 if (JSValuePtr* location = getDirectLocation(propertyName, attributes)) {
299 if (m_structure->hasGetterSetterProperties() && location[0]->isGetterSetter()) {
300 slotIsWriteable = false;
301 fillGetterPropertySlot(slot, location);
302 } else {
303 slotIsWriteable = !(attributes & ReadOnly);
304 slot.setValueSlot(this, location, offsetForLocation(location));
305 }
306 return true;
307 }
308
309 // non-standard Netscape extension
310 if (propertyName == exec->propertyNames().underscoreProto) {
311 slot.setValue(prototype());
312 slotIsWriteable = false;
313 return true;
314 }
315
316 return false;
317}
318
319// It may seem crazy to inline a function this large, especially a virtual function,
320// but it makes a big difference to property lookup that derived classes can inline their
321// base class call to this.
322ALWAYS_INLINE bool JSObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
323{
324 return inlineGetOwnPropertySlot(exec, propertyName, slot);
325}
326
327ALWAYS_INLINE bool JSCell::fastGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
328{
329 if (structure()->typeInfo().hasStandardGetOwnPropertySlot())
330 return asObject(this)->inlineGetOwnPropertySlot(exec, propertyName, slot);
331 return getOwnPropertySlot(exec, propertyName, slot);
332}
333
334// It may seem crazy to inline a function this large but it makes a big difference
335// since this is function very hot in variable lookup
336inline bool JSObject::getPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
337{
338 JSObject* object = this;
339 while (true) {
340 if (object->fastGetOwnPropertySlot(exec, propertyName, slot))
341 return true;
342 JSValuePtr prototype = object->prototype();
343 if (!prototype->isObject())
344 return false;
345 object = asObject(prototype);
346 }
347}
348
349inline bool JSObject::getPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
350{
351 JSObject* object = this;
352 while (true) {
353 if (object->getOwnPropertySlot(exec, propertyName, slot))
354 return true;
355 JSValuePtr prototype = object->prototype();
356 if (!prototype->isObject())
357 return false;
358 object = asObject(prototype);
359 }
360}
361
362inline JSValuePtr JSObject::get(ExecState* exec, const Identifier& propertyName) const
363{
364 PropertySlot slot(this);
365 if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot))
366 return slot.getValue(exec, propertyName);
367
368 return jsUndefined();
369}
370
371inline JSValuePtr JSObject::get(ExecState* exec, unsigned propertyName) const
372{
373 PropertySlot slot(this);
374 if (const_cast<JSObject*>(this)->getPropertySlot(exec, propertyName, slot))
375 return slot.getValue(exec, propertyName);
376
377 return jsUndefined();
378}
379
380inline void JSObject::putDirect(const Identifier& propertyName, JSValuePtr value, unsigned attr)
381{
382 PutPropertySlot slot;
383 putDirect(propertyName, value, attr, false, slot);
384}
385
386inline void JSObject::putDirect(const Identifier& propertyName, JSValuePtr value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
387{
388 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
389
390 if (m_structure->isDictionary()) {
391 unsigned currentAttributes;
392 size_t offset = m_structure->get(propertyName, currentAttributes);
393 if (offset != WTF::notFound) {
394 if (checkReadOnly && currentAttributes & ReadOnly)
395 return;
396 m_propertyStorage[offset] = value;
397 slot.setExistingProperty(this, offset);
398 return;
399 }
400
401 size_t currentCapacity = m_structure->propertyStorageCapacity();
402 offset = m_structure->addPropertyWithoutTransition(propertyName, attributes);
403 if (currentCapacity != m_structure->propertyStorageCapacity())
404 allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
405
406 ASSERT(offset < m_structure->propertyStorageCapacity());
407 m_propertyStorage[offset] = value;
408 slot.setNewProperty(this, offset);
409 return;
410 }
411
412 size_t offset;
413 size_t currentCapacity = m_structure->propertyStorageCapacity();
414 if (RefPtr<Structure> structure = Structure::addPropertyTransitionToExistingStructure(m_structure, propertyName, attributes, offset)) {
415 if (currentCapacity != structure->propertyStorageCapacity())
416 allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
417
418 ASSERT(offset < structure->propertyStorageCapacity());
419 m_propertyStorage[offset] = value;
420 slot.setNewProperty(this, offset);
421 slot.setWasTransition(true);
422 setStructure(structure.release());
423 return;
424 }
425
426 unsigned currentAttributes;
427 offset = m_structure->get(propertyName, currentAttributes);
428 if (offset != WTF::notFound) {
429 if (checkReadOnly && currentAttributes & ReadOnly)
430 return;
431 m_propertyStorage[offset] = value;
432 slot.setExistingProperty(this, offset);
433 return;
434 }
435
436 RefPtr<Structure> structure = Structure::addPropertyTransition(m_structure, propertyName, attributes, offset);
437 if (currentCapacity != structure->propertyStorageCapacity())
438 allocatePropertyStorage(currentCapacity, structure->propertyStorageCapacity());
439
440 ASSERT(offset < structure->propertyStorageCapacity());
441 m_propertyStorage[offset] = value;
442 slot.setNewProperty(this, offset);
443 slot.setWasTransition(true);
444 setStructure(structure.release());
445}
446
447inline void JSObject::putDirectWithoutTransition(const Identifier& propertyName, JSValuePtr value, unsigned attributes)
448{
449 size_t currentCapacity = m_structure->propertyStorageCapacity();
450 size_t offset = m_structure->addPropertyWithoutTransition(propertyName, attributes);
451 if (currentCapacity != m_structure->propertyStorageCapacity())
452 allocatePropertyStorage(currentCapacity, m_structure->propertyStorageCapacity());
453 m_propertyStorage[offset] = value;
454}
455
456inline void JSObject::transitionTo(Structure* newStructure)
457{
458 if (m_structure->propertyStorageCapacity() != newStructure->propertyStorageCapacity())
459 allocatePropertyStorage(m_structure->propertyStorageCapacity(), newStructure->propertyStorageCapacity());
460 setStructure(newStructure);
461}
462
463inline JSValuePtr JSObject::toPrimitive(ExecState* exec, PreferredPrimitiveType preferredType) const
464{
465 return defaultValue(exec, preferredType);
466}
467
468inline JSValuePtr JSValue::get(ExecState* exec, const Identifier& propertyName) const
469{
470 PropertySlot slot(this);
471 return get(exec, propertyName, slot);
472}
473
474inline JSValuePtr JSValue::get(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) const
475{
476 if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
477 JSObject* prototype = JSImmediate::prototype(asValue(), exec);
478 if (!prototype->getPropertySlot(exec, propertyName, slot))
479 return jsUndefined();
480 return slot.getValue(exec, propertyName);
481 }
482 JSCell* cell = asCell();
483 while (true) {
484 if (cell->fastGetOwnPropertySlot(exec, propertyName, slot))
485 return slot.getValue(exec, propertyName);
486 ASSERT(cell->isObject());
487 JSValuePtr prototype = static_cast<JSObject*>(cell)->prototype();
488 if (!prototype->isObject())
489 return jsUndefined();
490 cell = asObject(prototype);
491 }
492}
493
494inline JSValuePtr JSValue::get(ExecState* exec, unsigned propertyName) const
495{
496 PropertySlot slot(this);
497 return get(exec, propertyName, slot);
498}
499
500inline JSValuePtr JSValue::get(ExecState* exec, unsigned propertyName, PropertySlot& slot) const
501{
502 if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
503 JSObject* prototype = JSImmediate::prototype(asValue(), exec);
504 if (!prototype->getPropertySlot(exec, propertyName, slot))
505 return jsUndefined();
506 return slot.getValue(exec, propertyName);
507 }
508 JSCell* cell = const_cast<JSCell*>(asCell());
509 while (true) {
510 if (cell->getOwnPropertySlot(exec, propertyName, slot))
511 return slot.getValue(exec, propertyName);
512 ASSERT(cell->isObject());
513 JSValuePtr prototype = static_cast<JSObject*>(cell)->prototype();
514 if (!prototype->isObject())
515 return jsUndefined();
516 cell = prototype->asCell();
517 }
518}
519
520inline void JSValue::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
521{
522 if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
523 JSImmediate::toObject(asValue(), exec)->put(exec, propertyName, value, slot);
524 return;
525 }
526 asCell()->put(exec, propertyName, value, slot);
527}
528
529inline void JSValue::put(ExecState* exec, unsigned propertyName, JSValuePtr value)
530{
531 if (UNLIKELY(JSImmediate::isImmediate(asValue()))) {
532 JSImmediate::toObject(asValue(), exec)->put(exec, propertyName, value);
533 return;
534 }
535 asCell()->put(exec, propertyName, value);
536}
537
538ALWAYS_INLINE void JSObject::allocatePropertyStorageInline(size_t oldSize, size_t newSize)
539{
540 ASSERT(newSize > oldSize);
541
542 JSValuePtr* oldPropertyStorage = m_propertyStorage;
543 m_propertyStorage = new JSValuePtr[newSize];
544
545 for (unsigned i = 0; i < oldSize; ++i)
546 m_propertyStorage[i] = oldPropertyStorage[i];
547
548 if (oldPropertyStorage != m_inlineStorage)
549 delete [] oldPropertyStorage;
550}
551
552} // namespace JSC
553
554#endif // JSObject_h
Note: See TracBrowser for help on using the repository browser.