source: webkit/trunk/Source/JavaScriptCore/jsc.cpp@ 154038

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

Foo::s_info should be Foo::info(), so that you can change how the s_info is actually linked
https://bugs.webkit.org/show_bug.cgi?id=119770

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

  • API/JSCallbackConstructor.cpp:

(JSC::JSCallbackConstructor::finishCreation):

  • API/JSCallbackConstructor.h:

(JSC::JSCallbackConstructor::createStructure):

  • API/JSCallbackFunction.cpp:

(JSC::JSCallbackFunction::finishCreation):

  • API/JSCallbackFunction.h:

(JSC::JSCallbackFunction::createStructure):

  • API/JSCallbackObject.cpp:

(JSC::::createStructure):

  • API/JSCallbackObject.h:

(JSC::JSCallbackObject::visitChildren):

  • API/JSCallbackObjectFunctions.h:

(JSC::::asCallbackObject):
(JSC::::finishCreation):

  • API/JSObjectRef.cpp:

(JSObjectGetPrivate):
(JSObjectSetPrivate):
(JSObjectGetPrivateProperty):
(JSObjectSetPrivateProperty):
(JSObjectDeletePrivateProperty):

  • API/JSValueRef.cpp:

(JSValueIsObjectOfClass):

  • API/JSWeakObjectMapRefPrivate.cpp:
  • API/ObjCCallbackFunction.h:

(JSC::ObjCCallbackFunction::createStructure):

  • JSCTypedArrayStubs.h:
  • bytecode/CallLinkStatus.cpp:

(JSC::CallLinkStatus::CallLinkStatus):
(JSC::CallLinkStatus::function):
(JSC::CallLinkStatus::internalFunction):

  • bytecode/CodeBlock.h:

(JSC::baselineCodeBlockForInlineCallFrame):

  • bytecode/SpeculatedType.cpp:

(JSC::speculationFromClassInfo):

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedFunctionExecutable::visitChildren):
(JSC::UnlinkedCodeBlock::visitChildren):
(JSC::UnlinkedProgramCodeBlock::visitChildren):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedFunctionExecutable::createStructure):
(JSC::UnlinkedProgramCodeBlock::createStructure):
(JSC::UnlinkedEvalCodeBlock::createStructure):
(JSC::UnlinkedFunctionCodeBlock::createStructure):

  • debugger/Debugger.cpp:
  • debugger/DebuggerActivation.cpp:

(JSC::DebuggerActivation::visitChildren):

  • debugger/DebuggerActivation.h:

(JSC::DebuggerActivation::createStructure):

  • debugger/DebuggerCallFrame.cpp:

(JSC::DebuggerCallFrame::functionName):

  • dfg/DFGAbstractInterpreterInlines.h:

(JSC::DFG::::executeEffects):

  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGFixupPhase.cpp:

(JSC::DFG::FixupPhase::isStringPrototypeMethodSane):
(JSC::DFG::FixupPhase::canOptimizeStringObjectAccess):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::dump):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::isInternalFunctionConstant):

  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::checkArray):
(JSC::DFG::SpeculativeJIT::compileNewStringObject):

  • dfg/DFGThunks.cpp:

(JSC::DFG::virtualForThunkGenerator):

  • interpreter/Interpreter.cpp:

(JSC::loadVarargs):

  • jsc.cpp:

(GlobalObject::createStructure):

  • profiler/LegacyProfiler.cpp:

(JSC::LegacyProfiler::createCallIdentifier):

  • runtime/Arguments.cpp:

(JSC::Arguments::visitChildren):

  • runtime/Arguments.h:

(JSC::Arguments::createStructure):
(JSC::asArguments):
(JSC::Arguments::finishCreation):

  • runtime/ArrayConstructor.cpp:

(JSC::arrayConstructorIsArray):

  • runtime/ArrayConstructor.h:

(JSC::ArrayConstructor::createStructure):

  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::finishCreation):
(JSC::arrayProtoFuncConcat):
(JSC::attemptFastSort):

  • runtime/ArrayPrototype.h:

(JSC::ArrayPrototype::createStructure):

  • runtime/BooleanConstructor.h:

(JSC::BooleanConstructor::createStructure):

  • runtime/BooleanObject.cpp:

(JSC::BooleanObject::finishCreation):

  • runtime/BooleanObject.h:

(JSC::BooleanObject::createStructure):
(JSC::asBooleanObject):

  • runtime/BooleanPrototype.cpp:

(JSC::BooleanPrototype::finishCreation):
(JSC::booleanProtoFuncToString):
(JSC::booleanProtoFuncValueOf):

  • runtime/BooleanPrototype.h:

(JSC::BooleanPrototype::createStructure):

  • runtime/DateConstructor.cpp:

(JSC::constructDate):

  • runtime/DateConstructor.h:

(JSC::DateConstructor::createStructure):

  • runtime/DateInstance.cpp:

(JSC::DateInstance::finishCreation):

  • runtime/DateInstance.h:

(JSC::DateInstance::createStructure):
(JSC::asDateInstance):

  • runtime/DatePrototype.cpp:

(JSC::formateDateInstance):
(JSC::DatePrototype::finishCreation):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToLocaleString):
(JSC::dateProtoFuncToLocaleDateString):
(JSC::dateProtoFuncToLocaleTimeString):
(JSC::dateProtoFuncGetTime):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(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/DatePrototype.h:

(JSC::DatePrototype::createStructure):

  • runtime/Error.h:

(JSC::StrictModeTypeErrorFunction::createStructure):

  • runtime/ErrorConstructor.h:

(JSC::ErrorConstructor::createStructure):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::finishCreation):

  • runtime/ErrorInstance.h:

(JSC::ErrorInstance::createStructure):

  • runtime/ErrorPrototype.cpp:

(JSC::ErrorPrototype::finishCreation):

  • runtime/ErrorPrototype.h:

(JSC::ErrorPrototype::createStructure):

  • runtime/ExceptionHelpers.cpp:

(JSC::isTerminatedExecutionException):

  • runtime/ExceptionHelpers.h:

(JSC::TerminatedExecutionError::createStructure):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::visitChildren):
(JSC::ProgramExecutable::visitChildren):
(JSC::FunctionExecutable::visitChildren):
(JSC::ExecutableBase::hashFor):

  • runtime/Executable.h:

(JSC::ExecutableBase::createStructure):
(JSC::NativeExecutable::createStructure):
(JSC::EvalExecutable::createStructure):
(JSC::ProgramExecutable::createStructure):
(JSC::FunctionExecutable::compileFor):
(JSC::FunctionExecutable::compileOptimizedFor):
(JSC::FunctionExecutable::createStructure):

  • runtime/FunctionConstructor.h:

(JSC::FunctionConstructor::createStructure):

  • runtime/FunctionPrototype.cpp:

(JSC::functionProtoFuncToString):
(JSC::functionProtoFuncApply):
(JSC::functionProtoFuncBind):

  • runtime/FunctionPrototype.h:

(JSC::FunctionPrototype::createStructure):

  • runtime/GetterSetter.cpp:

(JSC::GetterSetter::visitChildren):

  • runtime/GetterSetter.h:

(JSC::GetterSetter::createStructure):

  • runtime/InternalFunction.cpp:

(JSC::InternalFunction::finishCreation):

  • runtime/InternalFunction.h:

(JSC::InternalFunction::createStructure):
(JSC::asInternalFunction):

  • runtime/JSAPIValueWrapper.h:

(JSC::JSAPIValueWrapper::createStructure):

  • runtime/JSActivation.cpp:

(JSC::JSActivation::visitChildren):
(JSC::JSActivation::argumentsGetter):

  • runtime/JSActivation.h:

(JSC::JSActivation::createStructure):
(JSC::asActivation):

  • runtime/JSArray.h:

(JSC::JSArray::createStructure):
(JSC::asArray):
(JSC::isJSArray):

  • runtime/JSBoundFunction.cpp:

(JSC::JSBoundFunction::finishCreation):
(JSC::JSBoundFunction::visitChildren):

  • runtime/JSBoundFunction.h:

(JSC::JSBoundFunction::createStructure):

  • runtime/JSCJSValue.cpp:

(JSC::JSValue::dumpInContext):

  • runtime/JSCJSValueInlines.h:

(JSC::JSValue::isFunction):

  • runtime/JSCell.h:

(JSC::jsCast):
(JSC::jsDynamicCast):

  • runtime/JSCellInlines.h:

(JSC::allocateCell):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::finishCreation):
(JSC::JSFunction::visitChildren):
(JSC::skipOverBoundFunctions):
(JSC::JSFunction::callerGetter):

  • runtime/JSFunction.h:

