source: webkit/trunk/JavaScriptCore/kjs/JSGlobalObject.cpp@ 36263

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

2008-09-07 Cameron Zwarich <[email protected]>

Reviewed by Maciej Stachowiak.

Bug 20704: Replace the KJS namespace
<https://bugs.webkit.org/show_bug.cgi?id=20704>

Rename the KJS namespace to JSC. There are still some uses of KJS in
preprocessor macros and comments, but these will also be changed some
time in the near future. There are also some uses in the names of JNI
functions, but I will check if these are safe to change as well.

JavaScriptCore:

  • API/APICast.h: (toJS): (toRef): (toGlobalRef):
  • API/JSBase.cpp:
  • API/JSCallbackConstructor.cpp:
  • API/JSCallbackConstructor.h:
  • API/JSCallbackFunction.cpp:
  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.cpp:
  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:
  • API/JSClassRef.cpp: (OpaqueJSClass::staticValues): (OpaqueJSClass::staticFunctions):
  • API/JSClassRef.h:
  • API/JSContextRef.cpp:
  • API/JSObjectRef.cpp:
  • API/JSProfilerPrivate.cpp:
  • API/JSStringRef.cpp:
  • API/JSValueRef.cpp: (JSValueGetType):
  • API/OpaqueJSString.cpp:
  • API/OpaqueJSString.h:
  • JavaScriptCore.Debug.exp:
  • JavaScriptCore.base.exp:
  • VM/CTI.cpp: (JSC::):
  • VM/CTI.h:
  • VM/CodeBlock.cpp:
  • VM/CodeBlock.h:
  • VM/CodeGenerator.cpp:
  • VM/CodeGenerator.h:
  • VM/ExceptionHelpers.cpp:
  • VM/ExceptionHelpers.h:
  • VM/Instruction.h:
  • VM/JSPropertyNameIterator.cpp:
  • VM/JSPropertyNameIterator.h:
  • VM/LabelID.h:
  • VM/Machine.cpp:
  • VM/Machine.h:
  • VM/Opcode.cpp:
  • VM/Opcode.h:
  • VM/Register.h: (WTF::):
  • VM/RegisterFile.cpp:
  • VM/RegisterFile.h:
  • VM/RegisterID.h: (WTF::):
  • VM/SamplingTool.cpp:
  • VM/SamplingTool.h:
  • VM/SegmentedVector.h:
  • kjs/ArgList.cpp:
  • kjs/ArgList.h:
  • kjs/Arguments.cpp:
  • kjs/Arguments.h:
  • kjs/ArrayConstructor.cpp:
  • kjs/ArrayConstructor.h:
  • kjs/ArrayPrototype.cpp:
  • kjs/ArrayPrototype.h:
  • kjs/BatchedTransitionOptimizer.h:
  • kjs/BooleanConstructor.cpp:
  • kjs/BooleanConstructor.h:
  • kjs/BooleanObject.cpp:
  • kjs/BooleanObject.h:
  • kjs/BooleanPrototype.cpp:
  • kjs/BooleanPrototype.h:
  • kjs/CallData.cpp:
  • kjs/CallData.h:
  • kjs/ClassInfo.h:
  • kjs/CommonIdentifiers.cpp:
  • kjs/CommonIdentifiers.h:
  • kjs/ConstructData.cpp:
  • kjs/ConstructData.h:
  • kjs/DateConstructor.cpp:
  • kjs/DateConstructor.h:
  • kjs/DateInstance.cpp: (JSC::DateInstance::msToGregorianDateTime):
  • kjs/DateInstance.h:
  • kjs/DateMath.cpp:
  • kjs/DateMath.h:
  • kjs/DatePrototype.cpp:
  • kjs/DatePrototype.h:
  • kjs/DebuggerCallFrame.cpp:
  • kjs/DebuggerCallFrame.h:
  • kjs/Error.cpp:
  • kjs/Error.h:
  • kjs/ErrorConstructor.cpp:
  • kjs/ErrorConstructor.h:
  • kjs/ErrorInstance.cpp:
  • kjs/ErrorInstance.h:
  • kjs/ErrorPrototype.cpp:
  • kjs/ErrorPrototype.h:
  • kjs/ExecState.cpp:
  • kjs/ExecState.h:
  • kjs/FunctionConstructor.cpp:
  • kjs/FunctionConstructor.h:
  • kjs/FunctionPrototype.cpp:
  • kjs/FunctionPrototype.h:
  • kjs/GetterSetter.cpp:
  • kjs/GetterSetter.h:
  • kjs/GlobalEvalFunction.cpp:
  • kjs/GlobalEvalFunction.h:
  • kjs/IndexToNameMap.cpp:
  • kjs/IndexToNameMap.h:
  • kjs/InitializeThreading.cpp:
  • kjs/InitializeThreading.h:
  • kjs/InternalFunction.cpp:
  • kjs/InternalFunction.h: (JSC::InternalFunction::InternalFunction):
  • kjs/JSActivation.cpp:
  • kjs/JSActivation.h:
  • kjs/JSArray.cpp:
  • kjs/JSArray.h:
  • kjs/JSCell.cpp:
  • kjs/JSCell.h:
  • kjs/JSFunction.cpp:
  • kjs/JSFunction.h: (JSC::JSFunction::JSFunction):
  • kjs/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData):
  • kjs/JSGlobalData.h:
  • kjs/JSGlobalObject.cpp:
  • kjs/JSGlobalObject.h:
  • kjs/JSGlobalObjectFunctions.cpp:
  • kjs/JSGlobalObjectFunctions.h:
  • kjs/JSImmediate.cpp:
  • kjs/JSImmediate.h:
  • kjs/JSLock.cpp:
  • kjs/JSLock.h:
  • kjs/JSNotAnObject.cpp:
  • kjs/JSNotAnObject.h:
  • kjs/JSNumberCell.cpp:
  • kjs/JSNumberCell.h:
  • kjs/JSObject.cpp:
  • kjs/JSObject.h:
  • kjs/JSStaticScopeObject.cpp:
  • kjs/JSStaticScopeObject.h:
  • kjs/JSString.cpp:
  • kjs/JSString.h:
  • kjs/JSType.h:
  • kjs/JSValue.cpp:
  • kjs/JSValue.h:
  • kjs/JSVariableObject.cpp:
  • kjs/JSVariableObject.h:
  • kjs/JSWrapperObject.cpp:
  • kjs/JSWrapperObject.h:
  • kjs/LabelStack.cpp:
  • kjs/LabelStack.h:
  • kjs/MathObject.cpp:
  • kjs/MathObject.h:
  • kjs/NativeErrorConstructor.cpp:
  • kjs/NativeErrorConstructor.h:
  • kjs/NativeErrorPrototype.cpp:
  • kjs/NativeErrorPrototype.h:
  • kjs/NodeInfo.h:
  • kjs/NumberConstructor.cpp:
  • kjs/NumberConstructor.h:
  • kjs/NumberObject.cpp:
  • kjs/NumberObject.h:
  • kjs/NumberPrototype.cpp:
  • kjs/NumberPrototype.h:
  • kjs/ObjectConstructor.cpp:
  • kjs/ObjectConstructor.h:
  • kjs/ObjectPrototype.cpp:
  • kjs/ObjectPrototype.h:
  • kjs/Parser.cpp:
  • kjs/Parser.h:
  • kjs/PropertyMap.cpp: (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
  • kjs/PropertyMap.h:
  • kjs/PropertyNameArray.cpp:
  • kjs/PropertyNameArray.h:
  • kjs/PropertySlot.cpp:
  • kjs/PropertySlot.h:
  • kjs/PrototypeFunction.cpp:
  • kjs/PrototypeFunction.h:
  • kjs/PutPropertySlot.h:
  • kjs/RegExpConstructor.cpp:
  • kjs/RegExpConstructor.h:
  • kjs/RegExpObject.cpp:
  • kjs/RegExpObject.h:
  • kjs/RegExpPrototype.cpp:
  • kjs/RegExpPrototype.h:
  • kjs/ScopeChain.cpp:
  • kjs/ScopeChain.h:
  • kjs/ScopeChainMark.h:
  • kjs/Shell.cpp: (jscmain):
  • kjs/SmallStrings.cpp:
  • kjs/SmallStrings.h:
  • kjs/SourceProvider.h:
  • kjs/SourceRange.h:
  • kjs/StringConstructor.cpp:
  • kjs/StringConstructor.h:
  • kjs/StringObject.cpp:
  • kjs/StringObject.h:
  • kjs/StringObjectThatMasqueradesAsUndefined.h:
  • kjs/StringPrototype.cpp:
  • kjs/StringPrototype.h:
  • kjs/StructureID.cpp:
  • kjs/StructureID.h:
  • kjs/SymbolTable.h:
  • kjs/collector.cpp:
  • kjs/collector.h:
  • kjs/completion.h:
  • kjs/create_hash_table:
  • kjs/debugger.cpp:
  • kjs/debugger.h:
  • kjs/dtoa.cpp:
  • kjs/dtoa.h:
  • kjs/grammar.y:
  • kjs/identifier.cpp:
  • kjs/identifier.h: (JSC::Identifier::equal):
  • kjs/interpreter.cpp:
  • kjs/interpreter.h:
  • kjs/lexer.cpp: (JSC::Lexer::Lexer): (JSC::Lexer::clear): (JSC::Lexer::makeIdentifier):
  • kjs/lexer.h:
  • kjs/lookup.cpp:
  • kjs/lookup.h:
  • kjs/nodes.cpp:
  • kjs/nodes.h:
  • kjs/nodes2string.cpp:
  • kjs/operations.cpp:
  • kjs/operations.h:
  • kjs/protect.h:
  • kjs/regexp.cpp:
  • kjs/regexp.h:
  • kjs/ustring.cpp:
  • kjs/ustring.h: (JSC::operator!=): (JSC::IdentifierRepHash::hash): (WTF::):
  • masm/MacroAssembler.h:
  • masm/MacroAssemblerWin.cpp:
  • masm/X86Assembler.h:
  • pcre/pcre_exec.cpp:
  • profiler/CallIdentifier.h: (WTF::):
  • profiler/HeavyProfile.cpp:
  • profiler/HeavyProfile.h:
  • profiler/Profile.cpp:
  • profiler/Profile.h:
  • profiler/ProfileGenerator.cpp:
  • profiler/ProfileGenerator.h:
  • profiler/ProfileNode.cpp:
  • profiler/ProfileNode.h:
  • profiler/Profiler.cpp:
  • profiler/Profiler.h:
  • profiler/TreeProfile.cpp:
  • profiler/TreeProfile.h:
  • wrec/WREC.cpp:
  • wrec/WREC.h:
  • wtf/AVLTree.h:

WebCore:

  • WebCore.base.exp:
  • bindings/js/GCController.cpp:
  • bindings/js/JSAttrCustom.cpp:
  • bindings/js/JSAudioConstructor.cpp:
  • bindings/js/JSAudioConstructor.h: (WebCore::JSAudioConstructor::classInfo):
  • bindings/js/JSCSSRuleCustom.cpp:
  • bindings/js/JSCSSStyleDeclarationCustom.cpp:
  • bindings/js/JSCSSValueCustom.cpp:
  • bindings/js/JSCanvasPixelArrayCustom.cpp:
  • bindings/js/JSCanvasRenderingContext2DCustom.cpp:
  • bindings/js/JSClipboardCustom.cpp:
  • bindings/js/JSConsoleCustom.cpp:
  • bindings/js/JSCustomSQLStatementCallback.cpp: (WebCore::JSCustomSQLStatementCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementCallback.h: (WebCore::JSCustomSQLStatementCallback::create):
  • bindings/js/JSCustomSQLStatementErrorCallback.cpp: (WebCore::JSCustomSQLStatementErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLStatementErrorCallback.h: (WebCore::JSCustomSQLStatementErrorCallback::create):
  • bindings/js/JSCustomSQLTransactionCallback.cpp: (WebCore::JSCustomSQLTransactionCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionCallback.h: (WebCore::JSCustomSQLTransactionCallback::create):
  • bindings/js/JSCustomSQLTransactionErrorCallback.cpp: (WebCore::JSCustomSQLTransactionErrorCallback::handleEvent):
  • bindings/js/JSCustomSQLTransactionErrorCallback.h: (WebCore::JSCustomSQLTransactionErrorCallback::create):
  • bindings/js/JSCustomVoidCallback.cpp: (WebCore::JSCustomVoidCallback::handleEvent):
  • bindings/js/JSCustomVoidCallback.h: (WebCore::JSCustomVoidCallback::create):
  • bindings/js/JSCustomXPathNSResolver.cpp: (WebCore::JSCustomXPathNSResolver::create):
  • bindings/js/JSCustomXPathNSResolver.h:
  • bindings/js/JSDOMApplicationCacheCustom.cpp: (WebCore::JSDOMApplicationCache::dispatchEvent):
  • bindings/js/JSDOMBinding.cpp: (WebCore::jsOwnedStringOrNull):
  • bindings/js/JSDOMBinding.h: (WebCore::DOMObject::DOMObject): (WebCore::cacheDOMObject): (WebCore::cacheSVGDOMObject): (WebCore::DOMExceptionTranslator::DOMExceptionTranslator): (WebCore::toJS):
  • bindings/js/JSDOMWindowBase.cpp:
  • bindings/js/JSDOMWindowBase.h: (WebCore::JSDOMWindowBase::classInfo): (WebCore::JSDOMWindowBase::d):
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::getPropertyAttributes):
  • bindings/js/JSDOMWindowCustom.h: (WebCore::asJSDOMWindow): (WebCore::JSDOMWindow::customGetOwnPropertySlot): (WebCore::JSDOMWindow::customPut): (WebCore::JSDOMWindowBase::allowsAccessFrom): (WebCore::JSDOMWindowBase::allowsAccessFromNoErrorMessage):
  • bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::getPropertyAttributes):
  • bindings/js/JSDOMWindowShell.h: (WebCore::JSDOMWindowShell::classInfo):
  • bindings/js/JSDatabaseCustom.cpp:
  • bindings/js/JSDocumentCustom.cpp:
  • bindings/js/JSDocumentFragmentCustom.cpp:
  • bindings/js/JSElementCustom.cpp:
  • bindings/js/JSEventCustom.cpp:
  • bindings/js/JSEventListener.cpp:
  • bindings/js/JSEventListener.h: (WebCore::JSUnprotectedEventListener::create): (WebCore::JSEventListener::create):
  • bindings/js/JSEventTargetBase.cpp:
  • bindings/js/JSEventTargetBase.h: (WebCore::JSEventTargetBase::getValueProperty): (WebCore::JSEventTargetBase::putValueProperty): (WebCore::JSEventTargetBase::getOwnPropertySlot): (WebCore::JSEventTargetBase::put): (WebCore::JSEventTargetPrototype::JSEventTargetPrototype): (WebCore::JSEventTargetPrototype::self): (WebCore::JSEventTargetPrototype::getOwnPropertySlot): (WebCore::JSEventTargetPrototype::classInfo):
  • bindings/js/JSEventTargetNode.cpp:
  • bindings/js/JSEventTargetNode.h: (WebCore::JSEventTargetNode::getOwnPropertySlot): (WebCore::JSEventTargetNode::getValueProperty): (WebCore::JSEventTargetNode::put): (WebCore::JSEventTargetNode::putValueProperty):
  • bindings/js/JSHTMLAllCollection.h: (WebCore::JSHTMLAllCollection::JSHTMLAllCollection): (WebCore::JSHTMLAllCollection::toBoolean):
  • bindings/js/JSHTMLAppletElementCustom.cpp:
  • bindings/js/JSHTMLCollectionCustom.cpp:
  • bindings/js/JSHTMLDocumentCustom.cpp:
  • bindings/js/JSHTMLElementCustom.cpp:
  • bindings/js/JSHTMLEmbedElementCustom.cpp:
  • bindings/js/JSHTMLFormElementCustom.cpp:
  • bindings/js/JSHTMLFrameElementCustom.cpp:
  • bindings/js/JSHTMLFrameSetElementCustom.cpp:
  • bindings/js/JSHTMLIFrameElementCustom.cpp:
  • bindings/js/JSHTMLInputElementBase.cpp: (WebCore::JSHTMLInputElementBase::JSHTMLInputElementBase): (WebCore::JSHTMLInputElementBase::getOwnPropertySlot):
  • bindings/js/JSHTMLInputElementBase.h: (WebCore::JSHTMLInputElementBase::classInfo):
  • bindings/js/JSHTMLObjectElementCustom.cpp:
  • bindings/js/JSHTMLOptionElementConstructor.cpp:
  • bindings/js/JSHTMLOptionElementConstructor.h: (WebCore::JSHTMLOptionElementConstructor::classInfo):
  • bindings/js/JSHTMLOptionsCollectionCustom.cpp:
  • bindings/js/JSHTMLSelectElementCustom.cpp: (WebCore::selectIndexSetter): (WebCore::JSHTMLSelectElement::indexSetter):
  • bindings/js/JSHTMLSelectElementCustom.h:
  • bindings/js/JSHistoryCustom.cpp:
  • bindings/js/JSImageConstructor.cpp:
  • bindings/js/JSImageConstructor.h: (WebCore::JSImageConstructor::classInfo):
  • bindings/js/JSInspectedObjectWrapper.cpp:
  • bindings/js/JSInspectedObjectWrapper.h: (WebCore::JSInspectedObjectWrapper::wrapOutgoingValue): (WebCore::JSInspectedObjectWrapper::classInfo):
  • bindings/js/JSInspectorCallbackWrapper.cpp:
  • bindings/js/JSInspectorCallbackWrapper.h: (WebCore::JSInspectorCallbackWrapper::classInfo): (WebCore::JSInspectorCallbackWrapper::wrapOutgoingValue):
  • bindings/js/JSJavaScriptCallFrameCustom.cpp:
  • bindings/js/JSLocationCustom.cpp:
  • bindings/js/JSMimeTypeArrayCustom.cpp:
  • bindings/js/JSNSResolver.cpp:
  • bindings/js/JSNSResolver.h: (WebCore::JSNSResolver::create):
  • bindings/js/JSNamedNodeMapCustom.cpp:
  • bindings/js/JSNamedNodesCollection.cpp: (WebCore::JSNamedNodesCollection::JSNamedNodesCollection):
  • bindings/js/JSNamedNodesCollection.h: (WebCore::JSNamedNodesCollection::classInfo):
  • bindings/js/JSNavigatorCustom.cpp:
  • bindings/js/JSNodeCustom.cpp:
  • bindings/js/JSNodeFilterCondition.cpp: (WebCore::JSNodeFilterCondition::acceptNode):
  • bindings/js/JSNodeFilterCondition.h: (WebCore::JSNodeFilterCondition::create):
  • bindings/js/JSNodeFilterCustom.cpp:
  • bindings/js/JSNodeIteratorCustom.cpp:
  • bindings/js/JSNodeListCustom.cpp:
  • bindings/js/JSPluginArrayCustom.cpp:
  • bindings/js/JSPluginCustom.cpp:
  • bindings/js/JSPluginElementFunctions.cpp: (WebCore::getRuntimeObject):
  • bindings/js/JSPluginElementFunctions.h:
  • bindings/js/JSQuarantinedObjectWrapper.cpp: (WebCore::JSQuarantinedObjectWrapper::construct): (WebCore::JSQuarantinedObjectWrapper::call):
  • bindings/js/JSQuarantinedObjectWrapper.h: (WebCore::JSQuarantinedObjectWrapper::unwrappedObject): (WebCore::JSQuarantinedObjectWrapper::unwrappedGlobalObject): (WebCore::JSQuarantinedObjectWrapper::className):
  • bindings/js/JSRGBColor.cpp:
  • bindings/js/JSRGBColor.h: (WebCore::JSRGBColor::classInfo):
  • bindings/js/JSSQLResultSetRowListCustom.cpp:
  • bindings/js/JSSQLTransactionCustom.cpp:
  • bindings/js/JSSVGLazyEventListener.cpp:
  • bindings/js/JSSVGLazyEventListener.h:
  • bindings/js/JSSVGLengthCustom.cpp:
  • bindings/js/JSSVGMatrixCustom.cpp: (WebCore::JSSVGMatrix::inverse): (WebCore::JSSVGMatrix::rotateFromVector):
  • bindings/js/JSSVGPathSegCustom.cpp:
  • bindings/js/JSSVGPathSegListCustom.cpp: (WebCore::JSSVGPathSegList::initialize): (WebCore::JSSVGPathSegList::getItem): (WebCore::JSSVGPathSegList::insertItemBefore): (WebCore::JSSVGPathSegList::replaceItem): (WebCore::JSSVGPathSegList::removeItem): (WebCore::JSSVGPathSegList::appendItem):
  • bindings/js/JSSVGPointListCustom.cpp:
  • bindings/js/JSSVGTransformListCustom.cpp:
  • bindings/js/JSStorageCustom.cpp:
  • bindings/js/JSStyleSheetCustom.cpp:
  • bindings/js/JSStyleSheetListCustom.cpp:
  • bindings/js/JSTextCustom.cpp:
  • bindings/js/JSTreeWalkerCustom.cpp:
  • bindings/js/JSXMLHttpRequestConstructor.cpp:
  • bindings/js/JSXMLHttpRequestConstructor.h: (WebCore::JSXMLHttpRequestConstructor::classInfo):
  • bindings/js/JSXMLHttpRequestCustom.cpp:
  • bindings/js/JSXMLHttpRequestUploadCustom.cpp:
  • bindings/js/JSXSLTProcessorConstructor.cpp:
  • bindings/js/JSXSLTProcessorConstructor.h: (WebCore::JSXSLTProcessorConstructor::classInfo):
  • bindings/js/JSXSLTProcessorCustom.cpp:
  • bindings/js/ScheduledAction.cpp:
  • bindings/js/ScheduledAction.h:
  • bindings/js/ScriptController.cpp: (WebCore::ScriptController::attachDebugger): (WebCore::ScriptController::windowScriptNPObject):
  • bindings/js/ScriptController.h:
  • bindings/js/ScriptControllerGtk.cpp: (WebCore::ScriptController::createScriptInstanceForWidget):
  • bindings/js/ScriptControllerMac.mm: (WebCore::ScriptController::createScriptInstanceForWidget): (WebCore::ScriptController::windowScriptObject): (WebCore::ScriptController::clearPlatformScriptObjects): (WebCore::updateRenderingForBindings): (WebCore::ScriptController::initJavaJSBindings):
  • bindings/js/ScriptControllerQt.cpp: (WebCore::ScriptController::createScriptInstanceForWidget):
  • bindings/js/ScriptControllerWin.cpp: (WebCore::ScriptController::createScriptInstanceForWidget):
  • bindings/js/ScriptControllerWx.cpp: (WebCore::ScriptController::createScriptInstanceForWidget):
  • bindings/js/StringSourceProvider.h: (WebCore::StringSourceProvider::getRange):
  • bindings/objc/DOM.mm: (-[DOMNode JSC::Bindings::]):
  • bindings/objc/DOMInternal.h:
  • bindings/objc/DOMInternal.mm: (-[WebScriptObject _initializeScriptDOMNodeImp]):
  • bindings/objc/DOMUtility.mm: (JSC::createDOMWrapper): (WebCore::createDOMWrapper):
  • bindings/objc/WebScriptObject.mm: (WebCore::createJSWrapper): (-[WebScriptObject _initWithJSObject:JSC::originRootObject:JSC::Bindings::rootObject:JSC::Bindings::]):
  • bindings/objc/WebScriptObjectPrivate.h:
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/NP_jsobject.cpp:
  • bridge/NP_jsobject.h:
  • bridge/c/c_class.cpp:
  • bridge/c/c_class.h:
  • bridge/c/c_instance.cpp:
  • bridge/c/c_instance.h:
  • bridge/c/c_runtime.cpp:
  • bridge/c/c_runtime.h:
  • bridge/c/c_utility.cpp:
  • bridge/c/c_utility.h:
  • bridge/jni/jni_class.cpp:
  • bridge/jni/jni_class.h:
  • bridge/jni/jni_instance.cpp:
  • bridge/jni/jni_instance.h:
  • bridge/jni/jni_jsobject.h:
  • bridge/jni/jni_jsobject.mm: (JavaJSObject::call): (JavaJSObject::convertJObjectToValue):
  • bridge/jni/jni_objc.mm: (JSC::Bindings::dispatchJNICall):
  • bridge/jni/jni_runtime.cpp:
  • bridge/jni/jni_runtime.h:
  • bridge/jni/jni_utility.cpp:
  • bridge/jni/jni_utility.h:
  • bridge/npruntime.cpp: (_NPN_GetStringIdentifier):
  • bridge/objc/WebScriptObject.h:
  • bridge/objc/objc_class.h:
  • bridge/objc/objc_class.mm:
  • bridge/objc/objc_instance.h:
  • bridge/objc/objc_instance.mm:
  • bridge/objc/objc_runtime.h:
  • bridge/objc/objc_runtime.mm:
  • bridge/objc/objc_utility.h:
  • bridge/objc/objc_utility.mm:
  • bridge/qt/qt_class.cpp:
  • bridge/qt/qt_class.h:
  • bridge/qt/qt_instance.cpp:
  • bridge/qt/qt_instance.h:
  • bridge/qt/qt_runtime.cpp: (JSC::Bindings::convertQVariantToValue): (JSC::Bindings::):
  • bridge/qt/qt_runtime.h:
  • bridge/runtime.cpp:
  • bridge/runtime.h:
  • bridge/runtime_array.cpp:
  • bridge/runtime_array.h:
  • bridge/runtime_method.cpp:
  • bridge/runtime_method.h:
  • bridge/runtime_object.cpp:
  • bridge/runtime_object.h:
  • bridge/runtime_root.cpp: (JSC::Bindings::RootObject::invalidate): (JSC::Bindings::RootObject::gcProtect): (JSC::Bindings::RootObject::gcUnprotect):
  • bridge/runtime_root.h:
  • bridge/testbindings.cpp:
  • bridge/testbindings.mm:
  • bridge/testqtbindings.cpp:
  • dom/Document.cpp: (WebCore::Document::~Document):
  • dom/NSResolver.h:
  • dom/Node.cpp: (WebCore::Node::setDocument): (WebCore::ResolveNamespaceFunctor::ResolveNamespaceFunctor): (WebCore::resolveNamespacesForSelector): (WebCore::Node::querySelector): (WebCore::Node::querySelectorAll):
  • dom/Node.h:
  • dom/NodeFilter.cpp:
  • dom/NodeFilter.h:
  • dom/NodeFilterCondition.cpp:
  • dom/NodeFilterCondition.h:
  • dom/NodeIterator.cpp:
  • dom/NodeIterator.h:
  • dom/Traversal.cpp:
  • dom/Traversal.h:
  • dom/TreeWalker.cpp:
  • dom/TreeWalker.h:
  • dom/make_names.pl:
  • history/CachedPage.cpp:
  • history/CachedPage.h:
  • html/HTMLPlugInElement.cpp: (WebCore::HTMLPlugInElement::getInstance):
  • html/HTMLPlugInElement.h:
  • loader/FrameLoader.cpp:
  • loader/FrameLoader.h:
  • loader/icon/IconDatabase.cpp: (WebCore::iconDatabase):
  • page/Console.cpp:
  • page/Console.h:
  • page/InspectorController.cpp: (WebCore::XMLHttpRequestResource::XMLHttpRequestResource): (WebCore::XMLHttpRequestResource::~XMLHttpRequestResource): (WebCore::InspectorResource::setXMLHttpRequestProperties): (WebCore::InspectorResource::sourceString): (WebCore::getResourceDocumentNode): (WebCore::search): (WebCore::InspectorController::focusNode): (WebCore::InspectorController::inspectedWindowScriptObjectCleared): (WebCore::InspectorController::addDatabaseScriptResource): (WebCore::InspectorController::resourceRetrievedByXMLHttpRequest):
  • page/InspectorController.h: (WebCore::InspectorController::profiles):
  • page/JavaScriptCallFrame.cpp: (WebCore::JavaScriptCallFrame::scopeChain):
  • page/JavaScriptCallFrame.h: (WebCore::JavaScriptCallFrame::create): (WebCore::JavaScriptCallFrame::update):
  • page/JavaScriptDebugListener.h:
  • page/JavaScriptDebugServer.cpp: (WebCore::dispatchDidParseSource):
  • page/JavaScriptDebugServer.h:
  • page/JavaScriptProfile.cpp:
  • page/JavaScriptProfile.h:
  • page/JavaScriptProfileNode.cpp: (WebCore::getTotalTime): (WebCore::getSelfTime): (WebCore::getTotalPercent): (WebCore::getSelfPercent): (WebCore::getNumberOfCalls): (WebCore::getChildren): (WebCore::getVisible):
  • page/JavaScriptProfileNode.h:
  • page/Page.cpp: (WebCore::Page::setDebuggerForAllPages): (WebCore::Page::setDebugger):
  • page/Page.h: (WebCore::Page::debugger):
  • page/mac/FrameMac.mm:
  • platform/KURL.h: (WebCore::KURL::operator JSC::UString):
  • platform/text/AtomicString.cpp: (WebCore::AtomicString::add): (WebCore::AtomicString::find):
  • platform/text/AtomicString.h: (WebCore::AtomicString::AtomicString):
  • platform/text/PlatformString.h:
  • platform/text/String.cpp: (WebCore::charactersToDouble):
  • platform/win/BString.cpp:
  • platform/win/BString.h:
  • plugins/MimeTypeArray.h:
  • plugins/Plugin.h:
  • plugins/PluginArray.h:
  • plugins/PluginView.cpp: (WebCore::PluginView::start): (WebCore::PluginView::performRequest): (WebCore::PluginView::bindingInstance):
  • plugins/PluginView.h:
  • plugins/gtk/PluginViewGtk.cpp: (WebCore::PluginView::paint): (WebCore::PluginView::handleKeyboardEvent): (WebCore::PluginView::handleMouseEvent): (WebCore::PluginView::setNPWindowRect): (WebCore::PluginView::stop): (WebCore::PluginView::init):
  • plugins/qt/PluginViewQt.cpp: (WebCore::PluginView::setNPWindowRect): (WebCore::PluginView::stop): (WebCore::PluginView::init):
  • plugins/win/PluginViewWin.cpp: (WebCore::PluginView::dispatchNPEvent): (WebCore::PluginView::handleKeyboardEvent): (WebCore::PluginView::handleMouseEvent): (WebCore::PluginView::setNPWindowRect): (WebCore::PluginView::stop):
  • storage/Database.cpp: (WebCore::Database::Database):
  • xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseText): (WebCore::XMLHttpRequest::loadRequestAsynchronously): (WebCore::XMLHttpRequest::clearResponse): (WebCore::XMLHttpRequest::dropProtection): (WebCore::XMLHttpRequest::didFinishLoading): (WebCore::XMLHttpRequest::didReceiveData):
  • xml/XMLHttpRequest.h:

WebKit/gtk:

  • webkit/webkitprivate.cpp: (webkit_init):

WebKit/mac:

  • Misc/WebCoreStatistics.mm:
  • Plugins/WebBaseNetscapePluginStream.mm: (-[WebBaseNetscapePluginStream wantsAllStreams]):
  • Plugins/WebBaseNetscapePluginView.mm: (-[WebBaseNetscapePluginView sendEvent:isDrawRect:]): (-[WebBaseNetscapePluginView setWindowIfNecessary]): (-[WebBaseNetscapePluginView start]): (-[WebBaseNetscapePluginView createPluginScriptableObject]): (-[WebBaseNetscapePluginView evaluateJavaScriptPluginRequest:]): (-[WebBaseNetscapePluginView webFrame:didFinishLoadWithReason:]): (-[WebBaseNetscapePluginView loadPluginRequest:]): (-[WebBaseNetscapePluginView _printedPluginBitmap]):
  • Plugins/WebPluginController.mm: (+[WebPluginController plugInViewWithArguments:fromPluginPackage:]): (-[WebPluginController startAllPlugins]): (-[WebPluginController stopAllPlugins]): (-[WebPluginController addPlugin:]): (-[WebPluginController destroyPlugin:]): (-[WebPluginController destroyAllPlugins]):
  • WebView/WebFrame.mm:
  • WebView/WebScriptDebugDelegate.mm:
  • WebView/WebScriptDebugger.h:
  • WebView/WebScriptDebugger.mm:
  • WebView/WebView.mm: (-[WebViewPrivate init]):

WebKit/qt:


  • Api/qwebframe.cpp: (QWebFrame::addToJavaScriptWindowObject): (QWebFrame::evaluateJavaScript):

WebKit/win:

  • WebCoreStatistics.cpp:
  • WebJavaScriptCollector.cpp:
  • WebScriptCallFrame.cpp: (WebScriptCallFrame::jsValueToString):
  • WebScriptCallFrame.h: (WebScriptCallFrame::state):
  • WebView.cpp: (WebView::WebView): (WebView::stringByEvaluatingJavaScriptFromString):

WebKit/wx:

  • WebFrame.cpp: (wxWebFrame::RunScript):
  • Property svn:eol-style set to native
File size: 19.3 KB
Line 
1/*
2 * Copyright (C) 2007, 2008 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#include "config.h"
31#include "JSGlobalObject.h"
32
33#include "ArrayConstructor.h"
34#include "ArrayPrototype.h"
35#include "BooleanConstructor.h"
36#include "BooleanPrototype.h"
37#include "CodeBlock.h"
38#include "DateConstructor.h"
39#include "DatePrototype.h"
40#include "ErrorConstructor.h"
41#include "ErrorPrototype.h"
42#include "FunctionConstructor.h"
43#include "FunctionPrototype.h"
44#include "GlobalEvalFunction.h"
45#include "JSGlobalObjectFunctions.h"
46#include "JSLock.h"
47#include "Machine.h"
48#include "MathObject.h"
49#include "NativeErrorConstructor.h"
50#include "NativeErrorPrototype.h"
51#include "NumberConstructor.h"
52#include "NumberPrototype.h"
53#include "ObjectConstructor.h"
54#include "ObjectPrototype.h"
55#include "Profiler.h"
56#include "PrototypeFunction.h"
57#include "RegExpConstructor.h"
58#include "RegExpPrototype.h"
59#include "ScopeChainMark.h"
60#include "StringConstructor.h"
61#include "StringPrototype.h"
62#include "debugger.h"
63
64namespace JSC {
65
66ASSERT_CLASS_FITS_IN_CELL(JSGlobalObject);
67
68// Default number of ticks before a timeout check should be done.
69static const int initialTickCountThreshold = 255;
70
71// Preferred number of milliseconds between each timeout check
72static const int preferredScriptCheckTimeInterval = 1000;
73
74static inline void markIfNeeded(JSValue* v)
75{
76 if (v && !v->marked())
77 v->mark();
78}
79
80JSGlobalObject::~JSGlobalObject()
81{
82 ASSERT(JSLock::currentThreadIsHoldingLock());
83
84 if (d()->debugger)
85 d()->debugger->detach(this);
86
87 Profiler** profiler = Profiler::enabledProfilerReference();
88 if (UNLIKELY(*profiler != 0)) {
89 (*profiler)->stopProfiling(globalExec(), UString());
90 }
91
92 d()->next->d()->prev = d()->prev;
93 d()->prev->d()->next = d()->next;
94 JSGlobalObject*& headObject = head();
95 if (headObject == this)
96 headObject = d()->next;
97 if (headObject == this)
98 headObject = 0;
99
100 HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
101 for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
102 (*it)->globalObject = 0;
103
104 RegisterFile& registerFile = globalData()->machine->registerFile();
105 if (registerFile.globalObject() == this) {
106 registerFile.setGlobalObject(0);
107 registerFile.setNumGlobals(0);
108 }
109 delete d();
110}
111
112void JSGlobalObject::init(JSObject* thisValue)
113{
114 ASSERT(JSLock::currentThreadIsHoldingLock());
115
116 d()->globalData = Heap::heap(this)->globalData();
117
118 if (JSGlobalObject*& headObject = head()) {
119 d()->prev = headObject;
120 d()->next = headObject->d()->next;
121 headObject->d()->next->d()->prev = this;
122 headObject->d()->next = this;
123 } else
124 headObject = d()->next = d()->prev = this;
125
126 d()->recursion = 0;
127 d()->debugger = 0;
128 globalData()->machine->initTimeout();
129
130 d()->globalExec.set(new ExecState(this, thisValue, d()->globalScopeChain.node()));
131
132 d()->profileGroup = 0;
133
134 reset(prototype());
135}
136
137void JSGlobalObject::put(ExecState* exec, const Identifier& propertyName, JSValue* value, PutPropertySlot& slot)
138{
139 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
140
141 if (symbolTablePut(propertyName, value))
142 return;
143 JSVariableObject::put(exec, propertyName, value, slot);
144}
145
146void JSGlobalObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue* value, unsigned attributes)
147{
148 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
149
150 if (symbolTablePutWithAttributes(propertyName, value, attributes))
151 return;
152
153 JSValue* valueBefore = getDirect(propertyName);
154 PutPropertySlot slot;
155 JSVariableObject::put(exec, propertyName, value, slot);
156 if (!valueBefore) {
157 if (JSValue* valueAfter = getDirect(propertyName))
158 putDirect(propertyName, valueAfter, attributes);
159 }
160}
161
162void JSGlobalObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunc)
163{
164 PropertySlot slot;
165 if (!symbolTableGet(propertyName, slot))
166 JSVariableObject::defineGetter(exec, propertyName, getterFunc);
167}
168
169void JSGlobalObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunc)
170{
171 PropertySlot slot;
172 if (!symbolTableGet(propertyName, slot))
173 JSVariableObject::defineSetter(exec, propertyName, setterFunc);
174}
175
176static inline JSObject* lastInPrototypeChain(JSObject* object)
177{
178 JSObject* o = object;
179 while (o->prototype()->isObject())
180 o = static_cast<JSObject*>(o->prototype());
181 return o;
182}
183
184void JSGlobalObject::reset(JSValue* prototype)
185{
186 // Clear before inititalizing, to avoid calling mark() on stale pointers --
187 // which would be wasteful -- or uninitialized pointers -- which would be
188 // dangerous. (The allocations below may cause a GC.)
189
190 ASSERT(!hasCustomProperties());
191 symbolTable().clear();
192 setRegisterArray(0, 0);
193
194 // Prototypes
195 d()->functionPrototype = 0;
196 d()->objectPrototype = 0;
197
198 d()->arrayPrototype = 0;
199 d()->stringPrototype = 0;
200 d()->booleanPrototype = 0;
201 d()->numberPrototype = 0;
202 d()->datePrototype = 0;
203 d()->regExpPrototype = 0;
204 d()->errorPrototype = 0;
205
206 d()->evalErrorPrototype = 0;
207 d()->rangeErrorPrototype = 0;
208 d()->referenceErrorPrototype = 0;
209 d()->syntaxErrorPrototype = 0;
210 d()->typeErrorPrototype = 0;
211 d()->URIErrorPrototype = 0;
212
213 // Constructors
214 d()->regExpConstructor = 0;
215 d()->errorConstructor = 0;
216
217 d()->evalErrorConstructor = 0;
218 d()->rangeErrorConstructor = 0;
219 d()->referenceErrorConstructor = 0;
220 d()->syntaxErrorConstructor = 0;
221 d()->typeErrorConstructor = 0;
222 d()->URIErrorConstructor = 0;
223
224 d()->evalFunction = 0;
225
226 ExecState* exec = d()->globalExec.get();
227
228 // Prototypes
229
230 d()->functionPrototype = new (exec) FunctionPrototype(exec);
231 d()->objectPrototype = new (exec) ObjectPrototype(exec, d()->functionPrototype);
232 d()->functionPrototype->setPrototype(d()->objectPrototype);
233
234 d()->arrayPrototype = new (exec) ArrayPrototype(exec, d()->objectPrototype);
235 d()->stringPrototype = new (exec) StringPrototype(exec, d()->objectPrototype);
236 d()->booleanPrototype = new (exec) BooleanPrototype(exec, d()->objectPrototype, d()->functionPrototype);
237 d()->numberPrototype = new (exec) NumberPrototype(exec, d()->objectPrototype, d()->functionPrototype);
238 d()->datePrototype = new (exec) DatePrototype(exec, d()->objectPrototype);
239 d()->regExpPrototype = new (exec) RegExpPrototype(exec, d()->objectPrototype, d()->functionPrototype);
240 d()->errorPrototype = new (exec) ErrorPrototype(exec, d()->objectPrototype, d()->functionPrototype);
241
242 d()->evalErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "EvalError", "EvalError");
243 d()->rangeErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "RangeError", "RangeError");
244 d()->referenceErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "ReferenceError", "ReferenceError");
245 d()->syntaxErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "SyntaxError", "SyntaxError");
246 d()->typeErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "TypeError", "TypeError");
247 d()->URIErrorPrototype = new (exec) NativeErrorPrototype(exec, d()->errorPrototype, "URIError", "URIError");
248
249 // Constructors
250
251 JSValue* objectConstructor = new (exec) ObjectConstructor(exec, d()->objectPrototype, d()->functionPrototype);
252 JSValue* functionConstructor = new (exec) FunctionConstructor(exec, d()->functionPrototype);
253 JSValue* arrayConstructor = new (exec) ArrayConstructor(exec, d()->functionPrototype, d()->arrayPrototype);
254 JSValue* stringConstructor = new (exec) StringConstructor(exec, d()->functionPrototype, d()->stringPrototype);
255 JSValue* booleanConstructor = new (exec) BooleanConstructor(exec, d()->functionPrototype, d()->booleanPrototype);
256 JSValue* numberConstructor = new (exec) NumberConstructor(exec, d()->functionPrototype, d()->numberPrototype);
257 JSValue* dateConstructor = new (exec) DateConstructor(exec, d()->functionPrototype, d()->datePrototype);
258
259 d()->regExpConstructor = new (exec) RegExpConstructor(exec, d()->functionPrototype, d()->regExpPrototype);
260
261 d()->errorConstructor = new (exec) ErrorConstructor(exec, d()->functionPrototype, d()->errorPrototype);
262
263 d()->evalErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->evalErrorPrototype);
264 d()->rangeErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->rangeErrorPrototype);
265 d()->referenceErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->referenceErrorPrototype);
266 d()->syntaxErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->syntaxErrorPrototype);
267 d()->typeErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->typeErrorPrototype);
268 d()->URIErrorConstructor = new (exec) NativeErrorConstructor(exec, d()->functionPrototype, d()->URIErrorPrototype);
269
270 d()->functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);
271
272 d()->objectPrototype->putDirect(exec->propertyNames().constructor, objectConstructor, DontEnum);
273 d()->functionPrototype->putDirect(exec->propertyNames().constructor, functionConstructor, DontEnum);
274 d()->arrayPrototype->putDirect(exec->propertyNames().constructor, arrayConstructor, DontEnum);
275 d()->booleanPrototype->putDirect(exec->propertyNames().constructor, booleanConstructor, DontEnum);
276 d()->stringPrototype->putDirect(exec->propertyNames().constructor, stringConstructor, DontEnum);
277 d()->numberPrototype->putDirect(exec->propertyNames().constructor, numberConstructor, DontEnum);
278 d()->datePrototype->putDirect(exec->propertyNames().constructor, dateConstructor, DontEnum);
279 d()->regExpPrototype->putDirect(exec->propertyNames().constructor, d()->regExpConstructor, DontEnum);
280 d()->errorPrototype->putDirect(exec->propertyNames().constructor, d()->errorConstructor, DontEnum);
281 d()->evalErrorPrototype->putDirect(exec->propertyNames().constructor, d()->evalErrorConstructor, DontEnum);
282 d()->rangeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->rangeErrorConstructor, DontEnum);
283 d()->referenceErrorPrototype->putDirect(exec->propertyNames().constructor, d()->referenceErrorConstructor, DontEnum);
284 d()->syntaxErrorPrototype->putDirect(exec->propertyNames().constructor, d()->syntaxErrorConstructor, DontEnum);
285 d()->typeErrorPrototype->putDirect(exec->propertyNames().constructor, d()->typeErrorConstructor, DontEnum);
286 d()->URIErrorPrototype->putDirect(exec->propertyNames().constructor, d()->URIErrorConstructor, DontEnum);
287
288 // Set global constructors
289
290 // FIXME: These properties could be handled by a static hash table.
291
292 putDirect(Identifier(exec, "Object"), objectConstructor, DontEnum);
293 putDirect(Identifier(exec, "Function"), functionConstructor, DontEnum);
294 putDirect(Identifier(exec, "Array"), arrayConstructor, DontEnum);
295 putDirect(Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
296 putDirect(Identifier(exec, "String"), stringConstructor, DontEnum);
297 putDirect(Identifier(exec, "Number"), numberConstructor, DontEnum);
298 putDirect(Identifier(exec, "Date"), dateConstructor, DontEnum);
299 putDirect(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum);
300 putDirect(Identifier(exec, "Error"), d()->errorConstructor, DontEnum);
301 putDirect(Identifier(exec, "EvalError"), d()->evalErrorConstructor);
302 putDirect(Identifier(exec, "RangeError"), d()->rangeErrorConstructor);
303 putDirect(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor);
304 putDirect(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor);
305 putDirect(Identifier(exec, "TypeError"), d()->typeErrorConstructor);
306 putDirect(Identifier(exec, "URIError"), d()->URIErrorConstructor);
307
308 // Set global values.
309 GlobalPropertyInfo staticGlobals[] = {
310 GlobalPropertyInfo(Identifier(exec, "Math"), new (exec) MathObject(exec, d()->objectPrototype), DontEnum | DontDelete),
311 GlobalPropertyInfo(Identifier(exec, "NaN"), jsNaN(exec), DontEnum | DontDelete),
312 GlobalPropertyInfo(Identifier(exec, "Infinity"), jsNumber(exec, Inf), DontEnum | DontDelete),
313 GlobalPropertyInfo(Identifier(exec, "undefined"), jsUndefined(), DontEnum | DontDelete)
314 };
315
316 addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
317
318 // Set global functions.
319
320 d()->evalFunction = new (exec) GlobalEvalFunction(exec, d()->functionPrototype, 1, exec->propertyNames().eval, globalFuncEval, this);
321 putDirectFunction(exec, d()->evalFunction, DontEnum);
322 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 2, Identifier(exec, "parseInt"), globalFuncParseInt), DontEnum);
323 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "parseFloat"), globalFuncParseFloat), DontEnum);
324 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "isNaN"), globalFuncIsNaN), DontEnum);
325 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "isFinite"), globalFuncIsFinite), DontEnum);
326 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "escape"), globalFuncEscape), DontEnum);
327 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "unescape"), globalFuncUnescape), DontEnum);
328 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "decodeURI"), globalFuncDecodeURI), DontEnum);
329 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "decodeURIComponent"), globalFuncDecodeURIComponent), DontEnum);
330 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "encodeURI"), globalFuncEncodeURI), DontEnum);
331 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "encodeURIComponent"), globalFuncEncodeURIComponent), DontEnum);
332#ifndef NDEBUG
333 putDirectFunction(exec, new (exec) PrototypeFunction(exec, d()->functionPrototype, 1, Identifier(exec, "kjsprint"), globalFuncKJSPrint), DontEnum);
334#endif
335
336 resetPrototype(prototype);
337}
338
339// Set prototype, and also insert the object prototype at the end of the chain.
340void JSGlobalObject::resetPrototype(JSValue* prototype)
341{
342 setPrototype(prototype);
343 lastInPrototypeChain(this)->setPrototype(d()->objectPrototype);
344}
345
346void JSGlobalObject::setTimeoutTime(unsigned timeoutTime)
347{
348 globalData()->machine->setTimeoutTime(timeoutTime);
349}
350
351void JSGlobalObject::startTimeoutCheck()
352{
353 globalData()->machine->startTimeoutCheck();
354}
355
356void JSGlobalObject::stopTimeoutCheck()
357{
358 globalData()->machine->stopTimeoutCheck();
359}
360
361void JSGlobalObject::mark()
362{
363 JSVariableObject::mark();
364
365 HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
366 for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
367 (*it)->mark();
368
369 RegisterFile& registerFile = globalData()->machine->registerFile();
370 if (registerFile.globalObject() == this)
371 registerFile.markGlobals(globalData()->heap);
372
373 markIfNeeded(d()->globalExec->exception());
374
375 markIfNeeded(d()->regExpConstructor);
376 markIfNeeded(d()->errorConstructor);
377 markIfNeeded(d()->evalErrorConstructor);
378 markIfNeeded(d()->rangeErrorConstructor);
379 markIfNeeded(d()->referenceErrorConstructor);
380 markIfNeeded(d()->syntaxErrorConstructor);
381 markIfNeeded(d()->typeErrorConstructor);
382 markIfNeeded(d()->URIErrorConstructor);
383
384 markIfNeeded(d()->evalFunction);
385
386 markIfNeeded(d()->objectPrototype);
387 markIfNeeded(d()->functionPrototype);
388 markIfNeeded(d()->arrayPrototype);
389 markIfNeeded(d()->booleanPrototype);
390 markIfNeeded(d()->stringPrototype);
391 markIfNeeded(d()->numberPrototype);
392 markIfNeeded(d()->datePrototype);
393 markIfNeeded(d()->regExpPrototype);
394 markIfNeeded(d()->errorPrototype);
395 markIfNeeded(d()->evalErrorPrototype);
396 markIfNeeded(d()->rangeErrorPrototype);
397 markIfNeeded(d()->referenceErrorPrototype);
398 markIfNeeded(d()->syntaxErrorPrototype);
399 markIfNeeded(d()->typeErrorPrototype);
400 markIfNeeded(d()->URIErrorPrototype);
401}
402
403JSGlobalObject* JSGlobalObject::toGlobalObject(ExecState*) const
404{
405 return const_cast<JSGlobalObject*>(this);
406}
407
408ExecState* JSGlobalObject::globalExec()
409{
410 return d()->globalExec.get();
411}
412
413bool JSGlobalObject::isDynamicScope() const
414{
415 return true;
416}
417
418void JSGlobalObject::copyGlobalsFrom(RegisterFile& registerFile)
419{
420 ASSERT(!d()->registerArray);
421 ASSERT(!d()->registerArraySize);
422
423 int numGlobals = registerFile.numGlobals();
424 if (!numGlobals) {
425 d()->registers = 0;
426 return;
427 }
428 copyRegisterArray(registerFile.lastGlobal(), numGlobals);
429}
430
431void JSGlobalObject::copyGlobalsTo(RegisterFile& registerFile)
432{
433 JSGlobalObject* lastGlobalObject = registerFile.globalObject();
434 if (lastGlobalObject && lastGlobalObject != this)
435 lastGlobalObject->copyGlobalsFrom(registerFile);
436
437 registerFile.setGlobalObject(this);
438 registerFile.setNumGlobals(symbolTable().size());
439
440 if (d()->registerArray) {
441 memcpy(registerFile.base() - d()->registerArraySize, d()->registerArray.get(), d()->registerArraySize * sizeof(Register));
442 setRegisterArray(0, 0);
443 }
444
445 d()->registers = registerFile.base();
446}
447
448void* JSGlobalObject::operator new(size_t size, JSGlobalData* globalData)
449{
450#ifdef JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE
451 return globalData->heap->inlineAllocate(size);
452#else
453 return globalData->heap->allocate(size);
454#endif
455}
456
457} // namespace JSC
Note: See TracBrowser for help on using the repository browser.