source: webkit/trunk/JavaScriptCore/kjs/JSImmediate.h@ 36270

Last change on this file since 36270 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: 16.7 KB
Line 
1/*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 Alexey Proskuryakov ([email protected])
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22#ifndef KJS_JS_IMMEDIATE_H
23#define KJS_JS_IMMEDIATE_H
24
25#include <wtf/Assertions.h>
26#include <wtf/AlwaysInline.h>
27#include <wtf/MathExtras.h>
28#include <limits>
29#include <limits.h>
30#include <stdarg.h>
31#include <stdint.h>
32#include <stdlib.h>
33
34namespace JSC {
35
36 class ExecState;
37 class JSObject;
38 class JSValue;
39 class UString;
40
41 /*
42 * A JSValue* is either a pointer to a cell (a heap-allocated object) or an immediate (a type-tagged
43 * value masquerading as a pointer). The low two bits in a JSValue* are available for type tagging
44 * because allocator alignment guarantees they will be 00 in cell pointers.
45 *
46 * For example, on a 32 bit system:
47 *
48 * JSCell*: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 00
49 * [ high 30 bits: pointer address ] [ low 2 bits -- always 0 ]
50 * JSImmediate: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX TT
51 * [ high 30 bits: 'payload' ] [ low 2 bits -- tag ]
52 *
53 * Where the bottom two bits are non-zero they either indicate that the immediate is a 31 bit signed
54 * integer, or they mark the value as being an immediate of a type other than integer, with a secondary
55 * tag used to indicate the exact type.
56 *
57 * Where the lowest bit is set (TT is equal to 01 or 11) the high 31 bits form a 31 bit signed int value.
58 * Where TT is equal to 10 this indicates this is a type of immediate other than an integer, and the next
59 * two bits will form an extended tag.
60 *
61 * 31 bit signed int: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X1
62 * [ high 30 bits of the value ] [ high bit part of value ]
63 * Other: YYYYYYYYYYYYYYYYYYYYYYYYYYYY ZZ 10
64 * [ extended 'payload' ] [ extended tag ] [ tag 'other' ]
65 *
66 * Where the first bit of the extended tag is set this flags the value as being a boolean, and the following
67 * bit would flag the value as undefined. If neither bits are set, the value is null.
68 *
69 * Other: YYYYYYYYYYYYYYYYYYYYYYYYYYYY UB 10
70 * [ extended 'payload' ] [ undefined | bool ] [ tag 'other' ]
71 *
72 * For boolean value the lowest bit in the payload holds the value of the bool, all remaining bits are zero.
73 * For undefined or null immediates the payload is zero.
74 *
75 * Boolean: 000000000000000000000000000V 01 10
76 * [ boolean value ] [ bool ] [ tag 'other' ]
77 * Undefined: 0000000000000000000000000000 10 10
78 * [ zero ] [ undefined ] [ tag 'other' ]
79 * Null: 0000000000000000000000000000 00 10
80 * [ zero ] [ zero ] [ tag 'other' ]
81 */
82
83 class JSImmediate {
84 private:
85 friend class CTI; // Whooo!
86
87 static const uintptr_t TagMask = 0x3u; // primary tag is 2 bits long
88 static const uintptr_t TagBitTypeInteger = 0x1u; // bottom bit set indicates integer, this dominates the following bit
89 static const uintptr_t TagBitTypeOther = 0x2u; // second bit set indicates immediate other than an integer
90
91 static const uintptr_t ExtendedTagMask = 0xCu; // extended tag holds a further two bits
92 static const uintptr_t ExtendedTagBitBool = 0x4u;
93 static const uintptr_t ExtendedTagBitUndefined = 0x8u;
94
95 static const uintptr_t FullTagTypeMask = TagMask | ExtendedTagMask;
96 static const uintptr_t FullTagTypeBool = TagBitTypeOther | ExtendedTagBitBool;
97 static const uintptr_t FullTagTypeUndefined = TagBitTypeOther | ExtendedTagBitUndefined;
98 static const uintptr_t FullTagTypeNull = TagBitTypeOther;
99
100 static const uint32_t IntegerPayloadShift = 1u;
101 static const uint32_t ExtendedPayloadShift = 4u;
102
103 static const uintptr_t ExtendedPayloadBitBoolValue = 1 << ExtendedPayloadShift;
104
105 public:
106 static ALWAYS_INLINE bool isImmediate(const JSValue* v)
107 {
108 return reinterpret_cast<uintptr_t>(v) & TagMask;
109 }
110
111 static ALWAYS_INLINE bool isNumber(const JSValue* v)
112 {
113 return reinterpret_cast<uintptr_t>(v) & TagBitTypeInteger;
114 }
115
116 static ALWAYS_INLINE bool isPositiveNumber(const JSValue* v)
117 {
118 // A single mask to check for the sign bit and the number tag all at once.
119 return (reinterpret_cast<uintptr_t>(v) & (0x80000000 | TagBitTypeInteger)) == TagBitTypeInteger;
120 }
121
122 static ALWAYS_INLINE bool isBoolean(const JSValue* v)
123 {
124 return (reinterpret_cast<uintptr_t>(v) & FullTagTypeMask) == FullTagTypeBool;
125 }
126
127 static ALWAYS_INLINE bool isUndefinedOrNull(const JSValue* v)
128 {
129 // Undefined and null share the same value, bar the 'undefined' bit in the extended tag.
130 return (reinterpret_cast<uintptr_t>(v) & ~ExtendedTagBitUndefined) == FullTagTypeNull;
131 }
132
133 static bool isNegative(const JSValue* v)
134 {
135 ASSERT(isNumber(v));
136 return reinterpret_cast<uintptr_t>(v) & 0x80000000;
137 }
138
139 static JSValue* from(char);
140 static JSValue* from(signed char);
141 static JSValue* from(unsigned char);
142 static JSValue* from(short);
143 static JSValue* from(unsigned short);
144 static JSValue* from(int);
145 static JSValue* from(unsigned);
146 static JSValue* from(long);
147 static JSValue* from(unsigned long);
148 static JSValue* from(long long);
149 static JSValue* from(unsigned long long);
150 static JSValue* from(double);
151
152 static ALWAYS_INLINE bool isEitherImmediate(const JSValue* v1, const JSValue* v2)
153 {
154 return (reinterpret_cast<uintptr_t>(v1) | reinterpret_cast<uintptr_t>(v2)) & TagMask;
155 }
156
157 static ALWAYS_INLINE bool areBothImmediateNumbers(const JSValue* v1, const JSValue* v2)
158 {
159 return reinterpret_cast<uintptr_t>(v1) & reinterpret_cast<uintptr_t>(v2) & TagBitTypeInteger;
160 }
161
162 static ALWAYS_INLINE JSValue* andImmediateNumbers(const JSValue* v1, const JSValue* v2)
163 {
164 ASSERT(areBothImmediateNumbers(v1, v2));
165 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) & reinterpret_cast<uintptr_t>(v2));
166 }
167
168 static ALWAYS_INLINE JSValue* xorImmediateNumbers(const JSValue* v1, const JSValue* v2)
169 {
170 ASSERT(areBothImmediateNumbers(v1, v2));
171 return reinterpret_cast<JSValue*>((reinterpret_cast<uintptr_t>(v1) ^ reinterpret_cast<uintptr_t>(v2)) | TagBitTypeInteger);
172 }
173
174 static ALWAYS_INLINE JSValue* orImmediateNumbers(const JSValue* v1, const JSValue* v2)
175 {
176 ASSERT(areBothImmediateNumbers(v1, v2));
177 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) | reinterpret_cast<uintptr_t>(v2));
178 }
179
180 static ALWAYS_INLINE JSValue* rightShiftImmediateNumbers(const JSValue* val, const JSValue* shift)
181 {
182 ASSERT(areBothImmediateNumbers(val, shift));
183 return reinterpret_cast<JSValue*>((reinterpret_cast<intptr_t>(val) >> ((reinterpret_cast<uintptr_t>(shift) >> IntegerPayloadShift) & 0x1f)) | TagBitTypeInteger);
184 }
185
186 static ALWAYS_INLINE bool canDoFastAdditiveOperations(const JSValue* v)
187 {
188 // Number is non-negative and an operation involving two of these can't overflow.
189 // Checking for allowed negative numbers takes more time than it's worth on SunSpider.
190 return (reinterpret_cast<uintptr_t>(v) & (TagBitTypeInteger + (3u << 30))) == TagBitTypeInteger;
191 }
192
193 static ALWAYS_INLINE JSValue* addImmediateNumbers(const JSValue* v1, const JSValue* v2)
194 {
195 ASSERT(canDoFastAdditiveOperations(v1));
196 ASSERT(canDoFastAdditiveOperations(v2));
197 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) + reinterpret_cast<uintptr_t>(v2) - TagBitTypeInteger);
198 }
199
200 static ALWAYS_INLINE JSValue* subImmediateNumbers(const JSValue* v1, const JSValue* v2)
201 {
202 ASSERT(canDoFastAdditiveOperations(v1));
203 ASSERT(canDoFastAdditiveOperations(v2));
204 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) - reinterpret_cast<uintptr_t>(v2) + TagBitTypeInteger);
205 }
206
207 static ALWAYS_INLINE JSValue* incImmediateNumber(const JSValue* v)
208 {
209 ASSERT(canDoFastAdditiveOperations(v));
210 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v) + (1 << IntegerPayloadShift));
211 }
212
213 static ALWAYS_INLINE JSValue* decImmediateNumber(const JSValue* v)
214 {
215 ASSERT(canDoFastAdditiveOperations(v));
216 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v) - (1 << IntegerPayloadShift));
217 }
218
219 static double toDouble(const JSValue*);
220 static bool toBoolean(const JSValue*);
221 static JSObject* toObject(const JSValue*, ExecState*);
222 static UString toString(const JSValue*);
223
224 static bool getUInt32(const JSValue*, uint32_t&);
225 static bool getTruncatedInt32(const JSValue*, int32_t&);
226 static bool getTruncatedUInt32(const JSValue*, uint32_t&);
227
228 static int32_t getTruncatedInt32(const JSValue*);
229 static uint32_t getTruncatedUInt32(const JSValue*);
230
231 static JSValue* trueImmediate();
232 static JSValue* falseImmediate();
233 static JSValue* undefinedImmediate();
234 static JSValue* nullImmediate();
235 static JSValue* zeroImmediate();
236 static JSValue* oneImmediate();
237
238 static JSValue* impossibleValue();
239
240 static JSObject* prototype(const JSValue*, ExecState*);
241
242 private:
243 static const int minImmediateInt = ((-INT_MAX) - 1) >> IntegerPayloadShift;
244 static const int maxImmediateInt = INT_MAX >> IntegerPayloadShift;
245 static const unsigned maxImmediateUInt = maxImmediateInt;
246
247 static ALWAYS_INLINE JSValue* makeInt(int32_t value)
248 {
249 return reinterpret_cast<JSValue*>((value << IntegerPayloadShift) | TagBitTypeInteger);
250 }
251
252 static ALWAYS_INLINE JSValue* makeBool(bool b)
253 {
254 return reinterpret_cast<JSValue*>((static_cast<uintptr_t>(b) << ExtendedPayloadShift) | FullTagTypeBool);
255 }
256
257 static ALWAYS_INLINE JSValue* makeUndefined()
258 {
259 return reinterpret_cast<JSValue*>(FullTagTypeUndefined);
260 }
261
262 static ALWAYS_INLINE JSValue* makeNull()
263 {
264 return reinterpret_cast<JSValue*>(FullTagTypeNull);
265 }
266
267 static ALWAYS_INLINE int32_t intValue(const JSValue* v)
268 {
269 return static_cast<int32_t>(reinterpret_cast<intptr_t>(v) >> IntegerPayloadShift);
270 }
271
272 static ALWAYS_INLINE uint32_t uintValue(const JSValue* v)
273 {
274 return static_cast<uint32_t>(rawValue(v) >> IntegerPayloadShift);
275 }
276
277 static ALWAYS_INLINE bool boolValue(const JSValue* v)
278 {
279 return rawValue(v) & ExtendedPayloadBitBoolValue;
280 }
281
282 static ALWAYS_INLINE uintptr_t rawValue(const JSValue* v)
283 {
284 return reinterpret_cast<uintptr_t>(v);
285 }
286 };
287
288 ALWAYS_INLINE JSValue* JSImmediate::trueImmediate() { return makeBool(true); }
289 ALWAYS_INLINE JSValue* JSImmediate::falseImmediate() { return makeBool(false); }
290 ALWAYS_INLINE JSValue* JSImmediate::undefinedImmediate() { return makeUndefined(); }
291 ALWAYS_INLINE JSValue* JSImmediate::nullImmediate() { return makeNull(); }
292 ALWAYS_INLINE JSValue* JSImmediate::zeroImmediate() { return makeInt(0); }
293 ALWAYS_INLINE JSValue* JSImmediate::oneImmediate() { return makeInt(1); }
294
295 // This value is impossible because 0x4 is not a valid pointer but a tag of 0 would indicate non-immediate
296 ALWAYS_INLINE JSValue* JSImmediate::impossibleValue() { return reinterpret_cast<JSValue*>(0x4); }
297
298 ALWAYS_INLINE bool JSImmediate::toBoolean(const JSValue* v)
299 {
300 ASSERT(isImmediate(v));
301 uintptr_t bits = rawValue(v);
302 return (bits & TagBitTypeInteger)
303 ? bits != TagBitTypeInteger // !0 ints
304 : bits == (FullTagTypeBool | ExtendedPayloadBitBoolValue); // bool true
305 }
306
307 ALWAYS_INLINE uint32_t JSImmediate::getTruncatedUInt32(const JSValue* v)
308 {
309 ASSERT(isNumber(v));
310 return intValue(v);
311 }
312
313 ALWAYS_INLINE JSValue* JSImmediate::from(char i)
314 {
315 return makeInt(i);
316 }
317
318 ALWAYS_INLINE JSValue* JSImmediate::from(signed char i)
319 {
320 return makeInt(i);
321 }
322
323 ALWAYS_INLINE JSValue* JSImmediate::from(unsigned char i)
324 {
325 return makeInt(i);
326 }
327
328 ALWAYS_INLINE JSValue* JSImmediate::from(short i)
329 {
330 return makeInt(i);
331 }
332
333 ALWAYS_INLINE JSValue* JSImmediate::from(unsigned short i)
334 {
335 return makeInt(i);
336 }
337
338 ALWAYS_INLINE JSValue* JSImmediate::from(int i)
339 {
340 if ((i < minImmediateInt) | (i > maxImmediateInt))
341 return 0;
342 return makeInt(i);
343 }
344
345 ALWAYS_INLINE JSValue* JSImmediate::from(unsigned i)
346 {
347 if (i > maxImmediateUInt)
348 return 0;
349 return makeInt(i);
350 }
351
352 ALWAYS_INLINE JSValue* JSImmediate::from(long i)
353 {
354 if ((i < minImmediateInt) | (i > maxImmediateInt))
355 return 0;
356 return makeInt(i);
357 }
358
359 ALWAYS_INLINE JSValue* JSImmediate::from(unsigned long i)
360 {
361 if (i > maxImmediateUInt)
362 return 0;
363 return makeInt(i);
364 }
365
366 ALWAYS_INLINE JSValue* JSImmediate::from(long long i)
367 {
368 if ((i < minImmediateInt) | (i > maxImmediateInt))
369 return 0;
370 return makeInt(static_cast<uintptr_t>(i));
371 }
372
373 ALWAYS_INLINE JSValue* JSImmediate::from(unsigned long long i)
374 {
375 if (i > maxImmediateUInt)
376 return 0;
377 return makeInt(static_cast<uintptr_t>(i));
378 }
379
380 ALWAYS_INLINE JSValue* JSImmediate::from(double d)
381 {
382 const int intVal = static_cast<int>(d);
383
384 if ((intVal < minImmediateInt) | (intVal > maxImmediateInt))
385 return 0;
386
387 // Check for data loss from conversion to int.
388 if (intVal != d || (!intVal && signbit(d)))
389 return 0;
390
391 return makeInt(intVal);
392 }
393
394 ALWAYS_INLINE int32_t JSImmediate::getTruncatedInt32(const JSValue* v)
395 {
396 ASSERT(isNumber(v));
397 return intValue(v);
398 }
399
400 ALWAYS_INLINE double JSImmediate::toDouble(const JSValue* v)
401 {
402 ASSERT(isImmediate(v));
403 if (isNumber(v))
404 return intValue(v);
405 if (rawValue(v) == (FullTagTypeBool | ExtendedPayloadBitBoolValue))
406 return 1.0;
407 if (rawValue(v) != FullTagTypeUndefined)
408 return 0.0;
409 return std::numeric_limits<double>::quiet_NaN();
410 }
411
412 ALWAYS_INLINE bool JSImmediate::getUInt32(const JSValue* v, uint32_t& i)
413 {
414 i = uintValue(v);
415 return isPositiveNumber(v);
416 }
417
418 ALWAYS_INLINE bool JSImmediate::getTruncatedInt32(const JSValue* v, int32_t& i)
419 {
420 i = intValue(v);
421 return isNumber(v);
422 }
423
424 ALWAYS_INLINE bool JSImmediate::getTruncatedUInt32(const JSValue* v, uint32_t& i)
425 {
426 return getUInt32(v, i);
427 }
428
429 ALWAYS_INLINE JSValue* jsUndefined()
430 {
431 return JSImmediate::undefinedImmediate();
432 }
433
434 inline JSValue* jsNull()
435 {
436 return JSImmediate::nullImmediate();
437 }
438
439 inline JSValue* jsBoolean(bool b)
440 {
441 return b ? JSImmediate::trueImmediate() : JSImmediate::falseImmediate();
442 }
443
444} // namespace JSC
445
446#endif
Note: See TracBrowser for help on using the repository browser.