(JSC::JSFunction::createStructure):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::visitChildren):
(JSC::slowValidateCell):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::createStructure):

  • runtime/JSNameScope.cpp:

(JSC::JSNameScope::visitChildren):

  • runtime/JSNameScope.h:

(JSC::JSNameScope::createStructure):

  • runtime/JSNotAnObject.h:

(JSC::JSNotAnObject::createStructure):

  • runtime/JSONObject.cpp:

(JSC::JSONObject::finishCreation):
(JSC::unwrapBoxedPrimitive):
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::appendStringifiedValue):
(JSC::Stringifier::Holder::Holder):
(JSC::Walker::walk):
(JSC::JSONProtoFuncStringify):

  • runtime/JSONObject.h:

(JSC::JSONObject::createStructure):

  • runtime/JSObject.cpp:

(JSC::getCallableObjectSlow):
(JSC::JSObject::visitChildren):
(JSC::JSObject::copyBackingStore):
(JSC::JSFinalObject::visitChildren):
(JSC::JSObject::ensureInt32Slow):
(JSC::JSObject::ensureDoubleSlow):
(JSC::JSObject::ensureContiguousSlow):
(JSC::JSObject::ensureArrayStorageSlow):

  • runtime/JSObject.h:

(JSC::JSObject::finishCreation):
(JSC::JSObject::createStructure):
(JSC::JSNonFinalObject::createStructure):
(JSC::JSFinalObject::createStructure):
(JSC::isJSFinalObject):

  • runtime/JSPropertyNameIterator.cpp:

(JSC::JSPropertyNameIterator::visitChildren):

  • runtime/JSPropertyNameIterator.h:

(JSC::JSPropertyNameIterator::createStructure):

  • runtime/JSProxy.cpp:

(JSC::JSProxy::visitChildren):

  • runtime/JSProxy.h:

(JSC::JSProxy::createStructure):

  • runtime/JSScope.cpp:

(JSC::JSScope::visitChildren):

  • runtime/JSSegmentedVariableObject.cpp:

(JSC::JSSegmentedVariableObject::visitChildren):

  • runtime/JSString.h:

(JSC::JSString::createStructure):
(JSC::isJSString):

  • runtime/JSSymbolTableObject.cpp:

(JSC::JSSymbolTableObject::visitChildren):

  • runtime/JSVariableObject.h:
  • runtime/JSWithScope.cpp:

(JSC::JSWithScope::visitChildren):

  • runtime/JSWithScope.h:

(JSC::JSWithScope::createStructure):

  • runtime/JSWrapperObject.cpp:

(JSC::JSWrapperObject::visitChildren):

  • runtime/JSWrapperObject.h:

(JSC::JSWrapperObject::createStructure):

  • runtime/MathObject.cpp:

(JSC::MathObject::finishCreation):

  • runtime/MathObject.h:

(JSC::MathObject::createStructure):

  • runtime/NameConstructor.h:

(JSC::NameConstructor::createStructure):

  • runtime/NameInstance.h:

(JSC::NameInstance::createStructure):
(JSC::NameInstance::finishCreation):

  • runtime/NamePrototype.cpp:

(JSC::NamePrototype::finishCreation):
(JSC::privateNameProtoFuncToString):

  • runtime/NamePrototype.h:

(JSC::NamePrototype::createStructure):

  • runtime/NativeErrorConstructor.cpp:

(JSC::NativeErrorConstructor::visitChildren):

  • runtime/NativeErrorConstructor.h:

(JSC::NativeErrorConstructor::createStructure):
(JSC::NativeErrorConstructor::finishCreation):

  • runtime/NumberConstructor.cpp:

(JSC::NumberConstructor::finishCreation):

  • runtime/NumberConstructor.h:

(JSC::NumberConstructor::createStructure):

  • runtime/NumberObject.cpp:

(JSC::NumberObject::finishCreation):

  • runtime/NumberObject.h:

(JSC::NumberObject::createStructure):

  • runtime/NumberPrototype.cpp:

(JSC::NumberPrototype::finishCreation):

  • runtime/NumberPrototype.h:

(JSC::NumberPrototype::createStructure):

  • runtime/ObjectConstructor.h:

(JSC::ObjectConstructor::createStructure):

  • runtime/ObjectPrototype.cpp:

(JSC::ObjectPrototype::finishCreation):

  • runtime/ObjectPrototype.h:

(JSC::ObjectPrototype::createStructure):

  • runtime/PropertyMapHashTable.h:

(JSC::PropertyTable::createStructure):

  • runtime/PropertyTable.cpp:

(JSC::PropertyTable::visitChildren):

  • runtime/RegExp.h:

(JSC::RegExp::createStructure):

  • runtime/RegExpConstructor.cpp:

(JSC::RegExpConstructor::finishCreation):
(JSC::RegExpConstructor::visitChildren):
(JSC::constructRegExp):

  • runtime/RegExpConstructor.h:

(JSC::RegExpConstructor::createStructure):
(JSC::asRegExpConstructor):

  • runtime/RegExpMatchesArray.cpp:

(JSC::RegExpMatchesArray::visitChildren):

  • runtime/RegExpMatchesArray.h:

(JSC::RegExpMatchesArray::createStructure):

  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::finishCreation):
(JSC::RegExpObject::visitChildren):

  • runtime/RegExpObject.h:

(JSC::RegExpObject::createStructure):
(JSC::asRegExpObject):

  • runtime/RegExpPrototype.cpp:

(JSC::regExpProtoFuncTest):
(JSC::regExpProtoFuncExec):
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString):

  • runtime/RegExpPrototype.h:

(JSC::RegExpPrototype::createStructure):

  • runtime/SparseArrayValueMap.cpp:

(JSC::SparseArrayValueMap::createStructure):

  • runtime/SparseArrayValueMap.h:
  • runtime/StrictEvalActivation.h:

(JSC::StrictEvalActivation::createStructure):

  • runtime/StringConstructor.h:

(JSC::StringConstructor::createStructure):

  • runtime/StringObject.cpp:

(JSC::StringObject::finishCreation):

  • runtime/StringObject.h:

(JSC::StringObject::createStructure):
(JSC::asStringObject):

  • runtime/StringPrototype.cpp:

(JSC::StringPrototype::finishCreation):
(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncToString):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSplit):

  • runtime/StringPrototype.h:

(JSC::StringPrototype::createStructure):

  • runtime/Structure.cpp:

(JSC::Structure::Structure):
(JSC::Structure::materializePropertyMap):
(JSC::Structure::get):
(JSC::Structure::visitChildren):

  • runtime/Structure.h:

(JSC::Structure::typeInfo):
(JSC::Structure::previousID):
(JSC::Structure::outOfLineSize):
(JSC::Structure::totalStorageCapacity):
(JSC::Structure::materializePropertyMapIfNecessary):
(JSC::Structure::materializePropertyMapIfNecessaryForPinning):

  • runtime/StructureChain.cpp:

(JSC::StructureChain::visitChildren):

  • runtime/StructureChain.h:

(JSC::StructureChain::createStructure):

  • runtime/StructureInlines.h:

(JSC::Structure::get):

  • runtime/StructureRareData.cpp:

(JSC::StructureRareData::createStructure):
(JSC::StructureRareData::visitChildren):

  • runtime/StructureRareData.h:
  • runtime/SymbolTable.h:

(JSC::SharedSymbolTable::createStructure):

  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::StackPreservingRecompiler::operator()):
(JSC::VM::releaseExecutableMemory):

  • runtime/WriteBarrier.h:

(JSC::validateCell):

  • testRegExp.cpp:

(GlobalObject::createStructure):

Source/WebCore:

No new tests because no new behavior.

  • bindings/js/IDBBindingUtilities.cpp:

(WebCore::createIDBKeyFromValue):

  • bindings/js/JSAttrCustom.cpp:

(WebCore::JSAttr::visitChildren):

  • bindings/js/JSAudioTrackCustom.cpp:

(WebCore::JSAudioTrack::visitChildren):

  • bindings/js/JSAudioTrackListCustom.cpp:

(WebCore::JSAudioTrackList::visitChildren):

  • bindings/js/JSBlobCustom.cpp:

(WebCore::JSBlobConstructor::constructJSBlob):

  • bindings/js/JSCSSRuleCustom.cpp:

(WebCore::JSCSSRule::visitChildren):

  • bindings/js/JSCSSStyleDeclarationCustom.cpp:

(WebCore::JSCSSStyleDeclaration::visitChildren):
(WebCore::JSCSSStyleDeclaration::getOwnPropertyNames):

  • bindings/js/JSCanvasRenderingContext2DCustom.cpp:

