-
barraclough@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=86509 Reviewed by Oliver Hunt. The spec isn't final, but we can start adding support to allow property maps to contain keys that aren't identifiers. Source/JavaScriptCore: * API/JSCallbackObjectFunctions.h: (JSC::::getOwnPropertySlot): (JSC::::put): (JSC::::deleteProperty): (JSC::::getStaticValue): (JSC::::staticFunctionGetter): (JSC::::callbackGetter): - Only expose public named properties over the JSC API. * CMakeLists.txt: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * Target.pri: - Added new files to build system. * dfg/DFGOperations.cpp: (JSC::DFG::operationPutByValInternal): - Added support for property access with name objects. * interpreter/CallFrame.h: (JSC::ExecState::privateNamePrototypeTable): - Added hash table for NamePrototype * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): - Added support for property access with name objects. * jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION): - Added support for property access with name objects. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::getByVal): (JSC::LLInt::LLINT_SLOW_PATH_DECL): * runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::opIn): * runtime/JSActivation.cpp: (JSC::JSActivation::symbolTableGet): (JSC::JSActivation::symbolTablePut): (JSC::JSActivation::symbolTablePutWithAttributes): - Added support for property access with name objects. * runtime/JSGlobalData.cpp: (JSC): (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::~JSGlobalData): * runtime/JSGlobalData.h: (JSGlobalData): - Added hash table for NamePrototype * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset): * runtime/JSGlobalObject.h: (JSGlobalObject): (JSC::JSGlobalObject::privateNameStructure): (JSC::JSGlobalObject::symbolTableHasProperty): - Added new global properties. * runtime/JSType.h: * runtime/JSTypeInfo.h: (JSC::TypeInfo::isName): - Added type for NameInstances, for fast isName check. * runtime/JSVariableObject.cpp: (JSC::JSVariableObject::deleteProperty): (JSC::JSVariableObject::symbolTableGet): * runtime/JSVariableObject.h: (JSC::JSVariableObject::symbolTableGet): (JSC::JSVariableObject::symbolTablePut): (JSC::JSVariableObject::symbolTablePutWithAttributes): - symbol table lookup should take a PropertyName. * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): * runtime/Lookup.h: (JSC::HashTable::entry): - entry lookup should take a PropertyName. * runtime/NameConstructor.cpp: Added. (JSC): (JSC::NameConstructor::NameConstructor): (JSC::NameConstructor::finishCreation): (JSC::constructPrivateName): (JSC::NameConstructor::getConstructData): (JSC::NameConstructor::getCallData): * runtime/NameConstructor.h: Added. (JSC): (NameConstructor): (JSC::NameConstructor::create): (JSC::NameConstructor::createStructure): - Added constructor. * runtime/NameInstance.cpp: Added. (JSC): (JSC::NameInstance::NameInstance): (JSC::NameInstance::destroy): * runtime/NameInstance.h: Added. (JSC): (NameInstance): (JSC::NameInstance::createStructure): (JSC::NameInstance::create): (JSC::NameInstance::privateName): (JSC::NameInstance::nameString): (JSC::NameInstance::finishCreation): (JSC::isName): - Added instance. * runtime/NamePrototype.cpp: Added. (JSC): (JSC::NamePrototype::NamePrototype): (JSC::NamePrototype::finishCreation): (JSC::NamePrototype::getOwnPropertySlot): (JSC::NamePrototype::getOwnPropertyDescriptor): (JSC::privateNameProtoFuncToString): * runtime/NamePrototype.h: Added. (JSC): (NamePrototype): (JSC::NamePrototype::create): (JSC::NamePrototype::createStructure): - Added prototype. * runtime/PrivateName.h: Added. (JSC): (PrivateName): (JSC::PrivateName::PrivateName): (JSC::PrivateName::uid): - A private name object holds a StringImpl that can be used as a unique key in a property map. * runtime/PropertyMapHashTable.h: (JSC::PropertyTable::find): (JSC::PropertyTable::findWithString): - Strings should only match keys in the table that are identifiers. * runtime/PropertyName.h: (JSC::PropertyName::PropertyName): (PropertyName): (JSC::PropertyName::uid): (JSC::PropertyName::publicName): (JSC::PropertyName::asIndex): (JSC::operator==): (JSC::operator!=): - replaced impl() & ustring() with uid() [to get the raw impl] and publicName() [impl or null, if not an identifier]. * runtime/Structure.cpp: (JSC::Structure::despecifyDictionaryFunction): (JSC::Structure::addPropertyTransitionToExistingStructure): (JSC::Structure::addPropertyTransition): (JSC::Structure::attributeChangeTransition): (JSC::Structure::get): (JSC::Structure::despecifyFunction): (JSC::Structure::putSpecificValue): (JSC::Structure::remove): (JSC::Structure::getPropertyNamesFromStructure): * runtime/Structure.h: (JSC::Structure::get): - call uid() to get a PropertyName raw impl, for use as a key. Source/WebCore: Test: fast/js/names.html * bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::cssPropertyIDForJSCSSPropertyName): * bindings/js/JSDOMBinding.cpp: (WebCore::findAtomicString): (WebCore::objectToStringFunctionGetter): * bindings/js/JSDOMBinding.h: (WebCore::propertyNameToString): (WebCore::propertyNameToAtomicString): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::nonCachingStaticFunctionGetter): * bindings/js/JSHistoryCustom.cpp: (WebCore::nonCachingStaticBackFunctionGetter): (WebCore::nonCachingStaticForwardFunctionGetter): (WebCore::nonCachingStaticGoFunctionGetter): * bindings/js/JSLocationCustom.cpp: (WebCore::nonCachingStaticReplaceFunctionGetter): (WebCore::nonCachingStaticReloadFunctionGetter): (WebCore::nonCachingStaticAssignFunctionGetter): * bridge/c/c_class.cpp: (JSC::Bindings::CClass::methodsNamed): (JSC::Bindings::CClass::fieldNamed): * bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::getMethod): * bridge/jni/jsc/JavaClassJSC.cpp: (JavaClass::methodsNamed): (JavaClass::fieldNamed): * bridge/jni/jsc/JavaInstanceJSC.cpp: * bridge/objc/objc_class.mm: (JSC::Bindings::ObjcClass::methodsNamed): (JSC::Bindings::ObjcClass::fieldNamed): (JSC::Bindings::ObjcClass::fallbackObject): * bridge/objc/objc_instance.mm: (ObjcInstance::setValueOfUndefinedField): (ObjcInstance::getValueOfUndefinedField): - Removed PropertyName::impl(), call publicName() to get the string associated with a name. Source/WebKit/mac: * Plugins/Hosted/ProxyInstance.mm: (WebKit::ProxyClass::methodsNamed): (WebKit::ProxyClass::fieldNamed): (WebKit::ProxyInstance::getMethod): (WebKit::ProxyInstance::methodsNamed): (WebKit::ProxyInstance::fieldNamed): - Removed PropertyName::impl(), call publicName() to get the string associated with a name. Source/WebKit2: * WebProcess/Plugins/Netscape/JSNPObject.cpp: (WebKit::npIdentifierFromIdentifier): (WebKit::JSNPObject::methodGetter): - Removed PropertyName::impl(), call publicName() to get the string associated with a name. Source/WTF: * wtf/text/StringImpl.h: (WTF::StringImpl::StringImpl): (StringImpl): (WTF::StringImpl::createEmptyUnique): (WTF::StringImpl::isEmptyUnique): - Allow empty string impls to be allocated, which can be used as unique keys. LayoutTests: * fast/js/names-expected.txt: Added. * fast/js/names.html: Added. * fast/js/script-tests/names.js: Added. - Added test cases. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117859 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6c9b264e