source: webkit/trunk/JavaScriptCore/bytecode/CodeBlock.h@ 40046

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

JavaScriptCore:

2009-01-19 Sam Weinig <[email protected]>

Rubber-stamped by Gavin Barraclough.

Remove temporary operator-> from JSValuePtr.

  • API/JSCallbackFunction.cpp: (JSC::JSCallbackFunction::call):
  • API/JSCallbackObjectFunctions.h: (JSC::::call): (JSC::::toNumber): (JSC::::toString):
  • API/JSObjectRef.cpp: (JSObjectSetPrototype):
  • API/JSValueRef.cpp: (JSValueGetType): (JSValueIsUndefined): (JSValueIsNull): (JSValueIsBoolean): (JSValueIsNumber): (JSValueIsString): (JSValueIsObject): (JSValueIsObjectOfClass): (JSValueToBoolean): (JSValueToNumber): (JSValueToStringCopy): (JSValueToObject):
  • bytecode/CodeBlock.cpp: (JSC::valueToSourceString): (JSC::CodeBlock::mark):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::isKnownNotImmediate):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitEqualityOp): (JSC::keyForImmediateSwitch):
  • interpreter/Interpreter.cpp: (JSC::jsLess): (JSC::jsLessEq): (JSC::jsAddSlowCase): (JSC::jsAdd): (JSC::jsTypeStringForValue): (JSC::jsIsObjectType): (JSC::jsIsFunctionType): (JSC::isNotObject): (JSC::Interpreter::callEval): (JSC::Interpreter::throwException): (JSC::cachePrototypeChain): (JSC::Interpreter::tryCachePutByID): (JSC::countPrototypeChainEntriesAndCheckForProxies): (JSC::Interpreter::tryCacheGetByID): (JSC::Interpreter::privateExecute): (JSC::Interpreter::tryCTICachePutByID): (JSC::Interpreter::tryCTICacheGetByID): (JSC::Interpreter::cti_op_convert_this): (JSC::Interpreter::cti_op_add): (JSC::Interpreter::cti_op_pre_inc): (JSC::Interpreter::cti_op_put_by_id_generic): (JSC::Interpreter::cti_op_get_by_id_generic): (JSC::Interpreter::cti_op_put_by_id): (JSC::Interpreter::cti_op_put_by_id_second): (JSC::Interpreter::cti_op_put_by_id_fail): (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_JSFunction): (JSC::Interpreter::cti_op_call_NotJSFunction): (JSC::Interpreter::cti_op_construct_JSConstruct): (JSC::Interpreter::cti_op_construct_NotJSConstruct): (JSC::Interpreter::cti_op_get_by_val): (JSC::Interpreter::cti_op_get_by_val_byte_array): (JSC::Interpreter::cti_op_sub): (JSC::Interpreter::cti_op_put_by_val): (JSC::Interpreter::cti_op_put_by_val_array): (JSC::Interpreter::cti_op_put_by_val_byte_array): (JSC::Interpreter::cti_op_loop_if_true): (JSC::Interpreter::cti_op_negate): (JSC::Interpreter::cti_op_div): (JSC::Interpreter::cti_op_pre_dec): (JSC::Interpreter::cti_op_not): (JSC::Interpreter::cti_op_jtrue): (JSC::Interpreter::cti_op_post_inc): (JSC::Interpreter::cti_op_lshift): (JSC::Interpreter::cti_op_bitand): (JSC::Interpreter::cti_op_rshift): (JSC::Interpreter::cti_op_bitnot): (JSC::Interpreter::cti_op_mod): (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_push_scope): (JSC::Interpreter::cti_op_is_undefined): (JSC::Interpreter::cti_op_is_boolean): (JSC::Interpreter::cti_op_is_number): (JSC::Interpreter::cti_op_to_jsnumber): (JSC::Interpreter::cti_op_in): (JSC::Interpreter::cti_op_put_by_index): (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_put_getter): (JSC::Interpreter::cti_op_put_setter): (JSC::Interpreter::cti_op_new_error):
  • interpreter/Interpreter.h: (JSC::Interpreter::isJSArray): (JSC::Interpreter::isJSString): (JSC::Interpreter::isJSByteArray):
  • interpreter/Register.h: (JSC::Register::marked): (JSC::Register::mark):
  • jit/JITInlineMethods.h: (JSC::JIT::getConstantOperandImmediateInt): (JSC::JIT::isOperandConstantImmediateInt):
  • jsc.cpp: (functionPrint): (functionDebug): (functionRun): (functionLoad): (runWithScripts): (runInteractive):
  • parser/Nodes.cpp: (JSC::processClauseList):
  • profiler/ProfileGenerator.cpp: (JSC::ProfileGenerator::addParentForConsoleStart):
  • profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier):
  • runtime/ArrayConstructor.cpp: (JSC::constructArrayWithSizeQuirk):
  • runtime/ArrayPrototype.cpp: (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::constructBoolean): (JSC::callBooleanConstructor):
  • runtime/BooleanPrototype.cpp: (JSC::booleanProtoFuncToString): (JSC::booleanProtoFuncValueOf):
  • runtime/Collector.cpp: (JSC::Heap::protect): (JSC::Heap::unprotect): (JSC::Heap::heap): (JSC::Heap::collect): (JSC::typeName):
  • runtime/Completion.cpp: (JSC::evaluate):
  • runtime/DateConstructor.cpp: (JSC::constructDate): (JSC::dateParse): (JSC::dateUTC):
  • runtime/DateInstance.h: (JSC::DateInstance::internalNumber):
  • runtime/DatePrototype.cpp: (JSC::formatLocaleDate): (JSC::fillStructuresUsingTimeArgs): (JSC::fillStructuresUsingDateArgs): (JSC::dateProtoFuncToString): (JSC::dateProtoFuncToUTCString): (JSC::dateProtoFuncToDateString): (JSC::dateProtoFuncToTimeString): (JSC::dateProtoFuncToLocaleString): (JSC::dateProtoFuncToLocaleDateString): (JSC::dateProtoFuncToLocaleTimeString): (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::dateProtoFuncSetYear): (JSC::dateProtoFuncGetYear):
  • runtime/ErrorConstructor.cpp: (JSC::constructError):
  • runtime/ErrorPrototype.cpp: (JSC::errorProtoFuncToString):
  • runtime/ExceptionHelpers.cpp: (JSC::createError): (JSC::createErrorMessage):
  • runtime/FunctionConstructor.cpp: (JSC::constructFunction):
  • runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): (JSC::functionProtoFuncApply): (JSC::functionProtoFuncCall):
  • runtime/GetterSetter.cpp: (JSC::GetterSetter::toObject):
  • runtime/JSActivation.cpp: (JSC::JSActivation::getOwnPropertySlot):
  • runtime/JSArray.cpp: (JSC::JSArray::put): (JSC::JSArray::mark): (JSC::JSArray::sort): (JSC::AVLTreeAbstractorForArrayCompare::compare_key_key): (JSC::JSArray::compactForSorting):
  • runtime/JSByteArray.h: (JSC::JSByteArray::setIndex):
  • runtime/JSCell.h: (JSC::asCell):
  • runtime/JSFunction.cpp: (JSC::JSFunction::call): (JSC::JSFunction::construct):
  • runtime/JSGlobalObject.cpp: (JSC::markIfNeeded): (JSC::lastInPrototypeChain):
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::encode): (JSC::decode): (JSC::globalFuncEval): (JSC::globalFuncParseInt): (JSC::globalFuncParseFloat): (JSC::globalFuncIsNaN): (JSC::globalFuncIsFinite): (JSC::globalFuncEscape): (JSC::globalFuncUnescape): (JSC::globalFuncJSCPrint):
  • runtime/JSImmediate.cpp: (JSC::JSImmediate::toThisObject): (JSC::JSImmediate::toObject): (JSC::JSImmediate::prototype): (JSC::JSImmediate::toString):
  • runtime/JSImmediate.h:
  • runtime/JSObject.cpp: (JSC::JSObject::mark): (JSC::JSObject::put): (JSC::callDefaultValueFunction): (JSC::JSObject::getPrimitiveNumber): (JSC::JSObject::defineGetter): (JSC::JSObject::defineSetter): (JSC::JSObject::lookupGetter): (JSC::JSObject::lookupSetter): (JSC::JSObject::hasInstance): (JSC::JSObject::toNumber): (JSC::JSObject::toString):
  • runtime/JSObject.h: (JSC::JSObject::JSObject): (JSC::JSObject::inlineGetOwnPropertySlot): (JSC::JSObject::getOwnPropertySlotForWrite): (JSC::JSObject::getPropertySlot): (JSC::JSValuePtr::get):
  • runtime/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::create):
  • runtime/JSString.cpp: (JSC::JSString::getOwnPropertySlot):
  • runtime/JSValue.h:
  • runtime/JSWrapperObject.cpp: (JSC::JSWrapperObject::mark):
  • runtime/JSWrapperObject.h: (JSC::JSWrapperObject::setInternalValue):
  • 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::mathProtoFuncRound): (JSC::mathProtoFuncSin): (JSC::mathProtoFuncSqrt): (JSC::mathProtoFuncTan):
  • runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor): (JSC::NativeErrorConstructor::construct):
  • runtime/NumberConstructor.cpp: (JSC::constructWithNumberConstructor): (JSC::callNumberConstructor):
  • runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToString): (JSC::numberProtoFuncToLocaleString): (JSC::numberProtoFuncValueOf): (JSC::numberProtoFuncToFixed): (JSC::numberProtoFuncToExponential): (JSC::numberProtoFuncToPrecision):
  • runtime/ObjectConstructor.cpp: (JSC::constructObject):
  • runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncValueOf): (JSC::objectProtoFuncHasOwnProperty): (JSC::objectProtoFuncIsPrototypeOf): (JSC::objectProtoFuncDefineGetter): (JSC::objectProtoFuncDefineSetter): (JSC::objectProtoFuncLookupGetter): (JSC::objectProtoFuncLookupSetter): (JSC::objectProtoFuncPropertyIsEnumerable): (JSC::objectProtoFuncToLocaleString): (JSC::objectProtoFuncToString):
  • runtime/Operations.h: (JSC::JSValuePtr::equalSlowCaseInline): (JSC::JSValuePtr::strictEqual): (JSC::JSValuePtr::strictEqualSlowCaseInline):
  • runtime/Protect.h: (JSC::gcProtect): (JSC::gcUnprotect):
  • runtime/RegExpConstructor.cpp: (JSC::setRegExpConstructorInput): (JSC::setRegExpConstructorMultiline): (JSC::constructRegExp):
  • runtime/RegExpObject.cpp: (JSC::setRegExpObjectLastIndex): (JSC::RegExpObject::match):
  • runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncTest): (JSC::regExpProtoFuncExec): (JSC::regExpProtoFuncCompile): (JSC::regExpProtoFuncToString):
  • runtime/StringConstructor.cpp: (JSC::stringFromCharCodeSlowCase): (JSC::stringFromCharCode): (JSC::constructWithStringConstructor): (JSC::callStringConstructor):
  • 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::getEnumerablePropertyNames): (JSC::Structure::createCachedPrototypeChain):
  • runtime/Structure.h: (JSC::Structure::mark):
  • runtime/StructureChain.cpp: (JSC::StructureChain::StructureChain):

