+2009-01-05 Gavin Barraclough <baraclough@apple.com>
+
+ 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):
+
2009-01-06 Oliver Hunt <oliver@apple.com>
Reviewed by Cameron Zwarich.
// FIXME: This operation should be called "getNumber", not "isNumber" (as it is in JSValue.h).
// FIXME: There's no need to have a "slow" version of this. All versions should be fast.
-static ALWAYS_INLINE bool fastIsNumber(JSValue* value, double& arg)
+static ALWAYS_INLINE bool fastIsNumber(JSValuePtr value, double& arg)
{
if (JSImmediate::isNumber(value))
arg = JSImmediate::getTruncatedInt32(value);
return true;
}
-// FIXME: Why doesn't JSValue*::toInt32 have the Heap::isNumber optimization?
-static bool fastToInt32(JSValue* value, int32_t& arg)
+// FIXME: Why doesn't JSValuePtr::toInt32 have the Heap::isNumber optimization?
+static bool fastToInt32(JSValuePtr value, int32_t& arg)
{
if (JSImmediate::isNumber(value))
arg = JSImmediate::getTruncatedInt32(value);
return true;
}
-static ALWAYS_INLINE bool fastToUInt32(JSValue* value, uint32_t& arg)
+static ALWAYS_INLINE bool fastToUInt32(JSValuePtr value, uint32_t& arg)
{
if (JSImmediate::isNumber(value)) {
if (JSImmediate::getTruncatedUInt32(value, arg))
return true;
}
-static inline bool jsLess(CallFrame* callFrame, JSValue* v1, JSValue* v2)
+static inline bool jsLess(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2)
{
if (JSImmediate::areBothImmediateNumbers(v1, v2))
return JSImmediate::getTruncatedInt32(v1) < JSImmediate::getTruncatedInt32(v2);
if (interpreter->isJSString(v1) && interpreter->isJSString(v2))
return asString(v1)->value() < asString(v2)->value();
- JSValue* p1;
- JSValue* p2;
+ JSValuePtr p1;
+ JSValuePtr p2;
bool wasNotString1 = v1->getPrimitiveNumber(callFrame, n1, p1);
bool wasNotString2 = v2->getPrimitiveNumber(callFrame, n2, p2);
return asString(p1)->value() < asString(p2)->value();
}
-static inline bool jsLessEq(CallFrame* callFrame, JSValue* v1, JSValue* v2)
+static inline bool jsLessEq(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2)
{
if (JSImmediate::areBothImmediateNumbers(v1, v2))
return JSImmediate::getTruncatedInt32(v1) <= JSImmediate::getTruncatedInt32(v2);
if (interpreter->isJSString(v1) && interpreter->isJSString(v2))
return !(asString(v2)->value() < asString(v1)->value());
- JSValue* p1;
- JSValue* p2;
+ JSValuePtr p1;
+ JSValuePtr p2;
bool wasNotString1 = v1->getPrimitiveNumber(callFrame, n1, p1);
bool wasNotString2 = v2->getPrimitiveNumber(callFrame, n2, p2);
return !(asString(p2)->value() < asString(p1)->value());
}
-static NEVER_INLINE JSValue* jsAddSlowCase(CallFrame* callFrame, JSValue* v1, JSValue* v2)
+static NEVER_INLINE JSValuePtr jsAddSlowCase(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2)
{
// exception for the Date exception in defaultValue()
- JSValue* p1 = v1->toPrimitive(callFrame);
- JSValue* p2 = v2->toPrimitive(callFrame);
+ JSValuePtr p1 = v1->toPrimitive(callFrame);
+ JSValuePtr p2 = v2->toPrimitive(callFrame);
if (p1->isString() || p2->isString()) {
RefPtr<UString::Rep> value = concatenate(p1->toString(callFrame).rep(), p2->toString(callFrame).rep());
// 13962 Add case: 5 3
// 4000 Add case: 3 5
-static ALWAYS_INLINE JSValue* jsAdd(CallFrame* callFrame, JSValue* v1, JSValue* v2)
+static ALWAYS_INLINE JSValuePtr jsAdd(CallFrame* callFrame, JSValuePtr v1, JSValuePtr v2)
{
double left;
double right = 0.0;
return jsAddSlowCase(callFrame, v1, v2);
}
-static JSValue* jsTypeStringForValue(CallFrame* callFrame, JSValue* v)
+static JSValuePtr jsTypeStringForValue(CallFrame* callFrame, JSValuePtr v)
{
if (v->isUndefined())
return jsNontrivialString(callFrame, "undefined");
return jsNontrivialString(callFrame, "object");
}
-static bool jsIsObjectType(JSValue* v)
+static bool jsIsObjectType(JSValuePtr v)
{
if (JSImmediate::isImmediate(v))
return v->isNull();
return true;
}
-static bool jsIsFunctionType(JSValue* v)
+static bool jsIsFunctionType(JSValuePtr v)
{
if (v->isObject()) {
CallData callData;
return false;
}
-NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValue*& exceptionValue)
+NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, JSValuePtr& exceptionValue)
{
int dst = (vPC + 1)->u.operand;
int property = (vPC + 2)->u.operand;
JSObject* o = *iter;
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[dst] = result;
+ callFrame[dst] = JSValuePtr(result);
return true;
}
} while (++iter != end);
return false;
}
-NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vPC, JSValue*& exceptionValue)
+NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vPC, JSValuePtr& exceptionValue)
{
CodeBlock* codeBlock = callFrame->codeBlock();
JSObject* o = *iter;
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[dst] = result;
+ callFrame[dst] = JSValuePtr(result);
return true;
}
} while (++iter != end);
return false;
}
-NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* vPC, JSValue*& exceptionValue)
+NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction* vPC, JSValuePtr& exceptionValue)
{
int dst = (vPC + 1)->u.operand;
JSGlobalObject* globalObject = static_cast<JSGlobalObject*>((vPC + 2)->u.jsCell);
int offset = (vPC + 5)->u.operand;
if (structure == globalObject->structure()) {
- callFrame[dst] = globalObject->getDirectOffset(offset);
+ callFrame[dst] = JSValuePtr(globalObject->getDirectOffset(offset));
return true;
}
Identifier& ident = codeBlock->identifier(property);
PropertySlot slot(globalObject);
if (globalObject->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
if (slot.isCacheable() && !globalObject->structure()->isDictionary()) {
if (vPC[4].u.structure)
vPC[4].u.structure->deref();
globalObject->structure()->ref();
vPC[4] = globalObject->structure();
vPC[5] = slot.cachedOffset();
- callFrame[dst] = result;
+ callFrame[dst] = JSValuePtr(result);
return true;
}
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[dst] = result;
+ callFrame[dst] = JSValuePtr(result);
return true;
}
return false;
}
-static ALWAYS_INLINE JSValue* inlineResolveBase(CallFrame* callFrame, Identifier& property, ScopeChainNode* scopeChain)
+static ALWAYS_INLINE JSValuePtr inlineResolveBase(CallFrame* callFrame, Identifier& property, ScopeChainNode* scopeChain)
{
ScopeChainIterator iter = scopeChain->begin();
ScopeChainIterator next = iter;
{
int dst = (vPC + 1)->u.operand;
int property = (vPC + 2)->u.operand;
- callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain());
+ callFrame[dst] = JSValuePtr(inlineResolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain()));
}
-NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Instruction* vPC, JSValue*& exceptionValue)
+NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Instruction* vPC, JSValuePtr& exceptionValue)
{
int baseDst = (vPC + 1)->u.operand;
int propDst = (vPC + 2)->u.operand;
base = *iter;
PropertySlot slot(base);
if (base->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[propDst] = result;
- callFrame[baseDst] = base;
+ callFrame[propDst] = JSValuePtr(result);
+ callFrame[baseDst] = JSValuePtr(base);
return true;
}
++iter;
return false;
}
-NEVER_INLINE bool Interpreter::resolveBaseAndFunc(CallFrame* callFrame, Instruction* vPC, JSValue*& exceptionValue)
+NEVER_INLINE bool Interpreter::resolveBaseAndFunc(CallFrame* callFrame, Instruction* vPC, JSValuePtr& exceptionValue)
{
int baseDst = (vPC + 1)->u.operand;
int funcDst = (vPC + 2)->u.operand;
// that in host objects you always get a valid object for this.
// We also handle wrapper substitution for the global object at the same time.
JSObject* thisObj = base->toThisObject(callFrame);
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
exceptionValue = callFrame->globalData().exception;
if (exceptionValue)
return false;
- callFrame[baseDst] = thisObj;
- callFrame[funcDst] = result;
+ callFrame[baseDst] = JSValuePtr(thisObj);
+ callFrame[funcDst] = JSValuePtr(result);
return true;
}
++iter;
return CallFrame::create(r);
}
-static NEVER_INLINE bool isNotObject(CallFrame* callFrame, bool forInstanceOf, CodeBlock* codeBlock, const Instruction* vPC, JSValue* value, JSValue*& exceptionData)
+static NEVER_INLINE bool isNotObject(CallFrame* callFrame, bool forInstanceOf, CodeBlock* codeBlock, const Instruction* vPC, JSValuePtr value, JSValuePtr& exceptionData)
{
if (value->isObject())
return false;
return true;
}
-NEVER_INLINE JSValue* Interpreter::callEval(CallFrame* callFrame, RegisterFile* registerFile, Register* argv, int argc, int registerOffset, JSValue*& exceptionValue)
+NEVER_INLINE JSValuePtr Interpreter::callEval(CallFrame* callFrame, RegisterFile* registerFile, Register* argv, int argc, int registerOffset, JSValuePtr& exceptionValue)
{
if (argc < 2)
return jsUndefined();
- JSValue* program = argv[1].jsValue(callFrame);
+ JSValuePtr program = argv[1].jsValue(callFrame);
if (!program->isString())
return program;
CodeBlock* codeBlock = callFrame->codeBlock();
RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
- JSValue* result = jsUndefined();
+ JSValuePtr result = jsUndefined();
if (evalNode)
result = callFrame->globalData().interpreter->execute(evalNode.get(), callFrame, callFrame->thisValue()->toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue);
#endif
}
-NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue* exceptionValue, unsigned& bytecodeOffset, CodeBlock*& codeBlock)
+NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValuePtr exceptionValue, unsigned& bytecodeOffset, CodeBlock*& codeBlock)
{
CodeBlock* oldCodeBlock = codeBlock;
ScopeChainNode* scopeChain = callFrame->scopeChain();
return true;
}
-NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue*& exceptionValue, unsigned bytecodeOffset, bool explicitThrow)
+NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValuePtr& exceptionValue, unsigned bytecodeOffset, bool explicitThrow)
{
// Set up the exception object
return handler;
}
-JSValue* Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue** exception)
+JSValuePtr Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValuePtr* exception)
{
ASSERT(!scopeChain->globalData->exception);
globalObject->copyGlobalsTo(m_registerFile);
CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
- newCallFrame[codeBlock->thisRegister()] = thisObj;
+ newCallFrame[codeBlock->thisRegister()] = JSValuePtr(thisObj);
newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), 0, 0, 0);
if (codeBlock->needsFullScopeChain())
if (*profiler)
(*profiler)->willExecute(newCallFrame, programNode->sourceURL(), programNode->lineNo());
- JSValue* result;
+ JSValuePtr result;
{
SamplingTool::CallRecord callRecord(m_sampler);
return result;
}
-JSValue* Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue** exception)
+JSValuePtr Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValuePtr* exception)
{
ASSERT(!scopeChain->globalData->exception);
CallFrame* newCallFrame = CallFrame::create(oldEnd);
size_t dst = 0;
- newCallFrame[0] = thisObj;
+ newCallFrame[0] = JSValuePtr(thisObj);
ArgList::const_iterator end = args.end();
for (ArgList::const_iterator it = args.begin(); it != end; ++it)
newCallFrame[++dst] = *it;
if (*profiler)
(*profiler)->willExecute(newCallFrame, function);
- JSValue* result;
+ JSValuePtr result;
{
SamplingTool::CallRecord callRecord(m_sampler);
return result;
}
-JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue** exception)
+JSValuePtr Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValuePtr* exception)
{
return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
}
-JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue** exception)
+JSValuePtr Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValuePtr* exception)
{
ASSERT(!scopeChain->globalData->exception);
CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset);
// a 0 codeBlock indicates a built-in caller
- newCallFrame[codeBlock->thisRegister()] = thisObj;
+ newCallFrame[codeBlock->thisRegister()] = JSValuePtr(thisObj);
newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0);
if (codeBlock->needsFullScopeChain())
if (*profiler)
(*profiler)->willExecute(newCallFrame, evalNode->sourceURL(), evalNode->lineNo());
- JSValue* result;
+ JSValuePtr result;
{
SamplingTool::CallRecord callRecord(m_sampler);
// We have to return a JSValue here, gcc seems to produce worse code if
// we attempt to return a bool
-ALWAYS_INLINE JSValue* Interpreter::checkTimeout(JSGlobalObject* globalObject)
+ALWAYS_INLINE bool Interpreter::checkTimeout(JSGlobalObject* globalObject)
{
unsigned currentTime = getCPUTime();
if (!m_timeAtLastCheckTimeout) {
// Suspicious amount of looping in a script -- start timing it
m_timeAtLastCheckTimeout = currentTime;
- return noValue();
+ return false;
}
unsigned timeDiff = currentTime - m_timeAtLastCheckTimeout;
if (m_timeoutTime && m_timeExecuting > m_timeoutTime) {
if (globalObject->shouldInterruptScript())
- return jsNull(); // Appeasing GCC, all we need is a non-null js value.
+ return true;
resetTimeoutCheck();
}
- return noValue();
+ return false;
}
NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFrame, const Instruction* vPC)
int dst = (++vPC)->u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& property = codeBlock->identifier((++vPC)->u.operand);
- JSValue* value = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr value = callFrame[(++vPC)->u.operand].jsValue(callFrame);
JSObject* scope = new (callFrame) JSStaticScopeObject(callFrame, property, value, DontDelete);
- callFrame[dst] = scope;
+ callFrame[dst] = JSValuePtr(scope);
return callFrame->scopeChain()->push(scope);
}
static StructureChain* cachePrototypeChain(CallFrame* callFrame, Structure* structure)
{
- JSValue* prototype = structure->prototypeForLookup(callFrame);
+ JSValuePtr prototype = structure->prototypeForLookup(callFrame);
if (JSImmediate::isImmediate(prototype))
return 0;
RefPtr<StructureChain> chain = StructureChain::create(asObject(prototype)->structure());
return structure->cachedPrototypeChain();
}
-NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, Instruction* vPC, JSValue* baseValue, const PutPropertySlot& slot)
+NEVER_INLINE void Interpreter::tryCachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, Instruction* vPC, JSValuePtr baseValue, const PutPropertySlot& slot)
{
// Recursive invocation may already have specialized this instruction.
if (vPC[0].u.opcode != getOpcode(op_put_by_id))
vPC[4] = 0;
}
-static size_t countPrototypeChainEntriesAndCheckForProxies(CallFrame* callFrame, JSValue* baseValue, const PropertySlot& slot)
+static size_t countPrototypeChainEntriesAndCheckForProxies(CallFrame* callFrame, JSValuePtr baseValue, const PropertySlot& slot)
{
JSCell* cell = asCell(baseValue);
size_t count = 0;
while (slot.slotBase() != cell) {
- JSValue* v = cell->structure()->prototypeForLookup(callFrame);
+ JSValuePtr v = cell->structure()->prototypeForLookup(callFrame);
// If we didn't find slotBase in baseValue's prototype chain, then baseValue
// must be a proxy for another object.
return count;
}
-NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, Instruction* vPC, JSValue* baseValue, const Identifier& propertyName, const PropertySlot& slot)
+NEVER_INLINE void Interpreter::tryCacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, Instruction* vPC, JSValuePtr baseValue, const Identifier& propertyName, const PropertySlot& slot)
{
// Recursive invocation may already have specialized this instruction.
if (vPC[0].u.opcode != getOpcode(op_get_by_id))
vPC[4] = 0;
}
-JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame, JSValue** exception)
+JSValuePtr Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFile, CallFrame* callFrame, JSValuePtr* exception)
{
// One-time initialization of our address tables. We have to put this code
// here because our labels are only in scope inside this function.
#endif
JSGlobalData* globalData = &callFrame->globalData();
- JSValue* exceptionValue = noValue();
+ JSValuePtr exceptionValue = noValue();
HandlerInfo* handler = 0;
Instruction* vPC = callFrame->codeBlock()->instructions().begin();
#define CHECK_FOR_TIMEOUT() \
if (!--tickCount) { \
- if ((exceptionValue = checkTimeout(callFrame->dynamicGlobalObject()))) \
+ if (checkTimeout(callFrame->dynamicGlobalObject())) { \
+ exceptionValue = jsNull(); \
goto vm_throw; \
+ } \
tickCount = m_ticksUntilNextTimeoutCheck; \
}
constructor, and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- callFrame[dst] = constructEmptyObject(callFrame);
+ callFrame[dst] = JSValuePtr(constructEmptyObject(callFrame));
++vPC;
NEXT_INSTRUCTION();
int firstArg = (++vPC)->u.operand;
int argCount = (++vPC)->u.operand;
ArgList args(callFrame->registers() + firstArg, argCount);
- callFrame[dst] = constructArray(callFrame, args);
+ callFrame[dst] = JSValuePtr(constructArray(callFrame, args));
++vPC;
NEXT_INSTRUCTION();
*/
int dst = (++vPC)->u.operand;
int regExp = (++vPC)->u.operand;
- callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp));
+ callFrame[dst] = JSValuePtr(new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp)));
++vPC;
NEXT_INSTRUCTION();
as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (JSImmediate::areBothImmediateNumbers(src1, src2))
callFrame[dst] = jsBoolean(src1 == src2);
else {
- JSValue* result = jsBoolean(equalSlowCase(callFrame, src1, src2));
+ JSValuePtr result = jsBoolean(equalSlowCase(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
operator, and puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (src->isUndefinedOrNull()) {
callFrame[dst] = jsBoolean(true);
result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (JSImmediate::areBothImmediateNumbers(src1, src2))
callFrame[dst] = jsBoolean(src1 != src2);
else {
- JSValue* result = jsBoolean(!equalSlowCase(callFrame, src1, src2));
+ JSValuePtr result = jsBoolean(!equalSlowCase(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
operator, and puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (src->isUndefinedOrNull()) {
callFrame[dst] = jsBoolean(false);
result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (JSImmediate::areBothImmediate(src1, src2))
callFrame[dst] = jsBoolean(src1 == src2);
else if (JSImmediate::isEitherImmediate(src1, src2) & (src1 != JSImmediate::zeroImmediate()) & (src2 != JSImmediate::zeroImmediate()))
puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (JSImmediate::areBothImmediate(src1, src2))
callFrame[dst] = jsBoolean(src1 != src2);
a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* result = jsBoolean(jsLess(callFrame, src1, src2));
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr result = jsBoolean(jsLess(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
puts the result as a boolean in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* result = jsBoolean(jsLessEq(callFrame, src1, src2));
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr result = jsBoolean(jsLessEq(callFrame, src1, src2));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
back in register srcDst.
*/
int srcDst = (++vPC)->u.operand;
- JSValue* v = callFrame[srcDst].jsValue(callFrame);
+ JSValuePtr v = callFrame[srcDst].jsValue(callFrame);
if (JSImmediate::canDoFastAdditiveOperations(v))
- callFrame[srcDst] = JSImmediate::incImmediateNumber(v);
+ callFrame[srcDst] = JSValuePtr(JSImmediate::incImmediateNumber(v));
else {
- JSValue* result = jsNumber(callFrame, v->toNumber(callFrame) + 1);
+ JSValuePtr result = jsNumber(callFrame, v->toNumber(callFrame) + 1);
CHECK_FOR_EXCEPTION();
callFrame[srcDst] = result;
}
back in register srcDst.
*/
int srcDst = (++vPC)->u.operand;
- JSValue* v = callFrame[srcDst].jsValue(callFrame);
+ JSValuePtr v = callFrame[srcDst].jsValue(callFrame);
if (JSImmediate::canDoFastAdditiveOperations(v))
- callFrame[srcDst] = JSImmediate::decImmediateNumber(v);
+ callFrame[srcDst] = JSValuePtr(JSImmediate::decImmediateNumber(v));
else {
- JSValue* result = jsNumber(callFrame, v->toNumber(callFrame) - 1);
+ JSValuePtr result = jsNumber(callFrame, v->toNumber(callFrame) - 1);
CHECK_FOR_EXCEPTION();
callFrame[srcDst] = result;
}
*/
int dst = (++vPC)->u.operand;
int srcDst = (++vPC)->u.operand;
- JSValue* v = callFrame[srcDst].jsValue(callFrame);
+ JSValuePtr v = callFrame[srcDst].jsValue(callFrame);
if (JSImmediate::canDoFastAdditiveOperations(v)) {
callFrame[dst] = v;
- callFrame[srcDst] = JSImmediate::incImmediateNumber(v);
+ callFrame[srcDst] = JSValuePtr(JSImmediate::incImmediateNumber(v));
} else {
- JSValue* number = callFrame[srcDst].jsValue(callFrame)->toJSNumber(callFrame);
+ JSValuePtr number = callFrame[srcDst].jsValue(callFrame)->toJSNumber(callFrame);
CHECK_FOR_EXCEPTION();
callFrame[dst] = number;
- callFrame[srcDst] = jsNumber(callFrame, number->uncheckedGetNumber() + 1);
+ callFrame[srcDst] = JSValuePtr(jsNumber(callFrame, number->uncheckedGetNumber() + 1));
}
++vPC;
*/
int dst = (++vPC)->u.operand;
int srcDst = (++vPC)->u.operand;
- JSValue* v = callFrame[srcDst].jsValue(callFrame);
+ JSValuePtr v = callFrame[srcDst].jsValue(callFrame);
if (JSImmediate::canDoFastAdditiveOperations(v)) {
callFrame[dst] = v;
- callFrame[srcDst] = JSImmediate::decImmediateNumber(v);
+ callFrame[srcDst] = JSValuePtr(JSImmediate::decImmediateNumber(v));
} else {
- JSValue* number = callFrame[srcDst].jsValue(callFrame)->toJSNumber(callFrame);
+ JSValuePtr number = callFrame[srcDst].jsValue(callFrame)->toJSNumber(callFrame);
CHECK_FOR_EXCEPTION();
callFrame[dst] = number;
- callFrame[srcDst] = jsNumber(callFrame, number->uncheckedGetNumber() - 1);
+ callFrame[srcDst] = JSValuePtr(jsNumber(callFrame, number->uncheckedGetNumber() - 1));
}
++vPC;
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- JSValue* srcVal = callFrame[src].jsValue(callFrame);
+ JSValuePtr srcVal = callFrame[src].jsValue(callFrame);
if (LIKELY(srcVal->isNumber()))
callFrame[dst] = callFrame[src];
else {
- JSValue* result = srcVal->toJSNumber(callFrame);
+ JSValuePtr result = srcVal->toJSNumber(callFrame);
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
++vPC;
double v;
if (fastIsNumber(src, v))
- callFrame[dst] = jsNumber(callFrame, -v);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, -v));
else {
- JSValue* result = jsNumber(callFrame, -src->toNumber(callFrame));
+ JSValuePtr result = jsNumber(callFrame, -src->toNumber(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
numeric add, depending on the types of the operands.)
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (JSImmediate::canDoFastAdditiveOperations(src1) && JSImmediate::canDoFastAdditiveOperations(src2))
- callFrame[dst] = JSImmediate::addImmediateNumbers(src1, src2);
+ callFrame[dst] = JSValuePtr(JSImmediate::addImmediateNumbers(src1, src2));
else {
- JSValue* result = jsAdd(callFrame, src1, src2);
+ JSValuePtr result = jsAdd(callFrame, src1, src2);
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
numbers), and puts the product in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
double left;
double right;
if (JSImmediate::areBothImmediateNumbers(src1, src2)) {
int32_t left = JSImmediate::getTruncatedInt32(src1);
int32_t right = JSImmediate::getTruncatedInt32(src2);
if ((left | right) >> 15 == 0)
- callFrame[dst] = jsNumber(callFrame, left * right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left * right));
else
- callFrame[dst] = jsNumber(callFrame, static_cast<double>(left) * static_cast<double>(right));
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, static_cast<double>(left) * static_cast<double>(right)));
} else if (fastIsNumber(src1, left) && fastIsNumber(src2, right))
- callFrame[dst] = jsNumber(callFrame, left * right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left * right));
else {
- JSValue* result = jsNumber(callFrame, src1->toNumber(callFrame) * src2->toNumber(callFrame));
+ JSValuePtr result = jsNumber(callFrame, src1->toNumber(callFrame) * src2->toNumber(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
quotient in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* dividend = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* divisor = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr dividend = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr divisor = callFrame[(++vPC)->u.operand].jsValue(callFrame);
double left;
double right;
if (fastIsNumber(dividend, left) && fastIsNumber(divisor, right))
- callFrame[dst] = jsNumber(callFrame, left / right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left / right));
else {
- JSValue* result = jsNumber(callFrame, dividend->toNumber(callFrame) / divisor->toNumber(callFrame));
+ JSValuePtr result = jsNumber(callFrame, dividend->toNumber(callFrame) / divisor->toNumber(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
int dividend = (++vPC)->u.operand;
int divisor = (++vPC)->u.operand;
- JSValue* dividendValue = callFrame[dividend].jsValue(callFrame);
- JSValue* divisorValue = callFrame[divisor].jsValue(callFrame);
+ JSValuePtr dividendValue = callFrame[dividend].jsValue(callFrame);
+ JSValuePtr divisorValue = callFrame[divisor].jsValue(callFrame);
if (JSImmediate::areBothImmediateNumbers(dividendValue, divisorValue) && divisorValue != JSImmediate::from(0)) {
- callFrame[dst] = JSImmediate::from(JSImmediate::getTruncatedInt32(dividendValue) % JSImmediate::getTruncatedInt32(divisorValue));
+ callFrame[dst] = JSValuePtr(JSImmediate::from(JSImmediate::getTruncatedInt32(dividendValue) % JSImmediate::getTruncatedInt32(divisorValue)));
++vPC;
NEXT_INSTRUCTION();
}
double d = dividendValue->toNumber(callFrame);
- JSValue* result = jsNumber(callFrame, fmod(d, divisorValue->toNumber(callFrame)));
+ JSValuePtr result = jsNumber(callFrame, fmod(d, divisorValue->toNumber(callFrame)));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
++vPC;
register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
double left;
double right;
if (JSImmediate::canDoFastAdditiveOperations(src1) && JSImmediate::canDoFastAdditiveOperations(src2))
- callFrame[dst] = JSImmediate::subImmediateNumbers(src1, src2);
+ callFrame[dst] = JSValuePtr(JSImmediate::subImmediateNumbers(src1, src2));
else if (fastIsNumber(src1, left) && fastIsNumber(src2, right))
- callFrame[dst] = jsNumber(callFrame, left - right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left - right));
else {
- JSValue* result = jsNumber(callFrame, src1->toNumber(callFrame) - src2->toNumber(callFrame));
+ JSValuePtr result = jsNumber(callFrame, src1->toNumber(callFrame) - src2->toNumber(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* val = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* shift = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr val = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr shift = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int32_t left;
uint32_t right;
if (JSImmediate::areBothImmediateNumbers(val, shift))
- callFrame[dst] = jsNumber(callFrame, JSImmediate::getTruncatedInt32(val) << (JSImmediate::getTruncatedUInt32(shift) & 0x1f));
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, JSImmediate::getTruncatedInt32(val) << (JSImmediate::getTruncatedUInt32(shift) & 0x1f)));
else if (fastToInt32(val, left) && fastToUInt32(shift, right))
- callFrame[dst] = jsNumber(callFrame, left << (right & 0x1f));
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left << (right & 0x1f)));
else {
- JSValue* result = jsNumber(callFrame, (val->toInt32(callFrame)) << (shift->toUInt32(callFrame) & 0x1f));
+ JSValuePtr result = jsNumber(callFrame, (val->toInt32(callFrame)) << (shift->toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
uint32), and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* val = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* shift = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr val = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr shift = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int32_t left;
uint32_t right;
if (JSImmediate::areBothImmediateNumbers(val, shift))
- callFrame[dst] = JSImmediate::rightShiftImmediateNumbers(val, shift);
+ callFrame[dst] = JSValuePtr(JSImmediate::rightShiftImmediateNumbers(val, shift));
else if (fastToInt32(val, left) && fastToUInt32(shift, right))
- callFrame[dst] = jsNumber(callFrame, left >> (right & 0x1f));
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left >> (right & 0x1f)));
else {
- JSValue* result = jsNumber(callFrame, (val->toInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
+ JSValuePtr result = jsNumber(callFrame, (val->toInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
uint32), and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* val = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* shift = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr val = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr shift = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (JSImmediate::areBothImmediateNumbers(val, shift) && !JSImmediate::isNegative(val))
- callFrame[dst] = JSImmediate::rightShiftImmediateNumbers(val, shift);
+ callFrame[dst] = JSValuePtr(JSImmediate::rightShiftImmediateNumbers(val, shift));
else {
- JSValue* result = jsNumber(callFrame, (val->toUInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
+ JSValuePtr result = jsNumber(callFrame, (val->toUInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int32_t left;
int32_t right;
if (JSImmediate::areBothImmediateNumbers(src1, src2))
- callFrame[dst] = JSImmediate::andImmediateNumbers(src1, src2);
+ callFrame[dst] = JSValuePtr(JSImmediate::andImmediateNumbers(src1, src2));
else if (fastToInt32(src1, left) && fastToInt32(src2, right))
- callFrame[dst] = jsNumber(callFrame, left & right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left & right));
else {
- JSValue* result = jsNumber(callFrame, src1->toInt32(callFrame) & src2->toInt32(callFrame));
+ JSValuePtr result = jsNumber(callFrame, src1->toInt32(callFrame) & src2->toInt32(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int32_t left;
int32_t right;
if (JSImmediate::areBothImmediateNumbers(src1, src2))
- callFrame[dst] = JSImmediate::xorImmediateNumbers(src1, src2);
+ callFrame[dst] = JSValuePtr(JSImmediate::xorImmediateNumbers(src1, src2));
else if (fastToInt32(src1, left) && fastToInt32(src2, right))
- callFrame[dst] = jsNumber(callFrame, left ^ right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left ^ right));
else {
- JSValue* result = jsNumber(callFrame, src1->toInt32(callFrame) ^ src2->toInt32(callFrame));
+ JSValuePtr result = jsNumber(callFrame, src1->toInt32(callFrame) ^ src2->toInt32(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int32_t left;
int32_t right;
if (JSImmediate::areBothImmediateNumbers(src1, src2))
- callFrame[dst] = JSImmediate::orImmediateNumbers(src1, src2);
+ callFrame[dst] = JSValuePtr(JSImmediate::orImmediateNumbers(src1, src2));
else if (fastToInt32(src1, left) && fastToInt32(src2, right))
- callFrame[dst] = jsNumber(callFrame, left | right);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, left | right));
else {
- JSValue* result = jsNumber(callFrame, src1->toInt32(callFrame) | src2->toInt32(callFrame));
+ JSValuePtr result = jsNumber(callFrame, src1->toInt32(callFrame) | src2->toInt32(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
and puts the result in register dst.
*/
int dst = (++vPC)->u.operand;
- JSValue* src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int32_t value;
if (fastToInt32(src, value))
- callFrame[dst] = jsNumber(callFrame, ~value);
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, ~value));
else {
- JSValue* result = jsNumber(callFrame, ~src->toInt32(callFrame));
+ JSValuePtr result = jsNumber(callFrame, ~src->toInt32(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
}
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- JSValue* result = jsBoolean(!callFrame[src].jsValue(callFrame)->toBoolean(callFrame));
+ JSValuePtr result = jsBoolean(!callFrame[src].jsValue(callFrame)->toBoolean(callFrame));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
int base = vPC[3].u.operand;
int baseProto = vPC[4].u.operand;
- JSValue* baseVal = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseVal = callFrame[base].jsValue(callFrame);
if (isNotObject(callFrame, true, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
goto vm_throw;
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = jsTypeStringForValue(callFrame, callFrame[src].jsValue(callFrame));
+ callFrame[dst] = JSValuePtr(jsTypeStringForValue(callFrame, callFrame[src].jsValue(callFrame)));
++vPC;
NEXT_INSTRUCTION();
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- JSValue* v = callFrame[src].jsValue(callFrame);
+ JSValuePtr v = callFrame[src].jsValue(callFrame);
callFrame[dst] = jsBoolean(JSImmediate::isImmediate(v) ? v->isUndefined() : v->asCell()->structure()->typeInfo().masqueradesAsUndefined());
++vPC;
int property = (++vPC)->u.operand;
int base = (++vPC)->u.operand;
- JSValue* baseVal = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseVal = callFrame[base].jsValue(callFrame);
if (isNotObject(callFrame, false, callFrame->codeBlock(), vPC, baseVal, exceptionValue))
goto vm_throw;
JSObject* baseObj = asObject(baseVal);
- JSValue* propName = callFrame[property].jsValue(callFrame);
+ JSValuePtr propName = callFrame[property].jsValue(callFrame);
uint32_t i;
if (propName->getUInt32(i))
int index = (++vPC)->u.operand;
int value = (++vPC)->u.operand;
- scope->registerAt(index) = callFrame[value].jsValue(callFrame);
+ scope->registerAt(index) = JSValuePtr(callFrame[value].jsValue(callFrame));
++vPC;
NEXT_INSTRUCTION();
}
ASSERT((*iter)->isVariableObject());
JSVariableObject* scope = static_cast<JSVariableObject*>(*iter);
- scope->registerAt(index) = callFrame[value].jsValue(callFrame);
+ scope->registerAt(index) = JSValuePtr(callFrame[value].jsValue(callFrame));
++vPC;
NEXT_INSTRUCTION();
}
CodeBlock* codeBlock = callFrame->codeBlock();
Identifier& ident = codeBlock->identifier(property);
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, ident, slot);
+ JSValuePtr result = baseValue->get(callFrame, ident, slot);
CHECK_FOR_EXCEPTION();
tryCacheGetByID(callFrame, codeBlock, vPC, baseValue, ident, slot);
op_get_by_id.
*/
int base = vPC[2].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(!JSImmediate::isImmediate(baseValue))) {
JSCell* baseCell = asCell(baseValue);
int offset = vPC[5].u.operand;
ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- callFrame[dst] = baseObject->getDirectOffset(offset);
+ callFrame[dst] = JSValuePtr(baseObject->getDirectOffset(offset));
vPC += 8;
NEXT_INSTRUCTION();
reverts to op_get_by_id.
*/
int base = vPC[2].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(!JSImmediate::isImmediate(baseValue))) {
JSCell* baseCell = asCell(baseValue);
int offset = vPC[6].u.operand;
ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
- callFrame[dst] = protoObject->getDirectOffset(offset);
+ callFrame[dst] = JSValuePtr(protoObject->getDirectOffset(offset));
vPC += 8;
NEXT_INSTRUCTION();
reverts to op_get_by_id.
*/
int base = vPC[2].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(!JSImmediate::isImmediate(baseValue))) {
JSCell* baseCell = asCell(baseValue);
int offset = vPC[7].u.operand;
ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
- callFrame[dst] = baseObject->getDirectOffset(offset);
+ callFrame[dst] = JSValuePtr(baseObject->getDirectOffset(offset));
vPC += 8;
NEXT_INSTRUCTION();
int property = vPC[3].u.operand;
Identifier& ident = callFrame->codeBlock()->identifier(property);
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, ident, slot);
+ JSValuePtr result = baseValue->get(callFrame, ident, slot);
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
*/
int base = vPC[2].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(isJSArray(baseValue))) {
int dst = vPC[1].u.operand;
- callFrame[dst] = jsNumber(callFrame, asArray(baseValue)->length());
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, asArray(baseValue)->length()));
vPC += 8;
NEXT_INSTRUCTION();
}
*/
int base = vPC[2].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(isJSString(baseValue))) {
int dst = vPC[1].u.operand;
- callFrame[dst] = jsNumber(callFrame, asString(baseValue)->value().size());
+ callFrame[dst] = JSValuePtr(jsNumber(callFrame, asString(baseValue)->value().size()));
vPC += 8;
NEXT_INSTRUCTION();
}
int value = vPC[3].u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
Identifier& ident = codeBlock->identifier(property);
PutPropertySlot slot;
baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot);
the register file.
*/
int base = vPC[1].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(!JSImmediate::isImmediate(baseValue))) {
JSCell* baseCell = asCell(baseValue);
RefPtr<Structure>* it = vPC[6].u.structureChain->head();
- JSValue* proto = baseObject->structure()->prototypeForLookup(callFrame);
+ JSValuePtr proto = baseObject->structure()->prototypeForLookup(callFrame);
while (!proto->isNull()) {
if (UNLIKELY(asObject(proto)->structure() != (*it).get())) {
uncachePutByID(callFrame->codeBlock(), vPC);
the register file.
*/
int base = vPC[1].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
if (LIKELY(!JSImmediate::isImmediate(baseValue))) {
JSCell* baseCell = asCell(baseValue);
int property = vPC[2].u.operand;
int value = vPC[3].u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
Identifier& ident = callFrame->codeBlock()->identifier(property);
PutPropertySlot slot;
baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot);
JSObject* baseObj = callFrame[base].jsValue(callFrame)->toObject(callFrame);
Identifier& ident = callFrame->codeBlock()->identifier(property);
- JSValue* result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
+ JSValuePtr result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
CHECK_FOR_EXCEPTION();
callFrame[dst] = result;
++vPC;
int base = (++vPC)->u.operand;
int property = (++vPC)->u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
- JSValue* subscript = callFrame[property].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr subscript = callFrame[property].jsValue(callFrame);
- JSValue* result;
+ JSValuePtr result;
unsigned i;
bool isUInt32 = JSImmediate::getUInt32(subscript, i);
int property = (++vPC)->u.operand;
int value = (++vPC)->u.operand;
- JSValue* baseValue = callFrame[base].jsValue(callFrame);
- JSValue* subscript = callFrame[property].jsValue(callFrame);
+ JSValuePtr baseValue = callFrame[base].jsValue(callFrame);
+ JSValuePtr subscript = callFrame[property].jsValue(callFrame);
unsigned i;
} else if (isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i)) {
JSByteArray* jsByteArray = asByteArray(baseValue);
double dValue = 0;
- JSValue* jsValue = callFrame[value].jsValue(callFrame);
+ JSValuePtr jsValue = callFrame[value].jsValue(callFrame);
if (JSImmediate::isNumber(jsValue))
jsByteArray->setIndex(i, JSImmediate::getTruncatedInt32(jsValue));
else if (fastIsNumber(jsValue, dValue))
JSObject* baseObj = callFrame[base].jsValue(callFrame)->toObject(callFrame); // may throw
- JSValue* subscript = callFrame[property].jsValue(callFrame);
- JSValue* result;
+ JSValuePtr subscript = callFrame[property].jsValue(callFrame);
+ JSValuePtr result;
uint32_t i;
if (subscript->getUInt32(i))
result = jsBoolean(baseObj->deleteProperty(callFrame, i));
*/
int src = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- JSValue* srcValue = callFrame[src].jsValue(callFrame);
+ JSValuePtr srcValue = callFrame[src].jsValue(callFrame);
if (srcValue->isUndefinedOrNull() || (!JSImmediate::isImmediate(srcValue) && srcValue->asCell()->structure()->typeInfo().masqueradesAsUndefined())) {
vPC += target;
*/
int src = (++vPC)->u.operand;
int target = (++vPC)->u.operand;
- JSValue* srcValue = callFrame[src].jsValue(callFrame);
+ JSValuePtr srcValue = callFrame[src].jsValue(callFrame);
if (!srcValue->isUndefinedOrNull() || (!JSImmediate::isImmediate(srcValue) && !srcValue->asCell()->structure()->typeInfo().masqueradesAsUndefined())) {
vPC += target;
Additionally this loop instruction may terminate JS execution is
the JS timeout is reached.
*/
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int target = (++vPC)->u.operand;
bool result = jsLess(callFrame, src1, src2);
Additionally this loop instruction may terminate JS execution is
the JS timeout is reached.
*/
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int target = (++vPC)->u.operand;
bool result = jsLessEq(callFrame, src1, src2);
target from the current instruction, if and only if the
result of the comparison is false.
*/
- JSValue* src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
- JSValue* src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src1 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr src2 = callFrame[(++vPC)->u.operand].jsValue(callFrame);
int target = (++vPC)->u.operand;
bool result = jsLess(callFrame, src1, src2);
*/
int tableIndex = (++vPC)->u.operand;
int defaultOffset = (++vPC)->u.operand;
- JSValue* scrutinee = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr scrutinee = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (!JSImmediate::isNumber(scrutinee))
vPC += defaultOffset;
else {
*/
int tableIndex = (++vPC)->u.operand;
int defaultOffset = (++vPC)->u.operand;
- JSValue* scrutinee = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr scrutinee = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (!scrutinee->isString())
vPC += defaultOffset;
else {
*/
int tableIndex = (++vPC)->u.operand;
int defaultOffset = (++vPC)->u.operand;
- JSValue* scrutinee = callFrame[(++vPC)->u.operand].jsValue(callFrame);
+ JSValuePtr scrutinee = callFrame[(++vPC)->u.operand].jsValue(callFrame);
if (!scrutinee->isString())
vPC += defaultOffset;
else
int argCount = vPC[3].u.operand;
int registerOffset = vPC[4].u.operand;
- JSValue* funcVal = callFrame[func].jsValue(callFrame);
+ JSValuePtr funcVal = callFrame[func].jsValue(callFrame);
Register* newCallFrame = callFrame->registers() + registerOffset;
Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
- JSValue* thisValue = argv[0].jsValue(callFrame);
+ JSValuePtr thisValue = argv[0].jsValue(callFrame);
JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject();
if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
- JSValue* result = callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
+ JSValuePtr result = callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
if (exceptionValue)
goto vm_throw;
callFrame[dst] = result;
int argCount = vPC[3].u.operand;
int registerOffset = vPC[4].u.operand;
- JSValue* v = callFrame[func].jsValue(callFrame);
+ JSValuePtr v = callFrame[func].jsValue(callFrame);
CallData callData;
CallType callType = v->getCallData(callData);
ArgList args(thisRegister + 1, argCount - 1);
// FIXME: All host methods should be calling toThisObject, but this is not presently the case.
- JSValue* thisValue = thisRegister->jsValue(callFrame);
+ JSValuePtr thisValue = thisRegister->jsValue(callFrame);
if (thisValue == jsNull())
thisValue = callFrame->globalThisValue();
- JSValue* returnValue;
+ JSValuePtr returnValue;
{
SamplingTool::HostCallRecord callRecord(m_sampler);
returnValue = callData.native.function(newCallFrame, asObject(v), thisValue, args);
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = returnValue;
+ callFrame[dst] = JSValuePtr(returnValue);
vPC += 5;
NEXT_INSTRUCTION();
if (callFrame->codeBlock()->needsFullScopeChain())
callFrame->scopeChain()->deref();
- JSValue* returnValue = callFrame[result].jsValue(callFrame);
+ JSValuePtr returnValue = callFrame[result].jsValue(callFrame);
vPC = callFrame->returnPC();
int dst = callFrame->returnValueRegister();
if (callFrame->hasHostCallFrameFlag())
return returnValue;
- callFrame[dst] = returnValue;
+ callFrame[dst] = JSValuePtr(returnValue);
NEXT_INSTRUCTION();
}
*/
int thisRegister = (++vPC)->u.operand;
- JSValue* thisVal = callFrame[thisRegister].getJSValue();
+ JSValuePtr thisVal = callFrame[thisRegister].getJSValue();
if (thisVal->needsThisConversion())
- callFrame[thisRegister] = thisVal->toThisObject(callFrame);
+ callFrame[thisRegister] = JSValuePtr(thisVal->toThisObject(callFrame));
++vPC;
NEXT_INSTRUCTION();
int proto = vPC[5].u.operand;
int thisRegister = vPC[6].u.operand;
- JSValue* v = callFrame[func].jsValue(callFrame);
+ JSValuePtr v = callFrame[func].jsValue(callFrame);
ConstructData constructData;
ConstructType constructType = v->getConstructData(constructData);
CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain);
Structure* structure;
- JSValue* prototype = callFrame[proto].jsValue(callFrame);
+ JSValuePtr prototype = callFrame[proto].jsValue(callFrame);
if (prototype->isObject())
structure = asObject(prototype)->inheritorID();
else
structure = callDataScopeChain->globalObject()->emptyObjectStructure();
JSObject* newObject = new (globalData) JSObject(structure);
- callFrame[thisRegister] = newObject; // "this" value
+ callFrame[thisRegister] = JSValuePtr(newObject); // "this" value
CallFrame* previousCallFrame = callFrame;
CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
newCallFrame->init(0, vPC + 7, scopeChain, callFrame, dst, argCount, 0);
- JSValue* returnValue;
+ JSValuePtr returnValue;
{
SamplingTool::HostCallRecord callRecord(m_sampler);
returnValue = constructData.native.function(newCallFrame, asObject(v), args);
}
CHECK_FOR_EXCEPTION();
- callFrame[dst] = returnValue;
+ callFrame[dst] = JSValuePtr(returnValue);
vPC += 7;
NEXT_INSTRUCTION();
are replaced by the result of toObject conversion of the scope.
*/
int scope = (++vPC)->u.operand;
- JSValue* v = callFrame[scope].jsValue(callFrame);
+ JSValuePtr v = callFrame[scope].jsValue(callFrame);
JSObject* o = v->toObject(callFrame);
CHECK_FOR_EXCEPTION();
- callFrame[scope] = o;
+ callFrame[scope] = JSValuePtr(o);
callFrame->setScopeChain(callFrame->scopeChain()->push(o));
++vPC;
int target = (++vPC)->u.operand;
JSPropertyNameIterator* it = callFrame[iter].propertyNameIterator();
- if (JSValue* temp = it->next(callFrame)) {
+ if (JSValuePtr temp = it->next(callFrame)) {
CHECK_FOR_TIMEOUT();
- callFrame[dst] = temp;
+ callFrame[dst] = JSValuePtr(temp);
vPC += target;
NEXT_INSTRUCTION();
}
*/
int dst = (++vPC)->u.operand;
int src = (++vPC)->u.operand;
- callFrame[dst] = callFrame->codeBlock()->unexpectedConstant(src);
+ callFrame[dst] = JSValuePtr(callFrame->codeBlock()->unexpectedConstant(src));
++vPC;
NEXT_INSTRUCTION();
int message = (++vPC)->u.operand;
CodeBlock* codeBlock = callFrame->codeBlock();
- callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant(message)->toString(callFrame), codeBlock->lineNumberForBytecodeOffset(vPC - codeBlock->instructions().begin()), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
+ callFrame[dst] = JSValuePtr(Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant(message)->toString(callFrame), codeBlock->lineNumberForBytecodeOffset(vPC - codeBlock->instructions().begin()), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()));
++vPC;
NEXT_INSTRUCTION();
#undef CHECK_FOR_TIMEOUT
}
-JSValue* Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* function) const
+JSValuePtr Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* function) const
{
CallFrame* functionCallFrame = findFunctionCallFrame(callFrame, function);
if (!functionCallFrame)
return arguments;
}
-JSValue* Interpreter::retrieveCaller(CallFrame* callFrame, InternalFunction* function) const
+JSValuePtr Interpreter::retrieveCaller(CallFrame* callFrame, InternalFunction* function) const
{
CallFrame* functionCallFrame = findFunctionCallFrame(callFrame, function);
if (!functionCallFrame)
if (callerFrame->hasHostCallFrameFlag())
return jsNull();
- JSValue* caller = callerFrame->callee();
+ JSValuePtr caller = callerFrame->callee();
if (!caller)
return jsNull();
return caller;
}
-void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue*& function) const
+void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValuePtr& function) const
{
function = noValue();
lineNumber = -1;
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
-NEVER_INLINE void Interpreter::tryCTICachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress, JSValue* baseValue, const PutPropertySlot& slot)
+NEVER_INLINE void Interpreter::tryCTICachePutByID(CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress, JSValuePtr baseValue, const PutPropertySlot& slot)
{
// The interpreter checks for recursion here; I do not believe this can occur in CTI.
#endif
}
-NEVER_INLINE void Interpreter::tryCTICacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress, JSValue* baseValue, const Identifier& propertyName, const PropertySlot& slot)
+NEVER_INLINE void Interpreter::tryCTICacheGetByID(CallFrame* callFrame, CodeBlock* codeBlock, void* returnAddress, JSValuePtr baseValue, const Identifier& propertyName, const PropertySlot& slot)
{
// FIXME: Write a test that proves we need to check for recursion here just
// like the interpreter does, then add a check for recursion.
{
BEGIN_STUB_FUNCTION();
- JSValue* v1 = ARG_src1;
+ JSValuePtr v1 = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
JSObject* result = v1->toThisObject(callFrame);
scopeChain->deref();
}
-JSValue* Interpreter::cti_op_add(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_add(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* v1 = ARG_src1;
- JSValue* v2 = ARG_src2;
+ JSValuePtr v1 = ARG_src1;
+ JSValuePtr v2 = ARG_src2;
double left;
double right = 0.0;
bool rightIsNumber = fastIsNumber(v2, right);
if (rightIsNumber && fastIsNumber(v1, left))
- return jsNumber(ARG_globalData, left + right);
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left + right));
CallFrame* callFrame = ARG_callFrame;
VM_THROW_EXCEPTION();
}
- return jsString(ARG_globalData, value.release());
+ return JSValuePtr::encode(jsString(ARG_globalData, value.release()));
}
if (rightIsNumber & leftIsString) {
throwOutOfMemoryError(callFrame);
VM_THROW_EXCEPTION();
}
- return jsString(ARG_globalData, value.release());
+ return JSValuePtr::encode(jsString(ARG_globalData, value.release()));
}
// All other cases are pretty uncommon
- JSValue* result = jsAddSlowCase(callFrame, v1, v2);
+ JSValuePtr result = jsAddSlowCase(callFrame, v1, v2);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_pre_inc(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_pre_inc(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* v = ARG_src1;
+ JSValuePtr v = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, v->toNumber(callFrame) + 1);
+ JSValuePtr result = jsNumber(ARG_globalData, v->toNumber(callFrame) + 1);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
int Interpreter::cti_timeout_check(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
bool result = jsLess(callFrame, src1, src2);
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
bool result = jsLessEq(callFrame, src1, src2);
CHECK_FOR_EXCEPTION_AT_END();
}
-JSValue* Interpreter::cti_op_get_by_id_generic(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_generic(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
Identifier& ident = *ARG_id2;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, ident, slot);
+ JSValuePtr result = baseValue->get(callFrame, ident, slot);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
#if ENABLE(JIT_OPTIMIZE_PROPERTY_ACCESS)
CHECK_FOR_EXCEPTION_AT_END();
}
-JSValue* Interpreter::cti_op_get_by_id(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
Identifier& ident = *ARG_id2;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, ident, slot);
+ JSValuePtr result = baseValue->get(callFrame, ident, slot);
ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_second));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_get_by_id_second(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_second(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
Identifier& ident = *ARG_id2;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, ident, slot);
+ JSValuePtr result = baseValue->get(callFrame, ident, slot);
ARG_globalData->interpreter->tryCTICacheGetByID(callFrame, callFrame->codeBlock(), STUB_RETURN_ADDRESS, baseValue, ident, slot);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_get_by_id_self_fail(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_self_fail(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
Identifier& ident = *ARG_id2;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, ident, slot);
+ JSValuePtr result = baseValue->get(callFrame, ident, slot);
CHECK_FOR_EXCEPTION();
} else {
ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_generic));
}
- return result;
+ return JSValuePtr::encode(result);
}
static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(StructureStubInfo* stubInfo, int& listIndex)
return prototypeStructureList;
}
-JSValue* Interpreter::cti_op_get_by_id_proto_list(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_proto_list(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(callFrame, *ARG_id2, slot);
+ JSValuePtr result = baseValue->get(callFrame, *ARG_id2, slot);
CHECK_FOR_EXCEPTION();
if (JSImmediate::isImmediate(baseValue) || !slot.isCacheable() || asCell(baseValue)->structure()->isDictionary()) {
ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_proto_fail));
- return result;
+ return JSValuePtr::encode(result);
}
Structure* structure = asCell(baseValue)->structure();
} else
ctiPatchCallByReturnAddress(STUB_RETURN_ADDRESS, reinterpret_cast<void*>(cti_op_get_by_id_proto_fail));
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_get_by_id_proto_list_full(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_proto_list_full(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
+ JSValuePtr result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_get_by_id_proto_fail(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_proto_fail(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
+ JSValuePtr result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_get_by_id_array_fail(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_array_fail(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
+ JSValuePtr result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_get_by_id_string_fail(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_id_string_fail(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
PropertySlot slot(baseValue);
- JSValue* result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
+ JSValuePtr result = baseValue->get(ARG_callFrame, *ARG_id2, slot);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
#endif
-JSValue* Interpreter::cti_op_instanceof(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_instanceof(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* value = ARG_src1;
- JSValue* baseVal = ARG_src2;
- JSValue* proto = ARG_src3;
+ JSValuePtr value = ARG_src1;
+ JSValuePtr baseVal = ARG_src2;
+ JSValuePtr proto = ARG_src3;
// at least one of these checks must have failed to get to the slow case
ASSERT(JSImmediate::isAnyImmediate(value, baseVal, proto)
}
if (!asObject(baseVal)->structure()->typeInfo().implementsHasInstance())
- return jsBoolean(false);
+ return JSValuePtr::encode(jsBoolean(false));
if (!proto->isObject()) {
throwError(callFrame, TypeError, "instanceof called on an object with an invalid prototype property.");
}
if (!value->isObject())
- return jsBoolean(false);
+ return JSValuePtr::encode(jsBoolean(false));
- JSValue* result = jsBoolean(asObject(baseVal)->hasInstance(callFrame, value, proto));
+ JSValuePtr result = jsBoolean(asObject(baseVal)->hasInstance(callFrame, value, proto));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_del_by_id(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_del_by_id(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
JSObject* baseObj = ARG_src1->toObject(callFrame);
- JSValue* result = jsBoolean(baseObj->deleteProperty(callFrame, *ARG_id2));
+ JSValuePtr result = jsBoolean(baseObj->deleteProperty(callFrame, *ARG_id2));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_mul(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_mul(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
double left;
double right;
if (fastIsNumber(src1, left) && fastIsNumber(src2, right))
- return jsNumber(ARG_globalData, left * right);
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left * right));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, src1->toNumber(callFrame) * src2->toNumber(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, src1->toNumber(callFrame) * src2->toNumber(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
JSObject* Interpreter::cti_op_new_func(STUB_ARGS)
return activation;
}
-JSValue* Interpreter::cti_op_call_NotJSFunction(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_call_NotJSFunction(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* funcVal = ARG_src1;
+ JSValuePtr funcVal = ARG_src1;
CallData callData;
CallType callType = funcVal->getCallData(callData);
Register* argv = ARG_callFrame->registers() - RegisterFile::CallFrameHeaderSize - argCount;
ArgList argList(argv + 1, argCount - 1);
- JSValue* returnValue;
+ JSValuePtr returnValue;
{
SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
// FIXME: All host methods should be calling toThisObject, but this is not presently the case.
- JSValue* thisValue = argv[0].jsValue(callFrame);
+ JSValuePtr thisValue = argv[0].jsValue(callFrame);
if (thisValue == jsNull())
thisValue = callFrame->globalThisValue();
ARG_setCallFrame(previousCallFrame);
CHECK_FOR_EXCEPTION();
- return returnValue;
+ return JSValuePtr::encode(returnValue);
}
ASSERT(callType == CallTypeNone);
return constructArray(ARG_callFrame, argList);
}
-JSValue* Interpreter::cti_op_resolve(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_resolve(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
JSObject* o = *iter;
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
} while (++iter != end);
return new (ARG_globalData) JSObject(structure);
}
-JSValue* Interpreter::cti_op_construct_NotJSConstruct(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_construct_NotJSConstruct(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* constrVal = ARG_src1;
+ JSValuePtr constrVal = ARG_src1;
int argCount = ARG_int3;
int thisRegister = ARG_int5;
if (constructType == ConstructTypeHost) {
ArgList argList(callFrame->registers() + thisRegister + 1, argCount - 1);
- JSValue* returnValue;
+ JSValuePtr returnValue;
{
SamplingTool::HostCallRecord callRecord(CTI_SAMPLER);
returnValue = constructData.native.function(callFrame, asObject(constrVal), argList);
}
CHECK_FOR_EXCEPTION();
- return returnValue;
+ return JSValuePtr::encode(returnValue);
}
ASSERT(constructType == ConstructTypeNone);
VM_THROW_EXCEPTION();
}
-JSValue* Interpreter::cti_op_get_by_val(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_get_by_val(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
Interpreter* interpreter = ARG_globalData->interpreter;
- JSValue* baseValue = ARG_src1;
- JSValue* subscript = ARG_src2;
+ JSValuePtr baseValue = ARG_src1;
+ JSValuePtr subscript = ARG_src2;
- JSValue* result;
+ JSValuePtr result;
unsigned i;
bool isUInt32 = JSImmediate::getUInt32(subscript, i);
else
result = jsArray->JSArray::get(callFrame, i);
} else if (interpreter->isJSString(baseValue) && asString(baseValue)->canGetIndex(i))
- return asString(baseValue)->getIndex(ARG_globalData, i);
+ return JSValuePtr::encode(asString(baseValue)->getIndex(ARG_globalData, i));
else if (interpreter->isJSByteArray(baseValue) && asByteArray(baseValue)->canAccessIndex(i))
- return asByteArray(baseValue)->getIndex(i);
+ return JSValuePtr::encode(asByteArray(baseValue)->getIndex(i));
else
result = baseValue->get(callFrame, i);
} else {
}
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
VoidPtrPair Interpreter::cti_op_resolve_func(STUB_ARGS)
// that in host objects you always get a valid object for this.
// We also handle wrapper substitution for the global object at the same time.
JSObject* thisObj = base->toThisObject(callFrame);
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
CHECK_FOR_EXCEPTION_AT_END();
- RETURN_PAIR(thisObj, asPointer(result));
+ RETURN_PAIR(thisObj, JSValuePtr::encode(result));
}
++iter;
} while (iter != end);
VM_THROW_EXCEPTION_2();
}
-JSValue* Interpreter::cti_op_sub(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_sub(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
double left;
double right;
if (fastIsNumber(src1, left) && fastIsNumber(src2, right))
- return jsNumber(ARG_globalData, left - right);
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left - right));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, src1->toNumber(callFrame) - src2->toNumber(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, src1->toNumber(callFrame) - src2->toNumber(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
void Interpreter::cti_op_put_by_val(STUB_ARGS)
CallFrame* callFrame = ARG_callFrame;
Interpreter* interpreter = ARG_globalData->interpreter;
- JSValue* baseValue = ARG_src1;
- JSValue* subscript = ARG_src2;
- JSValue* value = ARG_src3;
+ JSValuePtr baseValue = ARG_src1;
+ JSValuePtr subscript = ARG_src2;
+ JSValuePtr value = ARG_src3;
unsigned i;
CallFrame* callFrame = ARG_callFrame;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
int i = ARG_int2;
- JSValue* value = ARG_src3;
+ JSValuePtr value = ARG_src3;
ASSERT(ARG_globalData->interpreter->isJSArray(baseValue));
CHECK_FOR_EXCEPTION_AT_END();
}
-JSValue* Interpreter::cti_op_lesseq(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_lesseq(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsBoolean(jsLessEq(callFrame, ARG_src1, ARG_src2));
+ JSValuePtr result = jsBoolean(jsLessEq(callFrame, ARG_src1, ARG_src2));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
int Interpreter::cti_op_loop_if_true(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
+ JSValuePtr src1 = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
return result;
}
-JSValue* Interpreter::cti_op_negate(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_negate(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src = ARG_src1;
+ JSValuePtr src = ARG_src1;
double v;
if (fastIsNumber(src, v))
- return jsNumber(ARG_globalData, -v);
+ return JSValuePtr::encode(jsNumber(ARG_globalData, -v));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, -src->toNumber(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, -src->toNumber(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_resolve_base(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_resolve_base(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return inlineResolveBase(ARG_callFrame, *ARG_id1, ARG_callFrame->scopeChain());
+ return JSValuePtr::encode(inlineResolveBase(ARG_callFrame, *ARG_id1, ARG_callFrame->scopeChain()));
}
-JSValue* Interpreter::cti_op_resolve_skip(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_resolve_skip(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
JSObject* o = *iter;
PropertySlot slot(o);
if (o->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
} while (++iter != end);
VM_THROW_EXCEPTION();
}
-JSValue* Interpreter::cti_op_resolve_global(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_resolve_global(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
PropertySlot slot(globalObject);
if (globalObject->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
if (slot.isCacheable() && !globalObject->structure()->isDictionary()) {
GlobalResolveInfo& globalResolveInfo = callFrame->codeBlock()->globalResolveInfo(globalResolveInfoIndex);
if (globalResolveInfo.structure)
globalObject->structure()->ref();
globalResolveInfo.structure = globalObject->structure();
globalResolveInfo.offset = slot.cachedOffset();
- return result;
+ return JSValuePtr::encode(result);
}
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
unsigned vPCIndex = ARG_callFrame->codeBlock()->getBytecodeIndex(STUB_RETURN_ADDRESS);
VM_THROW_EXCEPTION();
}
-JSValue* Interpreter::cti_op_div(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_div(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
double left;
double right;
if (fastIsNumber(src1, left) && fastIsNumber(src2, right))
- return jsNumber(ARG_globalData, left / right);
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left / right));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, src1->toNumber(callFrame) / src2->toNumber(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, src1->toNumber(callFrame) / src2->toNumber(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_pre_dec(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_pre_dec(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* v = ARG_src1;
+ JSValuePtr v = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, v->toNumber(callFrame) - 1);
+ JSValuePtr result = jsNumber(ARG_globalData, v->toNumber(callFrame) - 1);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
int Interpreter::cti_op_jless(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
bool result = jsLess(callFrame, src1, src2);
return result;
}
-JSValue* Interpreter::cti_op_not(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_not(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src = ARG_src1;
+ JSValuePtr src = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsBoolean(!src->toBoolean(callFrame));
+ JSValuePtr result = jsBoolean(!src->toBoolean(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
int Interpreter::cti_op_jtrue(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
+ JSValuePtr src1 = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
{
BEGIN_STUB_FUNCTION();
- JSValue* v = ARG_src1;
+ JSValuePtr v = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
- JSValue* number = v->toJSNumber(callFrame);
+ JSValuePtr number = v->toJSNumber(callFrame);
CHECK_FOR_EXCEPTION_AT_END();
- RETURN_PAIR(asPointer(number), asPointer(jsNumber(ARG_globalData, number->uncheckedGetNumber() + 1)));
+ RETURN_PAIR(JSValuePtr::encode(number), JSValuePtr::encode(jsNumber(ARG_globalData, number->uncheckedGetNumber() + 1)));
}
-JSValue* Interpreter::cti_op_eq(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_eq(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
ASSERT(!JSImmediate::areBothImmediateNumbers(src1, src2));
- JSValue* result = jsBoolean(equalSlowCaseInline(callFrame, src1, src2));
+ JSValuePtr result = jsBoolean(equalSlowCaseInline(callFrame, src1, src2));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_lshift(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_lshift(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* val = ARG_src1;
- JSValue* shift = ARG_src2;
+ JSValuePtr val = ARG_src1;
+ JSValuePtr shift = ARG_src2;
int32_t left;
uint32_t right;
if (JSImmediate::areBothImmediateNumbers(val, shift))
- return jsNumber(ARG_globalData, JSImmediate::getTruncatedInt32(val) << (JSImmediate::getTruncatedUInt32(shift) & 0x1f));
+ return JSValuePtr::encode(jsNumber(ARG_globalData, JSImmediate::getTruncatedInt32(val) << (JSImmediate::getTruncatedUInt32(shift) & 0x1f)));
if (fastToInt32(val, left) && fastToUInt32(shift, right))
- return jsNumber(ARG_globalData, left << (right & 0x1f));
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left << (right & 0x1f)));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, (val->toInt32(callFrame)) << (shift->toUInt32(callFrame) & 0x1f));
+ JSValuePtr result = jsNumber(ARG_globalData, (val->toInt32(callFrame)) << (shift->toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_bitand(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_bitand(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
int32_t left;
int32_t right;
if (fastToInt32(src1, left) && fastToInt32(src2, right))
- return jsNumber(ARG_globalData, left & right);
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left & right));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, src1->toInt32(callFrame) & src2->toInt32(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, src1->toInt32(callFrame) & src2->toInt32(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_rshift(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_rshift(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* val = ARG_src1;
- JSValue* shift = ARG_src2;
+ JSValuePtr val = ARG_src1;
+ JSValuePtr shift = ARG_src2;
int32_t left;
uint32_t right;
if (JSImmediate::areBothImmediateNumbers(val, shift))
- return JSImmediate::rightShiftImmediateNumbers(val, shift);
+ return JSValuePtr::encode(JSImmediate::rightShiftImmediateNumbers(val, shift));
if (fastToInt32(val, left) && fastToUInt32(shift, right))
- return jsNumber(ARG_globalData, left >> (right & 0x1f));
+ return JSValuePtr::encode(jsNumber(ARG_globalData, left >> (right & 0x1f)));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, (val->toInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
+ JSValuePtr result = jsNumber(ARG_globalData, (val->toInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_bitnot(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_bitnot(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src = ARG_src1;
+ JSValuePtr src = ARG_src1;
int value;
if (fastToInt32(src, value))
- return jsNumber(ARG_globalData, ~value);
-
+ return JSValuePtr::encode(jsNumber(ARG_globalData, ~value));
+
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, ~src->toInt32(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, ~src->toInt32(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
VoidPtrPair Interpreter::cti_op_resolve_with_base(STUB_ARGS)
base = *iter;
PropertySlot slot(base);
if (base->getPropertySlot(callFrame, ident, slot)) {
- JSValue* result = slot.getValue(callFrame, ident);
+ JSValuePtr result = slot.getValue(callFrame, ident);
CHECK_FOR_EXCEPTION_AT_END();
- RETURN_PAIR(base, asPointer(result));
+ RETURN_PAIR(base, JSValuePtr::encode(result));
}
++iter;
} while (iter != end);
return ARG_funcexp1->makeFunction(ARG_callFrame, ARG_callFrame->scopeChain());
}
-JSValue* Interpreter::cti_op_mod(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_mod(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* dividendValue = ARG_src1;
- JSValue* divisorValue = ARG_src2;
+ JSValuePtr dividendValue = ARG_src1;
+ JSValuePtr divisorValue = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
double d = dividendValue->toNumber(callFrame);
- JSValue* result = jsNumber(ARG_globalData, fmod(d, divisorValue->toNumber(callFrame)));
+ JSValuePtr result = jsNumber(ARG_globalData, fmod(d, divisorValue->toNumber(callFrame)));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_less(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_less(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsBoolean(jsLess(callFrame, ARG_src1, ARG_src2));
+ JSValuePtr result = jsBoolean(jsLess(callFrame, ARG_src1, ARG_src2));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_neq(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_neq(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
ASSERT(!JSImmediate::areBothImmediateNumbers(src1, src2));
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsBoolean(!equalSlowCaseInline(callFrame, src1, src2));
+ JSValuePtr result = jsBoolean(!equalSlowCaseInline(callFrame, src1, src2));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
VoidPtrPair Interpreter::cti_op_post_dec(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* v = ARG_src1;
+ JSValuePtr v = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
- JSValue* number = v->toJSNumber(callFrame);
+ JSValuePtr number = v->toJSNumber(callFrame);
CHECK_FOR_EXCEPTION_AT_END();
- RETURN_PAIR(asPointer(number), asPointer(jsNumber(ARG_globalData, number->uncheckedGetNumber() - 1)));
+ RETURN_PAIR(JSValuePtr::encode(number), JSValuePtr::encode(jsNumber(ARG_globalData, number->uncheckedGetNumber() - 1)));
}
-JSValue* Interpreter::cti_op_urshift(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_urshift(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* val = ARG_src1;
- JSValue* shift = ARG_src2;
+ JSValuePtr val = ARG_src1;
+ JSValuePtr shift = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
if (JSImmediate::areBothImmediateNumbers(val, shift) && !JSImmediate::isNegative(val))
- return JSImmediate::rightShiftImmediateNumbers(val, shift);
+ return JSValuePtr::encode(JSImmediate::rightShiftImmediateNumbers(val, shift));
else {
- JSValue* result = jsNumber(ARG_globalData, (val->toUInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
+ JSValuePtr result = jsNumber(ARG_globalData, (val->toUInt32(callFrame)) >> (shift->toUInt32(callFrame) & 0x1f));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
}
-JSValue* Interpreter::cti_op_bitxor(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_bitxor(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, src1->toInt32(callFrame) ^ src2->toInt32(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, src1->toInt32(callFrame) ^ src2->toInt32(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
JSObject* Interpreter::cti_op_new_regexp(STUB_ARGS)
return new (ARG_globalData) RegExpObject(ARG_callFrame->lexicalGlobalObject()->regExpStructure(), ARG_regexp1);
}
-JSValue* Interpreter::cti_op_bitor(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_bitor(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = jsNumber(ARG_globalData, src1->toInt32(callFrame) | src2->toInt32(callFrame));
+ JSValuePtr result = jsNumber(ARG_globalData, src1->toInt32(callFrame) | src2->toInt32(callFrame));
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_call_eval(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_call_eval(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
Interpreter* interpreter = ARG_globalData->interpreter;
- JSValue* funcVal = ARG_src1;
+ JSValuePtr funcVal = ARG_src1;
int registerOffset = ARG_int2;
int argCount = ARG_int3;
Register* newCallFrame = callFrame->registers() + registerOffset;
Register* argv = newCallFrame - RegisterFile::CallFrameHeaderSize - argCount;
- JSValue* thisValue = argv[0].jsValue(callFrame);
+ JSValuePtr thisValue = argv[0].jsValue(callFrame);
JSGlobalObject* globalObject = callFrame->scopeChain()->globalObject();
if (thisValue == globalObject && funcVal == globalObject->evalFunction()) {
- JSValue* exceptionValue = noValue();
- JSValue* result = interpreter->callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
+ JSValuePtr exceptionValue = noValue();
+ JSValuePtr result = interpreter->callEval(callFrame, registerFile, argv, argCount, registerOffset, exceptionValue);
if (UNLIKELY(exceptionValue != noValue())) {
ARG_globalData->exception = exceptionValue;
VM_THROW_EXCEPTION_AT_END();
}
- return result;
+ return JSValuePtr::encode(result);
}
- return JSImmediate::impossibleValue();
+ return JSValuePtr::encode(JSImmediate::impossibleValue());
}
-JSValue* Interpreter::cti_op_throw(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_throw(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
unsigned vPCIndex = codeBlock->getBytecodeIndex(STUB_RETURN_ADDRESS);
- JSValue* exceptionValue = ARG_src1;
+ JSValuePtr exceptionValue = ARG_src1;
ASSERT(exceptionValue);
HandlerInfo* handler = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, vPCIndex, true);
if (!handler) {
*ARG_exception = exceptionValue;
- return JSImmediate::nullImmediate();
+ return JSValuePtr::encode(JSImmediate::nullImmediate());
}
ARG_setCallFrame(callFrame);
void* catchRoutine = handler->nativeCode;
ASSERT(catchRoutine);
STUB_SET_RETURN_ADDRESS(catchRoutine);
- return exceptionValue;
+ return JSValuePtr::encode(exceptionValue);
}
JSPropertyNameIterator* Interpreter::cti_op_get_pnames(STUB_ARGS)
return JSPropertyNameIterator::create(ARG_callFrame, ARG_src1);
}
-JSValue* Interpreter::cti_op_next_pname(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_next_pname(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
JSPropertyNameIterator* it = ARG_pni1;
- JSValue* temp = it->next(ARG_callFrame);
+ JSValuePtr temp = it->next(ARG_callFrame);
if (!temp)
it->invalidate();
- return temp;
+ return JSValuePtr::encode(temp);
}
JSObject* Interpreter::cti_op_push_scope(STUB_ARGS)
ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->pop());
}
-JSValue* Interpreter::cti_op_typeof(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_typeof(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return jsTypeStringForValue(ARG_callFrame, ARG_src1);
+ return JSValuePtr::encode(jsTypeStringForValue(ARG_callFrame, ARG_src1));
}
-JSValue* Interpreter::cti_op_is_undefined(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_is_undefined(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* v = ARG_src1;
- return jsBoolean(JSImmediate::isImmediate(v) ? v->isUndefined() : v->asCell()->structure()->typeInfo().masqueradesAsUndefined());
+ JSValuePtr v = ARG_src1;
+ return JSValuePtr::encode(jsBoolean(JSImmediate::isImmediate(v) ? v->isUndefined() : v->asCell()->structure()->typeInfo().masqueradesAsUndefined()));
}
-JSValue* Interpreter::cti_op_is_boolean(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_is_boolean(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return jsBoolean(ARG_src1->isBoolean());
+ return JSValuePtr::encode(jsBoolean(ARG_src1->isBoolean()));
}
-JSValue* Interpreter::cti_op_is_number(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_is_number(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return jsBoolean(ARG_src1->isNumber());
+ return JSValuePtr::encode(jsBoolean(ARG_src1->isNumber()));
}
-JSValue* Interpreter::cti_op_is_string(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_is_string(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return jsBoolean(ARG_globalData->interpreter->isJSString(ARG_src1));
+ return JSValuePtr::encode(jsBoolean(ARG_globalData->interpreter->isJSString(ARG_src1)));
}
-JSValue* Interpreter::cti_op_is_object(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_is_object(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return jsBoolean(jsIsObjectType(ARG_src1));
+ return JSValuePtr::encode(jsBoolean(jsIsObjectType(ARG_src1)));
}
-JSValue* Interpreter::cti_op_is_function(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_is_function(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- return jsBoolean(jsIsFunctionType(ARG_src1));
+ return JSValuePtr::encode(jsBoolean(jsIsFunctionType(ARG_src1)));
}
-JSValue* Interpreter::cti_op_stricteq(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_stricteq(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
// handled inline as fast cases
ASSERT(!JSImmediate::areBothImmediate(src1, src2));
ASSERT(!(JSImmediate::isEitherImmediate(src1, src2) & (src1 != JSImmediate::zeroImmediate()) & (src2 != JSImmediate::zeroImmediate())));
- return jsBoolean(strictEqualSlowCaseInline(src1, src2));
+ return JSValuePtr::encode(jsBoolean(strictEqualSlowCaseInline(src1, src2)));
}
-JSValue* Interpreter::cti_op_nstricteq(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_nstricteq(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src1 = ARG_src1;
- JSValue* src2 = ARG_src2;
+ JSValuePtr src1 = ARG_src1;
+ JSValuePtr src2 = ARG_src2;
// handled inline as fast cases
ASSERT(!JSImmediate::areBothImmediate(src1, src2));
ASSERT(!(JSImmediate::isEitherImmediate(src1, src2) & (src1 != JSImmediate::zeroImmediate()) & (src2 != JSImmediate::zeroImmediate())));
- return jsBoolean(!strictEqualSlowCaseInline(src1, src2));
+ return JSValuePtr::encode(jsBoolean(!strictEqualSlowCaseInline(src1, src2)));
}
-JSValue* Interpreter::cti_op_to_jsnumber(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_to_jsnumber(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* src = ARG_src1;
+ JSValuePtr src = ARG_src1;
CallFrame* callFrame = ARG_callFrame;
- JSValue* result = src->toJSNumber(callFrame);
+ JSValuePtr result = src->toJSNumber(callFrame);
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
-JSValue* Interpreter::cti_op_in(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_in(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* baseVal = ARG_src2;
+ JSValuePtr baseVal = ARG_src2;
if (!baseVal->isObject()) {
CallFrame* callFrame = ARG_callFrame;
VM_THROW_EXCEPTION();
}
- JSValue* propName = ARG_src1;
+ JSValuePtr propName = ARG_src1;
JSObject* baseObj = asObject(baseVal);
uint32_t i;
if (propName->getUInt32(i))
- return jsBoolean(baseObj->hasProperty(callFrame, i));
+ return JSValuePtr::encode(jsBoolean(baseObj->hasProperty(callFrame, i)));
Identifier property(callFrame, propName->toString(callFrame));
CHECK_FOR_EXCEPTION();
- return jsBoolean(baseObj->hasProperty(callFrame, property));
+ return JSValuePtr::encode(jsBoolean(baseObj->hasProperty(callFrame, property)));
}
JSObject* Interpreter::cti_op_push_new_scope(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
- JSValue* scrutinee = ARG_src1;
+ JSValuePtr scrutinee = ARG_src1;
unsigned tableIndex = ARG_int2;
CallFrame* callFrame = ARG_callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
{
BEGIN_STUB_FUNCTION();
- JSValue* scrutinee = ARG_src1;
+ JSValuePtr scrutinee = ARG_src1;
unsigned tableIndex = ARG_int2;
CallFrame* callFrame = ARG_callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
{
BEGIN_STUB_FUNCTION();
- JSValue* scrutinee = ARG_src1;
+ JSValuePtr scrutinee = ARG_src1;
unsigned tableIndex = ARG_int2;
CallFrame* callFrame = ARG_callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
return result;
}
-JSValue* Interpreter::cti_op_del_by_val(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_op_del_by_val(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
CallFrame* callFrame = ARG_callFrame;
- JSValue* baseValue = ARG_src1;
+ JSValuePtr baseValue = ARG_src1;
JSObject* baseObj = baseValue->toObject(callFrame); // may throw
- JSValue* subscript = ARG_src2;
- JSValue* result;
+ JSValuePtr subscript = ARG_src2;
+ JSValuePtr result;
uint32_t i;
if (subscript->getUInt32(i))
result = jsBoolean(baseObj->deleteProperty(callFrame, i));
}
CHECK_FOR_EXCEPTION_AT_END();
- return result;
+ return JSValuePtr::encode(result);
}
void Interpreter::cti_op_put_getter(STUB_ARGS)
CallFrame* callFrame = ARG_callFrame;
CodeBlock* codeBlock = callFrame->codeBlock();
unsigned type = ARG_int1;
- JSValue* message = ARG_src2;
+ JSValuePtr message = ARG_src2;
unsigned lineNumber = ARG_int3;
return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
ARG_globalData->interpreter->debug(callFrame, static_cast<DebugHookID>(debugHookID), firstLine, lastLine);
}
-JSValue* Interpreter::cti_vm_throw(STUB_ARGS)
+JSValueEncodedAsPointer* Interpreter::cti_vm_throw(STUB_ARGS)
{
BEGIN_STUB_FUNCTION();
unsigned vPCIndex = codeBlock->getBytecodeIndex(globalData->exceptionLocation);
- JSValue* exceptionValue = globalData->exception;
+ JSValuePtr exceptionValue = globalData->exception;
ASSERT(exceptionValue);
globalData->exception = noValue();
if (!handler) {
*ARG_exception = exceptionValue;
- return JSImmediate::nullImmediate();
+ return JSValuePtr::encode(JSImmediate::nullImmediate());
}
ARG_setCallFrame(callFrame);
void* catchRoutine = handler->nativeCode;
ASSERT(catchRoutine);
STUB_SET_RETURN_ADDRESS(catchRoutine);
- return exceptionValue;
+ return JSValuePtr::encode(exceptionValue);
}
#undef STUB_RETURN_ADDRESS