(WebCore::toHTMLCanvasStyle):

  • bindings/js/JSCanvasRenderingContextCustom.cpp:

(WebCore::JSCanvasRenderingContext::visitChildren):

  • bindings/js/JSDOMBinding.cpp:

(WebCore::valueToDate):

  • bindings/js/JSDOMBinding.h:

(WebCore::DOMConstructorObject::createStructure):
(WebCore::getDOMStructure):
(WebCore::toRefPtrNativeArray):
(WebCore::getStaticValueSlotEntryWithoutCaching):

  • bindings/js/JSDOMFormDataCustom.cpp:

(WebCore::toHTMLFormElement):
(WebCore::JSDOMFormData::append):

  • bindings/js/JSDOMGlobalObject.cpp:

(WebCore::JSDOMGlobalObject::finishCreation):
(WebCore::JSDOMGlobalObject::scriptExecutionContext):
(WebCore::JSDOMGlobalObject::visitChildren):

  • bindings/js/JSDOMGlobalObject.h:

(WebCore::JSDOMGlobalObject::info):
(WebCore::JSDOMGlobalObject::createStructure):
(WebCore::getDOMConstructor):

  • bindings/js/JSDOMStringListCustom.cpp:

(WebCore::toDOMStringList):

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::JSDOMWindowBase::finishCreation):
(WebCore::toJSDOMWindow):

  • bindings/js/JSDOMWindowBase.h:

(WebCore::JSDOMWindowBase::createStructure):

  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::visitChildren):
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertyDescriptor):
(WebCore::toDOMWindow):

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::finishCreation):

  • bindings/js/JSDOMWindowShell.h:

(WebCore::JSDOMWindowShell::createStructure):

  • bindings/js/JSEventTargetCustom.cpp:

(WebCore::toEventTarget):

  • bindings/js/JSHistoryCustom.cpp:

(WebCore::JSHistory::getOwnPropertySlotDelegate):
(WebCore::JSHistory::getOwnPropertyDescriptorDelegate):

  • bindings/js/JSImageConstructor.cpp:

(WebCore::JSImageConstructor::finishCreation):

  • bindings/js/JSImageConstructor.h:

(WebCore::JSImageConstructor::createStructure):

  • bindings/js/JSInjectedScriptHostCustom.cpp:

(WebCore::JSInjectedScriptHost::isHTMLAllCollection):
(WebCore::JSInjectedScriptHost::type):
(WebCore::JSInjectedScriptHost::functionDetails):

  • bindings/js/JSInspectorFrontendHostCustom.cpp:

(WebCore::populateContextMenuItems):

  • bindings/js/JSLocationCustom.cpp:

(WebCore::JSLocation::getOwnPropertySlotDelegate):
(WebCore::JSLocation::getOwnPropertyDescriptorDelegate):
(WebCore::JSLocation::putDelegate):

  • bindings/js/JSMessageChannelCustom.cpp:

(WebCore::JSMessageChannel::visitChildren):

  • bindings/js/JSMessagePortCustom.cpp:

(WebCore::JSMessagePort::visitChildren):

  • bindings/js/JSNodeCustom.cpp:

(WebCore::JSNode::pushEventHandlerScope):
(WebCore::JSNode::visitChildren):

  • bindings/js/JSNodeFilterCustom.cpp:

(WebCore::JSNodeFilter::visitChildren):
(WebCore::toNodeFilter):

  • bindings/js/JSNodeIteratorCustom.cpp:

(WebCore::JSNodeIterator::visitChildren):

  • bindings/js/JSPluginElementFunctions.h:

(WebCore::pluginElementCustomGetOwnPropertySlot):
(WebCore::pluginElementCustomGetOwnPropertyDescriptor):

  • bindings/js/JSSVGElementInstanceCustom.cpp:

(WebCore::JSSVGElementInstance::visitChildren):

  • bindings/js/JSSharedWorkerCustom.cpp:

(WebCore::JSSharedWorker::visitChildren):

  • bindings/js/JSStyleSheetCustom.cpp:

(WebCore::JSStyleSheet::visitChildren):

  • bindings/js/JSTextTrackCueCustom.cpp:

(WebCore::JSTextTrackCue::visitChildren):

  • bindings/js/JSTextTrackCustom.cpp:

(WebCore::JSTextTrack::visitChildren):

  • bindings/js/JSTextTrackListCustom.cpp:

(WebCore::JSTextTrackList::visitChildren):

  • bindings/js/JSTrackCustom.cpp:

(WebCore::toTrack):

  • bindings/js/JSTreeWalkerCustom.cpp:

(WebCore::JSTreeWalker::visitChildren):

  • bindings/js/JSVideoTrackCustom.cpp:

(WebCore::JSVideoTrack::visitChildren):

  • bindings/js/JSVideoTrackListCustom.cpp:

(WebCore::JSVideoTrackList::visitChildren):

  • bindings/js/JSWebGLRenderingContextCustom.cpp:

(WebCore::JSWebGLRenderingContext::visitChildren):
(WebCore::JSWebGLRenderingContext::getAttachedShaders):
(WebCore::JSWebGLRenderingContext::getProgramParameter):
(WebCore::JSWebGLRenderingContext::getShaderParameter):
(WebCore::JSWebGLRenderingContext::getUniform):
(WebCore::dataFunctionf):
(WebCore::dataFunctioni):
(WebCore::dataFunctionMatrix):

  • bindings/js/JSWorkerGlobalScopeBase.cpp:

(WebCore::JSWorkerGlobalScopeBase::finishCreation):
(WebCore::toJSDedicatedWorkerGlobalScope):
(WebCore::toJSSharedWorkerGlobalScope):

  • bindings/js/JSWorkerGlobalScopeBase.h:

(WebCore::JSWorkerGlobalScopeBase::createStructure):

  • bindings/js/JSWorkerGlobalScopeCustom.cpp:

(WebCore::JSWorkerGlobalScope::visitChildren):

  • bindings/js/JSXMLHttpRequestCustom.cpp:

(WebCore::JSXMLHttpRequest::visitChildren):
(WebCore::JSXMLHttpRequest::send):

  • bindings/js/JSXPathResultCustom.cpp:

(WebCore::JSXPathResult::visitChildren):

  • bindings/js/ScriptDebugServer.cpp:

(WebCore::ScriptDebugServer::dispatchDidPause):

  • bindings/js/ScriptState.cpp:

(WebCore::domWindowFromScriptState):
(WebCore::scriptExecutionContextFromScriptState):

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneSerializer::isArray):
(WebCore::CloneSerializer::dumpArrayBufferView):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneSerializer::serialize):
(WebCore::CloneDeserializer::CloneDeserializer):
(WebCore::CloneDeserializer::readArrayBufferView):

  • bindings/objc/DOM.mm:

(+[DOMNode _nodeFromJSWrapper:]):

  • bindings/objc/DOMUtility.mm:

(JSC::createDOMWrapper):

  • bindings/objc/WebScriptObject.mm:

(+[WebScriptObject _convertValueToObjcValue:JSC::originRootObject:rootObject:]):

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateGetOwnPropertySlotBody):
(GenerateGetOwnPropertyDescriptorBody):
(GenerateHeader):
(GenerateParametersCheckExpression):
(GenerateImplementation):
(GenerateParametersCheck):
(GenerateConstructorDeclaration):
(GenerateConstructorHelperMethods):

  • bindings/scripts/test/JS/JSFloat64Array.cpp:

(WebCore::JSFloat64ArrayConstructor::finishCreation):
(WebCore::JSFloat64Array::finishCreation):
(WebCore::JSFloat64Array::getOwnPropertySlot):
(WebCore::JSFloat64Array::getOwnPropertyDescriptor):
(WebCore::JSFloat64Array::getOwnPropertySlotByIndex):
(WebCore::JSFloat64Array::put):
(WebCore::JSFloat64Array::putByIndex):
(WebCore::JSFloat64Array::getOwnPropertyNames):
(WebCore::jsFloat64ArrayPrototypeFunctionFoo):
(WebCore::jsFloat64ArrayPrototypeFunctionSet):
(WebCore::JSFloat64Array::getByIndex):
(WebCore::toFloat64Array):

  • bindings/scripts/test/JS/JSFloat64Array.h:

(WebCore::JSFloat64Array::createStructure):
(WebCore::JSFloat64ArrayPrototype::createStructure):
(WebCore::JSFloat64ArrayConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:

(WebCore::JSTestActiveDOMObjectConstructor::finishCreation):
(WebCore::JSTestActiveDOMObject::finishCreation):
(WebCore::JSTestActiveDOMObject::getOwnPropertySlot):
(WebCore::JSTestActiveDOMObject::getOwnPropertyDescriptor):
(WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
(WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage):
(WebCore::toTestActiveDOMObject):

  • bindings/scripts/test/JS/JSTestActiveDOMObject.h:

(WebCore::JSTestActiveDOMObject::createStructure):
(WebCore::JSTestActiveDOMObjectPrototype::createStructure):
(WebCore::JSTestActiveDOMObjectConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:

(WebCore::JSTestCustomNamedGetterConstructor::finishCreation):
(WebCore::JSTestCustomNamedGetter::finishCreation):
(WebCore::JSTestCustomNamedGetter::getOwnPropertySlot):
(WebCore::JSTestCustomNamedGetter::getOwnPropertyDescriptor):
(WebCore::JSTestCustomNamedGetter::getOwnPropertySlotByIndex):
(WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction):
(WebCore::toTestCustomNamedGetter):

  • bindings/scripts/test/JS/JSTestCustomNamedGetter.h:

(WebCore::JSTestCustomNamedGetter::createStructure):
(WebCore::JSTestCustomNamedGetterPrototype::createStructure):
(WebCore::JSTestCustomNamedGetterConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestEventConstructor.cpp:

(WebCore::JSTestEventConstructorConstructor::finishCreation):
(WebCore::JSTestEventConstructor::finishCreation):
(WebCore::JSTestEventConstructor::getOwnPropertySlot):
(WebCore::JSTestEventConstructor::getOwnPropertyDescriptor):
(WebCore::toTestEventConstructor):

  • bindings/scripts/test/JS/JSTestEventConstructor.h:

(WebCore::JSTestEventConstructor::createStructure):
(WebCore::JSTestEventConstructorPrototype::createStructure):
(WebCore::JSTestEventConstructorConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestEventTarget.cpp:

(WebCore::JSTestEventTargetConstructor::finishCreation):
(WebCore::JSTestEventTarget::finishCreation):
(WebCore::JSTestEventTarget::getOwnPropertySlot):
(WebCore::JSTestEventTarget::getOwnPropertyDescriptor):
(WebCore::JSTestEventTarget::getOwnPropertySlotByIndex):
(WebCore::JSTestEventTarget::getOwnPropertyNames):
(WebCore::jsTestEventTargetPrototypeFunctionItem):
(WebCore::jsTestEventTargetPrototypeFunctionAddEventListener):
(WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener):
(WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent):
(WebCore::JSTestEventTarget::visitChildren):
(WebCore::JSTestEventTarget::indexGetter):
(WebCore::toTestEventTarget):

  • bindings/scripts/test/JS/JSTestEventTarget.h:

(WebCore::JSTestEventTarget::createStructure):
(WebCore::JSTestEventTargetPrototype::createStructure):
(WebCore::JSTestEventTargetConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestException.cpp:

(WebCore::JSTestExceptionConstructor::finishCreation):
(WebCore::JSTestException::finishCreation):
(WebCore::JSTestException::getOwnPropertySlot):
(WebCore::JSTestException::getOwnPropertyDescriptor):
(WebCore::toTestException):

  • bindings/scripts/test/JS/JSTestException.h:

(WebCore::JSTestException::createStructure):
(WebCore::JSTestExceptionPrototype::createStructure):
(WebCore::JSTestExceptionConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestInterface.cpp:

(WebCore::JSTestInterfaceConstructor::finishCreation):
(WebCore::JSTestInterface::finishCreation):
(WebCore::JSTestInterface::getOwnPropertySlot):
(WebCore::JSTestInterface::getOwnPropertyDescriptor):
(WebCore::JSTestInterface::put):
(WebCore::JSTestInterface::putByIndex):
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod1):
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
(WebCore::jsTestInterfacePrototypeFunctionImplementsMethod3):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod1):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
(WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod3):
(WebCore::toTestInterface):

  • bindings/scripts/test/JS/JSTestInterface.h:

(WebCore::JSTestInterface::createStructure):
(WebCore::JSTestInterfacePrototype::createStructure):
(WebCore::JSTestInterfaceConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:

(WebCore::JSTestMediaQueryListListenerConstructor::finishCreation):
(WebCore::JSTestMediaQueryListListener::finishCreation):
(WebCore::JSTestMediaQueryListListener::getOwnPropertySlot):
(WebCore::JSTestMediaQueryListListener::getOwnPropertyDescriptor):
(WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
(WebCore::toTestMediaQueryListListener):

  • bindings/scripts/test/JS/JSTestMediaQueryListListener.h:

(WebCore::JSTestMediaQueryListListener::createStructure):
(WebCore::JSTestMediaQueryListListenerPrototype::createStructure):
(WebCore::JSTestMediaQueryListListenerConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestNamedConstructor.cpp:

(WebCore::JSTestNamedConstructorConstructor::finishCreation):
(WebCore::JSTestNamedConstructorNamedConstructor::finishCreation):
(WebCore::JSTestNamedConstructor::finishCreation):
(WebCore::JSTestNamedConstructor::getOwnPropertySlot):
(WebCore::JSTestNamedConstructor::getOwnPropertyDescriptor):
(WebCore::toTestNamedConstructor):

  • bindings/scripts/test/JS/JSTestNamedConstructor.h:

(WebCore::JSTestNamedConstructor::createStructure):
(WebCore::JSTestNamedConstructorPrototype::createStructure):
(WebCore::JSTestNamedConstructorConstructor::createStructure):
(WebCore::JSTestNamedConstructorNamedConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestNode.cpp:

(WebCore::JSTestNodeConstructor::finishCreation):
(WebCore::JSTestNode::finishCreation):
(WebCore::JSTestNode::getOwnPropertySlot):
(WebCore::JSTestNode::getOwnPropertyDescriptor):
(WebCore::JSTestNode::visitChildren):

  • bindings/scripts/test/JS/JSTestNode.h:

(WebCore::JSTestNode::createStructure):
(WebCore::JSTestNodePrototype::createStructure):
(WebCore::JSTestNodeConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::JSTestObjConstructor::finishCreation):
(WebCore::JSTestObj::finishCreation):
(WebCore::JSTestObj::getOwnPropertySlot):
(WebCore::JSTestObj::getOwnPropertyDescriptor):
(WebCore::JSTestObj::put):
(WebCore::jsTestObjPrototypeFunctionVoidMethod):
(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionByteMethod):
(WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionOctetMethod):
(WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionLongMethod):
(WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethod):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestObjPrototypeFunctionMethodReturningSequence):
(WebCore::jsTestObjPrototypeFunctionMethodWithEnumArg):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionSerializedValue):
(WebCore::jsTestObjPrototypeFunctionOptionsObject):
(WebCore::jsTestObjPrototypeFunctionMethodWithException):
(WebCore::jsTestObjPrototypeFunctionCustomMethod):
(WebCore::jsTestObjPrototypeFunctionCustomMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionAddEventListener):
(WebCore::jsTestObjPrototypeFunctionRemoveEventListener):
(WebCore::jsTestObjPrototypeFunctionWithScriptStateVoid):
(WebCore::jsTestObjPrototypeFunctionWithScriptStateObj):
(WebCore::jsTestObjPrototypeFunctionWithScriptStateVoidException):
(WebCore::jsTestObjPrototypeFunctionWithScriptStateObjException):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContext):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptState):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateObjException):
(WebCore::jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces):
(WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionConditionalMethod1):
(WebCore::jsTestObjPrototypeFunctionConditionalMethod2):
(WebCore::jsTestObjPrototypeFunctionConditionalMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod6):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod7):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod9):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod10):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod11):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
(WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence):
(WebCore::jsTestObjPrototypeFunctionStringArrayFunction):
(WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
(WebCore::jsTestObjPrototypeFunctionGetSVGDocument):
(WebCore::jsTestObjPrototypeFunctionConvert1):
(WebCore::jsTestObjPrototypeFunctionConvert2):
(WebCore::jsTestObjPrototypeFunctionConvert4):
(WebCore::jsTestObjPrototypeFunctionConvert5):
(WebCore::jsTestObjPrototypeFunctionMutablePointFunction):
(WebCore::jsTestObjPrototypeFunctionImmutablePointFunction):
(WebCore::jsTestObjPrototypeFunctionOrange):
(WebCore::jsTestObjPrototypeFunctionStrictFunction):
(WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
(WebCore::JSTestObj::visitChildren):
(WebCore::toTestObj):

  • bindings/scripts/test/JS/JSTestObj.h:

(WebCore::JSTestObj::createStructure):
(WebCore::JSTestObjPrototype::createStructure):
(WebCore::JSTestObjConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:

(WebCore::JSTestOverloadedConstructorsConstructor::constructJSTestOverloadedConstructors):
(WebCore::JSTestOverloadedConstructorsConstructor::finishCreation):
(WebCore::JSTestOverloadedConstructors::finishCreation):
(WebCore::JSTestOverloadedConstructors::getOwnPropertySlot):
(WebCore::JSTestOverloadedConstructors::getOwnPropertyDescriptor):
(WebCore::toTestOverloadedConstructors):

  • bindings/scripts/test/JS/JSTestOverloadedConstructors.h:

(WebCore::JSTestOverloadedConstructors::createStructure):
(WebCore::JSTestOverloadedConstructorsPrototype::createStructure):
(WebCore::JSTestOverloadedConstructorsConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:

(WebCore::JSTestSerializedScriptValueInterfaceConstructor::finishCreation):
(WebCore::JSTestSerializedScriptValueInterface::finishCreation):
(WebCore::JSTestSerializedScriptValueInterface::getOwnPropertySlot):
(WebCore::JSTestSerializedScriptValueInterface::getOwnPropertyDescriptor):
(WebCore::JSTestSerializedScriptValueInterface::put):
(WebCore::JSTestSerializedScriptValueInterface::visitChildren):
(WebCore::toTestSerializedScriptValueInterface):

  • bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:

(WebCore::JSTestSerializedScriptValueInterface::createStructure):
(WebCore::JSTestSerializedScriptValueInterfacePrototype::createStructure):
(WebCore::JSTestSerializedScriptValueInterfaceConstructor::createStructure):

  • bindings/scripts/test/JS/JSTestTypedefs.cpp:

(WebCore::JSTestTypedefsConstructor::finishCreation):
(WebCore::JSTestTypedefs::finishCreation):
(WebCore::JSTestTypedefs::getOwnPropertySlot):
(WebCore::JSTestTypedefs::getOwnPropertyDescriptor):
(WebCore::JSTestTypedefs::put):
(WebCore::jsTestTypedefsPrototypeFunctionFunc):
(WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
(WebCore::jsTestTypedefsPrototypeFunctionMethodWithSequenceArg):
(WebCore::jsTestTypedefsPrototypeFunctionNullableArrayArg):
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
(WebCore::jsTestTypedefsPrototypeFunctionImmutablePointFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringArrayFunction):
(WebCore::jsTestTypedefsPrototypeFunctionStringArrayFunction2):
(WebCore::jsTestTypedefsPrototypeFunctionMethodWithException):
(WebCore::toTestTypedefs):

  • bindings/scripts/test/JS/JSTestTypedefs.h:

(WebCore::JSTestTypedefs::createStructure):
(WebCore::JSTestTypedefsPrototype::createStructure):
(WebCore::JSTestTypedefsConstructor::createStructure):

  • bridge/c/CRuntimeObject.cpp:

(JSC::Bindings::CRuntimeObject::finishCreation):

  • bridge/c/CRuntimeObject.h:

(JSC::Bindings::CRuntimeObject::createStructure):

  • bridge/c/c_instance.cpp:

(JSC::Bindings::CRuntimeMethod::createStructure):
(JSC::Bindings::CRuntimeMethod::finishCreation):
(JSC::Bindings::CInstance::invokeMethod):

  • bridge/c/c_utility.cpp:

(JSC::Bindings::convertValueToNPVariant):

  • bridge/objc/ObjCRuntimeObject.h:

(JSC::Bindings::ObjCRuntimeObject::createStructure):

  • bridge/objc/objc_instance.mm:

(ObjCRuntimeMethod::finishCreation):
(ObjcInstance::invokeMethod):

  • bridge/objc/objc_runtime.h:

(JSC::Bindings::ObjcFallbackObjectImp::createStructure):

  • bridge/objc/objc_runtime.mm:

(JSC::Bindings::ObjcFallbackObjectImp::finishCreation):
(JSC::Bindings::callObjCFallbackObject):

  • bridge/qt/qt_instance.cpp:

(JSC::Bindings::QtRuntimeObject::createStructure):
(JSC::Bindings::QtInstance::getInstance):

  • bridge/qt/qt_pixmapruntime.cpp:

(JSC::Bindings::assignToHTMLImageElement):
(JSC::Bindings::QtPixmapRuntime::toQt):

  • bridge/qt/qt_runtime.cpp:

(JSC::Bindings::isJSUint8Array):
(JSC::Bindings::isJSArray):
(JSC::Bindings::isJSDate):
(JSC::Bindings::isQtObject):
(JSC::Bindings::unwrapBoxedPrimitive):
(JSC::Bindings::convertQVariantToValue):

  • bridge/runtime_array.cpp:

(JSC::RuntimeArray::finishCreation):

  • bridge/runtime_array.h:

(JSC::RuntimeArray::createStructure):

  • bridge/runtime_method.cpp:

(JSC::RuntimeMethod::finishCreation):
(JSC::callRuntimeMethod):

  • bridge/runtime_method.h:

(JSC::RuntimeMethod::createStructure):

  • bridge/runtime_object.cpp:

(JSC::Bindings::RuntimeObject::finishCreation):
(JSC::Bindings::callRuntimeObject):
(JSC::Bindings::callRuntimeConstructor):

  • bridge/runtime_object.h:

(JSC::Bindings::RuntimeObject::createStructure):

Source/WebKit/mac:

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::getObjectID):
(WebKit::NetscapePluginInstanceProxy::retainLocalObject):
(WebKit::NetscapePluginInstanceProxy::releaseLocalObject):

  • Plugins/Hosted/ProxyInstance.mm:

(WebKit::ProxyRuntimeMethod::finishCreation):
(WebKit::ProxyInstance::invokeMethod):

  • Plugins/Hosted/ProxyRuntimeObject.h:

(WebKit::ProxyRuntimeObject::createStructure):

  • WebView/WebView.mm:

(aeDescFromJSValue):

Source/WebKit/qt:

  • Api/qwebelement.cpp:

(convertJSValueToWebElementVariant):

  • WebCoreSupport/DumpRenderTreeSupportQt.cpp:

(convertJSValueToNodeVariant):

  • Property svn:eol-style set to native
File size: 26.9 KB
Line 
1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2006 Bjoern Graf ([email protected])
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#include "config.h"
24
25#include "APIShims.h"
26#include "ButterflyInlines.h"
27#include "BytecodeGenerator.h"
28#include "CallFrameInlines.h"
29#include "Completion.h"
30#include "CopiedSpaceInlines.h"
31#include "ExceptionHelpers.h"
32#include "HeapStatistics.h"
33#include "InitializeThreading.h"
34#include "Interpreter.h"
35#include "JSArray.h"
36#include "JSCTypedArrayStubs.h"
37#include "JSFunction.h"
38#include "JSLock.h"
39#include "JSProxy.h"
40#include "JSString.h"
41#include "Operations.h"
42#include "SamplingTool.h"
43#include "StackIterator.h"
44#include "StructureRareDataInlines.h"
45#include <math.h>
46#include <stdio.h>
47#include <stdlib.h>
48#include <string.h>
49#include <wtf/CurrentTime.h>
50#include <wtf/MainThread.h>
51#include <wtf/StringPrintStream.h>
52#include <wtf/text/StringBuilder.h>
53
54#if !OS(WINDOWS)
55#include <unistd.h>
56#endif
57
58#if HAVE(READLINE)
59// readline/history.h has a Function typedef which conflicts with the WTF::Function template from WTF/Forward.h
60// We #define it to something else to avoid this conflict.
61#define Function ReadlineFunction
62#include <readline/history.h>
63#include <readline/readline.h>
64#undef Function
65#endif
66
67#if HAVE(SYS_TIME_H)
68#include <sys/time.h>
69#endif
70
71#if HAVE(SIGNAL_H)
72#include <signal.h>
73#endif
74
75#if COMPILER(MSVC) && !OS(WINCE)
76#include <crtdbg.h>
77#include <mmsystem.h>
78#include <windows.h>
79#endif
80
81#if PLATFORM(QT)
82#include <QCoreApplication>
83#include <QDateTime>
84#endif
85
86#if PLATFORM(IOS)
87#include <fenv.h>
88#include <arm/arch.h>
89#endif
90
91#if PLATFORM(BLACKBERRY)
92#include <BlackBerryPlatformLog.h>
93#endif
94
95#if PLATFORM(EFL)
96#include <Ecore.h>
97#endif
98
99using namespace JSC;
100using namespace WTF;
101
102static bool fillBufferWithContentsOfFile(const String& fileName, Vector<char>& buffer);
103
104static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
105static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
106static EncodedJSValue JSC_HOST_CALL functionDescribe(ExecState*);
107static EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState*);
108static EncodedJSValue JSC_HOST_CALL functionGC(ExecState*);
109#ifndef NDEBUG
110static EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState*);
111static EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState*);
112#endif
113static EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*);
114static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*);
115static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*);
116static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*);
117static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*);
118static EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*);
119static NO_RETURN_WITH_VALUE EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*);
120
121#if ENABLE(SAMPLING_FLAGS)
122static EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState*);
123static EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState*);
124#endif
125
126struct Script {
127 bool isFile;
128 char* argument;
129
130 Script(bool isFile, char *argument)
131 : isFile(isFile)
132 , argument(argument)
133 {
134 }
135};
136
137class CommandLine {
138public:
139 CommandLine(int argc, char** argv)
140 : m_interactive(false)
141 , m_dump(false)
142 , m_exitCode(false)
143 , m_profile(false)
144 {
145 parseArguments(argc, argv);
146 }
147
148 bool m_interactive;
149 bool m_dump;
150 bool m_exitCode;
151 Vector<Script> m_scripts;
152 Vector<String> m_arguments;
153 bool m_profile;
154 String m_profilerOutput;
155
156 void parseArguments(int, char**);
157};
158
159static const char interactivePrompt[] = ">>> ";
160
161class StopWatch {
162public:
163 void start();
164 void stop();
165 long getElapsedMS(); // call stop() first
166
167private:
168 double m_startTime;
169 double m_stopTime;
170};
171
172void StopWatch::start()
173{
174 m_startTime = monotonicallyIncreasingTime();
175}
176
177void StopWatch::stop()
178{
179 m_stopTime = monotonicallyIncreasingTime();
180}
181
182long StopWatch::getElapsedMS()
183{
184 return static_cast<long>((m_stopTime - m_startTime) * 1000);
185}
186
187class GlobalObject : public JSGlobalObject {
188private:
189 GlobalObject(VM&, Structure*);
190
191public:
192 typedef JSGlobalObject Base;
193
194 static GlobalObject* create(VM& vm, Structure* structure, const Vector<String>& arguments)
195 {
196 GlobalObject* object = new (NotNull, allocateCell<GlobalObject>(vm.heap)) GlobalObject(vm, structure);
197 object->finishCreation(vm, arguments);
198 vm.heap.addFinalizer(object, destroy);
199 object->setGlobalThis(vm, JSProxy::create(vm, JSProxy::createStructure(vm, object, object->prototype()), object));
200 return object;
201 }
202
203 static const bool needsDestruction = false;
204
205 DECLARE_INFO;
206 static const GlobalObjectMethodTable s_globalObjectMethodTable;
207
208 static Structure* createStructure(VM& vm, JSValue prototype)
209 {
210 return Structure::create(vm, 0, prototype, TypeInfo(GlobalObjectType, StructureFlags), info());
211 }
212
213 static bool javaScriptExperimentsEnabled(const JSGlobalObject*) { return true; }
214
215protected:
216 void finishCreation(VM& vm, const Vector<String>& arguments)
217 {
218 Base::finishCreation(vm);
219
220 addFunction(vm, "debug", functionDebug, 1);
221 addFunction(vm, "describe", functionDescribe, 1);
222 addFunction(vm, "print", functionPrint, 1);
223 addFunction(vm, "quit", functionQuit, 0);
224 addFunction(vm, "gc", functionGC, 0);
225#ifndef NDEBUG
226 addFunction(vm, "dumpCallFrame", functionDumpCallFrame, 0);
227 addFunction(vm, "releaseExecutableMemory", functionReleaseExecutableMemory, 0);
228#endif
229 addFunction(vm, "version", functionVersion, 1);
230 addFunction(vm, "run", functionRun, 1);
231 addFunction(vm, "load", functionLoad, 1);
232 addFunction(vm, "checkSyntax", functionCheckSyntax, 1);
233 addFunction(vm, "jscStack", functionJSCStack, 1);
234 addFunction(vm, "readline", functionReadline, 0);
235 addFunction(vm, "preciseTime", functionPreciseTime, 0);
236#if ENABLE(SAMPLING_FLAGS)
237 addFunction(vm, "setSamplingFlags", functionSetSamplingFlags, 1);
238 addFunction(vm, "clearSamplingFlags", functionClearSamplingFlags, 1);
239#endif
240
241 addConstructableFunction(vm, "Uint8Array", constructJSUint8Array, 1);
242 addConstructableFunction(vm, "Uint8ClampedArray", constructJSUint8ClampedArray, 1);
243 addConstructableFunction(vm, "Uint16Array", constructJSUint16Array, 1);
244 addConstructableFunction(vm, "Uint32Array", constructJSUint32Array, 1);
245 addConstructableFunction(vm, "Int8Array", constructJSInt8Array, 1);
246 addConstructableFunction(vm, "Int16Array", constructJSInt16Array, 1);
247 addConstructableFunction(vm, "Int32Array", constructJSInt32Array, 1);
248 addConstructableFunction(vm, "Float32Array", constructJSFloat32Array, 1);
249 addConstructableFunction(vm, "Float64Array", constructJSFloat64Array, 1);
250
251 JSArray* array = constructEmptyArray(globalExec(), 0);
252 for (size_t i = 0; i < arguments.size(); ++i)
253 array->putDirectIndex(globalExec(), i, jsString(globalExec(), arguments[i]));
254 putDirect(vm, Identifier(globalExec(), "arguments"), array);
255 }
256
257 void addFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
258 {
259 Identifier identifier(globalExec(), name);
260 putDirect(vm, identifier, JSFunction::create(globalExec(), this, arguments, identifier.string(), function));
261 }
262
263 void addConstructableFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
264 {
265 Identifier identifier(globalExec(), name);
266 putDirect(vm, identifier, JSFunction::create(globalExec(), this, arguments, identifier.string(), function, NoIntrinsic, function));
267 }
268};
269
270COMPILE_ASSERT(!IsInteger<GlobalObject>::value, WTF_IsInteger_GlobalObject_false);
271
272const ClassInfo GlobalObject::s_info = { "global", &JSGlobalObject::s_info, 0, ExecState::globalObjectTable, CREATE_METHOD_TABLE(GlobalObject) };
273const GlobalObjectMethodTable GlobalObject::s_globalObjectMethodTable = { &allowsAccessFrom, &supportsProfiling, &supportsRichSourceInfo, &shouldInterruptScript, &javaScriptExperimentsEnabled };
274
275
276GlobalObject::GlobalObject(VM& vm, Structure* structure)
277 : JSGlobalObject(vm, structure, &s_globalObjectMethodTable)
278{
279}
280
281static inline String stringFromUTF(const char* utf8)
282{
283 // Find the the first non-ascii character, or nul.
284 const char* pos = utf8;
285 while (*pos > 0)
286 pos++;
287 size_t asciiLength = pos - utf8;
288
289 // Fast case - string is all ascii.
290 if (!*pos)
291 return String(utf8, asciiLength);
292
293 // Slow case - contains non-ascii characters, use fromUTF8WithLatin1Fallback.
294 ASSERT(*pos < 0);
295 ASSERT(strlen(utf8) == asciiLength + strlen(pos));
296 return String::fromUTF8WithLatin1Fallback(utf8, asciiLength + strlen(pos));
297}
298
299static inline SourceCode jscSource(const char* utf8, const String& filename)
300{
301 String str = stringFromUTF(utf8);
302 return makeSource(str, filename);
303}
304
305EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
306{
307 for (unsigned i = 0; i < exec->argumentCount(); ++i) {
308 if (i)
309 putchar(' ');
310
311 printf("%s", exec->argument(i).toString(exec)->value(exec).utf8().data());
312 }
313
314 putchar('\n');
315 fflush(stdout);
316 return JSValue::encode(jsUndefined());
317}
318
319#ifndef NDEBUG
320EncodedJSValue JSC_HOST_CALL functionDumpCallFrame(ExecState* exec)
321{
322 if (!exec->callerFrame()->hasHostCallFrameFlag())
323 exec->vm().interpreter->dumpCallFrame(exec->callerFrame());
324 return JSValue::encode(jsUndefined());
325}
326#endif
327
328EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
329{
330 fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec)->value(exec).utf8().data());
331 return JSValue::encode(jsUndefined());
332}
333
334EncodedJSValue JSC_HOST_CALL functionDescribe(ExecState* exec)
335{
336 fprintf(stderr, "--> %s\n", toCString(exec->argument(0)).data());
337 return JSValue::encode(jsUndefined());
338}
339
340EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState* exec)
341{
342 StringBuilder trace;
343 trace.appendLiteral("--> Stack trace:\n");
344
345 int i = 0;
346 for (StackIterator iter = exec->begin(); iter != exec->end(); ++iter, ++i)
347 trace.append(String::format(" %i %s\n", i, iter->toString().utf8().data()));
348 fprintf(stderr, "%s", trace.toString().utf8().data());
349 return JSValue::encode(jsUndefined());
350}
351
352EncodedJSValue JSC_HOST_CALL functionGC(ExecState* exec)
353{
354 JSLockHolder lock(exec);
355 exec->heap()->collectAllGarbage();
356 return JSValue::encode(jsUndefined());
357}
358
359#ifndef NDEBUG
360EncodedJSValue JSC_HOST_CALL functionReleaseExecutableMemory(ExecState* exec)
361{
362 JSLockHolder lock(exec);
363 exec->vm().releaseExecutableMemory();
364 return JSValue::encode(jsUndefined());
365}
366#endif
367
368EncodedJSValue JSC_HOST_CALL functionVersion(ExecState*)
369{
370 // We need this function for compatibility with the Mozilla JS tests but for now
371 // we don't actually do any version-specific handling
372 return JSValue::encode(jsUndefined());
373}
374
375EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
376{
377 String fileName = exec->argument(0).toString(exec)->value(exec);
378 Vector<char> script;
379 if (!fillBufferWithContentsOfFile(fileName, script))
380 return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
381
382 GlobalObject* globalObject = GlobalObject::create(exec->vm(), GlobalObject::createStructure(exec->vm(), jsNull()), Vector<String>());
383
384 JSValue exception;
385 StopWatch stopWatch;
386 stopWatch.start();
387 evaluate(globalObject->globalExec(), jscSource(script.data(), fileName), JSValue(), &exception);
388 stopWatch.stop();
389
390 if (!!exception) {
391 throwError(globalObject->globalExec(), exception);
392 return JSValue::encode(jsUndefined());
393 }
394
395 return JSValue::encode(jsNumber(stopWatch.getElapsedMS()));
396}
397
398EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
399{
400 String fileName = exec->argument(0).toString(exec)->value(exec);
401 Vector<char> script;
402 if (!fillBufferWithContentsOfFile(fileName, script))
403 return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
404
405 JSGlobalObject* globalObject = exec->lexicalGlobalObject();
406
407 JSValue evaluationException;
408 JSValue result = evaluate(globalObject->globalExec(), jscSource(script.data(), fileName), JSValue(), &evaluationException);
409 if (evaluationException)
410 throwError(exec, evaluationException);
411 return JSValue::encode(result);
412}
413
414EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
415{
416 String fileName = exec->argument(0).toString(exec)->value(exec);
417 Vector<char> script;
418 if (!fillBufferWithContentsOfFile(fileName, script))
419 return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
420
421 JSGlobalObject* globalObject = exec->lexicalGlobalObject();
422
423 StopWatch stopWatch;
424 stopWatch.start();
425
426 JSValue syntaxException;
427 bool validSyntax = checkSyntax(globalObject->globalExec(), jscSource(script.data(), fileName), &syntaxException);
428 stopWatch.stop();
429
430 if (!validSyntax)
431 throwError(exec, syntaxException);
432 return JSValue::encode(jsNumber(stopWatch.getElapsedMS()));
433}
434
435#if ENABLE(SAMPLING_FLAGS)
436EncodedJSValue JSC_HOST_CALL functionSetSamplingFlags(ExecState* exec)
437{
438 for (unsigned i = 0; i < exec->argumentCount(); ++i) {
439 unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
440 if ((flag >= 1) && (flag <= 32))
441 SamplingFlags::setFlag(flag);
442 }
443 return JSValue::encode(jsNull());
444}
445
446EncodedJSValue JSC_HOST_CALL functionClearSamplingFlags(ExecState* exec)
447{
448 for (unsigned i = 0; i < exec->argumentCount(); ++i) {
449 unsigned flag = static_cast<unsigned>(exec->argument(i).toNumber(exec));
450 if ((flag >= 1) && (flag <= 32))
451 SamplingFlags::clearFlag(flag);
452 }
453 return JSValue::encode(jsNull());
454}
455#endif
456
457EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec)
458{
459 Vector<char, 256> line;
460 int c;
461 while ((c = getchar()) != EOF) {
462 // FIXME: Should we also break on \r?
463 if (c == '\n')
464 break;
465 line.append(c);
466 }
467 line.append('\0');
468 return JSValue::encode(jsString(exec, line.data()));
469}
470
471EncodedJSValue JSC_HOST_CALL functionPreciseTime(ExecState*)
472{
473 return JSValue::encode(jsNumber(currentTime()));
474}
475
476EncodedJSValue JSC_HOST_CALL functionQuit(ExecState*)
477{
478 exit(EXIT_SUCCESS);
479
480#if COMPILER(MSVC) && OS(WINCE)
481 // Without this, Visual Studio will complain that this method does not return a value.
482 return JSValue::encode(jsUndefined());
483#endif
484}
485
486// Use SEH for Release builds only to get rid of the crash report dialog
487// (luckily the same tests fail in Release and Debug builds so far). Need to
488// be in a separate main function because the jscmain function requires object
489// unwinding.
490
491#if COMPILER(MSVC) && !COMPILER(INTEL) && !defined(_DEBUG) && !OS(WINCE)
492#define TRY __try {
493#define EXCEPT(x) } __except (EXCEPTION_EXECUTE_HANDLER) { x; }
494#else
495#define TRY
496#define EXCEPT(x)
497#endif
498
499int jscmain(int argc, char** argv);
500
501int main(int argc, char** argv)
502{
503#if PLATFORM(IOS)
504 // Enabled IEEE754 denormal support.
505 fenv_t env;
506 fegetenv( &env );
507 env.__fpscr &= ~0x01000000u;
508 fesetenv( &env );
509#endif
510
511#if OS(WINDOWS)
512#if !OS(WINCE)
513 // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
514 // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
515 // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
516 ::SetErrorMode(0);
517#endif
518
519#if defined(_DEBUG)
520 _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
521 _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
522 _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
523 _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
524 _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
525 _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
526#endif
527
528 timeBeginPeriod(1);
529#endif
530
531#if PLATFORM(BLACKBERRY)
532 // Write all WTF logs to the system log
533 BlackBerry::Platform::setupApplicationLogging("jsc");
534#endif
535
536#if PLATFORM(QT)
537 QCoreApplication app(argc, argv);
538#endif
539
540#if PLATFORM(EFL)
541 ecore_init();
542#endif
543
544 // Initialize JSC before getting VM.
545#if ENABLE(SAMPLING_REGIONS)
546 WTF::initializeMainThread();
547#endif
548 JSC::initializeThreading();
549
550 // We can't use destructors in the following code because it uses Windows
551 // Structured Exception Handling
552 int res = 0;
553 TRY
554 res = jscmain(argc, argv);
555 EXCEPT(res = 3)
556 if (Options::logHeapStatisticsAtExit())
557 HeapStatistics::reportSuccess();
558
559#if PLATFORM(EFL)
560 ecore_shutdown();
561#endif
562
563 return res;
564}
565
566static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts, bool dump)
567{
568 const char* script;
569 String fileName;
570 Vector<char> scriptBuffer;
571
572 if (dump)
573 JSC::Options::dumpGeneratedBytecodes() = true;
574
575 VM& vm = globalObject->vm();
576
577#if ENABLE(SAMPLING_FLAGS)
578 SamplingFlags::start();
579#endif
580
581 bool success = true;
582 for (size_t i = 0; i < scripts.size(); i++) {
583 if (scripts[i].isFile) {
584 fileName = scripts[i].argument;
585 if (!fillBufferWithContentsOfFile(fileName, scriptBuffer))
586 return false; // fail early so we can catch missing files
587 script = scriptBuffer.data();
588 } else {
589 script = scripts[i].argument;
590 fileName = "[Command Line]";
591 }
592
593 vm.startSampling();
594
595 JSValue evaluationException;
596 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(script, fileName), JSValue(), &evaluationException);
597 success = success && !evaluationException;
598 if (dump && !evaluationException)
599 printf("End: %s\n", returnValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
600 if (evaluationException) {
601 printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
602 Identifier stackID(globalObject->globalExec(), "stack");
603 JSValue stackValue = evaluationException.get(globalObject->globalExec(), stackID);
604 if (!stackValue.isUndefinedOrNull())
605 printf("%s\n", stackValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
606 }
607
608 vm.stopSampling();
609 globalObject->globalExec()->clearException();
610 }
611
612#if ENABLE(SAMPLING_FLAGS)
613 SamplingFlags::stop();
614#endif
615#if ENABLE(SAMPLING_REGIONS)
616 SamplingRegion::dump();
617#endif
618 vm.dumpSampleData(globalObject->globalExec());
619#if ENABLE(SAMPLING_COUNTERS)
620 AbstractSamplingCounter::dump();
621#endif
622#if ENABLE(REGEXP_TRACING)
623 vm.dumpRegExpTrace();
624#endif
625 return success;
626}
627
628#define RUNNING_FROM_XCODE 0
629
630static void runInteractive(GlobalObject* globalObject)
631{
632 String interpreterName("Interpreter");
633
634 bool shouldQuit = false;
635 while (!shouldQuit) {
636#if HAVE(READLINE) && !RUNNING_FROM_XCODE
637 ParserError error;
638 String source;
639 do {
640 error = ParserError();
641 char* line = readline(source.isEmpty() ? interactivePrompt : "... ");
642 shouldQuit = !line;
643 if (!line)
644 break;
645 source = source + line;
646 source = source + '\n';
647 checkSyntax(globalObject->vm(), makeSource(source, interpreterName), error);
648 if (!line[0])
649 break;
650 add_history(line);
651 } while (error.m_syntaxErrorType == ParserError::SyntaxErrorRecoverable);
652
653 if (error.m_type != ParserError::ErrorNone) {
654 printf("%s:%d\n", error.m_message.utf8().data(), error.m_line);
655 continue;
656 }
657
658
659 JSValue evaluationException;
660 JSValue returnValue = evaluate(globalObject->globalExec(), makeSource(source, interpreterName), JSValue(), &evaluationException);
661#else
662 printf("%s", interactivePrompt);
663 Vector<char, 256> line;
664 int c;
665 while ((c = getchar()) != EOF) {
666 // FIXME: Should we also break on \r?
667 if (c == '\n')
668 break;
669 line.append(c);
670 }
671 if (line.isEmpty())
672 break;
673 line.append('\0');
674
675 JSValue evaluationException;
676 JSValue returnValue = evaluate(globalObject->globalExec(), jscSource(line.data(), interpreterName), JSValue(), &evaluationException);
677#endif
678 if (evaluationException)
679 printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
680 else
681 printf("%s\n", returnValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
682
683 globalObject->globalExec()->clearException();
684 }
685 printf("\n");
686}
687
688static NO_RETURN void printUsageStatement(bool help = false)
689{
690 fprintf(stderr, "Usage: jsc [options] [files] [-- arguments]\n");
691 fprintf(stderr, " -d Dumps bytecode (debug builds only)\n");
692 fprintf(stderr, " -e Evaluate argument as script code\n");
693 fprintf(stderr, " -f Specifies a source file (deprecated)\n");
694 fprintf(stderr, " -h|--help Prints this help message\n");
695 fprintf(stderr, " -i Enables interactive mode (default if no files are specified)\n");
696#if HAVE(SIGNAL_H)
697 fprintf(stderr, " -s Installs signal handlers that exit on a crash (Unix platforms only)\n");
698#endif
699 fprintf(stderr, " -p <file> Outputs profiling data to a file\n");
700 fprintf(stderr, " -x Output exit code before terminating\n");
701 fprintf(stderr, "\n");
702 fprintf(stderr, " --options Dumps all JSC VM options and exits\n");
703 fprintf(stderr, " --dumpOptions Dumps all JSC VM options before continuing\n");
704 fprintf(stderr, " --<jsc VM option>=<value> Sets the specified JSC VM option\n");
705 fprintf(stderr, "\n");
706
707 exit(help ? EXIT_SUCCESS : EXIT_FAILURE);
708}
709
710void CommandLine::parseArguments(int argc, char** argv)
711{
712 int i = 1;
713 bool needToDumpOptions = false;
714 bool needToExit = false;
715
716 for (; i < argc; ++i) {
717 const char* arg = argv[i];
718 if (!strcmp(arg, "-f")) {
719 if (++i == argc)
720 printUsageStatement();
721 m_scripts.append(Script(true, argv[i]));
722 continue;
723 }
724 if (!strcmp(arg, "-e")) {
725 if (++i == argc)
726 printUsageStatement();
727 m_scripts.append(Script(false, argv[i]));
728 continue;
729 }
730 if (!strcmp(arg, "-i")) {
731 m_interactive = true;
732 continue;
733 }
734 if (!strcmp(arg, "-d")) {
735 m_dump = true;
736 continue;
737 }
738 if (!strcmp(arg, "-p")) {
739 if (++i == argc)
740 printUsageStatement();
741 m_profile = true;
742 m_profilerOutput = argv[i];
743 continue;
744 }
745 if (!strcmp(arg, "-s")) {
746#if HAVE(SIGNAL_H)
747 signal(SIGILL, _exit);
748 signal(SIGFPE, _exit);
749 signal(SIGBUS, _exit);
750 signal(SIGSEGV, _exit);
751#endif
752 continue;
753 }
754 if (!strcmp(arg, "-x")) {
755 m_exitCode = true;
756 continue;
757 }
758 if (!strcmp(arg, "--")) {
759 ++i;
760 break;
761 }
762 if (!strcmp(arg, "-h") || !strcmp(arg, "--help"))
763 printUsageStatement(true);
764
765 if (!strcmp(arg, "--options")) {
766 needToDumpOptions = true;
767 needToExit = true;
768 continue;
769 }
770 if (!strcmp(arg, "--dumpOptions")) {
771 needToDumpOptions = true;
772 continue;
773 }
774
775 // See if the -- option is a JSC VM option.
776 // NOTE: At this point, we know that the arg starts with "--". Skip it.
777 if (JSC::Options::setOption(&arg[2])) {
778 // The arg was recognized as a VM option and has been parsed.
779 continue; // Just continue with the next arg.
780 }
781
782 // This arg is not recognized by the VM nor by jsc. Pass it on to the
783 // script.
784 m_scripts.append(Script(true, argv[i]));
785 }
786
787 if (m_scripts.isEmpty())
788 m_interactive = true;
789
790 for (; i < argc; ++i)
791 m_arguments.append(argv[i]);
792
793 if (needToDumpOptions)
794 JSC::Options::dumpAllOptions(stderr);
795 if (needToExit)
796 exit(EXIT_SUCCESS);
797}
798
799int jscmain(int argc, char** argv)
800{
801 // Note that the options parsing can affect VM creation, and thus
802 // comes first.
803 CommandLine options(argc, argv);
804 VM* vm = VM::create(LargeHeap).leakRef();
805 APIEntryShim shim(vm);
806 int result;
807
808 if (options.m_profile && !vm->m_perBytecodeProfiler)
809 vm->m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*vm));
810
811 GlobalObject* globalObject = GlobalObject::create(*vm, GlobalObject::createStructure(*vm, jsNull()), options.m_arguments);
812 bool success = runWithScripts(globalObject, options.m_scripts, options.m_dump);
813 if (options.m_interactive && success)
814 runInteractive(globalObject);
815
816 result = success ? 0 : 3;
817
818 if (options.m_exitCode)
819 printf("jsc exiting %d\n", result);
820
821 if (options.m_profile) {
822 if (!vm->m_perBytecodeProfiler->save(options.m_profilerOutput.utf8().data()))
823 fprintf(stderr, "could not save profiler output.\n");
824 }
825
826 return result;
827}
828
829static bool fillBufferWithContentsOfFile(const String& fileName, Vector<char>& buffer)
830{
831 FILE* f = fopen(fileName.utf8().data(), "r");
832 if (!f) {
833 fprintf(stderr, "Could not open file: %s\n", fileName.utf8().data());
834 return false;
835 }
836
837 size_t bufferSize = 0;
838 size_t bufferCapacity = 1024;
839
840 buffer.resize(bufferCapacity);
841
842 while (!feof(f) && !ferror(f)) {
843 bufferSize += fread(buffer.data() + bufferSize, 1, bufferCapacity - bufferSize, f);
844 if (bufferSize == bufferCapacity) { // guarantees space for trailing '\0'
845 bufferCapacity *= 2;
846 buffer.resize(bufferCapacity);
847 }
848 }
849 fclose(f);
850 buffer[bufferSize] = '\0';
851
852 if (buffer[0] == '#' && buffer[1] == '!')
853 buffer[0] = buffer[1] = '/';
854
855 return true;
856}
Note: See TracBrowser for help on using the repository browser.