JavaScriptGlue:

2009-01-19 Sam Weinig <[email protected]>

Rubber-stamped by Gavin Barraclough.

Remove temporary operator-> from JSValuePtr.

  • JSUtils.cpp: (KJSValueToJSObject): (KJSValueToCFTypeInternal):
  • JSValueWrapper.cpp: (JSValueWrapper::JSObjectCopyPropertyNames): (JSValueWrapper::JSObjectCopyProperty): (JSValueWrapper::JSObjectSetProperty): (JSValueWrapper::JSObjectCallFunction): (JSValueWrapper::JSObjectMark):
  • UserObjectImp.cpp: (UserObjectImp::getOwnPropertySlot):

WebCore:

2009-01-19 Sam Weinig <[email protected]>

Rubber-stamped by Gavin Barraclough.

Remove temporary operator-> from JSValuePtr.

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSAudioConstructor.cpp: (WebCore::constructAudio):
  • bindings/js/JSCanvasRenderingContext2DCustom.cpp: (WebCore::toHTMLCanvasStyle): (WebCore::JSCanvasRenderingContext2D::setFillColor): (WebCore::JSCanvasRenderingContext2D::setStrokeColor): (WebCore::JSCanvasRenderingContext2D::strokeRect): (WebCore::JSCanvasRenderingContext2D::drawImage): (WebCore::JSCanvasRenderingContext2D::drawImageFromRect): (WebCore::JSCanvasRenderingContext2D::setShadow): (WebCore::JSCanvasRenderingContext2D::createPattern): (WebCore::JSCanvasRenderingContext2D::putImageData): (WebCore::JSCanvasRenderingContext2D::fillText): (WebCore::JSCanvasRenderingContext2D::strokeText):
  • bindings/js/JSClipboardCustom.cpp: (WebCore::JSClipboard::clearData): (WebCore::JSClipboard::getData): (WebCore::JSClipboard::setData): (WebCore::JSClipboard::setDragImage):
  • bindings/js/JSCustomPositionCallback.cpp: (WebCore::JSCustomPositionCallback::handleEvent):
  • bindings/js/JSCustomPositionErrorCallback.cpp: (WebCore::JSCustomPositionErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementCallback.cpp: (WebCore::JSCustomSQLStatementCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementErrorCallback.cpp: (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionCallback.cpp: (WebCore::JSCustomSQLTransactionCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionErrorCallback.cpp: (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
  • bindings/js/JSCustomVoidCallback.cpp: (WebCore::JSCustomVoidCallback::handleEvent): (WebCore::toVoidCallback):
  • bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::create): (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
  • bindings/js/JSDOMApplicationCacheCustom.cpp: (WebCore::JSDOMApplicationCache::hasItem): (WebCore::JSDOMApplicationCache::add): (WebCore::JSDOMApplicationCache::remove): (WebCore::JSDOMApplicationCache::addEventListener): (WebCore::JSDOMApplicationCache::removeEventListener):
  • bindings/js/JSDOMBinding.cpp: (WebCore::valueToStringWithNullCheck): (WebCore::valueToStringWithUndefinedOrNullCheck): (WebCore::reportException):
  • bindings/js/JSDOMGlobalObject.cpp: (WebCore::JSDOMGlobalObject::findJSEventListener): (WebCore::JSDOMGlobalObject::findOrCreateJSEventListener): (WebCore::JSDOMGlobalObject::findJSUnprotectedEventListener): (WebCore::JSDOMGlobalObject::findOrCreateJSUnprotectedEventListener):
  • bindings/js/JSDOMStringListCustom.cpp: (WebCore::JSDOMStringList::item):
  • bindings/js/JSDOMWindowBase.cpp: (WebCore::JSDOMWindowBase::getOwnPropertySlot): (windowProtoFuncOpen): (WebCore::toJSDOMWindow):
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setLocation): (WebCore::JSDOMWindow::postMessage): (WebCore::setTimeoutOrInterval): (WebCore::JSDOMWindow::clearTimeout): (WebCore::JSDOMWindow::clearInterval): (WebCore::JSDOMWindow::atob): (WebCore::JSDOMWindow::btoa): (WebCore::JSDOMWindow::addEventListener): (WebCore::JSDOMWindow::removeEventListener): (WebCore::toDOMWindow):
  • bindings/js/JSDatabaseCustom.cpp: (WebCore::JSDatabase::changeVersion): (WebCore::JSDatabase::transaction):
  • bindings/js/JSDocumentCustom.cpp: (WebCore::JSDocument::setLocation):
  • bindings/js/JSElementCustom.cpp: (WebCore::JSElement::setAttribute): (WebCore::JSElement::setAttributeNS):
  • bindings/js/JSEventListener.cpp: (WebCore::JSAbstractEventListener::handleEvent): (WebCore::JSLazyEventListener::parseCode):
  • bindings/js/JSEventTargetNodeCustom.cpp: (WebCore::JSEventTargetNode::addEventListener): (WebCore::JSEventTargetNode::removeEventListener):
  • bindings/js/JSGeolocationCustom.cpp: (WebCore::createPositionOptions): (WebCore::JSGeolocation::getCurrentPosition): (WebCore::JSGeolocation::watchPosition):
  • bindings/js/JSHTMLCollectionCustom.cpp: (WebCore::callHTMLCollection): (WebCore::JSHTMLCollection::canGetItemsForName): (WebCore::JSHTMLCollection::item): (WebCore::JSHTMLCollection::namedItem):
  • bindings/js/JSHTMLDocumentCustom.cpp: (WebCore::JSHTMLDocument::open): (WebCore::writeHelper):
  • bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::setLength): (WebCore::JSHTMLOptionsCollection::add):
  • bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::JSHTMLSelectElement::remove): (WebCore::selectIndexSetter):
  • bindings/js/JSImageConstructor.cpp: (WebCore::constructImage):
  • bindings/js/JSInspectedObjectWrapper.cpp: (WebCore::JSInspectedObjectWrapper::wrap): (WebCore::JSInspectedObjectWrapper::prepareIncomingValue):
  • bindings/js/JSInspectorCallbackWrapper.cpp: (WebCore::JSInspectorCallbackWrapper::wrap):
  • bindings/js/JSJavaScriptCallFrameCustom.cpp: (WebCore::JSJavaScriptCallFrame::evaluate):
  • bindings/js/JSLocationCustom.cpp: (WebCore::JSLocation::setHref): (WebCore::JSLocation::setProtocol): (WebCore::JSLocation::setHost): (WebCore::JSLocation::setHostname): (WebCore::JSLocation::setPort): (WebCore::JSLocation::setPathname): (WebCore::JSLocation::setSearch): (WebCore::JSLocation::setHash): (WebCore::JSLocation::replace): (WebCore::JSLocation::assign):
  • bindings/js/JSMessageChannelConstructor.cpp: (WebCore::JSMessageChannelConstructor::mark):
  • bindings/js/JSMessagePortCustom.cpp: (WebCore::JSMessagePort::startConversation): (WebCore::JSMessagePort::addEventListener): (WebCore::JSMessagePort::removeEventListener):
  • bindings/js/JSNodeFilterCondition.cpp: (WebCore::JSNodeFilterCondition::mark): (WebCore::JSNodeFilterCondition::acceptNode):
  • bindings/js/JSNodeFilterCondition.h:
  • bindings/js/JSNodeFilterCustom.cpp: (WebCore::toNodeFilter):
  • bindings/js/JSNodeListCustom.cpp: (WebCore::callNodeList):
  • bindings/js/JSOptionConstructor.cpp: (WebCore::constructHTMLOptionElement):
  • bindings/js/JSQuarantinedObjectWrapper.cpp: (WebCore::JSQuarantinedObjectWrapper::asWrapper): (WebCore::JSQuarantinedObjectWrapper::construct):
  • bindings/js/JSSQLResultSetRowListCustom.cpp: (WebCore::JSSQLResultSetRowList::item):
  • bindings/js/JSSQLTransactionCustom.cpp: (WebCore::JSSQLTransaction::executeSql):
  • bindings/js/JSSVGElementInstanceCustom.cpp: (WebCore::JSSVGElementInstance::addEventListener): (WebCore::JSSVGElementInstance::removeEventListener):
  • bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::convertToSpecifiedUnits):
  • bindings/js/JSSVGMatrixCustom.cpp: (WebCore::JSSVGMatrix::translate): (WebCore::JSSVGMatrix::scale): (WebCore::JSSVGMatrix::scaleNonUniform): (WebCore::JSSVGMatrix::rotate): (WebCore::JSSVGMatrix::rotateFromVector): (WebCore::JSSVGMatrix::skewX): (WebCore::JSSVGMatrix::skewY):
  • bindings/js/JSSVGPathSegListCustom.cpp: (WebCore::JSSVGPathSegList::getItem): (WebCore::JSSVGPathSegList::insertItemBefore): (WebCore::JSSVGPathSegList::replaceItem): (WebCore::JSSVGPathSegList::removeItem):
  • bindings/js/JSSVGPointListCustom.cpp: (WebCore::JSSVGPointList::getItem): (WebCore::JSSVGPointList::insertItemBefore): (WebCore::JSSVGPointList::replaceItem): (WebCore::JSSVGPointList::removeItem):
  • bindings/js/JSSVGTransformListCustom.cpp: (WebCore::JSSVGTransformList::getItem): (WebCore::JSSVGTransformList::insertItemBefore): (WebCore::JSSVGTransformList::replaceItem): (WebCore::JSSVGTransformList::removeItem):
  • bindings/js/JSStorageCustom.cpp: (WebCore::JSStorage::deleteProperty): (WebCore::JSStorage::customPut):
  • bindings/js/JSWebKitCSSMatrixConstructor.cpp: (WebCore::constructWebKitCSSMatrix):
  • bindings/js/JSWorkerConstructor.cpp: (WebCore::constructWorker):
  • bindings/js/JSWorkerContextCustom.cpp: (WebCore::JSWorkerContext::addEventListener): (WebCore::JSWorkerContext::removeEventListener):
  • bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorker::addEventListener): (WebCore::JSWorker::removeEventListener):
  • bindings/js/JSXMLHttpRequestCustom.cpp: (WebCore::JSXMLHttpRequest::open): (WebCore::JSXMLHttpRequest::setRequestHeader): (WebCore::JSXMLHttpRequest::send): (WebCore::JSXMLHttpRequest::getResponseHeader): (WebCore::JSXMLHttpRequest::overrideMimeType): (WebCore::JSXMLHttpRequest::addEventListener): (WebCore::JSXMLHttpRequest::removeEventListener):
  • bindings/js/JSXMLHttpRequestUploadCustom.cpp: (WebCore::JSXMLHttpRequestUpload::addEventListener): (WebCore::JSXMLHttpRequestUpload::removeEventListener):
  • bindings/js/JSXSLTProcessorCustom.cpp: (WebCore::JSXSLTProcessor::importStylesheet): (WebCore::JSXSLTProcessor::transformToFragment): (WebCore::JSXSLTProcessor::transformToDocument): (WebCore::JSXSLTProcessor::setParameter): (WebCore::JSXSLTProcessor::getParameter): (WebCore::JSXSLTProcessor::removeParameter):
  • bindings/js/ScheduledAction.cpp: (WebCore::ScheduledAction::executeFunctionInContext):
  • bindings/js/ScriptCallStack.cpp: (WebCore::ScriptCallStack::initialize):
  • bindings/js/ScriptController.cpp: (WebCore::ScriptController::createScriptObjectForPluginElement):
  • bindings/js/ScriptValue.cpp: (WebCore::ScriptValue::getString): (WebCore::ScriptValue::isNull): (WebCore::ScriptValue::isUndefined):
  • bindings/objc/WebScriptObject.mm: (-[WebScriptObject callWebScriptMethod:withArguments:]): (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/NP_jsobject.cpp: (_NPN_InvokeDefault): (_NPN_Invoke): (_NPN_HasMethod): (_NPN_Construct):
  • bridge/c/c_utility.cpp: (JSC::Bindings::convertValueToNPVariant):
  • bridge/jni/jni_instance.cpp: (JavaInstance::invokeMethod):
  • bridge/jni/jni_jsobject.mm: (JavaJSObject::call): (JavaJSObject::convertValueToJObject):
  • bridge/jni/jni_runtime.cpp: (JavaField::dispatchValueFromInstance): (JavaField::valueFromInstance): (JavaField::dispatchSetValueToInstance): (JavaField::setValueToInstance):
  • bridge/jni/jni_utility.cpp: (JSC::Bindings::convertArrayInstanceToJavaArray): (JSC::Bindings::convertValueToJValue):
  • bridge/objc/objc_runtime.mm: (JSC::Bindings::callObjCFallbackObject):
  • bridge/objc/objc_utility.mm: (JSC::Bindings::convertValueToObjcValue):
  • bridge/runtime_method.cpp: (JSC::callRuntimeMethod):
  • bridge/runtime_object.cpp: (JSC::RuntimeObjectImp::getOwnPropertySlot): (JSC::callRuntimeConstructor):

WebKit/mac:

2009-01-19 Sam Weinig <[email protected]>

Rubber-stamped by Gavin Barraclough.

Remove temporary operator-> from JSValuePtr.

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm: (WebKit::NetscapePluginInstanceProxy::invoke): (WebKit::NetscapePluginInstanceProxy::hasMethod): (WebKit::NetscapePluginInstanceProxy::marshalValue):
  • WebView/WebFrame.mm: (-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
  • WebView/WebView.mm: (aeDescFromJSValue):

WebKit/win:

2009-01-19 Sam Weinig <[email protected]>

Rubber-stamped by Gavin Barraclough.

Remove temporary operator-> from JSValuePtr.

  • WebScriptCallFrame.cpp: (WebScriptCallFrame::jsValueToString):
  • WebView.cpp: (WebView::stringByEvaluatingJavaScriptFromString):

WebKit/wx:

2009-01-19 Sam Weinig <[email protected]>

Rubber-stamped by Gavin Barraclough.

Remove temporary operator-> from JSValuePtr.

  • WebFrame.cpp: (wxWebFrame::RunScript):
File size: 22.2 KB
Line 
1/*
2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Cameron Zwarich <[email protected]>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef CodeBlock_h
31#define CodeBlock_h
32
33#include "EvalCodeCache.h"
34#include "Instruction.h"
35#include "JSGlobalObject.h"
36#include "JumpTable.h"
37#include "Nodes.h"
38#include "RegExp.h"
39#include "UString.h"
40#include <wtf/RefPtr.h>
41#include <wtf/Vector.h>
42
43#if ENABLE(JIT)
44#include "StructureStubInfo.h"
45#endif
46
47namespace JSC {
48
49 class ExecState;
50
51 enum CodeType { GlobalCode, EvalCode, FunctionCode };
52
53 static ALWAYS_INLINE int missingThisObjectMarker() { return std::numeric_limits<int>::max(); }
54
55 struct HandlerInfo {
56 uint32_t start;
57 uint32_t end;
58 uint32_t target;
59 uint32_t scopeDepth;
60#if ENABLE(JIT)
61 void* nativeCode;
62#endif
63 };
64
65#if ENABLE(JIT)
66 // The code, and the associated pool from which it was allocated.
67 struct JITCodeRef {
68 void* code;
69#ifndef NDEBUG
70 unsigned codeSize;
71#endif
72 RefPtr<ExecutablePool> executablePool;
73
74 JITCodeRef()
75 : code(0)
76#ifndef NDEBUG
77 , codeSize(0)
78#endif
79 {
80 }
81
82 JITCodeRef(void* code, PassRefPtr<ExecutablePool> executablePool)
83 : code(code)
84#ifndef NDEBUG
85 , codeSize(0)
86#endif
87 , executablePool(executablePool)
88 {
89 }
90 };
91#endif
92
93 struct ExpressionRangeInfo {
94 enum {
95 MaxOffset = (1 << 7) - 1,
96 MaxDivot = (1 << 25) - 1
97 };
98 uint32_t instructionOffset : 25;
99 uint32_t divotPoint : 25;
100 uint32_t startOffset : 7;
101 uint32_t endOffset : 7;
102 };
103
104 struct LineInfo {
105 uint32_t instructionOffset;
106 int32_t lineNumber;
107 };
108
109 // Both op_construct and op_instanceof require a use of op_get_by_id to get
110 // the prototype property from an object. The exception messages for exceptions
111 // thrown by these instances op_get_by_id need to reflect this.
112 struct GetByIdExceptionInfo {
113 unsigned bytecodeOffset : 31;
114 bool isOpConstruct : 1;
115 };
116
117#if ENABLE(JIT)
118 struct CallLinkInfo {
119 CallLinkInfo()
120 : callReturnLocation(0)
121 , hotPathBegin(0)
122 , hotPathOther(0)
123 , coldPathOther(0)
124 , callee(0)
125 {
126 }
127
128 unsigned bytecodeIndex;
129 void* callReturnLocation;
130 void* hotPathBegin;
131 void* hotPathOther;
132 void* coldPathOther;
133 CodeBlock* callee;
134 unsigned position;
135
136 void setUnlinked() { callee = 0; }
137 bool isLinked() { return callee; }
138 };
139
140 struct FunctionRegisterInfo {
141 FunctionRegisterInfo(unsigned bytecodeOffset, int functionRegisterIndex)
142 : bytecodeOffset(bytecodeOffset)
143 , functionRegisterIndex(functionRegisterIndex)
144 {
145 }
146
147 unsigned bytecodeOffset;
148 int functionRegisterIndex;
149 };
150
151 struct GlobalResolveInfo {
152 GlobalResolveInfo(unsigned bytecodeOffset)
153 : structure(0)
154 , offset(0)
155 , bytecodeOffset(bytecodeOffset)
156 {
157 }
158
159 Structure* structure;
160 unsigned offset;
161 unsigned bytecodeOffset;
162 };
163
164 struct PC {
165 PC(ptrdiff_t nativePCOffset, unsigned bytecodeIndex)
166 : nativePCOffset(nativePCOffset)
167 , bytecodeIndex(bytecodeIndex)
168 {
169 }
170
171 ptrdiff_t nativePCOffset;
172 unsigned bytecodeIndex;
173 };
174
175 // valueAtPosition helpers for the binaryChop algorithm below.
176
177 inline void* getStructureStubInfoReturnLocation(StructureStubInfo* structureStubInfo)
178 {
179 return structureStubInfo->callReturnLocation;
180 }
181
182 inline void* getCallLinkInfoReturnLocation(CallLinkInfo* callLinkInfo)
183 {
184 return callLinkInfo->callReturnLocation;
185 }
186
187 inline ptrdiff_t getNativePCOffset(PC* pc)
188 {
189 return pc->nativePCOffset;
190 }
191
192 // Binary chop algorithm, calls valueAtPosition on pre-sorted elements in array,
193 // compares result with key (KeyTypes should be comparable with '--', '<', '>').
194 // Optimized for cases where the array contains the key, checked by assertions.
195 template<typename ArrayType, typename KeyType, KeyType(*valueAtPosition)(ArrayType*)>
196 inline ArrayType* binaryChop(ArrayType* array, size_t size, KeyType key)
197 {
198 // The array must contain at least one element (pre-condition, array does conatin key).
199 // If the array only contains one element, no need to do the comparison.
200 while (size > 1) {
201 // Pick an element to check, half way through the array, and read the value.
202 int pos = (size - 1) >> 1;
203 KeyType val = valueAtPosition(&array[pos]);
204
205 // If the key matches, success!
206 if (val == key)
207 return &array[pos];
208 // The item we are looking for is smaller than the item being check; reduce the value of 'size',
209 // chopping off the right hand half of the array.
210 else if (key < val)
211 size = pos;
212 // Discard all values in the left hand half of the array, up to and including the item at pos.
213 else {
214 size -= (pos + 1);
215 array += (pos + 1);
216 }
217
218 // 'size' should never reach zero.
219 ASSERT(size);
220 }
221
222 // If we reach this point we've chopped down to one element, no need to check it matches
223 ASSERT(size == 1);
224 ASSERT(key == valueAtPosition(&array[0]));
225 return &array[0];
226 }
227#endif
228
229 class CodeBlock {
230 friend class JIT;
231 public:
232 CodeBlock(ScopeNode* ownerNode, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset);
233 ~CodeBlock();
234
235 void mark();
236 void refStructures(Instruction* vPC) const;
237 void derefStructures(Instruction* vPC) const;
238#if ENABLE(JIT)
239 void unlinkCallers();
240#endif
241
242 static void dumpStatistics();
243
244#if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING
245 void dump(ExecState*) const;
246 void printStructures(const Instruction*) const;
247 void printStructure(const char* name, const Instruction*, int operand) const;
248#endif
249
250 inline bool isKnownNotImmediate(int index)
251 {
252 if (index == m_thisRegister)
253 return true;
254
255 if (isConstantRegisterIndex(index))
256 return getConstant(index).isCell();
257
258 return false;
259 }
260
261 ALWAYS_INLINE bool isConstantRegisterIndex(int index)
262 {
263 return index >= m_numVars && index < m_numVars + m_numConstants;
264 }
265
266 ALWAYS_INLINE JSValuePtr getConstant(int index)
267 {
268 return m_constantRegisters[index - m_numVars].getJSValue();
269 }
270
271 ALWAYS_INLINE bool isTemporaryRegisterIndex(int index)
272 {
273 return index >= m_numVars + m_numConstants;
274 }
275
276 HandlerInfo* handlerForBytecodeOffset(unsigned bytecodeOffset);
277 int lineNumberForBytecodeOffset(CallFrame*, unsigned bytecodeOffset);
278 int expressionRangeForBytecodeOffset(CallFrame*, unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset);
279 bool getByIdExceptionInfoForBytecodeOffset(CallFrame*, unsigned bytecodeOffset, OpcodeID&);
280
281#if ENABLE(JIT)
282 void addCaller(CallLinkInfo* caller)
283 {
284 caller->callee = this;
285 caller->position = m_linkedCallerList.size();
286 m_linkedCallerList.append(caller);
287 }
288
289 void removeCaller(CallLinkInfo* caller)
290 {
291 unsigned pos = caller->position;
292 unsigned lastPos = m_linkedCallerList.size() - 1;
293
294 if (pos != lastPos) {
295 m_linkedCallerList[pos] = m_linkedCallerList[lastPos];
296 m_linkedCallerList[pos]->position = pos;
297 }
298 m_linkedCallerList.shrink(lastPos);
299 }
300
301 StructureStubInfo& getStubInfo(void* returnAddress)
302 {
303 return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_structureStubInfos.begin(), m_structureStubInfos.size(), returnAddress));
304 }
305
306 CallLinkInfo& getCallLinkInfo(void* returnAddress)
307 {
308 return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress));
309 }
310
311 unsigned getBytecodeIndex(CallFrame* callFrame, void* nativePC)
312 {
313 reparseForExceptionInfoIfNecessary(callFrame);
314 ptrdiff_t nativePCOffset = reinterpret_cast<void**>(nativePC) - reinterpret_cast<void**>(m_jitCode.code);
315 return binaryChop<PC, ptrdiff_t, getNativePCOffset>(m_exceptionInfo->m_pcVector.begin(), m_exceptionInfo->m_pcVector.size(), nativePCOffset)->bytecodeIndex;
316 }
317
318 bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex);
319#endif
320
321 Vector<Instruction>& instructions() { return m_instructions; }
322#ifndef NDEBUG
323 void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; }
324#endif
325
326#if ENABLE(JIT)
327 void setJITCode(JITCodeRef& jitCode);
328 void* jitCode() { return m_jitCode.code; }
329 ExecutablePool* executablePool() { return m_jitCode.executablePool.get(); }
330#endif
331
332 ScopeNode* ownerNode() const { return m_ownerNode; }
333
334 void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; }
335
336 void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; }
337 int thisRegister() const { return m_thisRegister; }
338
339 void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; }
340 bool needsFullScopeChain() const { return m_needsFullScopeChain; }
341 void setUsesEval(bool usesEval) { m_usesEval = usesEval; }
342 bool usesEval() const { return m_usesEval; }
343 void setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; }
344 bool usesArguments() const { return m_usesArguments; }
345
346 CodeType codeType() const { return m_codeType; }
347
348 SourceProvider* source() const { return m_source.get(); }
349 unsigned sourceOffset() const { return m_sourceOffset; }
350
351 size_t numberOfJumpTargets() const { return m_jumpTargets.size(); }
352 void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); }
353 unsigned jumpTarget(int index) const { return m_jumpTargets[index]; }
354 unsigned lastJumpTarget() const { return m_jumpTargets.last(); }
355
356#if !ENABLE(JIT)
357 void addPropertyAccessInstruction(unsigned propertyAccessInstruction) { m_propertyAccessInstructions.append(propertyAccessInstruction); }
358 void addGlobalResolveInstruction(unsigned globalResolveInstruction) { m_globalResolveInstructions.append(globalResolveInstruction); }
359 bool hasGlobalResolveInstructionAtBytecodeOffset(unsigned bytecodeOffset);
360#else
361 size_t numberOfStructureStubInfos() const { return m_structureStubInfos.size(); }
362 void addStructureStubInfo(const StructureStubInfo& stubInfo) { m_structureStubInfos.append(stubInfo); }
363 StructureStubInfo& structureStubInfo(int index) { return m_structureStubInfos[index]; }
364
365 void addGlobalResolveInfo(unsigned globalResolveInstruction) { m_globalResolveInfos.append(GlobalResolveInfo(globalResolveInstruction)); }
366 GlobalResolveInfo& globalResolveInfo(int index) { return m_globalResolveInfos[index]; }
367 bool hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset);
368
369 size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); }
370 void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); }
371 CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; }
372
373 void addFunctionRegisterInfo(unsigned bytecodeOffset, int functionIndex) { createRareDataIfNecessary(); m_rareData->m_functionRegisterInfos.append(FunctionRegisterInfo(bytecodeOffset, functionIndex)); }
374#endif
375
376 // Exception handling support
377
378 size_t numberOfExceptionHandlers() const { return m_rareData ? m_rareData->m_exceptionHandlers.size() : 0; }
379 void addExceptionHandler(const HandlerInfo& hanler) { createRareDataIfNecessary(); return m_rareData->m_exceptionHandlers.append(hanler); }
380 HandlerInfo& exceptionHandler(int index) { ASSERT(m_rareData); return m_rareData->m_exceptionHandlers[index]; }
381
382 bool hasExceptionInfo() const { return m_exceptionInfo; }
383 void clearExceptionInfo() { m_exceptionInfo.clear(); }
384
385 void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_expressionInfo.append(expressionInfo); }
386 void addGetByIdExceptionInfo(const GetByIdExceptionInfo& info) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_getByIdExceptionInfo.append(info); }
387
388 size_t numberOfLineInfos() const { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_lineInfo.size(); }
389 void addLineInfo(const LineInfo& lineInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_lineInfo.append(lineInfo); }
390 LineInfo& lastLineInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_lineInfo.last(); }
391
392#if ENABLE(JIT)
393 Vector<PC>& pcVector() { ASSERT(m_exceptionInfo); return m_exceptionInfo->m_pcVector; }
394#endif
395
396 // Constant Pool
397
398 size_t numberOfIdentifiers() const { return m_identifiers.size(); }
399 void addIdentifier(const Identifier& i) { return m_identifiers.append(i); }
400 Identifier& identifier(int index) { return m_identifiers[index]; }
401
402 size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
403 void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); }
404 Register& constantRegister(int index) { return m_constantRegisters[index]; }
405
406 unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; }
407 FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); }
408
409 unsigned addFunction(FuncDeclNode* n) { createRareDataIfNecessary(); unsigned size = m_rareData->m_functions.size(); m_rareData->m_functions.append(n); return size; }
410 FuncDeclNode* function(int index) const { ASSERT(m_rareData); return m_rareData->m_functions[index].get(); }
411
412 bool hasFunctions() const { return m_functionExpressions.size() || (m_rareData && m_rareData->m_functions.size()); }
413
414 unsigned addUnexpectedConstant(JSValuePtr v) { createRareDataIfNecessary(); unsigned size = m_rareData->m_unexpectedConstants.size(); m_rareData->m_unexpectedConstants.append(v); return size; }
415 JSValuePtr unexpectedConstant(int index) const { ASSERT(m_rareData); return m_rareData->m_unexpectedConstants[index]; }
416
417 unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; }
418 RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); }
419
420
421 // Jump Tables
422
423 size_t numberOfImmediateSwitchJumpTables() const { return m_rareData ? m_rareData->m_immediateSwitchJumpTables.size() : 0; }
424 SimpleJumpTable& addImmediateSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_immediateSwitchJumpTables.append(SimpleJumpTable()); return m_rareData->m_immediateSwitchJumpTables.last(); }
425 SimpleJumpTable& immediateSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_immediateSwitchJumpTables[tableIndex]; }
426
427 size_t numberOfCharacterSwitchJumpTables() const { return m_rareData ? m_rareData->m_characterSwitchJumpTables.size() : 0; }
428 SimpleJumpTable& addCharacterSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_characterSwitchJumpTables.append(SimpleJumpTable()); return m_rareData->m_characterSwitchJumpTables.last(); }
429 SimpleJumpTable& characterSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_characterSwitchJumpTables[tableIndex]; }
430
431 size_t numberOfStringSwitchJumpTables() const { return m_rareData ? m_rareData->m_stringSwitchJumpTables.size() : 0; }
432 StringJumpTable& addStringSwitchJumpTable() { createRareDataIfNecessary(); m_rareData->m_stringSwitchJumpTables.append(StringJumpTable()); return m_rareData->m_stringSwitchJumpTables.last(); }
433 StringJumpTable& stringSwitchJumpTable(int tableIndex) { ASSERT(m_rareData); return m_rareData->m_stringSwitchJumpTables[tableIndex]; }
434
435
436 SymbolTable& symbolTable() { return m_symbolTable; }
437
438 EvalCodeCache& evalCodeCache() { createRareDataIfNecessary(); return m_rareData->m_evalCodeCache; }
439
440 void shrinkToFit();
441
442 // FIXME: Make these remaining members private.
443
444 int m_numCalleeRegisters;
445 // NOTE: numConstants holds the number of constant registers allocated
446 // by the code generator, not the number of constant registers used.
447 // (Duplicate constants are uniqued during code generation, and spare
448 // constant registers may be allocated.)
449 int m_numConstants;
450 int m_numVars;
451 int m_numParameters;
452
453 private:
454#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
455 void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const;
456#endif
457
458 void reparseForExceptionInfoIfNecessary(CallFrame*);
459
460 void createRareDataIfNecessary()
461 {
462 if (!m_rareData)
463 m_rareData.set(new RareData);
464 }
465
466 ScopeNode* m_ownerNode;
467 JSGlobalData* m_globalData;
468
469 Vector<Instruction> m_instructions;
470#ifndef NDEBUG
471 unsigned m_instructionCount;
472#endif
473#if ENABLE(JIT)
474 JITCodeRef m_jitCode;
475#endif
476
477 int m_thisRegister;
478
479 bool m_needsFullScopeChain;
480 bool m_usesEval;
481 bool m_usesArguments;
482
483 CodeType m_codeType;
484
485 RefPtr<SourceProvider> m_source;
486 unsigned m_sourceOffset;
487
488#if !ENABLE(JIT)
489 Vector<unsigned> m_propertyAccessInstructions;
490 Vector<unsigned> m_globalResolveInstructions;
491#else
492 Vector<StructureStubInfo> m_structureStubInfos;
493 Vector<GlobalResolveInfo> m_globalResolveInfos;
494 Vector<CallLinkInfo> m_callLinkInfos;
495 Vector<CallLinkInfo*> m_linkedCallerList;
496#endif
497
498 Vector<unsigned> m_jumpTargets;
499
500 // Constant Pool
501 Vector<Identifier> m_identifiers;
502 Vector<Register> m_constantRegisters;
503 Vector<RefPtr<FuncExprNode> > m_functionExpressions;
504
505 SymbolTable m_symbolTable;
506
507 struct ExceptionInfo {
508 Vector<ExpressionRangeInfo> m_expressionInfo;
509 Vector<LineInfo> m_lineInfo;
510 Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo;
511
512#if ENABLE(JIT)
513 Vector<PC> m_pcVector;
514#endif
515 };
516 OwnPtr<ExceptionInfo> m_exceptionInfo;
517
518 struct RareData {
519 Vector<HandlerInfo> m_exceptionHandlers;
520
521 // Rare Constants
522 Vector<RefPtr<FuncDeclNode> > m_functions;
523 Vector<JSValuePtr> m_unexpectedConstants;
524 Vector<RefPtr<RegExp> > m_regexps;
525
526 // Jump Tables
527 Vector<SimpleJumpTable> m_immediateSwitchJumpTables;
528 Vector<SimpleJumpTable> m_characterSwitchJumpTables;
529 Vector<StringJumpTable> m_stringSwitchJumpTables;
530
531 EvalCodeCache m_evalCodeCache;
532
533#if ENABLE(JIT)
534 Vector<FunctionRegisterInfo> m_functionRegisterInfos;
535#endif
536 };
537 OwnPtr<RareData> m_rareData;
538 };
539
540 // Program code is not marked by any function, so we make the global object
541 // responsible for marking it.
542
543 class ProgramCodeBlock : public CodeBlock {
544 public:
545 ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
546 : CodeBlock(ownerNode, codeType, sourceProvider, 0)
547 , m_globalObject(globalObject)
548 {
549 m_globalObject->codeBlocks().add(this);
550 }
551
552 ~ProgramCodeBlock()
553 {
554 if (m_globalObject)
555 m_globalObject->codeBlocks().remove(this);
556 }
557
558 void clearGlobalObject() { m_globalObject = 0; }
559
560 private:
561 JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
562 };
563
564 class EvalCodeBlock : public ProgramCodeBlock {
565 public:
566 EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth)
567 : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider)
568 , m_baseScopeDepth(baseScopeDepth)
569 {
570 }
571
572 int baseScopeDepth() const { return m_baseScopeDepth; }
573
574 private:
575 int m_baseScopeDepth;
576 };
577
578} // namespace JSC
579
580#endif // CodeBlock_h
Note: See TracBrowser for help on using the repository browser.