Clean up Identifier factories to clarify the meaning of StringImpl*
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Mar 2015 21:25:14 +0000 (21:25 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Mar 2015 21:25:14 +0000 (21:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143146

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

In the a lot of places, `Identifier(VM*/ExecState*, StringImpl*)` constructor is used.
However, it's ambiguous because `StringImpl*` has 2 different meanings.
1) normal string, it is replacable with `WTFString` and
2) `uid`, which holds `isSymbol` information to represent Symbols.
So we dropped Identifier constructors for strings and instead, introduced 2 factory functions.
+ `Identifier::fromString(VM*/ExecState*, const String&)`.
Just construct Identifier from strings. The symbol-ness of StringImpl* is not kept.
+ `Identifier::fromUid(VM*/ExecState*, StringImpl*)`.
This function is used for 2) `uid`. So symbol-ness of `StringImpl*` is kept.

And to clean up `StringImpl` which is used as uid,
we introduce `StringKind` into `StringImpl`. There's 3 kinds
1. StringNormal (non-atomic, non-symbol)
2. StringAtomic (atomic, non-symbol)
3. StringSymbol (non-atomic, symbol)
They are mutually exclusive. And (atomic, symbol) case should not exist.

* API/JSCallbackObjectFunctions.h:
(JSC::JSCallbackObject<Parent>::getOwnNonIndexPropertyNames):
* API/JSObjectRef.cpp:
(JSObjectMakeFunction):
* API/OpaqueJSString.cpp:
(OpaqueJSString::identifier):
* bindings/ScriptFunctionCall.cpp:
(Deprecated::ScriptFunctionCall::call):
* builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createExecutableInternal):
* builtins/BuiltinNames.h:
(JSC::BuiltinNames::BuiltinNames):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitThrowReferenceError):
(JSC::BytecodeGenerator::emitThrowTypeError):
(JSC::BytecodeGenerator::emitReadOnlyExceptionIfNeeded):
(JSC::BytecodeGenerator::emitEnumeration):
* dfg/DFGDesiredIdentifiers.cpp:
(JSC::DFG::DesiredIdentifiers::reallyAdd):
* inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::functionDetails):
(Inspector::constructInternalProperty):
(Inspector::JSInjectedScriptHost::weakMapEntries):
(Inspector::JSInjectedScriptHost::iteratorEntries):
* inspector/JSInjectedScriptHostPrototype.cpp:
(Inspector::JSInjectedScriptHostPrototype::finishCreation):
* inspector/JSJavaScriptCallFramePrototype.cpp:
* inspector/ScriptCallStackFactory.cpp:
(Inspector::extractSourceInformationFromException):
* jit/JITOperations.cpp:
* jsc.cpp:
(GlobalObject::finishCreation):
(GlobalObject::addFunction):
(GlobalObject::addConstructableFunction):
(functionRun):
(runWithScripts):
* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
* parser/ASTBuilder.h:
(JSC::ASTBuilder::addVar):
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::createBindingPattern):
* parser/ParserArena.h:
(JSC::IdentifierArena::makeIdentifier):
(JSC::IdentifierArena::makeIdentifierLCharFromUChar):
(JSC::IdentifierArena::makeNumericIdentifier):
* runtime/ArgumentsIteratorPrototype.cpp:
(JSC::ArgumentsIteratorPrototype::finishCreation):
* runtime/ArrayIteratorPrototype.cpp:
(JSC::ArrayIteratorPrototype::finishCreation):
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::finishCreation):
(JSC::arrayProtoFuncPush):
* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::getOwnPropertySlot):
* runtime/CommonIdentifiers.cpp:
(JSC::CommonIdentifiers::CommonIdentifiers):
* runtime/CommonIdentifiers.h:
* runtime/Error.cpp:
(JSC::addErrorInfo):
(JSC::hasErrorInfo):
* runtime/ExceptionHelpers.cpp:
(JSC::createUndefinedVariableError):
* runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::getOwnPropertySlot):
* runtime/Identifier.h:
(JSC::Identifier::isSymbol):
(JSC::Identifier::Identifier):
(JSC::Identifier::from): Deleted.
* runtime/IdentifierInlines.h:
(JSC::Identifier::Identifier):
(JSC::Identifier::fromUid):
(JSC::Identifier::fromString):
* runtime/JSCJSValue.cpp:
(JSC::JSValue::dumpInContextAssumingStructure):
* runtime/JSCJSValueInlines.h:
(JSC::JSValue::toPropertyKey):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSLexicalEnvironment.cpp:
(JSC::JSLexicalEnvironment::getOwnNonIndexPropertyNames):
* runtime/JSObject.cpp:
(JSC::getClassPropertyNames):
(JSC::JSObject::reifyStaticFunctionsForDelete):
* runtime/JSObject.h:
(JSC::makeIdentifier):
* runtime/JSPromiseConstructor.cpp:
(JSC::JSPromiseConstructorFuncRace):
(JSC::JSPromiseConstructorFuncAll):
* runtime/JSString.h:
(JSC::JSString::toIdentifier):
* runtime/JSSymbolTableObject.cpp:
(JSC::JSSymbolTableObject::getOwnNonIndexPropertyNames):
* runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::tryJSONPParse):
(JSC::LiteralParser<CharType>::makeIdentifier):
* runtime/Lookup.h:
(JSC::reifyStaticProperties):
* runtime/MapConstructor.cpp:
(JSC::constructMap):
* runtime/MapIteratorPrototype.cpp:
(JSC::MapIteratorPrototype::finishCreation):
* runtime/MapPrototype.cpp:
(JSC::MapPrototype::finishCreation):
* runtime/MathObject.cpp:
(JSC::MathObject::finishCreation):
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::finishCreation):
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::finishCreation):
* runtime/PrivateName.h:
(JSC::PrivateName::PrivateName):
* runtime/PropertyMapHashTable.h:
(JSC::PropertyTable::find):
(JSC::PropertyTable::get):
* runtime/PropertyName.h:
(JSC::PropertyName::PropertyName):
(JSC::PropertyName::publicName):
(JSC::PropertyName::asIndex):
* runtime/PropertyNameArray.cpp:
(JSC::PropertyNameArray::add):
* runtime/PropertyNameArray.h:
(JSC::PropertyNameArray::addKnownUnique):
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::finishCreation):
* runtime/SetConstructor.cpp:
(JSC::constructSet):
* runtime/SetIteratorPrototype.cpp:
(JSC::SetIteratorPrototype::finishCreation):
* runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):
* runtime/StringIteratorPrototype.cpp:
(JSC::StringIteratorPrototype::finishCreation):
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
* runtime/Structure.cpp:
(JSC::Structure::getPropertyNamesFromStructure):
* runtime/SymbolConstructor.cpp:
* runtime/VM.cpp:
(JSC::VM::throwException):
* runtime/WeakMapConstructor.cpp:
(JSC::constructWeakMap):

Source/WebCore:

Just change Identifier creations.

1. If the code creates Identifier from StringImpl*
which is treated as symbol or string(unique id), use Identifier::fromUid.
2. If the code creates Identifier from string, use Identifier::fromString.

* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
(WebCore::QuickTimePluginReplacement::installReplacement):
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::get):
(WebCore::set):
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::getOwnPropertyNames):
* bindings/js/JSCallbackData.cpp:
(WebCore::JSCallbackData::invokeCallback):
* bindings/js/JSCommandLineAPIHostCustom.cpp:
(WebCore::getJSListenerFunctions):
(WebCore::JSCommandLineAPIHost::getEventListeners):
* bindings/js/JSCryptoAlgorithmBuilder.cpp:
(WebCore::JSCryptoAlgorithmBuilder::add):
* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::getProperty):
(WebCore::getHashAlgorithm):
* bindings/js/JSCryptoKeySerializationJWK.cpp:
(WebCore::getJSArrayFromJSON):
(WebCore::getStringFromJSON):
(WebCore::getBooleanFromJSON):
(WebCore::addToJSON):
(WebCore::buildJSONForRSAComponents):
(WebCore::addBoolToJSON):
(WebCore::addUsagesToJSON):
* bindings/js/JSCustomXPathNSResolver.cpp:
(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
* bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::getOwnPropertyNames):
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::defineOwnProperty):
(WebCore::JSDOMWindow::setLocation):
(WebCore::DialogHandler::dialogCreated):
(WebCore::DialogHandler::returnValue):
* bindings/js/JSDeviceMotionEventCustom.cpp:
(WebCore::readAccelerationArgument):
(WebCore::readRotationRateArgument):
(WebCore::createAccelerationObject):
(WebCore::createRotationRateObject):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::tryGetProperty):
* bindings/js/JSEventListener.cpp:
(WebCore::JSEventListener::handleEvent):
* bindings/js/JSHTMLAllCollectionCustom.cpp:
(WebCore::callHTMLAllCollection):
(WebCore::JSHTMLAllCollection::item):
(WebCore::JSHTMLAllCollection::namedItem):
* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::all):
(WebCore::JSHTMLDocument::setAll):
(WebCore::JSHTMLDocument::open):
* bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
(WebCore::JSHTMLFormControlsCollection::namedItem):
* bindings/js/JSIDBDatabaseCustom.cpp:
(WebCore::JSIDBDatabase::createObjectStore):
* bindings/js/JSIDBObjectStoreCustom.cpp:
(WebCore::JSIDBObjectStore::createIndex):
* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJS):
* bindings/js/JSInspectorFrontendHostCustom.cpp:
(WebCore::populateContextMenuItems):
* bindings/js/JSLazyEventListener.cpp:
(WebCore::JSLazyEventListener::initializeJSFunction):
* bindings/js/JSNodeFilterCondition.cpp:
(WebCore::JSNodeFilterCondition::acceptNode):
* bindings/js/JSSQLResultSetRowListCustom.cpp:
(WebCore::JSSQLResultSetRowList::item):
* bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::getOwnPropertyNames):
* bindings/js/ReadableStreamJSSource.cpp:
(WebCore::setInternalSlotToObject):
(WebCore::getInternalSlotFromObject):
* bindings/js/ScriptGlobalObject.cpp:
(WebCore::ScriptGlobalObject::set):
(WebCore::ScriptGlobalObject::get):
(WebCore::ScriptGlobalObject::remove):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::write):
(WebCore::CloneDeserializer::deserialize):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject callWebScriptMethod:withArguments:]):
(-[WebScriptObject setValue:forKey:]):
(-[WebScriptObject valueForKey:]):
(-[WebScriptObject removeWebScriptKey:]):
(-[WebScriptObject hasWebScriptKey:]):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSFloat64Array.cpp:
(WebCore::JSFloat64Array::getOwnPropertyNames):
* bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::JSTestEventTarget::getOwnPropertyNames):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
(WebCore::setJSTestObjConditionalAttr4Constructor):
(WebCore::setJSTestObjConditionalAttr5Constructor):
(WebCore::setJSTestObjConditionalAttr6Constructor):
(WebCore::setJSTestObjReplaceableAttribute):
* bridge/c/c_utility.cpp:
(JSC::Bindings::identifierFromNPIdentifier):
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::defaultValue):
* bridge/testbindings.cpp:
(main):
* bridge/testbindings.mm:
(main):
* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::loadTrigger):
(WebCore::ContentExtensions::loadAction):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::injectInternalsObject):

Source/WebKit/mac:

Just change to Identifier::fromString.

* Plugins/Hosted/NetscapePluginHostProxy.mm:
(identifierFromIdentifierRep):
* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyInstance::getPropertyNames):

Source/WebKit2:

Just change to Identifier::fromString.

* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::getOwnPropertyNames):
* WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::identifierFromIdentifierRep):

Source/WTF:

Introduce StringKind into `StringImpl`. There's 3 kinds
1. StringNormal (non-atomic, non-symbol)
2. StringAtomic (atomic, non-symbol)
3. StringSymbol (non-atomic, symbol)
They are mutually exclusive.

* wtf/text/AtomicString.cpp:
(WTF::AtomicString::addSlowCase):
(WTF::AtomicString::findSlowCase):
When registering a string into AtomicStringTable,
it should not be a symbol string
because symbol and atomic types are mutually exclusive.
When a symbol string comes, we extract an owner string
from a symbol string by using `StringImpl::extractFoldedStringInSymbol()`.
It always succeeds because a symbol (non empty) string
is always BufferSubstring and has an owner string.
Empty symbol string doesn't have an owner string.
This case is filtered by `!string.length()` guard.
* wtf/text/AtomicString.h:
(WTF::AtomicString::add):
(WTF::AtomicString::addWithStringTableProvider):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
(WTF::StringImpl::createSymbol):
(WTF::StringImpl::createUnique): Deleted.
* wtf/text/StringImpl.h:
(WTF::StringImpl::StringImpl):
(WTF::StringImpl::createSymbolEmpty):
(WTF::StringImpl::flagIsAtomic):
(WTF::StringImpl::flagIsSymbol):
(WTF::StringImpl::maskStringKind):
(WTF::StringImpl::stringKind):
(WTF::StringImpl::isSymbol):
(WTF::StringImpl::isAtomic):
(WTF::StringImpl::setIsAtomic):
(WTF::StringImpl::extractFoldedStringInSymbol):
(WTF::StringImpl::createUniqueEmpty): Deleted.
(WTF::StringImpl::flagIsUnique): Deleted.
(WTF::StringImpl::isUnique): Deleted.
* wtf/text/StringStatics.cpp:
(WTF::StringImpl::hashAndFlagsForSymbol):
(WTF::StringImpl::hashAndFlagsForUnique): Deleted.

Tools:

Simple API tests for StringImpl are added.

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182205 268f45cc-cd09-0410-ab3c-d52691b4dbfc

119 files changed:
Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
Source/JavaScriptCore/API/JSObjectRef.cpp
Source/JavaScriptCore/API/OpaqueJSString.cpp
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp
Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
Source/JavaScriptCore/builtins/BuiltinNames.h
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/dfg/DFGDesiredIdentifiers.cpp
Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp
Source/JavaScriptCore/inspector/JSJavaScriptCallFramePrototype.cpp
Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/llint/LLIntData.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm
Source/JavaScriptCore/parser/ASTBuilder.h
Source/JavaScriptCore/parser/Parser.cpp
Source/JavaScriptCore/parser/ParserArena.h
Source/JavaScriptCore/runtime/ArgumentsIteratorPrototype.cpp
Source/JavaScriptCore/runtime/ArrayIteratorPrototype.cpp
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/ClonedArguments.cpp
Source/JavaScriptCore/runtime/CommonIdentifiers.cpp
Source/JavaScriptCore/runtime/CommonIdentifiers.h
Source/JavaScriptCore/runtime/Error.cpp
Source/JavaScriptCore/runtime/ExceptionHelpers.cpp
Source/JavaScriptCore/runtime/GenericArgumentsInlines.h
Source/JavaScriptCore/runtime/Identifier.h
Source/JavaScriptCore/runtime/IdentifierInlines.h
Source/JavaScriptCore/runtime/JSCJSValue.cpp
Source/JavaScriptCore/runtime/JSCJSValueInlines.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSLexicalEnvironment.cpp
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
Source/JavaScriptCore/runtime/JSString.h
Source/JavaScriptCore/runtime/JSSymbolTableObject.cpp
Source/JavaScriptCore/runtime/LiteralParser.cpp
Source/JavaScriptCore/runtime/Lookup.h
Source/JavaScriptCore/runtime/MapConstructor.cpp
Source/JavaScriptCore/runtime/MapIteratorPrototype.cpp
Source/JavaScriptCore/runtime/MapPrototype.cpp
Source/JavaScriptCore/runtime/MathObject.cpp
Source/JavaScriptCore/runtime/NumberConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/PrivateName.h
Source/JavaScriptCore/runtime/PropertyMapHashTable.h
Source/JavaScriptCore/runtime/PropertyName.h
Source/JavaScriptCore/runtime/PropertyNameArray.cpp
Source/JavaScriptCore/runtime/PropertyNameArray.h
Source/JavaScriptCore/runtime/RegExpConstructor.cpp
Source/JavaScriptCore/runtime/SetConstructor.cpp
Source/JavaScriptCore/runtime/SetIteratorPrototype.cpp
Source/JavaScriptCore/runtime/SetPrototype.cpp
Source/JavaScriptCore/runtime/StringIteratorPrototype.cpp
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/runtime/Structure.cpp
Source/JavaScriptCore/runtime/SymbolConstructor.cpp
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/WeakMapConstructor.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/text/AtomicString.cpp
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/StringStatics.cpp
Source/WebCore/ChangeLog
Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm
Source/WebCore/bindings/js/IDBBindingUtilities.cpp
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
Source/WebCore/bindings/js/JSCallbackData.cpp
Source/WebCore/bindings/js/JSCommandLineAPIHostCustom.cpp
Source/WebCore/bindings/js/JSCryptoAlgorithmBuilder.cpp
Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp
Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp
Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp
Source/WebCore/bindings/js/JSDOMStringMapCustom.cpp
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
Source/WebCore/bindings/js/JSDictionary.cpp
Source/WebCore/bindings/js/JSEventListener.cpp
Source/WebCore/bindings/js/JSHTMLAllCollectionCustom.cpp
Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
Source/WebCore/bindings/js/JSHTMLFormControlsCollectionCustom.cpp
Source/WebCore/bindings/js/JSIDBDatabaseCustom.cpp
Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp
Source/WebCore/bindings/js/JSImageDataCustom.cpp
Source/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
Source/WebCore/bindings/js/JSLazyEventListener.cpp
Source/WebCore/bindings/js/JSNodeFilterCondition.cpp
Source/WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp
Source/WebCore/bindings/js/JSStorageCustom.cpp
Source/WebCore/bindings/js/ReadableStreamJSSource.cpp
Source/WebCore/bindings/js/ScriptGlobalObject.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bindings/objc/WebScriptObject.mm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSFloat64Array.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bridge/c/c_utility.cpp
Source/WebCore/bridge/objc/objc_runtime.mm
Source/WebCore/bridge/testbindings.cpp
Source/WebCore/bridge/testbindings.mm
Source/WebCore/contentextensions/ContentExtensionParser.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLPlugInImageElement.cpp
Source/WebCore/testing/js/WebCoreTestSupport.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostProxy.mm
Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp

index 9b1cb8f..a0b83e7 100644 (file)
@@ -521,8 +521,10 @@ void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, Exe
             for (iterator it = staticValues->begin(); it != end; ++it) {
                 StringImpl* name = it->key.get();
                 StaticValueEntry* entry = it->value.get();
-                if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum) || shouldIncludeDontEnumProperties(mode)))
-                    propertyNames.add(Identifier(exec, name));
+                if (entry->getProperty && (!(entry->attributes & kJSPropertyAttributeDontEnum) || shouldIncludeDontEnumProperties(mode))) {
+                    ASSERT(!name->isSymbol());
+                    propertyNames.add(Identifier::fromString(exec, String(name)));
+                }
             }
         }
         
@@ -532,8 +534,10 @@ void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, Exe
             for (iterator it = staticFunctions->begin(); it != end; ++it) {
                 StringImpl* name = it->key.get();
                 StaticFunctionEntry* entry = it->value.get();
-                if (!(entry->attributes & kJSPropertyAttributeDontEnum) || shouldIncludeDontEnumProperties(mode))
-                    propertyNames.add(Identifier(exec, name));
+                if (!(entry->attributes & kJSPropertyAttributeDontEnum) || shouldIncludeDontEnumProperties(mode)) {
+                    ASSERT(!name->isSymbol());
+                    propertyNames.add(Identifier::fromString(exec, String(name)));
+                }
             }
         }
     }
index 234d248..6ce1c2c 100644 (file)
@@ -140,7 +140,7 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa
     JSLockHolder locker(exec);
 
     startingLineNumber = std::max(1, startingLineNumber);
-    Identifier nameID = name ? name->identifier(&exec->vm()) : Identifier(exec, "anonymous");
+    Identifier nameID = name ? name->identifier(&exec->vm()) : Identifier::fromString(exec, "anonymous");
     
     MarkedArgumentBuffer args;
     for (unsigned i = 0; i < parameterCount; i++)
index 22c1623..7f9edb4 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CallFrame.h"
 #include "Identifier.h"
+#include "IdentifierInlines.h"
 #include "JSGlobalObject.h"
 #include <wtf/text/StringView.h>
 
@@ -69,9 +70,9 @@ Identifier OpaqueJSString::identifier(VM* vm) const
         return Identifier(Identifier::EmptyIdentifier);
 
     if (m_string.is8Bit())
-        return Identifier(vm, m_string.characters8(), m_string.length());
+        return Identifier::fromString(vm, m_string.characters8(), m_string.length());
 
-    return Identifier(vm, m_string.characters16(), m_string.length());
+    return Identifier::fromString(vm, m_string.characters16(), m_string.length());
 }
 
 const UChar* OpaqueJSString::characters()
index d2196e7..3fcc3d1 100644 (file)
@@ -1,3 +1,173 @@
+2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Clean up Identifier factories to clarify the meaning of StringImpl*
+        https://bugs.webkit.org/show_bug.cgi?id=143146
+
+        Reviewed by Filip Pizlo.
+
+        In the a lot of places, `Identifier(VM*/ExecState*, StringImpl*)` constructor is used.
+        However, it's ambiguous because `StringImpl*` has 2 different meanings.
+        1) normal string, it is replacable with `WTFString` and
+        2) `uid`, which holds `isSymbol` information to represent Symbols.
+        So we dropped Identifier constructors for strings and instead, introduced 2 factory functions.
+        + `Identifier::fromString(VM*/ExecState*, const String&)`.
+        Just construct Identifier from strings. The symbol-ness of StringImpl* is not kept.
+        + `Identifier::fromUid(VM*/ExecState*, StringImpl*)`.
+        This function is used for 2) `uid`. So symbol-ness of `StringImpl*` is kept.
+
+        And to clean up `StringImpl` which is used as uid,
+        we introduce `StringKind` into `StringImpl`. There's 3 kinds
+        1. StringNormal (non-atomic, non-symbol)
+        2. StringAtomic (atomic, non-symbol)
+        3. StringSymbol (non-atomic, symbol)
+        They are mutually exclusive. And (atomic, symbol) case should not exist.
+
+        * API/JSCallbackObjectFunctions.h:
+        (JSC::JSCallbackObject<Parent>::getOwnNonIndexPropertyNames):
+        * API/JSObjectRef.cpp:
+        (JSObjectMakeFunction):
+        * API/OpaqueJSString.cpp:
+        (OpaqueJSString::identifier):
+        * bindings/ScriptFunctionCall.cpp:
+        (Deprecated::ScriptFunctionCall::call):
+        * builtins/BuiltinExecutables.cpp:
+        (JSC::BuiltinExecutables::createExecutableInternal):
+        * builtins/BuiltinNames.h:
+        (JSC::BuiltinNames::BuiltinNames):
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        (JSC::BytecodeGenerator::emitThrowReferenceError):
+        (JSC::BytecodeGenerator::emitThrowTypeError):
+        (JSC::BytecodeGenerator::emitReadOnlyExceptionIfNeeded):
+        (JSC::BytecodeGenerator::emitEnumeration):
+        * dfg/DFGDesiredIdentifiers.cpp:
+        (JSC::DFG::DesiredIdentifiers::reallyAdd):
+        * inspector/JSInjectedScriptHost.cpp:
+        (Inspector::JSInjectedScriptHost::functionDetails):
+        (Inspector::constructInternalProperty):
+        (Inspector::JSInjectedScriptHost::weakMapEntries):
+        (Inspector::JSInjectedScriptHost::iteratorEntries):
+        * inspector/JSInjectedScriptHostPrototype.cpp:
+        (Inspector::JSInjectedScriptHostPrototype::finishCreation):
+        * inspector/JSJavaScriptCallFramePrototype.cpp:
+        * inspector/ScriptCallStackFactory.cpp:
+        (Inspector::extractSourceInformationFromException):
+        * jit/JITOperations.cpp:
+        * jsc.cpp:
+        (GlobalObject::finishCreation):
+        (GlobalObject::addFunction):
+        (GlobalObject::addConstructableFunction):
+        (functionRun):
+        (runWithScripts):
+        * llint/LLIntData.cpp:
+        (JSC::LLInt::Data::performAssertions):
+        * llint/LowLevelInterpreter.asm:
+        * parser/ASTBuilder.h:
+        (JSC::ASTBuilder::addVar):
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseInner):
+        (JSC::Parser<LexerType>::createBindingPattern):
+        * parser/ParserArena.h:
+        (JSC::IdentifierArena::makeIdentifier):
+        (JSC::IdentifierArena::makeIdentifierLCharFromUChar):
+        (JSC::IdentifierArena::makeNumericIdentifier):
+        * runtime/ArgumentsIteratorPrototype.cpp:
+        (JSC::ArgumentsIteratorPrototype::finishCreation):
+        * runtime/ArrayIteratorPrototype.cpp:
+        (JSC::ArrayIteratorPrototype::finishCreation):
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::finishCreation):
+        (JSC::arrayProtoFuncPush):
+        * runtime/ClonedArguments.cpp:
+        (JSC::ClonedArguments::getOwnPropertySlot):
+        * runtime/CommonIdentifiers.cpp:
+        (JSC::CommonIdentifiers::CommonIdentifiers):
+        * runtime/CommonIdentifiers.h:
+        * runtime/Error.cpp:
+        (JSC::addErrorInfo):
+        (JSC::hasErrorInfo):
+        * runtime/ExceptionHelpers.cpp:
+        (JSC::createUndefinedVariableError):
+        * runtime/GenericArgumentsInlines.h:
+        (JSC::GenericArguments<Type>::getOwnPropertySlot):
+        * runtime/Identifier.h:
+        (JSC::Identifier::isSymbol):
+        (JSC::Identifier::Identifier):
+        (JSC::Identifier::from): Deleted.
+        * runtime/IdentifierInlines.h:
+        (JSC::Identifier::Identifier):
+        (JSC::Identifier::fromUid):
+        (JSC::Identifier::fromString):
+        * runtime/JSCJSValue.cpp:
+        (JSC::JSValue::dumpInContextAssumingStructure):
+        * runtime/JSCJSValueInlines.h:
+        (JSC::JSValue::toPropertyKey):
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * runtime/JSLexicalEnvironment.cpp:
+        (JSC::JSLexicalEnvironment::getOwnNonIndexPropertyNames):
+        * runtime/JSObject.cpp:
+        (JSC::getClassPropertyNames):
+        (JSC::JSObject::reifyStaticFunctionsForDelete):
+        * runtime/JSObject.h:
+        (JSC::makeIdentifier):
+        * runtime/JSPromiseConstructor.cpp:
+        (JSC::JSPromiseConstructorFuncRace):
+        (JSC::JSPromiseConstructorFuncAll):
+        * runtime/JSString.h:
+        (JSC::JSString::toIdentifier):
+        * runtime/JSSymbolTableObject.cpp:
+        (JSC::JSSymbolTableObject::getOwnNonIndexPropertyNames):
+        * runtime/LiteralParser.cpp:
+        (JSC::LiteralParser<CharType>::tryJSONPParse):
+        (JSC::LiteralParser<CharType>::makeIdentifier):
+        * runtime/Lookup.h:
+        (JSC::reifyStaticProperties):
+        * runtime/MapConstructor.cpp:
+        (JSC::constructMap):
+        * runtime/MapIteratorPrototype.cpp:
+        (JSC::MapIteratorPrototype::finishCreation):
+        * runtime/MapPrototype.cpp:
+        (JSC::MapPrototype::finishCreation):
+        * runtime/MathObject.cpp:
+        (JSC::MathObject::finishCreation):
+        * runtime/NumberConstructor.cpp:
+        (JSC::NumberConstructor::finishCreation):
+        * runtime/ObjectConstructor.cpp:
+        (JSC::ObjectConstructor::finishCreation):
+        * runtime/PrivateName.h:
+        (JSC::PrivateName::PrivateName):
+        * runtime/PropertyMapHashTable.h:
+        (JSC::PropertyTable::find):
+        (JSC::PropertyTable::get):
+        * runtime/PropertyName.h:
+        (JSC::PropertyName::PropertyName):
+        (JSC::PropertyName::publicName):
+        (JSC::PropertyName::asIndex):
+        * runtime/PropertyNameArray.cpp:
+        (JSC::PropertyNameArray::add):
+        * runtime/PropertyNameArray.h:
+        (JSC::PropertyNameArray::addKnownUnique):
+        * runtime/RegExpConstructor.cpp:
+        (JSC::RegExpConstructor::finishCreation):
+        * runtime/SetConstructor.cpp:
+        (JSC::constructSet):
+        * runtime/SetIteratorPrototype.cpp:
+        (JSC::SetIteratorPrototype::finishCreation):
+        * runtime/SetPrototype.cpp:
+        (JSC::SetPrototype::finishCreation):
+        * runtime/StringIteratorPrototype.cpp:
+        (JSC::StringIteratorPrototype::finishCreation):
+        * runtime/StringPrototype.cpp:
+        (JSC::StringPrototype::finishCreation):
+        * runtime/Structure.cpp:
+        (JSC::Structure::getPropertyNamesFromStructure):
+        * runtime/SymbolConstructor.cpp:
+        * runtime/VM.cpp:
+        (JSC::VM::throwException):
+        * runtime/WeakMapConstructor.cpp:
+        (JSC::constructWeakMap):
+
 2015-03-31  Andreas Kling  <akling@apple.com>
 
         Logically empty WeakBlocks should not pin down their MarkedBlocks indefinitely.
index 2df7876..f3a2238 100644 (file)
@@ -121,7 +121,7 @@ Deprecated::ScriptValue ScriptFunctionCall::call(bool& hadException)
 
     JSLockHolder lock(m_exec);
 
-    JSValue function = thisObject->get(m_exec, Identifier(m_exec, m_name));
+    JSValue function = thisObject->get(m_exec, Identifier::fromString(m_exec, m_name));
     if (m_exec->hadException()) {
         hadException = true;
         return Deprecated::ScriptValue();
index c012487..cb30608 100644 (file)
@@ -101,7 +101,7 @@ UnlinkedFunctionExecutable* BuiltinExecutables::createExecutableInternal(const S
         
         if (closedVariable == m_vm.propertyNames->undefinedKeyword.impl())
             continue;
-        RELEASE_ASSERT(closedVariable->isUnique());
+        RELEASE_ASSERT(closedVariable->isSymbol());
     }
     body->overrideName(name);
     UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&m_vm, source, body, kind, WTF::move(sourceOverride));
index 9b8896b..7b4783a 100644 (file)
 
 namespace JSC {
     
-#define INITIALISE_BUILTIN_NAMES(name) , m_##name(vm, #name), m_##name##PrivateName(Identifier::from(PrivateName(ASCIILiteral("Symbol." #name))))
-#define DECLARE_BUILTIN_NAMES(name) const Identifier m_##name; const Identifier m_##name##PrivateName;;
+#define INITIALISE_BUILTIN_NAMES(name) , m_##name(Identifier::fromString(vm, #name)), m_##name##PrivateName(Identifier::fromUid(PrivateName()))
+#define DECLARE_BUILTIN_NAMES(name) const Identifier m_##name; const Identifier m_##name##PrivateName;
 #define DECLARE_BUILTIN_IDENTIFIER_ACCESSOR(name) \
     const Identifier& name##PublicName() const { return m_##name; } \
     const Identifier& name##PrivateName() const { return m_##name##PrivateName; }
 
+#define INITIALISE_BUILTIN_SYMBOLS(name) INITIALISE_BUILTIN_NAMES(name), m_##name##Symbol(Identifier::fromUid(PrivateName(ASCIILiteral("Symbol." #name))))
+#define DECLARE_BUILTIN_SYMBOLS(name) DECLARE_BUILTIN_NAMES(name) const Identifier m_##name##Symbol;
+#define DECLARE_BUILTIN_SYMBOL_ACCESSOR(name) \
+    DECLARE_BUILTIN_IDENTIFIER_ACCESSOR(name) \
+    const Identifier& name##Symbol() const { return m_##name##Symbol; }
+
 #define INITIALISE_PRIVATE_TO_PUBLIC_ENTRY(name) m_privateToPublicMap.add(m_##name##PrivateName.impl(), &m_##name);
 #define INITIALISE_PUBLIC_TO_PRIVATE_ENTRY(name) m_publicToPrivateMap.add(m_##name.impl(), &m_##name##PrivateName);
     
@@ -48,11 +54,14 @@ public:
         : m_emptyIdentifier(commonIdentifiers->emptyIdentifier)
         JSC_FOREACH_BUILTIN_FUNCTION_NAME(INITIALISE_BUILTIN_NAMES)
         JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALISE_BUILTIN_NAMES)
+        JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALISE_BUILTIN_SYMBOLS)
     {
         JSC_FOREACH_BUILTIN_FUNCTION_NAME(INITIALISE_PRIVATE_TO_PUBLIC_ENTRY)
         JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALISE_PRIVATE_TO_PUBLIC_ENTRY)
+        JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALISE_PRIVATE_TO_PUBLIC_ENTRY)
         JSC_FOREACH_BUILTIN_FUNCTION_NAME(INITIALISE_PUBLIC_TO_PRIVATE_ENTRY)
         JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALISE_PUBLIC_TO_PRIVATE_ENTRY)
+        JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALISE_PUBLIC_TO_PRIVATE_ENTRY)
     }
 
     const Identifier* getPrivateName(const Identifier&) const;
@@ -60,11 +69,13 @@ public:
     
     JSC_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
     JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(DECLARE_BUILTIN_IDENTIFIER_ACCESSOR)
+    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(DECLARE_BUILTIN_SYMBOL_ACCESSOR)
 
 private:
     Identifier m_emptyIdentifier;
     JSC_FOREACH_BUILTIN_FUNCTION_NAME(DECLARE_BUILTIN_NAMES)
     JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(DECLARE_BUILTIN_NAMES)
+    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(DECLARE_BUILTIN_SYMBOLS)
     typedef HashMap<RefPtr<StringImpl>, const Identifier*, IdentifierRepHash> BuiltinNamesMap;
     BuiltinNamesMap m_publicToPrivateMap;
     BuiltinNamesMap m_privateToPublicMap;
@@ -73,7 +84,9 @@ private:
 #undef DECLARE_BUILTIN_NAMES
 #undef INITIALISE_BUILTIN_NAMES
 #undef DECLARE_BUILTIN_IDENTIFIER_ACCESSOR
-
+#undef DECLARE_BUILTIN_SYMBOLS
+#undef INITIALISE_BUILTIN_SYMBOLS
+#undef DECLARE_BUILTIN_SYMBOL_ACCESSOR
 
 inline const Identifier* BuiltinNames::getPrivateName(const Identifier& ident) const
 {
@@ -91,7 +104,7 @@ inline const Identifier& BuiltinNames::getPublicName(const Identifier& ident) co
     return m_emptyIdentifier;
 }
 
-    
+
 }
 
 #endif
index 8f8d165..8872d77 100644 (file)
@@ -513,7 +513,7 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, EvalNode* evalNode, UnlinkedEvalCod
     Vector<Identifier, 0, UnsafeVectorOverflow> variables;
     variables.reserveCapacity(numVariables);
     for (size_t i = 0; i < numVariables; ++i) {
-        ASSERT(varStack[i].first.impl()->isAtomic());
+        ASSERT(varStack[i].first.impl()->isAtomic() || varStack[i].first.impl()->isSymbol());
         variables.append(varStack[i].first);
     }
     codeBlock->adoptVariables(variables);
@@ -2405,14 +2405,14 @@ RegisterID* BytecodeGenerator::popTryAndEmitCatch(TryData* tryData, RegisterID*
 void BytecodeGenerator::emitThrowReferenceError(const String& message)
 {
     emitOpcode(op_throw_static_error);
-    instructions().append(addConstantValue(addStringConstant(Identifier(m_vm, message)))->index());
+    instructions().append(addConstantValue(addStringConstant(Identifier::fromString(m_vm, message)))->index());
     instructions().append(true);
 }
 
 void BytecodeGenerator::emitThrowTypeError(const String& message)
 {
     emitOpcode(op_throw_static_error);
-    instructions().append(addConstantValue(addStringConstant(Identifier(m_vm, message)))->index());
+    instructions().append(addConstantValue(addStringConstant(Identifier::fromString(m_vm, message)))->index());
     instructions().append(false);
 }
 
@@ -2579,7 +2579,7 @@ void BytecodeGenerator::emitReadOnlyExceptionIfNeeded()
     if (!isStrictMode())
         return;
     emitOpcode(op_throw_static_error);
-    instructions().append(addConstantValue(addStringConstant(Identifier(m_vm, StrictModeReadonlyPropertyWriteError)))->index());
+    instructions().append(addConstantValue(addStringConstant(Identifier::fromString(m_vm, StrictModeReadonlyPropertyWriteError)))->index());
     instructions().append(false);
 }
     
@@ -2588,7 +2588,7 @@ void BytecodeGenerator::emitEnumeration(ThrowableExpressionData* node, Expressio
     LabelScopePtr scope = newLabelScope(LabelScope::Loop);
     RefPtr<RegisterID> subject = newTemporary();
     emitNode(subject.get(), subjectNode);
-    RefPtr<RegisterID> iterator = emitGetById(newTemporary(), subject.get(), propertyNames().iteratorPrivateName);
+    RefPtr<RegisterID> iterator = emitGetById(newTemporary(), subject.get(), propertyNames().iteratorSymbol);
     {
         CallArguments args(*this, nullptr);
         emitMove(args.thisRegister(), subject.get());
index 60a494d..65c301d 100644 (file)
@@ -73,7 +73,7 @@ void DesiredIdentifiers::reallyAdd(VM& vm, CommonData* commonData)
     for (unsigned i = 0; i < m_addedIdentifiers.size(); ++i) {
         StringImpl* rep = m_addedIdentifiers[i];
         ASSERT(rep->hasAtLeastOneRef());
-        commonData->dfgIdentifiers.append(Identifier(&vm, rep));
+        commonData->dfgIdentifiers.append(Identifier::fromUid(&vm, rep));
     }
 }
 
index b2974ab..21b08e3 100644 (file)
@@ -203,20 +203,20 @@ JSValue JSInjectedScriptHost::functionDetails(ExecState* exec)
 
     String scriptID = String::number(sourceCode->provider()->asID());
     JSObject* location = constructEmptyObject(exec);
-    location->putDirect(exec->vm(), Identifier(exec, "scriptId"), jsString(exec, scriptID));
-    location->putDirect(exec->vm(), Identifier(exec, "lineNumber"), jsNumber(lineNumber));
-    location->putDirect(exec->vm(), Identifier(exec, "columnNumber"), jsNumber(columnNumber));
+    location->putDirect(exec->vm(), Identifier::fromString(exec, "scriptId"), jsString(exec, scriptID));
+    location->putDirect(exec->vm(), Identifier::fromString(exec, "lineNumber"), jsNumber(lineNumber));
+    location->putDirect(exec->vm(), Identifier::fromString(exec, "columnNumber"), jsNumber(columnNumber));
 
     JSObject* result = constructEmptyObject(exec);
-    result->putDirect(exec->vm(), Identifier(exec, "location"), location);
+    result->putDirect(exec->vm(), Identifier::fromString(exec, "location"), location);
 
     String name = function->name(exec);
     if (!name.isEmpty())
-        result->putDirect(exec->vm(), Identifier(exec, "name"), jsString(exec, name));
+        result->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name));
 
     String displayName = function->displayName(exec);
     if (!displayName.isEmpty())
-        result->putDirect(exec->vm(), Identifier(exec, "displayName"), jsString(exec, displayName));
+        result->putDirect(exec->vm(), Identifier::fromString(exec, "displayName"), jsString(exec, displayName));
 
     // FIXME: provide function scope data in "scopesRaw" property when JSC supports it.
     // <https://webkit.org/b/87192> [JSC] expose function (closure) inner context to debugger
@@ -227,8 +227,8 @@ JSValue JSInjectedScriptHost::functionDetails(ExecState* exec)
 static JSObject* constructInternalProperty(ExecState* exec, const String& name, JSValue value)
 {
     JSObject* result = constructEmptyObject(exec);
-    result->putDirect(exec->vm(), Identifier(exec, "name"), jsString(exec, name));
-    result->putDirect(exec->vm(), Identifier(exec, "value"), value);
+    result->putDirect(exec->vm(), Identifier::fromString(exec, "name"), jsString(exec, name));
+    result->putDirect(exec->vm(), Identifier::fromString(exec, "value"), value);
     return result;
 }
 
@@ -381,8 +381,8 @@ JSValue JSInjectedScriptHost::weakMapEntries(ExecState* exec)
     JSArray* array = constructEmptyArray(exec, nullptr);
     for (auto it = weakMap->weakMapData()->begin(); it != weakMap->weakMapData()->end(); ++it) {
         JSObject* entry = constructEmptyObject(exec);
-        entry->putDirect(exec->vm(), Identifier(exec, "key"), it->key);
-        entry->putDirect(exec->vm(), Identifier(exec, "value"), it->value.get());
+        entry->putDirect(exec->vm(), Identifier::fromString(exec, "key"), it->key);
+        entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), it->value.get());
         array->putDirectIndex(exec, fetched++, entry);
         if (numberToFetch && fetched >= numberToFetch)
             break;
@@ -431,7 +431,7 @@ JSValue JSInjectedScriptHost::iteratorEntries(ExecState* exec)
             break;
 
         JSObject* entry = constructEmptyObject(exec);
-        entry->putDirect(exec->vm(), Identifier(exec, "value"), nextValue);
+        entry->putDirect(exec->vm(), Identifier::fromString(exec, "value"), nextValue);
         array->putDirectIndex(exec, i, entry);
     }
 
index 4bffad1..b1ce0a1 100644 (file)
@@ -66,7 +66,7 @@ void JSInjectedScriptHostPrototype::finishCreation(VM& vm, JSGlobalObject* globa
     JSC_NATIVE_FUNCTION("weakMapEntries", jsInjectedScriptHostPrototypeFunctionWeakMapEntries, DontEnum, 1);
     JSC_NATIVE_FUNCTION("iteratorEntries", jsInjectedScriptHostPrototypeFunctionIteratorEntries, DontEnum, 1);
 
-    Identifier evaluateIdentifier(&vm, "evaluate");
+    Identifier evaluateIdentifier = Identifier::fromString(&vm, "evaluate");
     GetterSetter* accessor = GetterSetter::create(vm, globalObject);
     JSFunction* function = JSFunction::create(vm, globalObject, 0, evaluateIdentifier.string(), jsInjectedScriptHostPrototypeAttributeEvaluate);
     accessor->setGetter(vm, globalObject, function);
index 58bb68b..4828386 100644 (file)
@@ -63,7 +63,7 @@ const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "JavaScriptCallFrame"
 
 #define JSC_NATIVE_NON_INDEX_ACCESSOR(jsName, cppName, attributes) \
     { \
-        Identifier identifier(&vm, jsName); \
+        Identifier identifier = Identifier::fromString(&vm, jsName); \
         GetterSetter* accessor = GetterSetter::create(vm, globalObject); \
         JSFunction* function = JSFunction::create(vm, globalObject, 0, identifier.string(), cppName); \
         accessor->setGetter(vm, globalObject, function); \
index 27dc099..f9f6c1c 100644 (file)
@@ -119,11 +119,11 @@ PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(JSC::ExecState* exec
 static void extractSourceInformationFromException(JSC::ExecState* exec, JSObject* exceptionObject, int* lineNumber, int* columnNumber, String* sourceURL)
 {
     // FIXME: <http://webkit.org/b/115087> Web Inspector: Should not need to evaluate JavaScript handling exceptions
-    JSValue lineValue = exceptionObject->getDirect(exec->vm(), Identifier(exec, "line"));
+    JSValue lineValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "line"));
     *lineNumber = lineValue && lineValue.isNumber() ? int(lineValue.toNumber(exec)) : 0;
-    JSValue columnValue = exceptionObject->getDirect(exec->vm(), Identifier(exec, "column"));
+    JSValue columnValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "column"));
     *columnNumber = columnValue && columnValue.isNumber() ? int(columnValue.toNumber(exec)) : 0;
-    JSValue sourceURLValue = exceptionObject->getDirect(exec->vm(), Identifier(exec, "sourceURL"));
+    JSValue sourceURLValue = exceptionObject->getDirect(exec->vm(), Identifier::fromString(exec, "sourceURL"));
     *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toString(exec)->value(exec) : ASCIILiteral("undefined");
     exec->clearException();
 }
index 6451650..58b8636 100644 (file)
@@ -153,7 +153,7 @@ EncodedJSValue JIT_OPERATION operationGetById(ExecState* exec, StructureStubInfo
     
     JSValue baseValue = JSValue::decode(base);
     PropertySlot slot(baseValue);
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     return JSValue::encode(baseValue.get(exec, ident, slot));
 }
 
@@ -162,7 +162,7 @@ EncodedJSValue JIT_OPERATION operationGetByIdBuildList(ExecState* exec, Structur
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
 
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue baseValue = JSValue::decode(base);
@@ -179,7 +179,7 @@ EncodedJSValue JIT_OPERATION operationGetByIdOptimize(ExecState* exec, Structure
 {
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
-    Identifier ident = uid->isUnique() ? Identifier::from(PrivateName(uid)) : Identifier(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
 
     JSValue baseValue = JSValue::decode(base);
     PropertySlot slot(baseValue);
@@ -206,7 +206,7 @@ EncodedJSValue JIT_OPERATION operationInOptimize(ExecState* exec, StructureStubI
     
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
-    Identifier ident(vm, key);
+    Identifier ident = Identifier::fromUid(vm, key);
     PropertySlot slot(base);
     bool result = asObject(base)->getPropertySlot(exec, ident, slot);
     
@@ -230,7 +230,7 @@ EncodedJSValue JIT_OPERATION operationIn(ExecState* exec, StructureStubInfo*, JS
         return JSValue::encode(jsUndefined());
     }
 
-    Identifier ident(vm, key);
+    Identifier ident = Identifier::fromUid(vm, key);
     return JSValue::encode(jsBoolean(asObject(base)->hasProperty(exec, ident)));
 }
 
@@ -247,7 +247,7 @@ void JIT_OPERATION operationPutByIdStrict(ExecState* exec, StructureStubInfo*, E
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     PutPropertySlot slot(JSValue::decode(encodedBase), true, exec->codeBlock()->putByIdContext());
     JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot);
 }
@@ -257,7 +257,7 @@ void JIT_OPERATION operationPutByIdNonStrict(ExecState* exec, StructureStubInfo*
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     PutPropertySlot slot(JSValue::decode(encodedBase), false, exec->codeBlock()->putByIdContext());
     JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot);
 }
@@ -267,7 +267,7 @@ void JIT_OPERATION operationPutByIdDirectStrict(ExecState* exec, StructureStubIn
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     PutPropertySlot slot(JSValue::decode(encodedBase), true, exec->codeBlock()->putByIdContext());
     asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot);
 }
@@ -277,7 +277,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrict(ExecState* exec, StructureStu
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     PutPropertySlot slot(JSValue::decode(encodedBase), false, exec->codeBlock()->putByIdContext());
     asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot);
 }
@@ -287,7 +287,7 @@ void JIT_OPERATION operationPutByIdStrictOptimize(ExecState* exec, StructureStub
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
@@ -311,7 +311,7 @@ void JIT_OPERATION operationPutByIdNonStrictOptimize(ExecState* exec, StructureS
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
@@ -335,7 +335,7 @@ void JIT_OPERATION operationPutByIdDirectStrictOptimize(ExecState* exec, Structu
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
@@ -359,7 +359,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrictOptimize(ExecState* exec, Stru
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
@@ -383,7 +383,7 @@ void JIT_OPERATION operationPutByIdStrictBuildList(ExecState* exec, StructureStu
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
@@ -404,7 +404,7 @@ void JIT_OPERATION operationPutByIdNonStrictBuildList(ExecState* exec, Structure
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
@@ -425,7 +425,7 @@ void JIT_OPERATION operationPutByIdDirectStrictBuildList(ExecState* exec, Struct
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
     
     JSValue value = JSValue::decode(encodedValue);
@@ -446,7 +446,7 @@ void JIT_OPERATION operationPutByIdDirectNonStrictBuildList(ExecState* exec, Str
     VM* vm = &exec->vm();
     NativeCallFrameTracer tracer(vm, exec);
     
-    Identifier ident(vm, uid);
+    Identifier ident = Identifier::fromUid(vm, uid);
     AccessType accessType = static_cast<AccessType>(stubInfo->accessType);
 
     JSValue value = JSValue::decode(encodedValue);
index 2b2d1b7..fa94ab6 100644 (file)
@@ -618,11 +618,11 @@ protected:
         addFunction(vm, "getElement", functionGetElement, 1);
         addFunction(vm, "setElementRoot", functionSetElementRoot, 2);
         
-        putDirectNativeFunction(vm, this, Identifier(&vm, "DFGTrue"), 0, functionFalse1, DFGTrueIntrinsic, DontEnum | JSC::Function);
-        putDirectNativeFunction(vm, this, Identifier(&vm, "OSRExit"), 0, functionUndefined1, OSRExitIntrinsic, DontEnum | JSC::Function);
-        putDirectNativeFunction(vm, this, Identifier(&vm, "isFinalTier"), 0, functionFalse2, IsFinalTierIntrinsic, DontEnum | JSC::Function);
-        putDirectNativeFunction(vm, this, Identifier(&vm, "predictInt32"), 0, functionUndefined2, SetInt32HeapPredictionIntrinsic, DontEnum | JSC::Function);
-        putDirectNativeFunction(vm, this, Identifier(&vm, "fiatInt52"), 0, functionIdentity, FiatInt52Intrinsic, DontEnum | JSC::Function);
+        putDirectNativeFunction(vm, this, Identifier::fromString(&vm, "DFGTrue"), 0, functionFalse1, DFGTrueIntrinsic, DontEnum | JSC::Function);
+        putDirectNativeFunction(vm, this, Identifier::fromString(&vm, "OSRExit"), 0, functionUndefined1, OSRExitIntrinsic, DontEnum | JSC::Function);
+        putDirectNativeFunction(vm, this, Identifier::fromString(&vm, "isFinalTier"), 0, functionFalse2, IsFinalTierIntrinsic, DontEnum | JSC::Function);
+        putDirectNativeFunction(vm, this, Identifier::fromString(&vm, "predictInt32"), 0, functionUndefined2, SetInt32HeapPredictionIntrinsic, DontEnum | JSC::Function);
+        putDirectNativeFunction(vm, this, Identifier::fromString(&vm, "fiatInt52"), 0, functionIdentity, FiatInt52Intrinsic, DontEnum | JSC::Function);
         
         addFunction(vm, "effectful42", functionEffectful42, 0);
         addFunction(vm, "makeMasquerader", functionMakeMasquerader, 0);
@@ -644,20 +644,20 @@ protected:
         JSArray* array = constructEmptyArray(globalExec(), 0);
         for (size_t i = 0; i < arguments.size(); ++i)
             array->putDirectIndex(globalExec(), i, jsString(globalExec(), arguments[i]));
-        putDirect(vm, Identifier(globalExec(), "arguments"), array);
+        putDirect(vm, Identifier::fromString(globalExec(), "arguments"), array);
         
-        putDirect(vm, Identifier(globalExec(), "console"), jsUndefined());
+        putDirect(vm, Identifier::fromString(globalExec(), "console"), jsUndefined());
     }
 
     void addFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
     {
-        Identifier identifier(&vm, name);
+        Identifier identifier = Identifier::fromString(&vm, name);
         putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function));
     }
     
     void addConstructableFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
     {
-        Identifier identifier(&vm, name);
+        Identifier identifier = Identifier::fromString(&vm, name);
         putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function, NoIntrinsic, function));
     }
 };
@@ -889,7 +889,7 @@ EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
     for (unsigned i = 1; i < exec->argumentCount(); ++i)
         array->putDirectIndex(globalObject->globalExec(), i - 1, exec->uncheckedArgument(i));
     globalObject->putDirect(
-        exec->vm(), Identifier(globalObject->globalExec(), "arguments"), array);
+        exec->vm(), Identifier::fromString(globalObject->globalExec(), "arguments"), array);
 
     JSValue exception;
     StopWatch stopWatch;
@@ -1270,7 +1270,7 @@ static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scr
             printf("End: %s\n", returnValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
         if (evaluationException) {
             printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
-            Identifier stackID(globalObject->globalExec(), "stack");
+            Identifier stackID = Identifier::fromString(globalObject->globalExec(), "stack");
             JSValue stackValue = evaluationException.get(globalObject->globalExec(), stackID);
             if (!stackValue.isUndefinedOrNull())
                 printf("%s\n", stackValue.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
index ab01501..edfd670 100644 (file)
@@ -163,7 +163,7 @@ void Data::performAssertions(VM& vm)
     ASSERT(bitwise_cast<int**>(&testVector)[0] == testVector.begin());
 #endif
 
-    ASSERT(StringImpl::s_hashFlag8BitBuffer == 32);
+    ASSERT(StringImpl::s_hashFlag8BitBuffer == 8);
 }
 #if COMPILER(CLANG)
 #pragma clang diagnostic pop
index 43ed7e8..fda91ed 100644 (file)
@@ -179,7 +179,7 @@ const FunctionCode = 2
 const LLIntReturnPC = ArgumentCount + TagOffset
 
 # String flags.
-const HashFlags8BitBuffer = 32
+const HashFlags8BitBuffer = 8
 
 # Copied from PropertyOffset.h
 const firstOutOfLineOffset = 100
index 3ae283d..b8fe4b8 100644 (file)
@@ -571,7 +571,7 @@ public:
     {
         if (m_vm->propertyNames->arguments == *ident)
             usesArguments();
-        ASSERT(ident->impl()->isAtomic());
+        ASSERT(ident->impl()->isAtomic() || ident->impl()->isSymbol());
         m_scope.m_varDeclarations.append(std::make_pair(*ident, attrs));
     }
 
index 40310bc..5f4480b 100644 (file)
@@ -292,10 +292,10 @@ String Parser<LexerType>::parseInner()
         IdentifierSet usedVariables;
         scope->getUsedVariables(usedVariables);
         for (const auto& variable : usedVariables) {
-            if (scope->hasDeclaredVariable(Identifier(m_vm, variable.get())))
+            if (scope->hasDeclaredVariable(Identifier::fromUid(m_vm, variable.get())))
                 continue;
             
-            if (scope->hasDeclaredParameter(Identifier(m_vm, variable.get())))
+            if (scope->hasDeclaredParameter(Identifier::fromUid(m_vm, variable.get())))
                 continue;
 
             if (variable == m_vm->propertyNames->arguments.impl())
@@ -524,7 +524,7 @@ template <class TreeBuilder> TreeDeconstructionPattern Parser<LexerType>::create
     ASSERT(!name.isEmpty());
     ASSERT(!name.isNull());
     
-    ASSERT(name.impl()->isAtomic());
+    ASSERT(name.impl()->isAtomic() || name.impl()->isSymbol());
     if (depth) {
         if (kind == DeconstructToVariables)
             failIfFalseIfStrict(declareVariable(&name), "Cannot deconstruct to a variable named '", name.impl(), "' in strict mode");
index 427b84c..40ece53 100644 (file)
@@ -73,20 +73,20 @@ namespace JSC {
         if (!length)
             return vm->propertyNames->emptyIdentifier;
         if (characters[0] >= MaximumCachableCharacter) {
-            m_identifiers.append(Identifier(vm, characters, length));
+            m_identifiers.append(Identifier::fromString(vm, characters, length));
             return m_identifiers.last();
         }
         if (length == 1) {
             if (Identifier* ident = m_shortIdentifiers[characters[0]])
                 return *ident;
-            m_identifiers.append(Identifier(vm, characters, length));
+            m_identifiers.append(Identifier::fromString(vm, characters, length));
             m_shortIdentifiers[characters[0]] = &m_identifiers.last();
             return m_identifiers.last();
         }
         Identifier* ident = m_recentIdentifiers[characters[0]];
         if (ident && Identifier::equal(ident->impl(), characters, length))
             return *ident;
-        m_identifiers.append(Identifier(vm, characters, length));
+        m_identifiers.append(Identifier::fromString(vm, characters, length));
         m_recentIdentifiers[characters[0]] = &m_identifiers.last();
         return m_identifiers.last();
     }
@@ -102,7 +102,7 @@ namespace JSC {
         if (length == 1) {
             if (Identifier* ident = m_shortIdentifiers[characters[0]])
                 return *ident;
-            m_identifiers.append(Identifier(vm, characters, length));
+            m_identifiers.append(Identifier::fromString(vm, characters, length));
             m_shortIdentifiers[characters[0]] = &m_identifiers.last();
             return m_identifiers.last();
         }
@@ -116,7 +116,7 @@ namespace JSC {
     
     inline const Identifier& IdentifierArena::makeNumericIdentifier(VM* vm, double number)
     {
-        m_identifiers.append(Identifier(vm, String::numberToStringECMAScript(number)));
+        m_identifiers.append(Identifier::fromString(vm, String::numberToStringECMAScript(number)));
         return m_identifiers.last();
     }
 
index ad8b759..fc35a9f 100644 (file)
@@ -43,7 +43,7 @@ void ArgumentsIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalOb
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
 
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, argumentsIteratorPrototypeFuncIterator, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, argumentsIteratorPrototypeFuncIterator, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->next, argumentsIteratorPrototypeFuncNext, DontEnum, 0);
 }
 
index f76868c..b862677 100644 (file)
@@ -59,7 +59,7 @@ void ArrayIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, arrayIteratorProtoFuncIterator, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, arrayIteratorProtoFuncIterator, DontEnum, 0);
 }
 
 bool ArrayIteratorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
index b2fd711..8148a31 100644 (file)
@@ -139,7 +139,7 @@ void ArrayPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, arrayProtoFuncValues, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, arrayProtoFuncValues, DontEnum, 0);
 }
 
 bool ArrayPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
@@ -531,7 +531,7 @@ EncodedJSValue JSC_HOST_CALL arrayProtoFuncPush(ExecState* exec)
             thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->uncheckedArgument(n), true);
         else {
             PutPropertySlot slot(thisObj);
-            Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec));
+            Identifier propertyName = Identifier::fromString(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec));
             thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot);
         }
         if (exec->hadException())
index eb95f78..807d51f 100644 (file)
@@ -140,9 +140,9 @@ bool ClonedArguments::getOwnPropertySlot(JSObject* object, ExecState* exec, Prop
     if (Base::getOwnPropertySlot(thisObject, exec, ident, slot))
         return true;
     
-    if (ident == vm.propertyNames->iteratorPrivateName) {
+    if (ident == vm.propertyNames->iteratorSymbol) {
         JSGlobalObject* globalObject = exec->lexicalGlobalObject();
-        thisObject->JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, argumentsFuncIterator, DontEnum, 0);
+        thisObject->JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, argumentsFuncIterator, DontEnum, 0);
         if (JSObject::getOwnPropertySlot(thisObject, exec, ident, slot))
             return true;
     }
index 56df345..0b28d5c 100644 (file)
 #include "CommonIdentifiers.h"
 
 #include "BuiltinNames.h"
+#include "IdentifierInlines.h"
 #include "JSCBuiltins.h"
 #include "PrivateName.h"
 
 namespace JSC {
 
-#define INITIALIZE_PROPERTY_NAME(name) , name(vm, #name)
-#define INITIALIZE_KEYWORD(name) , name##Keyword(vm, #name)
+#define INITIALIZE_PROPERTY_NAME(name) , name(Identifier::fromString(vm, #name))
+#define INITIALIZE_KEYWORD(name) , name##Keyword(Identifier::fromString(vm, #name))
 #define INITIALIZE_PRIVATE_NAME(name) , name##PrivateName(m_builtinNames->name##PrivateName())
+#define INITIALIZE_SYMBOL(name) , name##Symbol(m_builtinNames->name##Symbol())
 
 CommonIdentifiers::CommonIdentifiers(VM* vm)
     : nullIdentifier()
     , emptyIdentifier(Identifier::EmptyIdentifier)
-    , underscoreProto(vm, "__proto__")
-    , thisIdentifier(vm, "this")
-    , useStrictIdentifier(vm, "use strict")
+    , underscoreProto(Identifier::fromString(vm, "__proto__"))
+    , thisIdentifier(Identifier::fromString(vm, "this"))
+    , useStrictIdentifier(Identifier::fromString(vm, "use strict"))
     , m_builtinNames(new BuiltinNames(vm, this))
     JSC_COMMON_IDENTIFIERS_EACH_KEYWORD(INITIALIZE_KEYWORD)
     JSC_COMMON_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PROPERTY_NAME)
     JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_PRIVATE_NAME)
+    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALIZE_SYMBOL)
 {
 }
 
index 6f34fa9..7990b3f 100644 (file)
     macro(unscopable)
 
 #define JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
-    JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(macro) \
     macro(iteratedObject) \
     macro(arrayIteratorNextIndex) \
     macro(arrayIterationKind) \
@@ -298,7 +297,11 @@ namespace JSC {
 #define JSC_IDENTIFIER_DECLARE_PRIVATE_PROPERTY_NAME_GLOBAL(name) const Identifier name##PrivateName;
         JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(JSC_IDENTIFIER_DECLARE_PRIVATE_PROPERTY_NAME_GLOBAL)
 #undef JSC_IDENTIFIER_DECLARE_PRIVATE_PROPERTY_NAME_GLOBAL
-        
+
+#define JSC_IDENTIFIER_DECLARE_PRIVATE_WELL_KNOWN_SYMBOL_GLOBAL(name) const Identifier name##Symbol;
+        JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(JSC_IDENTIFIER_DECLARE_PRIVATE_WELL_KNOWN_SYMBOL_GLOBAL)
+#undef JSC_IDENTIFIER_DECLARE_PRIVATE_WELL_KNOWN_SYMBOL_GLOBAL
+
         const Identifier* getPrivateName(const Identifier&) const;
         Identifier getPublicName(const Identifier&) const;
     };
index 930b6fa..36156a1 100644 (file)
@@ -137,17 +137,17 @@ JSObject* addErrorInfo(CallFrame* callFrame, JSObject* error, int line, const So
     const String& sourceURL = source.provider()->url();
 
     if (line != -1)
-        error->putDirect(*vm, Identifier(vm, linePropertyName), jsNumber(line), ReadOnly | DontDelete);
+        error->putDirect(*vm, Identifier::fromString(vm, linePropertyName), jsNumber(line), ReadOnly | DontDelete);
     if (!sourceURL.isNull())
-        error->putDirect(*vm, Identifier(vm, sourceURLPropertyName), jsString(vm, sourceURL), ReadOnly | DontDelete);
+        error->putDirect(*vm, Identifier::fromString(vm, sourceURLPropertyName), jsString(vm, sourceURL), ReadOnly | DontDelete);
     return error;
 }
 
 
 bool hasErrorInfo(ExecState* exec, JSObject* error)
 {
-    return error->hasProperty(exec, Identifier(exec, linePropertyName))
-        || error->hasProperty(exec, Identifier(exec, sourceURLPropertyName));
+    return error->hasProperty(exec, Identifier::fromString(exec, linePropertyName))
+        || error->hasProperty(exec, Identifier::fromString(exec, sourceURLPropertyName));
 }
 
 JSObject* throwTypeError(ExecState* exec)
index a7be174..10fa930 100644 (file)
@@ -82,8 +82,7 @@ JSObject* createStackOverflowError(JSGlobalObject* globalObject)
 
 JSObject* createUndefinedVariableError(ExecState* exec, const Identifier& ident)
 {
-    
-    if (ident.impl()->isUnique()) {
+    if (ident.impl()->isSymbol()) {
         String message(makeString("Can't find private variable: @", exec->propertyNames().getPublicName(ident).string()));
         return createReferenceError(exec, message);
     }
index 516b7aa..0c8995c 100644 (file)
@@ -58,9 +58,9 @@ bool GenericArguments<Type>::getOwnPropertySlot(JSObject* object, ExecState* exe
     if (Base::getOwnPropertySlot(thisObject, exec, ident, slot))
         return true;
     
-    if (ident == vm.propertyNames->iteratorPrivateName) {
+    if (ident == vm.propertyNames->iteratorSymbol) {
         JSGlobalObject* globalObject = exec->lexicalGlobalObject();
-        thisObject->JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, argumentsFuncIterator, DontEnum, 0);
+        thisObject->JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, argumentsFuncIterator, DontEnum, 0);
         if (JSObject::getOwnPropertySlot(thisObject, exec, ident, slot))
             return true;
     }
index 0132d0e..de4acbc 100644 (file)
@@ -38,23 +38,6 @@ public:
     enum EmptyIdentifierFlag { EmptyIdentifier };
     Identifier(EmptyIdentifierFlag) : m_string(StringImpl::empty()) { ASSERT(m_string.impl()->isAtomic()); }
 
-    // Only to be used with string literals.
-    template<unsigned charactersCount>
-    Identifier(ExecState* exec, const char (&characters)[charactersCount]) : m_string(add(exec, characters)) { ASSERT(m_string.impl()->isAtomic()); }
-    template<unsigned charactersCount>
-    Identifier(VM* vm, const char (&characters)[charactersCount]) : m_string(add(vm, characters)) { ASSERT(m_string.impl()->isAtomic()); }
-
-    Identifier(ExecState*, AtomicStringImpl*);
-    Identifier(ExecState*, const AtomicString&);
-    Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { ASSERT(m_string.impl()->isAtomic()); }
-    Identifier(ExecState* exec, const String& s) : m_string(add(exec, s.impl())) { ASSERT(m_string.impl()->isAtomic()); }
-    Identifier(ExecState* exec, const char* s) : Identifier(exec, AtomicString(s)) { }
-
-    Identifier(VM* vm, const LChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
-    Identifier(VM* vm, const UChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
-    Identifier(VM* vm, StringImpl* rep) : m_string(add(vm, rep)) { ASSERT(m_string.impl()->isAtomic()); }
-    Identifier(VM* vm, const String& s) : m_string(add(vm, s.impl())) { ASSERT(m_string.impl()->isAtomic()); }
-
     const String& string() const { return m_string; }
     AtomicStringImpl* impl() const { return static_cast<AtomicStringImpl*>(m_string.impl()); }
 
@@ -63,12 +46,33 @@ public:
     CString ascii() const { return m_string.ascii(); }
     CString utf8() const { return m_string.utf8(); }
 
-    static Identifier from(const PrivateName& name)
-    {
-        Identifier result;
-        result.m_string = name.uid();
-        return result;
-    }
+    // There's 2 functions to construct Identifier from string, (1) fromString and (2) fromUid.
+    // They have different meanings in keeping or discarding symbol-ness of strings.
+    // (1): fromString
+    // Just construct Identifier from string. String held by Identifier is always atomized.
+    // Symbol-ness of StringImpl*, which represents that the string is inteded to be used for ES6 Symbols, is discarded.
+    // So a constructed Identifier never represents a symbol.
+    // (2): fromUid
+    // `StringImpl* uid` represents ether String or Symbol property.
+    // fromUid keeps symbol-ness of provided StringImpl* while fromString discards it.
+    // Use fromUid when constructing Identifier from StringImpl* which may represent symbols.
+
+    // Only to be used with string literals.
+    template<unsigned charactersCount>
+    static Identifier fromString(VM*, const char (&characters)[charactersCount]);
+    template<unsigned charactersCount>
+    static Identifier fromString(ExecState*, const char (&characters)[charactersCount]);
+    static Identifier fromString(VM*, const LChar*, int length);
+    static Identifier fromString(VM*, const UChar*, int length);
+    static Identifier fromString(VM*, const String&);
+    static Identifier fromString(ExecState*, AtomicStringImpl*);
+    static Identifier fromString(ExecState*, const AtomicString&);
+    static Identifier fromString(ExecState*, const String&);
+    static Identifier fromString(ExecState*, const char*);
+
+    static Identifier fromUid(VM*, StringImpl* uid);
+    static Identifier fromUid(ExecState*, StringImpl* uid);
+    static Identifier fromUid(const PrivateName&);
 
     static Identifier createLCharFromUChar(VM* vm, const UChar* s, int length) { return Identifier(vm, add8(vm, s, length)); }
 
@@ -81,6 +85,7 @@ public:
 
     bool isNull() const { return m_string.isNull(); }
     bool isEmpty() const { return m_string.isEmpty(); }
+    bool isSymbol() const { return impl()->isSymbol(); }
 
     friend bool operator==(const Identifier&, const Identifier&);
     friend bool operator!=(const Identifier&, const Identifier&);
@@ -105,6 +110,20 @@ public:
 private:
     String m_string;
 
+    // Only to be used with string literals.
+    template<unsigned charactersCount>
+    Identifier(VM* vm, const char (&characters)[charactersCount]) : m_string(add(vm, characters)) { ASSERT(m_string.impl()->isAtomic()); }
+
+    Identifier(VM* vm, const LChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(VM* vm, const UChar* s, int length) : m_string(add(vm, s, length)) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(ExecState*, AtomicStringImpl*);
+    Identifier(ExecState*, const AtomicString&);
+    Identifier(VM* vm, const String& string) : m_string(add(vm, string.impl())) { ASSERT(m_string.impl()->isAtomic()); }
+    Identifier(VM* vm, StringImpl* rep) : m_string(add(vm, rep)) { ASSERT(m_string.impl()->isAtomic()); }
+
+    enum UniqueIdentifierFlag { UniqueIdentifier };
+    Identifier(UniqueIdentifierFlag, StringImpl* uid) : m_string(uid) { ASSERT(m_string.impl()->isSymbol()); }
+
     template <typename CharType>
     ALWAYS_INLINE static uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok);
 
index 7472d84..406221a 100644 (file)
@@ -37,7 +37,7 @@ inline Identifier::Identifier(ExecState* exec, AtomicStringImpl* string)
 #ifndef NDEBUG
     checkCurrentAtomicStringTable(exec);
     if (string)
-        ASSERT_WITH_MESSAGE(!string->length() || AtomicString::isInAtomicStringTable(string), "The atomic string comes from an other thread!");
+        ASSERT_WITH_MESSAGE(!string->length() || string->isSymbol() || AtomicString::isInAtomicStringTable(string), "The atomic string comes from an other thread!");
 #else
     UNUSED_PARAM(exec);
 #endif
@@ -49,7 +49,7 @@ inline Identifier::Identifier(ExecState* exec, const AtomicString& string)
 #ifndef NDEBUG
     checkCurrentAtomicStringTable(exec);
     if (!string.isNull())
-        ASSERT_WITH_MESSAGE(!string.length() || AtomicString::isInAtomicStringTable(string.impl()), "The atomic string comes from an other thread!");
+        ASSERT_WITH_MESSAGE(!string.length() || string.impl()->isSymbol() || AtomicString::isInAtomicStringTable(string.impl()), "The atomic string comes from an other thread!");
 #else
     UNUSED_PARAM(exec);
 #endif
@@ -70,6 +70,70 @@ inline Ref<StringImpl> Identifier::add(VM* vm, StringImpl* r)
     return *AtomicString::addWithStringTableProvider(*vm, r);
 }
 
+inline Identifier Identifier::fromUid(VM* vm, StringImpl* uid)
+{
+    if (!uid || !uid->isSymbol())
+        return Identifier(vm, uid);
+    return Identifier(UniqueIdentifier, uid);
+}
+
+inline Identifier Identifier::fromUid(ExecState* exec, StringImpl* uid)
+{
+    return fromUid(&exec->vm(), uid);
+}
+
+inline Identifier Identifier::fromUid(const PrivateName& name)
+{
+    return Identifier(UniqueIdentifier, name.uid());
+}
+
+template<unsigned charactersCount>
+inline Identifier Identifier::fromString(VM* vm, const char (&characters)[charactersCount])
+{
+    return Identifier(vm, characters);
+}
+
+template<unsigned charactersCount>
+inline Identifier Identifier::fromString(ExecState* exec, const char (&characters)[charactersCount])
+{
+    return Identifier(&exec->vm(), characters);
+}
+
+inline Identifier Identifier::fromString(VM* vm, const LChar* s, int length)
+{
+    return Identifier(vm, s, length);
+}
+
+inline Identifier Identifier::fromString(VM* vm, const UChar* s, int length)
+{
+    return Identifier(vm, s, length);
+}
+
+inline Identifier Identifier::fromString(VM* vm, const String& string)
+{
+    return Identifier(vm, string.impl());
+}
+
+inline Identifier Identifier::fromString(ExecState* exec, const String& string)
+{
+    return Identifier(&exec->vm(), string.impl());
+}
+
+inline Identifier Identifier::fromString(ExecState* exec, AtomicStringImpl* atomicString)
+{
+    return Identifier(exec, atomicString);
+}
+
+inline Identifier Identifier::fromString(ExecState* exec, const AtomicString& atomicString)
+{
+    return Identifier(exec, atomicString);
+}
+
+inline Identifier Identifier::fromString(ExecState* exec, const char* s)
+{
+    return Identifier(exec, AtomicString(s));
+}
+
 } // namespace JSC
 
 #endif // IdentifierInlines_h
index 48756ba..7d61ca2 100644 (file)
@@ -233,8 +233,8 @@ void JSValue::dumpInContextAssumingStructure(
                     out.print(" (atomic)");
                 if (impl->isAtomic())
                     out.print(" (identifier)");
-                if (impl->isUnique())
-                    out.print(" (unique)");
+                if (impl->isSymbol())
+                    out.print(" (symbol)");
             } else
                 out.print(" (unresolved)");
             out.print(": ", impl);
index a40f98f..72c0cd9 100644 (file)
@@ -618,7 +618,7 @@ ALWAYS_INLINE Identifier JSValue::toPropertyKey(ExecState* exec) const
 
     JSValue primitive = toPrimitive(exec, PreferString);
     if (primitive.isSymbol())
-        return Identifier::from(asSymbol(primitive)->privateName());
+        return Identifier::fromUid(asSymbol(primitive)->privateName());
     return primitive.toString(exec)->toIdentifier(exec);
 }
 
index 2154db7..d39618a 100644 (file)
@@ -414,7 +414,7 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct
     
     for (unsigned typedArrayIndex = NUMBER_OF_TYPED_ARRAY_TYPES; typedArrayIndex--;) {
         m_typedArrays[typedArrayIndex].prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, typedArrayConstructors[typedArrayIndex], DontEnum);
-        putDirectWithoutTransition(vm, Identifier(exec, typedArrayConstructors[typedArrayIndex]->name(exec)), typedArrayConstructors[typedArrayIndex], DontEnum);
+        putDirectWithoutTransition(vm, Identifier::fromString(exec, typedArrayConstructors[typedArrayIndex]->name(exec)), typedArrayConstructors[typedArrayIndex], DontEnum);
     }
     
     JSFunction* builtinLog = JSFunction::create(vm, this, 1, vm.propertyNames->emptyIdentifier.string(), globalFuncBuiltinLog);
@@ -450,7 +450,7 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct
     ConsolePrototype* consolePrototype = ConsolePrototype::create(vm, this, ConsolePrototype::createStructure(vm, this, m_objectPrototype.get()));
     m_consoleStructure.set(vm, this, JSConsole::createStructure(vm, this, consolePrototype));
     JSConsole* consoleObject = JSConsole::create(vm, m_consoleStructure.get());
-    putDirectWithoutTransition(vm, Identifier(exec, "console"), consoleObject, DontEnum);
+    putDirectWithoutTransition(vm, Identifier::fromString(exec, "console"), consoleObject, DontEnum);
 
     resetPrototype(vm, prototype());
 }
index 5874f23..c1107e6 100644 (file)
@@ -112,7 +112,9 @@ void JSLexicalEnvironment::getOwnNonIndexPropertyNames(JSObject* object, ExecSta
                 continue;
             if (!thisObject->isValid(it->value.scopeOffset()))
                 continue;
-            propertyNames.add(Identifier(exec, it->key.get()));
+            if (it->key->isSymbol())
+                continue;
+            propertyNames.add(Identifier::fromUid(exec, it->key.get()));
         }
     }
     // Skip the JSEnvironmentRecord implementation of getOwnNonIndexPropertyNames
index 3fdd6be..523d12a 100644 (file)
@@ -79,7 +79,7 @@ static inline void getClassPropertyNames(ExecState* exec, const ClassInfo* class
 
         for (auto iter = table->begin(); iter != table->end(); ++iter) {
             if ((!(iter->attributes() & DontEnum) || shouldIncludeDontEnumProperties(mode)) && !((iter->attributes() & BuiltinOrFunction) && didReify))
-                propertyNames.add(Identifier(&vm, iter.key()));
+                propertyNames.add(Identifier::fromString(&vm, iter.key()));
         }
     }
 }
@@ -1679,7 +1679,7 @@ void JSObject::reifyStaticFunctionsForDelete(ExecState* exec)
         PropertySlot slot(this);
         for (auto iter = hashTable->begin(); iter != hashTable->end(); ++iter) {
             if (iter->attributes() & BuiltinOrFunction)
-                setUpStaticFunctionSlot(globalObject()->globalExec(), iter.value(), this, Identifier(&vm, iter.key()), slot);
+                setUpStaticFunctionSlot(globalObject()->globalExec(), iter.value(), this, Identifier::fromString(&vm, iter.key()), slot);
         }
     }
 
index 3f5e25d..786775a 100644 (file)
@@ -1554,7 +1554,7 @@ COMPILE_ASSERT(!(sizeof(JSObject) % sizeof(WriteBarrierBase<Unknown>)), JSObject
 
 ALWAYS_INLINE Identifier makeIdentifier(VM& vm, const char* name)
 {
-    return Identifier(&vm, name);
+    return Identifier::fromString(&vm, name);
 }
 
 ALWAYS_INLINE Identifier makeIdentifier(VM&, const Identifier& name)
index afdfc27..b8a5ada 100644 (file)
@@ -317,7 +317,7 @@ EncodedJSValue JSC_HOST_CALL JSPromiseConstructorFuncRace(ExecState* exec)
     JSPromiseDeferred* deferred = jsCast<JSPromiseDeferred*>(deferredValue);
 
     // 4. Let 'iterator' be the result of calling GetIterator(iterable).
-    JSValue iteratorFunction = iterable.get(exec, vm.propertyNames->iteratorPrivateName);
+    JSValue iteratorFunction = iterable.get(exec, vm.propertyNames->iteratorSymbol);
     if (exec->hadException())
         return JSValue::encode(abruptRejection(exec, deferred));
 
@@ -480,7 +480,7 @@ EncodedJSValue JSC_HOST_CALL JSPromiseConstructorFuncAll(ExecState* exec)
     JSPromiseDeferred* deferred = jsCast<JSPromiseDeferred*>(deferredValue);
 
     // 4. Let 'iterator' be the result of calling GetIterator(iterable).
-    JSValue iteratorFunction = iterable.get(exec, vm.propertyNames->iteratorPrivateName);
+    JSValue iteratorFunction = iterable.get(exec, vm.propertyNames->iteratorSymbol);
     if (exec->hadException())
         return JSValue::encode(abruptRejection(exec, deferred));
 
index 281ae46..c1af0ca 100644 (file)
@@ -467,7 +467,7 @@ inline JSString* jsNontrivialString(VM* vm, String&& s)
 
 ALWAYS_INLINE Identifier JSString::toIdentifier(ExecState* exec) const
 {
-    return Identifier(exec, toAtomicString(exec));
+    return Identifier::fromString(exec, toAtomicString(exec));
 }
 
 ALWAYS_INLINE AtomicString JSString::toAtomicString(ExecState* exec) const
index b8fb228..2b01862 100644 (file)
@@ -61,10 +61,10 @@ void JSSymbolTableObject::getOwnNonIndexPropertyNames(JSObject* object, ExecStat
         ConcurrentJITLocker locker(thisObject->symbolTable()->m_lock);
         SymbolTable::Map::iterator end = thisObject->symbolTable()->end(locker);
         for (SymbolTable::Map::iterator it = thisObject->symbolTable()->begin(locker); it != end; ++it) {
-            if (it->key->isUnique())
+            if (it->key->isSymbol())
                 continue;
             if (!(it->value.getAttributes() & DontEnum) || shouldIncludeDontEnumProperties(mode))
-                propertyNames.add(Identifier(exec, it->key.get()));
+                propertyNames.add(Identifier::fromUid(exec, it->key.get()));
         }
     }
     
index f6f5fe1..d4544a4 100644 (file)
@@ -57,17 +57,17 @@ bool LiteralParser<CharType>::tryJSONPParse(Vector<JSONPData>& results, bool nee
     do {
         Vector<JSONPPathEntry> path;
         // Unguarded next to start off the lexer
-        Identifier name = Identifier(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
+        Identifier name = Identifier::fromString(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
         JSONPPathEntry entry;
         if (name == m_exec->vm().propertyNames->varKeyword) {
             if (m_lexer.next() != TokIdentifier)
                 return false;
             entry.m_type = JSONPPathEntryTypeDeclare;
-            entry.m_pathEntryName = Identifier(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
+            entry.m_pathEntryName = Identifier::fromString(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
             path.append(entry);
         } else {
             entry.m_type = JSONPPathEntryTypeDot;
-            entry.m_pathEntryName = Identifier(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
+            entry.m_pathEntryName = Identifier::fromString(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
             path.append(entry);
         }
         if (m_exec->vm().keywords->isKeyword(entry.m_pathEntryName))
@@ -94,7 +94,7 @@ bool LiteralParser<CharType>::tryJSONPParse(Vector<JSONPData>& results, bool nee
                 entry.m_type = JSONPPathEntryTypeDot;
                 if (m_lexer.next() != TokIdentifier)
                     return false;
-                entry.m_pathEntryName = Identifier(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
+                entry.m_pathEntryName = Identifier::fromString(&m_exec->vm(), m_lexer.currentToken().start, m_lexer.currentToken().end - m_lexer.currentToken().start);
                 break;
             }
             case TokLParen: {
@@ -135,17 +135,17 @@ ALWAYS_INLINE const Identifier LiteralParser<CharType>::makeIdentifier(const LCh
     if (!length)
         return m_exec->vm().propertyNames->emptyIdentifier;
     if (characters[0] >= MaximumCachableCharacter)
-        return Identifier(&m_exec->vm(), characters, length);
+        return Identifier::fromString(&m_exec->vm(), characters, length);
 
     if (length == 1) {
         if (!m_shortIdentifiers[characters[0]].isNull())
             return m_shortIdentifiers[characters[0]];
-        m_shortIdentifiers[characters[0]] = Identifier(&m_exec->vm(), characters, length);
+        m_shortIdentifiers[characters[0]] = Identifier::fromString(&m_exec->vm(), characters, length);
         return m_shortIdentifiers[characters[0]];
     }
     if (!m_recentIdentifiers[characters[0]].isNull() && Identifier::equal(m_recentIdentifiers[characters[0]].impl(), characters, length))
         return m_recentIdentifiers[characters[0]];
-    m_recentIdentifiers[characters[0]] = Identifier(&m_exec->vm(), characters, length);
+    m_recentIdentifiers[characters[0]] = Identifier::fromString(&m_exec->vm(), characters, length);
     return m_recentIdentifiers[characters[0]];
 }
 
@@ -155,17 +155,17 @@ ALWAYS_INLINE const Identifier LiteralParser<CharType>::makeIdentifier(const UCh
     if (!length)
         return m_exec->vm().propertyNames->emptyIdentifier;
     if (characters[0] >= MaximumCachableCharacter)
-        return Identifier(&m_exec->vm(), characters, length);
+        return Identifier::fromString(&m_exec->vm(), characters, length);
 
     if (length == 1) {
         if (!m_shortIdentifiers[characters[0]].isNull())
             return m_shortIdentifiers[characters[0]];
-        m_shortIdentifiers[characters[0]] = Identifier(&m_exec->vm(), characters, length);
+        m_shortIdentifiers[characters[0]] = Identifier::fromString(&m_exec->vm(), characters, length);
         return m_shortIdentifiers[characters[0]];
     }
     if (!m_recentIdentifiers[characters[0]].isNull() && Identifier::equal(m_recentIdentifiers[characters[0]].impl(), characters, length))
         return m_recentIdentifiers[characters[0]];
-    m_recentIdentifiers[characters[0]] = Identifier(&m_exec->vm(), characters, length);
+    m_recentIdentifiers[characters[0]] = Identifier::fromString(&m_exec->vm(), characters, length);
     return m_recentIdentifiers[characters[0]];
 }
 
index b7ecbb1..a8a3367 100644 (file)
@@ -293,7 +293,7 @@ inline void reifyStaticProperties(VM& vm, const HashTableValue (&values)[numberO
         if (!value.m_key)
             continue;                
 
-        Identifier propertyName(&vm, reinterpret_cast<const LChar*>(value.m_key), strlen(value.m_key));
+        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(value.m_key), strlen(value.m_key));
         if (value.attributes() & Builtin) {
             thisObj.putDirectBuiltinFunction(vm, thisObj.globalObject(), propertyName, value.builtinGenerator()(vm), value.attributes());
             continue;
index ab55839..fad52c0 100644 (file)
@@ -69,7 +69,7 @@ static EncodedJSValue JSC_HOST_CALL constructMap(ExecState* exec)
     if (adderFunctionCallType == CallTypeNone)
         return JSValue::encode(throwTypeError(exec));
 
-    JSValue iteratorFunction = iterable.get(exec, exec->propertyNames().iteratorPrivateName);
+    JSValue iteratorFunction = iterable.get(exec, exec->propertyNames().iteratorSymbol);
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
index 8067cb2..ca7dc08 100644 (file)
@@ -46,7 +46,7 @@ void MapIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
 
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, MapIteratorPrototypeFuncIterator, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, MapIteratorPrototypeFuncIterator, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->next, MapIteratorPrototypeFuncNext, DontEnum, 0);
 }
 
index 88df583..fe525ec 100644 (file)
@@ -68,7 +68,7 @@ void MapPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     JSC_NATIVE_FUNCTION(vm.propertyNames->keys, mapProtoFuncKeys, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->values, mapProtoFuncValues, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->entries, mapProtoFuncEntries, DontEnum, 0);
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, mapProtoFuncEntries, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, mapProtoFuncEntries, DontEnum, 0);
 
     GetterSetter* accessor = GetterSetter::create(vm, globalObject);
     JSFunction* function = JSFunction::create(vm, globalObject, 0, vm.propertyNames->size.string(), mapProtoFuncSize);
index 28ff5c8..5156ed2 100644 (file)
@@ -87,49 +87,49 @@ void MathObject::finishCreation(VM& vm, JSGlobalObject* globalObject)
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
 
-    putDirectWithoutTransition(vm, Identifier(&vm, "E"), jsNumber(exp(1.0)), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "LN2"), jsNumber(log(2.0)), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "LN10"), jsNumber(log(10.0)), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "LOG2E"), jsNumber(1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "LOG10E"), jsNumber(0.4342944819032518), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "PI"), jsNumber(piDouble), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "SQRT1_2"), jsNumber(sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "SQRT2"), jsNumber(sqrt(2.0)), DontDelete | DontEnum | ReadOnly);
-
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "abs"), 1, mathProtoFuncAbs, AbsIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "acos"), 1, mathProtoFuncACos, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "asin"), 1, mathProtoFuncASin, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "atan"), 1, mathProtoFuncATan, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "acosh"), 1, mathProtoFuncACosh, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "asinh"), 1, mathProtoFuncASinh, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "atanh"), 1, mathProtoFuncATanh, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "atan2"), 2, mathProtoFuncATan2, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "cbrt"), 1, mathProtoFuncCbrt, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "ceil"), 1, mathProtoFuncCeil, CeilIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "cos"), 1, mathProtoFuncCos, CosIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "cosh"), 1, mathProtoFuncCosh, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "exp"), 1, mathProtoFuncExp, ExpIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "expm1"), 1, mathProtoFuncExpm1, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "floor"), 1, mathProtoFuncFloor, FloorIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "fround"), 1, mathProtoFuncFround, FRoundIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "hypot"), 2, mathProtoFuncHypot, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "log"), 1, mathProtoFuncLog, LogIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "log10"), 1, mathProtoFuncLog10, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "log1p"), 1, mathProtoFuncLog1p, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "log2"), 1, mathProtoFuncLog2, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "max"), 2, mathProtoFuncMax, MaxIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "min"), 2, mathProtoFuncMin, MinIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "pow"), 2, mathProtoFuncPow, PowIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "random"), 0, mathProtoFuncRandom, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "round"), 1, mathProtoFuncRound, RoundIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "sign"), 1, mathProtoFuncSign, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "sin"), 1, mathProtoFuncSin, SinIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "sinh"), 1, mathProtoFuncSinh, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "sqrt"), 1, mathProtoFuncSqrt, SqrtIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "tan"), 1, mathProtoFuncTan, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "tanh"), 1, mathProtoFuncTanh, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "trunc"), 1, mathProtoFuncTrunc, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier(&vm, "imul"), 1, mathProtoFuncIMul, IMulIntrinsic, DontEnum | Function);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "E"), jsNumber(exp(1.0)), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "LN2"), jsNumber(log(2.0)), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "LN10"), jsNumber(log(10.0)), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "LOG2E"), jsNumber(1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "LOG10E"), jsNumber(0.4342944819032518), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "PI"), jsNumber(piDouble), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "SQRT1_2"), jsNumber(sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "SQRT2"), jsNumber(sqrt(2.0)), DontDelete | DontEnum | ReadOnly);
+
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "abs"), 1, mathProtoFuncAbs, AbsIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "acos"), 1, mathProtoFuncACos, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "asin"), 1, mathProtoFuncASin, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "atan"), 1, mathProtoFuncATan, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "acosh"), 1, mathProtoFuncACosh, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "asinh"), 1, mathProtoFuncASinh, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "atanh"), 1, mathProtoFuncATanh, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "atan2"), 2, mathProtoFuncATan2, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "cbrt"), 1, mathProtoFuncCbrt, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "ceil"), 1, mathProtoFuncCeil, CeilIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "cos"), 1, mathProtoFuncCos, CosIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "cosh"), 1, mathProtoFuncCosh, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "exp"), 1, mathProtoFuncExp, ExpIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "expm1"), 1, mathProtoFuncExpm1, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "floor"), 1, mathProtoFuncFloor, FloorIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "fround"), 1, mathProtoFuncFround, FRoundIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "hypot"), 2, mathProtoFuncHypot, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "log"), 1, mathProtoFuncLog, LogIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "log10"), 1, mathProtoFuncLog10, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "log1p"), 1, mathProtoFuncLog1p, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "log2"), 1, mathProtoFuncLog2, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "max"), 2, mathProtoFuncMax, MaxIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "min"), 2, mathProtoFuncMin, MinIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "pow"), 2, mathProtoFuncPow, PowIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "random"), 0, mathProtoFuncRandom, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "round"), 1, mathProtoFuncRound, RoundIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "sign"), 1, mathProtoFuncSign, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "sin"), 1, mathProtoFuncSin, SinIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "sinh"), 1, mathProtoFuncSinh, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "sqrt"), 1, mathProtoFuncSqrt, SqrtIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "tan"), 1, mathProtoFuncTan, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "tanh"), 1, mathProtoFuncTanh, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "trunc"), 1, mathProtoFuncTrunc, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, globalObject, Identifier::fromString(&vm, "imul"), 1, mathProtoFuncIMul, IMulIntrinsic, DontEnum | Function);
 }
 
 // ------------------------------ Functions --------------------------------
index 3cfe941..95a8dca 100644 (file)
@@ -59,21 +59,21 @@ void NumberConstructor::finishCreation(VM& vm, NumberPrototype* numberPrototype)
     // no. of arguments for constructor
     putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
 
-    putDirectWithoutTransition(vm, Identifier(&vm, "EPSILON"), jsDoubleNumber(std::numeric_limits<double>::epsilon()), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "MAX_VALUE"), jsDoubleNumber(1.7976931348623157E+308), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "MIN_VALUE"), jsDoubleNumber(5E-324), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "MAX_SAFE_INTEGER"), jsDoubleNumber(9007199254740991.0), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "MIN_SAFE_INTEGER"), jsDoubleNumber(-9007199254740991.0), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "NEGATIVE_INFINITY"), jsDoubleNumber(-std::numeric_limits<double>::infinity()), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "POSITIVE_INFINITY"), jsDoubleNumber(std::numeric_limits<double>::infinity()), DontDelete | DontEnum | ReadOnly);
-    putDirectWithoutTransition(vm, Identifier(&vm, "NaN"), jsNaN(), DontDelete | DontEnum | ReadOnly);
-
-    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isFinite"), 1, numberConstructorFuncIsFinite, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isInteger"), 1, numberConstructorFuncIsInteger, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isNaN"), 1, numberConstructorFuncIsNaN, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "isSafeInteger"), 1, numberConstructorFuncIsSafeInteger, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "parseFloat"), 1, globalFuncParseFloat, NoIntrinsic, DontEnum | Function);
-    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier(&vm, "parseInt"), 1, globalFuncParseInt, NoIntrinsic, DontEnum | Function);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "EPSILON"), jsDoubleNumber(std::numeric_limits<double>::epsilon()), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "MAX_VALUE"), jsDoubleNumber(1.7976931348623157E+308), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "MIN_VALUE"), jsDoubleNumber(5E-324), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "MAX_SAFE_INTEGER"), jsDoubleNumber(9007199254740991.0), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "MIN_SAFE_INTEGER"), jsDoubleNumber(-9007199254740991.0), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "NEGATIVE_INFINITY"), jsDoubleNumber(-std::numeric_limits<double>::infinity()), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "POSITIVE_INFINITY"), jsDoubleNumber(std::numeric_limits<double>::infinity()), DontDelete | DontEnum | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, "NaN"), jsNaN(), DontDelete | DontEnum | ReadOnly);
+
+    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier::fromString(&vm, "isFinite"), 1, numberConstructorFuncIsFinite, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier::fromString(&vm, "isInteger"), 1, numberConstructorFuncIsInteger, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier::fromString(&vm, "isNaN"), 1, numberConstructorFuncIsNaN, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier::fromString(&vm, "isSafeInteger"), 1, numberConstructorFuncIsSafeInteger, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier::fromString(&vm, "parseFloat"), 1, globalFuncParseFloat, NoIntrinsic, DontEnum | Function);
+    putDirectNativeFunctionWithoutTransition(vm, numberPrototype->globalObject(), Identifier::fromString(&vm, "parseInt"), 1, globalFuncParseInt, NoIntrinsic, DontEnum | Function);
 }
 
 // ECMA 15.7.1
index 2f1c477..74db48b 100644 (file)
@@ -86,7 +86,7 @@ ObjectConstructor::ObjectConstructor(VM& vm, Structure* structure)
 
 void ObjectConstructor::finishCreation(VM& vm, ObjectPrototype* objectPrototype)
 {
-    Base::finishCreation(vm, Identifier(&vm, "Object").string());
+    Base::finishCreation(vm, objectPrototype->classInfo()->className);
     // ECMA 15.2.3.1
     putDirectWithoutTransition(vm, vm.propertyNames->prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
     // no. of arguments for constructor
index 2141644..ccccc39 100644 (file)
@@ -33,19 +33,19 @@ namespace JSC {
 class PrivateName {
 public:
     PrivateName()
-        : m_impl(StringImpl::createUniqueEmpty())
+        : m_impl(StringImpl::createSymbolEmpty())
     {
-        ASSERT(m_impl->isUnique());
-    }
-    PrivateName(const String& description)
-        : m_impl(StringImpl::createUnique(description.impl()))
-    {
-        ASSERT(m_impl->isUnique());
     }
+
     explicit PrivateName(StringImpl* uid)
         : m_impl(uid)
     {
-        ASSERT(m_impl->isUnique());
+        ASSERT(m_impl->isSymbol());
+    }
+
+    explicit PrivateName(const String& description)
+        : m_impl(StringImpl::createSymbol(description.impl()))
+    {
     }
 
     AtomicStringImpl* uid() const { return static_cast<AtomicStringImpl*>(m_impl.get()); }
index 0370a35..754da2d 100644 (file)
@@ -271,7 +271,7 @@ inline PropertyTable::const_iterator PropertyTable::end() const
 inline PropertyTable::find_iterator PropertyTable::find(const KeyType& key)
 {
     ASSERT(key);
-    ASSERT(key->isAtomic() || key->isUnique());
+    ASSERT(key->isAtomic() || key->isSymbol());
     unsigned hash = key->existingHash();
     unsigned step = 0;
 
@@ -305,7 +305,7 @@ inline PropertyTable::find_iterator PropertyTable::find(const KeyType& key)
 inline PropertyTable::ValueType* PropertyTable::get(const KeyType& key)
 {
     ASSERT(key);
-    ASSERT(key->isAtomic() || key->isUnique());
+    ASSERT(key->isAtomic() || key->isSymbol());
 
     if (!m_keyCount)
         return nullptr;
index 3074c72..655e74d 100644 (file)
@@ -81,7 +81,7 @@ public:
     PropertyName(AtomicStringImpl* propertyName)
         : m_impl(propertyName)
     {
-        ASSERT(!m_impl || m_impl->isAtomic());
+        ASSERT(!m_impl || m_impl->isAtomic() || m_impl->isSymbol());
     }
 
     PropertyName(const Identifier& propertyName)
@@ -93,8 +93,7 @@ public:
         : m_impl(static_cast<AtomicStringImpl*>(propertyName.uid()))
     {
         ASSERT(m_impl);
-        ASSERT(m_impl->isUnique());
-        ASSERT(m_impl->isAtomic());
+        ASSERT(m_impl->isSymbol());
     }
 
     AtomicStringImpl* uid() const
@@ -104,14 +103,14 @@ public:
 
     AtomicStringImpl* publicName() const
     {
-        return m_impl->isUnique() ? nullptr : m_impl;
+        return (!m_impl || m_impl->isSymbol()) ? nullptr : m_impl;
     }
 
     static const uint32_t NotAnIndex = UINT_MAX;
 
     uint32_t asIndex()
     {
-        return m_impl ? toUInt32FromStringImpl(m_impl) : NotAnIndex;
+        return (m_impl && !m_impl->isSymbol()) ? toUInt32FromStringImpl(m_impl) : NotAnIndex;
     }
     
     void dump(PrintStream& out) const
index 4475b89..e4e5e27 100644 (file)
@@ -31,9 +31,9 @@ namespace JSC {
 
 void PropertyNameArray::add(StringImpl* identifier)
 {
-    ASSERT(!identifier || identifier == StringImpl::empty() || identifier->isAtomic());
+    ASSERT(!identifier || (identifier == StringImpl::empty() || identifier->isAtomic() || identifier->isSymbol()));
     if (!ASSERT_DISABLED) {
-        uint32_t index = PropertyName(Identifier(m_vm, identifier)).asIndex();
+        uint32_t index = PropertyName(Identifier::fromUid(m_vm, identifier)).asIndex();
         ASSERT_UNUSED(index, index == PropertyName::NotAnIndex || index >= m_previouslyEnumeratedLength);
     }
 
index 994f09c..89fcbde 100644 (file)
@@ -98,7 +98,7 @@ public:
     void addKnownUnique(StringImpl* identifier)
     {
         m_set->add(identifier);
-        m_data->propertyNameVector().append(Identifier(m_vm, identifier));
+        m_data->propertyNameVector().append(Identifier::fromUid(m_vm, identifier));
     }
 
     Identifier& operator[](unsigned i) { return m_data->propertyNameVector()[i]; }
index 45e80f5..ee1d8b3 100644 (file)
@@ -91,7 +91,7 @@ RegExpConstructor::RegExpConstructor(VM& vm, Structure* structure, RegExpPrototy
 
 void RegExpConstructor::finishCreation(VM& vm, RegExpPrototype* regExpPrototype)
 {
-    Base::finishCreation(vm, Identifier(&vm, "RegExp").string());
+    Base::finishCreation(vm, regExpPrototype->classInfo()->className);
     ASSERT(inherits(info()));
 
     // ECMA 15.10.5.1 RegExp.prototype
index 423a6bd..fb97b6d 100644 (file)
@@ -70,7 +70,7 @@ static EncodedJSValue JSC_HOST_CALL constructSet(ExecState* exec)
     if (adderFunctionCallType == CallTypeNone)
         return JSValue::encode(throwTypeError(exec));
 
-    JSValue iteratorFunction = iterable.get(exec, exec->propertyNames().iteratorPrivateName);
+    JSValue iteratorFunction = iterable.get(exec, exec->propertyNames().iteratorSymbol);
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
index 5261bf3..f1b8b79 100644 (file)
@@ -46,7 +46,7 @@ void SetIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
 
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, SetIteratorPrototypeFuncIterator, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, SetIteratorPrototypeFuncIterator, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->next, SetIteratorPrototypeFuncNext, DontEnum, 0);
 }
 
index 40066ae..b315861 100644 (file)
@@ -67,7 +67,7 @@ void SetPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
     JSC_NATIVE_FUNCTION(vm.propertyNames->keys, setProtoFuncKeys, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->values, setProtoFuncValues, DontEnum, 0);
     JSC_NATIVE_FUNCTION(vm.propertyNames->entries, setProtoFuncEntries, DontEnum, 0);
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, setProtoFuncKeys, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, setProtoFuncKeys, DontEnum, 0);
 
     GetterSetter* accessor = GetterSetter::create(vm, globalObject);
     JSFunction* function = JSFunction::create(vm, globalObject, 0, vm.propertyNames->size.string(), setProtoFuncSize);
index 53e0ccb..468b72d 100644 (file)
@@ -58,7 +58,7 @@ void StringIteratorPrototype::finishCreation(VM& vm, JSGlobalObject* globalObjec
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
 
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, stringIteratorPrototypeIterator, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, stringIteratorPrototypeIterator, DontEnum, 0);
 }
 
 bool StringIteratorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
index aea5926..ca62c41 100644 (file)
@@ -142,7 +142,7 @@ void StringPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject, JSStr
     JSC_NATIVE_FUNCTION("startsWith", stringProtoFuncStartsWith, DontEnum, 0);
     JSC_NATIVE_FUNCTION("endsWith", stringProtoFuncEndsWith, DontEnum, 0);
     JSC_NATIVE_FUNCTION("includes", stringProtoFuncIncludes, DontEnum, 0);
-    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorPrivateName, stringProtoFuncIterator, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->iteratorSymbol, stringProtoFuncIterator, DontEnum, 0);
 
     JSC_NATIVE_INTRINSIC_FUNCTION(vm.propertyNames->charCodeAtPrivateName, stringProtoFuncCharCodeAt, DontEnum, 1, CharCodeAtIntrinsic);
 
index dce51b5..3b8ae1c 100644 (file)
@@ -939,7 +939,7 @@ void Structure::getPropertyNamesFromStructure(VM& vm, PropertyNameArray& propert
     PropertyTable::iterator end = propertyTable()->end();
     for (PropertyTable::iterator iter = propertyTable()->begin(); iter != end; ++iter) {
         ASSERT(hasNonEnumerableProperties() || !(iter->attributes & DontEnum));
-        if (!iter->key->isUnique() && (!(iter->attributes & DontEnum) || shouldIncludeDontEnumProperties(mode))) {
+        if (!iter->key->isSymbol() && (!(iter->attributes & DontEnum) || shouldIncludeDontEnumProperties(mode))) {
             if (knownUnique)
                 propertyNames.addKnownUnique(iter->key);
             else
index 99ce686..aa94fa3 100644 (file)
@@ -44,7 +44,7 @@ SymbolConstructor::SymbolConstructor(VM& vm, Structure* structure)
 }
 
 #define INITIALIZE_WELL_KNOWN_SYMBOLS(name) \
-    putDirectWithoutTransition(vm, Identifier(&vm, #name), Symbol::create(vm, vm.propertyNames->name##PrivateName.impl()), DontEnum | DontDelete | ReadOnly);
+    putDirectWithoutTransition(vm, Identifier::fromString(&vm, #name), Symbol::create(vm, vm.propertyNames->name##Symbol.impl()), DontEnum | DontDelete | ReadOnly);
 
 void SymbolConstructor::finishCreation(VM& vm, SymbolPrototype* prototype)
 {
index 3af817d..e763947 100644 (file)
@@ -662,10 +662,10 @@ JSValue VM::throwException(ExecState* exec, JSValue error)
         unsigned line;
         unsigned column;
         stackFrame.computeLineAndColumn(line, column);
-        exception->putDirect(*this, Identifier(this, "line"), jsNumber(line), ReadOnly | DontDelete);
-        exception->putDirect(*this, Identifier(this, "column"), jsNumber(column), ReadOnly | DontDelete);
+        exception->putDirect(*this, Identifier::fromString(this, "line"), jsNumber(line), ReadOnly | DontDelete);
+        exception->putDirect(*this, Identifier::fromString(this, "column"), jsNumber(column), ReadOnly | DontDelete);
         if (!stackFrame.sourceURL.isEmpty())
-            exception->putDirect(*this, Identifier(this, "sourceURL"), jsString(this, stackFrame.sourceURL), ReadOnly | DontDelete);
+            exception->putDirect(*this, Identifier::fromString(this, "sourceURL"), jsString(this, stackFrame.sourceURL), ReadOnly | DontDelete);
     }
     if (exception->isErrorInstance() && static_cast<ErrorInstance*>(exception)->hasSourceAppender()) {
         FindFirstCallerFrameWithCodeblockFunctor functor(exec);
index 09aff03..23c4333 100644 (file)
@@ -69,7 +69,7 @@ static EncodedJSValue JSC_HOST_CALL constructWeakMap(ExecState* exec)
     if (adderFunctionCallType == CallTypeNone)
         return JSValue::encode(throwTypeError(exec));
 
-    JSValue iteratorFunction = iterable.get(exec, exec->propertyNames().iteratorPrivateName);
+    JSValue iteratorFunction = iterable.get(exec, exec->propertyNames().iteratorSymbol);
     if (exec->hadException())
         return JSValue::encode(jsUndefined());
 
index 1091c8c..d0ee6c2 100644 (file)
@@ -1,3 +1,53 @@
+2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Clean up Identifier factories to clarify the meaning of StringImpl*
+        https://bugs.webkit.org/show_bug.cgi?id=143146
+
+        Reviewed by Filip Pizlo.
+
+        Introduce StringKind into `StringImpl`. There's 3 kinds
+        1. StringNormal (non-atomic, non-symbol)
+        2. StringAtomic (atomic, non-symbol)
+        3. StringSymbol (non-atomic, symbol)
+        They are mutually exclusive.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::addSlowCase):
+        (WTF::AtomicString::findSlowCase):
+        When registering a string into AtomicStringTable,
+        it should not be a symbol string
+        because symbol and atomic types are mutually exclusive.
+        When a symbol string comes, we extract an owner string
+        from a symbol string by using `StringImpl::extractFoldedStringInSymbol()`.
+        It always succeeds because a symbol (non empty) string
+        is always BufferSubstring and has an owner string.
+        Empty symbol string doesn't have an owner string.
+        This case is filtered by `!string.length()` guard.
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::add):
+        (WTF::AtomicString::addWithStringTableProvider):
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::~StringImpl):
+        (WTF::StringImpl::createSymbol):
+        (WTF::StringImpl::createUnique): Deleted.
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::StringImpl):
+        (WTF::StringImpl::createSymbolEmpty):
+        (WTF::StringImpl::flagIsAtomic):
+        (WTF::StringImpl::flagIsSymbol):
+        (WTF::StringImpl::maskStringKind):
+        (WTF::StringImpl::stringKind):
+        (WTF::StringImpl::isSymbol):
+        (WTF::StringImpl::isAtomic):
+        (WTF::StringImpl::setIsAtomic):
+        (WTF::StringImpl::extractFoldedStringInSymbol):
+        (WTF::StringImpl::createUniqueEmpty): Deleted.
+        (WTF::StringImpl::flagIsUnique): Deleted.
+        (WTF::StringImpl::isUnique): Deleted.
+        * wtf/text/StringStatics.cpp:
+        (WTF::StringImpl::hashAndFlagsForSymbol):
+        (WTF::StringImpl::hashAndFlagsForUnique): Deleted.
+
 2015-03-30  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         [CMake][EFL] Remove redundant library link and include path
index 19639ca..fa7e434 100644 (file)
@@ -403,6 +403,9 @@ Ref<StringImpl> AtomicString::addSlowCase(StringImpl& string)
     if (!string.length())
         return *StringImpl::empty();
 
+    if (string.isSymbol())
+        return add(string.extractFoldedStringInSymbol());
+
     ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicString should not hit the slow case if the string is already atomic.");
 
     AtomicStringTableLocker locker;
@@ -421,6 +424,9 @@ Ref<StringImpl> AtomicString::addSlowCase(AtomicStringTable& stringTable, String
     if (!string.length())
         return *StringImpl::empty();
 
+    if (string.isSymbol())
+        return add(stringTable, string.extractFoldedStringInSymbol());
+
     ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicString should not hit the slow case if the string is already atomic.");
 
     AtomicStringTableLocker locker;
@@ -503,6 +509,12 @@ AtomicStringImpl* AtomicString::findSlowCase(StringImpl& string)
 {
     ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicStringImpls should return from the fast case.");
 
+    if (!string.length())
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    if (string.isSymbol())
+        return find(&string.extractFoldedStringInSymbol());
+
     AtomicStringTableLocker locker;
     HashSet<StringImpl*>& atomicStringTable = stringTable();
     auto iterator = atomicStringTable.find(&string);
index 8416012..3a2fcf5 100644 (file)
@@ -199,11 +199,9 @@ public:
     WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned length);
     ALWAYS_INLINE static RefPtr<StringImpl> add(StringImpl* string)
     {
-        if (!string || string->isAtomic()) {
-            ASSERT_WITH_MESSAGE(!string || !string->length() || string->isUnique() || isInAtomicStringTable(string), "The atomic string comes from an other thread!");
+        if (!string)
             return string;
-        }
-        return addSlowCase(*string);
+        return add(*string);
     }
     WTF_EXPORT_STRING_API static Ref<StringImpl> addFromLiteralData(const char* characters, unsigned length);
 #if USE(CF)
@@ -213,11 +211,9 @@ public:
     template<typename StringTableProvider>
     ALWAYS_INLINE static RefPtr<StringImpl> addWithStringTableProvider(StringTableProvider& stringTableProvider, StringImpl* string)
     {
-        if (!string || string->isAtomic()) {
-            ASSERT_WITH_MESSAGE(!string || !string->length() || string->isUnique() || isInAtomicStringTable(string), "The atomic string comes from an other thread!");
+        if (!string)
             return string;
-        }
-        return addSlowCase(*stringTableProvider.atomicStringTable(), *string);
+        return add(*stringTableProvider.atomicStringTable(), *string);
     }
 
 #if !ASSERT_DISABLED
@@ -229,7 +225,25 @@ private:
     AtomicString(ASCIILiteral);
 
     String m_string;
-    
+
+    ALWAYS_INLINE static Ref<StringImpl> add(StringImpl& string)
+    {
+        if (string.isAtomic()) {
+            ASSERT_WITH_MESSAGE(!string.length() || isInAtomicStringTable(&string), "The atomic string comes from an other thread!");
+            return string;
+        }
+        return addSlowCase(string);
+    }
+
+    ALWAYS_INLINE static Ref<StringImpl> add(AtomicStringTable& stringTable, StringImpl& string)
+    {
+        if (string.isAtomic()) {
+            ASSERT_WITH_MESSAGE(!string.length() || isInAtomicStringTable(&string), "The atomic string comes from an other thread!");
+            return string;
+        }
+        return addSlowCase(stringTable, string);
+    }
+
     WTF_EXPORT_STRING_API static Ref<StringImpl> addSlowCase(StringImpl&);
     WTF_EXPORT_STRING_API static Ref<StringImpl> addSlowCase(AtomicStringTable&, StringImpl&);
 
index e15de11..9fabf2b 100644 (file)
@@ -109,7 +109,7 @@ StringImpl::~StringImpl()
 
     STRING_STATS_REMOVE_STRING(*this);
 
-    if (isAtomic() && length() && !isUnique())
+    if (isAtomic() && length() && !isSymbol())
         AtomicString::remove(this);
 
     BufferOwnership ownership = bufferOwnership();
@@ -286,13 +286,14 @@ Ref<StringImpl> StringImpl::create(const LChar* string)
     return create(string, length);
 }
 
-Ref<StringImpl> StringImpl::createUnique(PassRefPtr<StringImpl> rep)
+Ref<StringImpl> StringImpl::createSymbol(PassRefPtr<StringImpl> rep)
 {
     unsigned length = rep->length();
     if (!length)
-        return createUniqueEmpty();
+        return createSymbolEmpty();
     Ref<StringImpl> string = createSubstringSharingImpl(rep, 0, length);
-    string->m_hashAndFlags = hashAndFlagsForUnique(string->m_hashAndFlags);
+    ASSERT(!string->isAtomic());
+    string->m_hashAndFlags = hashAndFlagsForSymbol(string->m_hashAndFlags);
     return string;
 }
 
index 22bfcb6..504cb82 100644 (file)
@@ -141,6 +141,25 @@ private:
         BufferSubstring,
     };
 
+    // The bottom 6 bits in the hash are flags.
+    static const unsigned s_flagCount = 6;
+    static const unsigned s_flagMask = (1u << s_flagCount) - 1;
+    COMPILE_ASSERT(s_flagCount <= StringHasher::flagCount, StringHasher_reserves_enough_bits_for_StringImpl_flags);
+    static const unsigned s_flagStringKindCount = 4;
+
+    static const unsigned s_hashFlagStringKindIsAtomic = 1u << (s_flagStringKindCount);
+    static const unsigned s_hashFlagStringKindIsSymbol = 1u << (s_flagStringKindCount + 1);
+    static const unsigned s_hashMaskStringKind = s_hashFlagStringKindIsAtomic | s_hashFlagStringKindIsSymbol;
+    static const unsigned s_hashFlag8BitBuffer = 1u << 3;
+    static const unsigned s_hashFlagDidReportCost = 1u << 2;
+    static const unsigned s_hashMaskBufferOwnership = (1u << 0) | (1u << 1);
+
+    enum StringKind {
+        StringNormal = 0u, // non-symbol, non-atomic
+        StringAtomic = s_hashFlagStringKindIsAtomic, // non-symbol, atomic
+        StringSymbol = s_hashFlagStringKindIsSymbol, // symbol, non-atomic
+    };
+
     // Used to construct static strings, which have an special refCount that can never hit zero.
     // This means that the static string will never be destroyed, which is important because
     // static strings will be shared across threads & ref-counted in a non-threadsafe manner.
@@ -150,7 +169,7 @@ private:
         : m_refCount(s_refCountFlagIsStaticString)
         , m_length(0)
         , m_data8(reinterpret_cast<const LChar*>(&m_length))
-        , m_hashAndFlags(s_hashFlag8BitBuffer | s_hashFlagIsAtomic | BufferOwned)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | StringAtomic | BufferOwned)
     {
         // Ensure that the hash is computed so that AtomicStringHash can call existingHash()
         // with impunity. The empty string is special because it is never entered into
@@ -167,7 +186,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data8(tailPointer<LChar>())
-        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | StringNormal | BufferInternal)
     {
         ASSERT(m_data8);
         ASSERT(m_length);
@@ -180,7 +199,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data16(tailPointer<UChar>())
-        , m_hashAndFlags(BufferInternal)
+        , m_hashAndFlags(StringNormal | BufferInternal)
     {
         ASSERT(m_data16);
         ASSERT(m_length);
@@ -193,7 +212,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data8(characters.leakPtr())
-        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferOwned)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | StringNormal | BufferOwned)
     {
         ASSERT(m_data8);
         ASSERT(m_length);
@@ -206,7 +225,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data16(characters)
-        , m_hashAndFlags(BufferInternal)
+        , m_hashAndFlags(StringNormal | BufferInternal)
     {
         ASSERT(m_data16);
         ASSERT(m_length);
@@ -218,7 +237,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data8(characters)
-        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferInternal)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | StringNormal | BufferInternal)
     {
         ASSERT(m_data8);
         ASSERT(m_length);
@@ -231,7 +250,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data16(characters.leakPtr())
-        , m_hashAndFlags(BufferOwned)
+        , m_hashAndFlags(StringNormal | BufferOwned)
     {
         ASSERT(m_data16);
         ASSERT(m_length);
@@ -244,7 +263,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data8(characters)
-        , m_hashAndFlags(s_hashFlag8BitBuffer | BufferSubstring)
+        , m_hashAndFlags(s_hashFlag8BitBuffer | StringNormal | BufferSubstring)
     {
         ASSERT(is8Bit());
         ASSERT(m_data8);
@@ -261,7 +280,7 @@ private:
         : m_refCount(s_refCountIncrement)
         , m_length(length)
         , m_data16(characters)
-        , m_hashAndFlags(BufferSubstring)
+        , m_hashAndFlags(StringNormal | BufferSubstring)
     {
         ASSERT(!is8Bit());
         ASSERT(m_data16);
@@ -273,14 +292,14 @@ private:
         STRING_STATS_ADD_16BIT_STRING2(m_length, true);
     }
 
-    enum CreateEmptyUniqueTag { CreateEmptyUnique };
-    StringImpl(CreateEmptyUniqueTag)
+    enum CreateSymbolEmptyTag { CreateSymbolEmpty };
+    StringImpl(CreateSymbolEmptyTag)
         : m_refCount(s_refCountIncrement)
         , m_length(0)
         // We expect m_length to be initialized to 0 as we use it
         // to represent a null terminated buffer.
         , m_data8(reinterpret_cast<const LChar*>(&m_length))
-        , m_hashAndFlags(hashAndFlagsForUnique(s_hashFlag8BitBuffer | BufferInternal))
+        , m_hashAndFlags(hashAndFlagsForSymbol(s_hashFlag8BitBuffer | BufferInternal))
     {
         ASSERT(m_data8);
 
@@ -378,12 +397,12 @@ public:
         return constructInternal<T>(resultImpl, length);
     }
 
-    ALWAYS_INLINE static Ref<StringImpl> createUniqueEmpty()
+    ALWAYS_INLINE static Ref<StringImpl> createSymbolEmpty()
     {
-        return adoptRef(*new StringImpl(CreateEmptyUnique));
+        return adoptRef(*new StringImpl(CreateSymbolEmpty));
     }
 
-    WTF_EXPORT_STRING_API static Ref<StringImpl> createUnique(PassRefPtr<StringImpl> rep);
+    WTF_EXPORT_STRING_API static Ref<StringImpl> createSymbol(PassRefPtr<StringImpl> rep);
 
     // Reallocate the StringImpl. The originalString must be only owned by the PassRefPtr,
     // and the buffer ownership must be BufferInternal. Just like the input pointer of realloc(),
@@ -393,8 +412,9 @@ public:
 
     static unsigned flagsOffset() { return OBJECT_OFFSETOF(StringImpl, m_hashAndFlags); }
     static unsigned flagIs8Bit() { return s_hashFlag8BitBuffer; }
-    static unsigned flagIsAtomic() { return s_hashFlagIsAtomic; }
-    static unsigned flagIsUnique() { return s_hashFlagIsUnique; }
+    static unsigned flagIsAtomic() { return s_hashFlagStringKindIsAtomic; }
+    static unsigned flagIsSymbol() { return s_hashFlagStringKindIsSymbol; }
+    static unsigned maskStringKind() { return s_hashMaskStringKind; }
     static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data8); }
 
     template<typename CharType, size_t inlineCapacity, typename OverflowHandler>
@@ -454,17 +474,21 @@ public:
 
     WTF_EXPORT_STRING_API size_t sizeInBytes() const;
 
-    bool isUnique() const { return m_hashAndFlags & s_hashFlagIsUnique; }
+    StringKind stringKind() const { return static_cast<StringKind>(m_hashAndFlags & s_hashMaskStringKind); }
+    bool isSymbol() const { return m_hashAndFlags & s_hashFlagStringKindIsSymbol; }
+    bool isAtomic() const { return m_hashAndFlags & s_hashFlagStringKindIsAtomic; }
 
-    bool isAtomic() const { return m_hashAndFlags & s_hashFlagIsAtomic; }
     void setIsAtomic(bool isAtomic)
     {
         ASSERT(!isStatic());
-        ASSERT(!isUnique());
-        if (isAtomic)
-            m_hashAndFlags |= s_hashFlagIsAtomic;
-        else
-            m_hashAndFlags &= ~s_hashFlagIsAtomic;
+        ASSERT(!isSymbol());
+        if (isAtomic) {
+            m_hashAndFlags |= s_hashFlagStringKindIsAtomic;
+            ASSERT(stringKind() == StringAtomic);
+        } else {
+            m_hashAndFlags &= ~s_hashFlagStringKindIsAtomic;
+            ASSERT(stringKind() == StringNormal);
+        }
     }
 
 #if STRING_STATS
@@ -717,6 +741,16 @@ public:
 
     WTF_EXPORT_STRING_API static const UChar latin1CaseFoldTable[256];
 
+    WTF_EXPORT_STRING_API StringImpl& extractFoldedStringInSymbol()
+    {
+        ASSERT(length());
+        ASSERT(isSymbol());
+        ASSERT(bufferOwnership() == BufferSubstring);
+        ASSERT(substringBuffer());
+        ASSERT(!substringBuffer()->isSymbol());
+        return *substringBuffer();
+    }
+
 private:
     bool requiresCopy() const
     {
@@ -783,23 +817,12 @@ private:
     template <typename CharType> static Ref<StringImpl> reallocateInternal(PassRefPtr<StringImpl>, unsigned, CharType*&);
     template <typename CharType> static Ref<StringImpl> createInternal(const CharType*, unsigned);
     WTF_EXPORT_PRIVATE NEVER_INLINE unsigned hashSlowCase() const;
-    WTF_EXPORT_PRIVATE static unsigned hashAndFlagsForUnique(unsigned flags);
+    WTF_EXPORT_PRIVATE static unsigned hashAndFlagsForSymbol(unsigned flags);
 
     // The bottom bit in the ref count indicates a static (immortal) string.
     static const unsigned s_refCountFlagIsStaticString = 0x1;
     static const unsigned s_refCountIncrement = 0x2; // This allows us to ref / deref without disturbing the static string flag.
 
-    // The bottom 7 bits in the hash are flags.
-    static const unsigned s_flagCount = 7;
-    static const unsigned s_flagMask = (1u << s_flagCount) - 1;
-    COMPILE_ASSERT(s_flagCount <= StringHasher::flagCount, StringHasher_reserves_enough_bits_for_StringImpl_flags);
-
-    static const unsigned s_hashFlagIsUnique = 1u << 6;
-    static const unsigned s_hashFlag8BitBuffer = 1u << 5;
-    static const unsigned s_hashFlagIsAtomic = 1u << 4;
-    static const unsigned s_hashFlagDidReportCost = 1u << 3;
-    static const unsigned s_hashMaskBufferOwnership = 1u | (1u << 1);
-
 #if STRING_STATS
     WTF_EXPORTDATA static StringStats m_stringStats;
 #endif
@@ -814,7 +837,7 @@ public:
 
         // These values mimic ConstructFromLiteral.
         static const unsigned s_initialRefCount = s_refCountIncrement;
-        static const unsigned s_initialFlags = s_hashFlag8BitBuffer | BufferInternal;
+        static const unsigned s_initialFlags = s_hashFlag8BitBuffer | StringNormal | BufferInternal;
         static const unsigned s_hashShift = s_flagCount;
     };
 
index 65bb672..3945c73 100644 (file)
@@ -47,18 +47,18 @@ StringImpl* StringImpl::empty()
     return &emptyString.get();
 }
 
-// Set the hash early, so that all unique StringImpls have a hash,
+// Set the hash early, so that all symbol StringImpls have a hash,
 // and don't use the normal hashing algorithm - the unique nature of these
 // keys means that we don't need them to match any other string (in fact,
 // that's exactly the oposite of what we want!), and the normal hash would
 // lead to lots of conflicts.
-unsigned StringImpl::hashAndFlagsForUnique(unsigned flags)
+unsigned StringImpl::hashAndFlagsForSymbol(unsigned flags)
 {
-    static unsigned s_nextHashAndFlagsForUnique = 0;
-    s_nextHashAndFlagsForUnique += 1 << s_flagCount;
-    s_nextHashAndFlagsForUnique |= 1 << 31;
-    unsigned flagsForUnique = (flags & s_flagMask) | s_hashFlagIsAtomic | s_hashFlagIsUnique;
-    return s_nextHashAndFlagsForUnique | flagsForUnique;
+    static unsigned s_nextHashAndFlagsForSymbol = 0;
+    s_nextHashAndFlagsForSymbol += 1 << s_flagCount;
+    s_nextHashAndFlagsForSymbol |= 1 << 31;
+    unsigned flagsForSymbol = ((flags & s_flagMask) & (~s_hashMaskStringKind)) | StringSymbol;
+    return s_nextHashAndFlagsForSymbol | flagsForSymbol;
 }
 
 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
index 8924f39..fd1223c 100644 (file)
@@ -1,3 +1,133 @@
+2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Clean up Identifier factories to clarify the meaning of StringImpl*
+        https://bugs.webkit.org/show_bug.cgi?id=143146
+
+        Reviewed by Filip Pizlo.
+
+        Just change Identifier creations.
+
+        1. If the code creates Identifier from StringImpl*
+        which is treated as symbol or string(unique id), use Identifier::fromUid.
+        2. If the code creates Identifier from string, use Identifier::fromString.
+
+        * Modules/plugins/QuickTimePluginReplacement.mm:
+        (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
+        (WebCore::QuickTimePluginReplacement::installReplacement):
+        * bindings/js/IDBBindingUtilities.cpp:
+        (WebCore::get):
+        (WebCore::set):
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::JSCSSStyleDeclaration::getOwnPropertyNames):
+        * bindings/js/JSCallbackData.cpp:
+        (WebCore::JSCallbackData::invokeCallback):
+        * bindings/js/JSCommandLineAPIHostCustom.cpp:
+        (WebCore::getJSListenerFunctions):
+        (WebCore::JSCommandLineAPIHost::getEventListeners):
+        * bindings/js/JSCryptoAlgorithmBuilder.cpp:
+        (WebCore::JSCryptoAlgorithmBuilder::add):
+        * bindings/js/JSCryptoAlgorithmDictionary.cpp:
+        (WebCore::getProperty):
+        (WebCore::getHashAlgorithm):
+        * bindings/js/JSCryptoKeySerializationJWK.cpp:
+        (WebCore::getJSArrayFromJSON):
+        (WebCore::getStringFromJSON):
+        (WebCore::getBooleanFromJSON):
+        (WebCore::addToJSON):
+        (WebCore::buildJSONForRSAComponents):
+        (WebCore::addBoolToJSON):
+        (WebCore::addUsagesToJSON):
+        * bindings/js/JSCustomXPathNSResolver.cpp:
+        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
+        * bindings/js/JSDOMStringMapCustom.cpp:
+        (WebCore::JSDOMStringMap::getOwnPropertyNames):
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::JSDOMWindow::defineOwnProperty):
+        (WebCore::JSDOMWindow::setLocation):
+        (WebCore::DialogHandler::dialogCreated):
+        (WebCore::DialogHandler::returnValue):
+        * bindings/js/JSDeviceMotionEventCustom.cpp:
+        (WebCore::readAccelerationArgument):
+        (WebCore::readRotationRateArgument):
+        (WebCore::createAccelerationObject):
+        (WebCore::createRotationRateObject):
+        * bindings/js/JSDictionary.cpp:
+        (WebCore::JSDictionary::tryGetProperty):
+        * bindings/js/JSEventListener.cpp:
+        (WebCore::JSEventListener::handleEvent):
+        * bindings/js/JSHTMLAllCollectionCustom.cpp:
+        (WebCore::callHTMLAllCollection):
+        (WebCore::JSHTMLAllCollection::item):
+        (WebCore::JSHTMLAllCollection::namedItem):
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::JSHTMLDocument::all):
+        (WebCore::JSHTMLDocument::setAll):
+        (WebCore::JSHTMLDocument::open):
+        * bindings/js/JSHTMLFormControlsCollectionCustom.cpp:
+        (WebCore::JSHTMLFormControlsCollection::namedItem):
+        * bindings/js/JSIDBDatabaseCustom.cpp:
+        (WebCore::JSIDBDatabase::createObjectStore):
+        * bindings/js/JSIDBObjectStoreCustom.cpp:
+        (WebCore::JSIDBObjectStore::createIndex):
+        * bindings/js/JSImageDataCustom.cpp:
+        (WebCore::toJS):
+        * bindings/js/JSInspectorFrontendHostCustom.cpp:
+        (WebCore::populateContextMenuItems):
+        * bindings/js/JSLazyEventListener.cpp:
+        (WebCore::JSLazyEventListener::initializeJSFunction):
+        * bindings/js/JSNodeFilterCondition.cpp:
+        (WebCore::JSNodeFilterCondition::acceptNode):
+        * bindings/js/JSSQLResultSetRowListCustom.cpp:
+        (WebCore::JSSQLResultSetRowList::item):
+        * bindings/js/JSStorageCustom.cpp:
+        (WebCore::JSStorage::getOwnPropertyNames):
+        * bindings/js/ReadableStreamJSSource.cpp:
+        (WebCore::setInternalSlotToObject):
+        (WebCore::getInternalSlotFromObject):
+        * bindings/js/ScriptGlobalObject.cpp:
+        (WebCore::ScriptGlobalObject::set):
+        (WebCore::ScriptGlobalObject::get):
+        (WebCore::ScriptGlobalObject::remove):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::CloneSerializer::CloneSerializer):
+        (WebCore::CloneSerializer::write):
+        (WebCore::CloneDeserializer::deserialize):
+        * bindings/objc/WebScriptObject.mm:
+        (-[WebScriptObject callWebScriptMethod:withArguments:]):
+        (-[WebScriptObject setValue:forKey:]):
+        (-[WebScriptObject valueForKey:]):
+        (-[WebScriptObject removeWebScriptKey:]):
+        (-[WebScriptObject hasWebScriptKey:]):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        * bindings/scripts/test/JS/JSFloat64Array.cpp:
+        (WebCore::JSFloat64Array::getOwnPropertyNames):
+        * bindings/scripts/test/JS/JSTestEventTarget.cpp:
+        (WebCore::JSTestEventTarget::getOwnPropertyNames):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
+        (WebCore::setJSTestObjConditionalAttr4Constructor):
+        (WebCore::setJSTestObjConditionalAttr5Constructor):
+        (WebCore::setJSTestObjConditionalAttr6Constructor):
+        (WebCore::setJSTestObjReplaceableAttribute):
+        * bridge/c/c_utility.cpp:
+        (JSC::Bindings::identifierFromNPIdentifier):
+        * bridge/objc/objc_runtime.mm:
+        (JSC::Bindings::ObjcFallbackObjectImp::defaultValue):
+        * bridge/testbindings.cpp:
+        (main):
+        * bridge/testbindings.mm:
+        (main):
+        * contentextensions/ContentExtensionParser.cpp:
+        (WebCore::ContentExtensions::loadTrigger):
+        (WebCore::ContentExtensions::loadAction):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute):
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::injectInternalsObject):
+
 2015-03-31  Jer Noble  <jer.noble@apple.com>
 
         [Mac] Songza.com fails to play; QTKit path reports it is always "seeking".
index 7ea7cba..ac74ff6 100644 (file)
@@ -158,7 +158,7 @@ bool QuickTimePluginReplacement::ensureReplacementScriptInjected()
     JSC::ExecState* exec = globalObject->globalExec();
     JSC::JSLockHolder lock(exec);
     
-    JSC::JSValue replacementFunction = globalObject->get(exec, JSC::Identifier(exec, "createPluginReplacement"));
+    JSC::JSValue replacementFunction = globalObject->get(exec, JSC::Identifier::fromString(exec, "createPluginReplacement"));
     if (replacementFunction.isFunction())
         return true;
     
@@ -186,7 +186,7 @@ bool QuickTimePluginReplacement::installReplacement(ShadowRoot* root)
     JSC::JSLockHolder lock(exec);
     
     // Lookup the "createPluginReplacement" function.
-    JSC::JSValue replacementFunction = globalObject->get(exec, JSC::Identifier(exec, "createPluginReplacement"));
+    JSC::JSValue replacementFunction = globalObject->get(exec, JSC::Identifier::fromString(exec, "createPluginReplacement"));
     if (replacementFunction.isUndefinedOrNull())
         return false;
     JSC::JSObject* replacementObject = replacementFunction.toObject(exec);
@@ -208,7 +208,7 @@ bool QuickTimePluginReplacement::installReplacement(ShadowRoot* root)
     }
 
     // Get the <video> created to replace the plug-in.
-    JSC::JSValue value = replacement.get(exec, JSC::Identifier(exec, "video"));
+    JSC::JSValue value = replacement.get(exec, JSC::Identifier::fromString(exec, "video"));
     if (!exec->hadException() && !value.isUndefinedOrNull())
         m_mediaElement = JSHTMLVideoElement::toWrapped(value);
 
@@ -219,7 +219,7 @@ bool QuickTimePluginReplacement::installReplacement(ShadowRoot* root)
     }
 
     // Get the scripting interface.
-    value = replacement.get(exec, JSC::Identifier(exec, "scriptObject"));
+    value = replacement.get(exec, JSC::Identifier::fromString(exec, "scriptObject"));
     if (!exec->hadException() && !value.isUndefinedOrNull())
         m_scriptObject = value.toObject(exec);
 
index bb5018c..6f80661 100644 (file)
@@ -53,7 +53,7 @@ static bool get(ExecState* exec, JSValue object, const String& keyPathElement, J
     }
     if (!object.isObject())
         return false;
-    Identifier identifier(&exec->vm(), keyPathElement.utf8().data());
+    Identifier identifier = Identifier::fromString(&exec->vm(), keyPathElement.utf8().data());
     if (!asObject(object)->hasProperty(exec, identifier))
         return false;
     result = asObject(object)->get(exec, identifier);
@@ -70,7 +70,7 @@ static bool set(ExecState* exec, JSValue& object, const String& keyPathElement,
 {
     if (!canSet(object, keyPathElement))
         return false;
-    Identifier identifier(&exec->vm(), keyPathElement.utf8().data());
+    Identifier identifier = Identifier::fromString(&exec->vm(), keyPathElement.utf8().data());
     asObject(object)->putDirect(exec->vm(), identifier, jsValue);
     return true;
 }
index 0c5064d..b939073 100644 (file)
@@ -400,7 +400,7 @@ void JSCSSStyleDeclaration::getOwnPropertyNames(JSObject* object, ExecState* exe
 
         propertyIdentifiers = new Identifier[numCSSProperties];
         for (int i = 0; i < numCSSProperties; ++i)
-            propertyIdentifiers[i] = Identifier(exec, jsPropertyNames[i].impl());
+            propertyIdentifiers[i] = Identifier::fromString(exec, jsPropertyNames[i]);
     }
 
     for (int i = 0; i < numCSSProperties; ++i)
index e1d725f..451dac6 100644 (file)
@@ -60,7 +60,7 @@ JSValue JSCallbackData::invokeCallback(JSValue thisValue, MarkedArgumentBuffer&
     CallData callData;
     CallType callType = callback()->methodTable()->getCallData(callback(), callData);
     if (callType == CallTypeNone) {
-        function = callback()->get(exec, Identifier(exec, "handleEvent"));
+        function = callback()->get(exec, Identifier::fromString(exec, "handleEvent"));
         callType = getCallData(function, callData);
         if (callType == CallTypeNone)
             return JSValue();
index da52cec..8d2d020 100644 (file)
@@ -89,8 +89,8 @@ static JSArray* getJSListenerFunctions(ExecState* exec, Document* document, cons
             continue;
 
         JSObject* listenerEntry = constructEmptyObject(exec);
-        listenerEntry->putDirect(exec->vm(), Identifier(exec, "listener"), function);
-        listenerEntry->putDirect(exec->vm(), Identifier(exec, "useCapture"), jsBoolean(listenerInfo.eventListenerVector[i].useCapture));
+        listenerEntry->putDirect(exec->vm(), Identifier::fromString(exec, "listener"), function);
+        listenerEntry->putDirect(exec->vm(), Identifier::fromString(exec, "useCapture"), jsBoolean(listenerInfo.eventListenerVector[i].useCapture));
         result->putDirectIndex(exec, outputIndex++, JSValue(listenerEntry));
     }
     return result;
@@ -118,7 +118,7 @@ JSValue JSCommandLineAPIHost::getEventListeners(ExecState* exec)
         if (!listeners->length())
             continue;
         AtomicString eventType = listenersArray[i].eventType;
-        result->putDirect(exec->vm(), Identifier(exec, eventType.impl()), JSValue(listeners));
+        result->putDirect(exec->vm(), Identifier::fromString(exec, eventType.impl()), JSValue(listeners));
     }
 
     return result;
index 0810bc8..a9f3726 100644 (file)
@@ -56,21 +56,21 @@ std::unique_ptr<CryptoAlgorithmDescriptionBuilder> JSCryptoAlgorithmBuilder::cre
 void JSCryptoAlgorithmBuilder::add(const char* key, unsigned value)
 {
     VM& vm = m_exec->vm();
-    Identifier identifier(&vm, key);
+    Identifier identifier = Identifier::fromString(&vm, key);
     m_dictionary->putDirect(vm, identifier, jsNumber(value));
 }
 
 void JSCryptoAlgorithmBuilder::add(const char* key, const String& value)
 {
     VM& vm = m_exec->vm();
-    Identifier identifier(&vm, key);
+    Identifier identifier = Identifier::fromString(&vm, key);
     m_dictionary->putDirect(vm, identifier, jsString(m_exec, value));
 }
 
 void JSCryptoAlgorithmBuilder::add(const char* key, const Vector<uint8_t>& buffer)
 {
     VM& vm = m_exec->vm();
-    Identifier identifier(&vm, key);
+    Identifier identifier = Identifier::fromString(&vm, key);
     RefPtr<Uint8Array> arrayView = Uint8Array::create(buffer.data(), buffer.size());
     m_dictionary->putDirect(vm, identifier, arrayView->wrap(m_exec, vm.entryScope->globalObject()));
 }
@@ -78,7 +78,7 @@ void JSCryptoAlgorithmBuilder::add(const char* key, const Vector<uint8_t>& buffe
 void JSCryptoAlgorithmBuilder::add(const char* key, const CryptoAlgorithmDescriptionBuilder& nestedBuilder)
 {
     VM& vm = m_exec->vm();
-    Identifier identifier(&vm, key);
+    Identifier identifier = Identifier::fromString(&vm, key);
     const JSCryptoAlgorithmBuilder& jsBuilder = static_cast<const JSCryptoAlgorithmBuilder&>(nestedBuilder);
     m_dictionary->putDirect(vm, identifier, jsBuilder.result());
 }
index 64d56d9..4ae6ae5 100644 (file)
@@ -89,7 +89,7 @@ bool JSCryptoAlgorithmDictionary::getAlgorithmIdentifier(ExecState* exec, JSValu
 
 static JSValue getProperty(ExecState* exec, JSObject* object, const char* name)
 {
-    Identifier identifier(exec, name);
+    Identifier identifier = Identifier::fromString(exec, name);
     PropertySlot slot(object);
 
     if (object->getPropertySlot(exec, identifier, slot))
@@ -105,7 +105,7 @@ static bool getHashAlgorithm(JSDictionary& dictionary, CryptoAlgorithmIdentifier
     ExecState* exec = dictionary.execState();
     JSObject* object = dictionary.initializerObject();
 
-    Identifier identifier(exec, "hash");
+    Identifier identifier = Identifier::fromString(exec, "hash");
     PropertySlot slot(object);
 
     JSValue hash = getProperty(exec, object, "hash");
index fbb397e..835057b 100644 (file)
@@ -52,7 +52,7 @@ namespace WebCore {
 
 static bool getJSArrayFromJSON(ExecState* exec, JSObject* json, const char* key, JSArray*& result)
 {
-    Identifier identifier(exec, key);
+    Identifier identifier = Identifier::fromString(exec, key);
     PropertySlot slot(json);
 
     if (!json->getPropertySlot(exec, identifier, slot))
@@ -72,7 +72,7 @@ static bool getJSArrayFromJSON(ExecState* exec, JSObject* json, const char* key,
 
 static bool getStringFromJSON(ExecState* exec, JSObject* json, const char* key, String& result)
 {
-    Identifier identifier(exec, key);
+    Identifier identifier = Identifier::fromString(exec, key);
     PropertySlot slot(json);
 
     if (!json->getPropertySlot(exec, identifier, slot))
@@ -93,7 +93,7 @@ static bool getStringFromJSON(ExecState* exec, JSObject* json, const char* key,
 
 static bool getBooleanFromJSON(ExecState* exec, JSObject* json, const char* key, bool& result)
 {
-    Identifier identifier(exec, key);
+    Identifier identifier = Identifier::fromString(exec, key);
     PropertySlot slot(json);
 
     if (!json->getPropertySlot(exec, identifier, slot))
@@ -501,7 +501,7 @@ std::unique_ptr<CryptoKeyData> JSCryptoKeySerializationJWK::keyData() const
 static void addToJSON(ExecState* exec, JSObject* json, const char* key, const String& value)
 {
     VM& vm = exec->vm();
-    Identifier identifier(&vm, key);
+    Identifier identifier = Identifier::fromString(&vm, key);
     json->putDirect(vm, identifier, jsString(exec, value));
 }
 
@@ -542,13 +542,13 @@ static void buildJSONForRSAComponents(JSC::ExecState* exec, const CryptoKeyDataR
         addToJSON(exec, jsPrimeInfo, "t", base64URLEncode(data.otherPrimeInfos()[i].factorCRTCoefficient));
         oth->putDirectIndex(exec, i, jsPrimeInfo);
     }
-    result->putDirect(exec->vm(), Identifier(exec, "oth"), oth);
+    result->putDirect(exec->vm(), Identifier::fromString(exec, "oth"), oth);
 }
 
 static void addBoolToJSON(ExecState* exec, JSObject* json, const char* key, bool value)
 {
     VM& vm = exec->vm();
-    Identifier identifier(&vm, key);
+    Identifier identifier = Identifier::fromString(&vm, key);
     json->putDirect(vm, identifier, jsBoolean(value));
 }
 
@@ -675,7 +675,7 @@ static void addUsagesToJSON(ExecState* exec, JSObject* json, CryptoKeyUsage usag
     if (usages & CryptoKeyUsageDeriveBits)
         keyOps->putDirectIndex(exec, index++, jsNontrivialString(exec, ASCIILiteral("deriveBits")));
 
-    json->putDirect(exec->vm(), Identifier(exec, "key_ops"), keyOps);
+    json->putDirect(exec->vm(), Identifier::fromString(exec, "key_ops"), keyOps);
 }
 
 String JSCryptoKeySerializationJWK::serialize(ExecState* exec, const CryptoKey& key)
index 7836681..54eb331 100644 (file)
@@ -74,7 +74,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix)
 
     ExecState* exec = m_globalObject->globalExec();
         
-    JSValue function = m_customResolver->get(exec, Identifier(exec, "lookupNamespaceURI"));
+    JSValue function = m_customResolver->get(exec, Identifier::fromString(exec, "lookupNamespaceURI"));
     CallData callData;
     CallType callType = getCallData(function, callData);
     if (callType == CallTypeNone) {
index 3afaae2..52598ce 100644 (file)
@@ -53,7 +53,7 @@ void JSDOMStringMap::getOwnPropertyNames(JSObject* object, ExecState* exec, Prop
     thisObject->m_impl->getNames(names);
     size_t length = names.size();
     for (size_t i = 0; i < length; ++i)
-        propertyNames.add(Identifier(exec, names[i]));
+        propertyNames.add(Identifier::fromString(exec, names[i]));
 
     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
 }
index 6199265..be777a2 100644 (file)
@@ -428,7 +428,7 @@ bool JSDOMWindow::defineOwnProperty(JSC::JSObject* object, JSC::ExecState* exec,
         return false;
 
     // Don't allow shadowing location using accessor properties.
-    if (descriptor.isAccessorDescriptor() && propertyName == Identifier(exec, "location"))
+    if (descriptor.isAccessorDescriptor() && propertyName == Identifier::fromString(exec, "location"))
         return false;
 
     return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow);
@@ -444,7 +444,7 @@ void JSDOMWindow::setLocation(ExecState* exec, JSValue value)
     if (Frame* activeFrame = activeDOMWindow(exec).frame()) {
         if (activeFrame->settings().usesDashboardBackwardCompatibilityMode() && !activeFrame->tree().parent()) {
             if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, impl()))
-                putDirect(exec->vm(), Identifier(exec, "location"), value);
+                putDirect(exec->vm(), Identifier::fromString(exec, "location"), value);
             return;
         }
     }
@@ -526,7 +526,7 @@ inline void DialogHandler::dialogCreated(DOMWindow& dialog)
     //        world if dialogArguments comes from an isolated world.
     JSDOMWindow* globalObject = toJSDOMWindow(m_frame.get(), normalWorld(m_exec->vm()));
     if (JSValue dialogArguments = m_exec->argument(1))
-        globalObject->putDirect(m_exec->vm(), Identifier(m_exec, "dialogArguments"), dialogArguments);
+        globalObject->putDirect(m_exec->vm(), Identifier::fromString(m_exec, "dialogArguments"), dialogArguments);
 }
 
 inline JSValue DialogHandler::returnValue() const
@@ -534,7 +534,7 @@ inline JSValue DialogHandler::returnValue() const
     JSDOMWindow* globalObject = toJSDOMWindow(m_frame.get(), normalWorld(m_exec->vm()));
     if (!globalObject)
         return jsUndefined();
-    Identifier identifier(m_exec, "returnValue");
+    Identifier identifier = Identifier::fromString(m_exec, "returnValue");
     PropertySlot slot(globalObject);
     if (!JSGlobalObject::getOwnPropertySlot(globalObject, m_exec, identifier, slot))
         return jsUndefined();
index fca7c7e..ecbb33e 100644 (file)
@@ -48,7 +48,7 @@ static PassRefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSVal
     // Given the above test, this will always yield an object.
     JSObject* object = value.toObject(exec);
 
-    JSValue xValue = object->get(exec, Identifier(exec, "x"));
+    JSValue xValue = object->get(exec, Identifier::fromString(exec, "x"));
     if (exec->hadException())
         return 0;
     bool canProvideX = !xValue.isUndefinedOrNull();
@@ -56,7 +56,7 @@ static PassRefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSVal
     if (exec->hadException())
         return 0;
 
-    JSValue yValue = object->get(exec, Identifier(exec, "y"));
+    JSValue yValue = object->get(exec, Identifier::fromString(exec, "y"));
     if (exec->hadException())
         return 0;
     bool canProvideY = !yValue.isUndefinedOrNull();
@@ -64,7 +64,7 @@ static PassRefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSVal
     if (exec->hadException())
         return 0;
 
-    JSValue zValue = object->get(exec, Identifier(exec, "z"));
+    JSValue zValue = object->get(exec, Identifier::fromString(exec, "z"));
     if (exec->hadException())
         return 0;
     bool canProvideZ = !zValue.isUndefinedOrNull();
@@ -86,7 +86,7 @@ static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSVal
     // Given the above test, this will always yield an object.
     JSObject* object = value.toObject(exec);
 
-    JSValue alphaValue = object->get(exec, Identifier(exec, "alpha"));
+    JSValue alphaValue = object->get(exec, Identifier::fromString(exec, "alpha"));
     if (exec->hadException())
         return 0;
     bool canProvideAlpha = !alphaValue.isUndefinedOrNull();
@@ -94,7 +94,7 @@ static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSVal
     if (exec->hadException())
         return 0;
 
-    JSValue betaValue = object->get(exec, Identifier(exec, "beta"));
+    JSValue betaValue = object->get(exec, Identifier::fromString(exec, "beta"));
     if (exec->hadException())
         return 0;
     bool canProvideBeta = !betaValue.isUndefinedOrNull();
@@ -102,7 +102,7 @@ static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSVal
     if (exec->hadException())
         return 0;
 
-    JSValue gammaValue = object->get(exec, Identifier(exec, "gamma"));
+    JSValue gammaValue = object->get(exec, Identifier::fromString(exec, "gamma"));
     if (exec->hadException())
         return 0;
     bool canProvideGamma = !gammaValue.isUndefinedOrNull();
@@ -119,18 +119,18 @@ static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSVal
 static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState* exec)
 {
     JSObject* object = constructEmptyObject(exec);
-    object->putDirect(exec->vm(), Identifier(exec, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
-    object->putDirect(exec->vm(), Identifier(exec, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
-    object->putDirect(exec->vm(), Identifier(exec, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
+    object->putDirect(exec->vm(), Identifier::fromString(exec, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
+    object->putDirect(exec->vm(), Identifier::fromString(exec, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
+    object->putDirect(exec->vm(), Identifier::fromString(exec, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
     return object;
 }
 
 static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState* exec)
 {
     JSObject* object = constructEmptyObject(exec);
-    object->putDirect(exec->vm(), Identifier(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
-    object->putDirect(exec->vm(), Identifier(exec, "beta"),  rotationRate->canProvideBeta()  ? jsNumber(rotationRate->beta())  : jsNull());
-    object->putDirect(exec->vm(), Identifier(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
+    object->putDirect(exec->vm(), Identifier::fromString(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
+    object->putDirect(exec->vm(), Identifier::fromString(exec, "beta"),  rotationRate->canProvideBeta()  ? jsNumber(rotationRate->beta())  : jsNull());
+    object->putDirect(exec->vm(), Identifier::fromString(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
     return object;
 }
 
index 20d8f83..e984909 100644 (file)
@@ -63,7 +63,7 @@ namespace WebCore {
 JSDictionary::GetPropertyResult JSDictionary::tryGetProperty(const char* propertyName, JSValue& finalResult) const
 {
     ASSERT(isValid());
-    Identifier identifier(m_exec, propertyName);
+    Identifier identifier = Identifier::fromString(m_exec, propertyName);
     PropertySlot slot(m_initializerObject.get());
 
     if (!m_initializerObject.get()->getPropertySlot(m_exec, identifier, slot))
index e2d292d..ffb0580 100644 (file)
@@ -105,7 +105,7 @@ void JSEventListener::handleEvent(ScriptExecutionContext* scriptExecutionContext
     CallType callType = getCallData(handleEventFunction, callData);
     // If jsFunction is not actually a function, see if it implements the EventListener interface and use that
     if (callType == CallTypeNone) {
-        handleEventFunction = jsFunction->get(exec, Identifier(exec, "handleEvent"));
+        handleEventFunction = jsFunction->get(exec, Identifier::fromString(exec, "handleEvent"));
         callType = getCallData(handleEventFunction, callData);
     }
 
index 8122507..3eba421 100644 (file)
@@ -70,7 +70,7 @@ static EncodedJSValue JSC_HOST_CALL callHTMLAllCollection(ExecState* exec)
             return JSValue::encode(toJS(exec, jsCollection->globalObject(), collection.item(index)));
 
         // Support for document.images('<name>') etc.
-        return JSValue::encode(namedItems(exec, jsCollection, Identifier(exec, string)));
+        return JSValue::encode(namedItems(exec, jsCollection, Identifier::fromString(exec, string)));
     }
 
     // The second arg, if set, is the index of the item we want
@@ -106,12 +106,12 @@ JSValue JSHTMLAllCollection::item(ExecState* exec)
     uint32_t index = toUInt32FromStringImpl(exec->argument(0).toString(exec)->value(exec).impl());
     if (index != PropertyName::NotAnIndex)
         return toJS(exec, globalObject(), impl().item(index));
-    return namedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
+    return namedItems(exec, this, Identifier::fromString(exec, exec->argument(0).toString(exec)->value(exec)));
 }
 
 JSValue JSHTMLAllCollection::namedItem(ExecState* exec)
 {
-    JSValue value = namedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
+    JSValue value = namedItems(exec, this, Identifier::fromString(exec, exec->argument(0).toString(exec)->value(exec)));
     return value.isUndefined() ? jsNull() : value;
 }
 
index 3ad9a47..6d39c45 100644 (file)
@@ -113,7 +113,7 @@ EncodedJSValue JSHTMLDocument::nameGetter(ExecState* exec, JSObject* slotBase, E
 JSValue JSHTMLDocument::all(ExecState* exec) const
 {
     // If "all" has been overwritten, return the overwritten value
-    JSValue v = getDirect(exec->vm(), Identifier(exec, "all"));
+    JSValue v = getDirect(exec->vm(), Identifier::fromString(exec, "all"));
     if (v)
         return v;
 
@@ -123,7 +123,7 @@ JSValue JSHTMLDocument::all(ExecState* exec) const
 void JSHTMLDocument::setAll(ExecState* exec, JSValue value)
 {
     // Add "all" to the property map.
-    putDirect(exec->vm(), Identifier(exec, "all"), value);
+    putDirect(exec->vm(), Identifier::fromString(exec, "all"), value);
 }
 
 static Document* findCallingDocument(ExecState* exec)
@@ -146,7 +146,7 @@ JSValue JSHTMLDocument::open(ExecState* exec)
         if (Frame* frame = impl().frame()) {
             JSDOMWindowShell* wrapper = toJSDOMWindowShell(frame, currentWorld(exec));
             if (wrapper) {
-                JSValue function = wrapper->get(exec, Identifier(exec, "open"));
+                JSValue function = wrapper->get(exec, Identifier::fromString(exec, "open"));
                 CallData callData;
                 CallType callType = ::getCallData(function, callData);
                 if (callType == CallTypeNone)
index 2867d60..2848971 100644 (file)
@@ -57,7 +57,7 @@ EncodedJSValue JSHTMLFormControlsCollection::nameGetter(ExecState* exec, JSObjec
 
 JSValue JSHTMLFormControlsCollection::namedItem(ExecState* exec)
 {
-    JSValue value = namedItems(exec, this, Identifier(exec, exec->argument(0).toString(exec)->value(exec)));
+    JSValue value = namedItems(exec, this, Identifier::fromString(exec, exec->argument(0).toString(exec)->value(exec)));
     return value.isUndefined() ? jsNull() : value;
 }
 
index e6a140f..a25dca9 100644 (file)
@@ -60,7 +60,7 @@ JSValue JSIDBDatabase::createObjectStore(ExecState* exec)
     IDBKeyPath keyPath;
     bool autoIncrement = false;
     if (!optionsValue.isUndefinedOrNull()) {
-        JSValue keyPathValue = optionsValue.get(exec, Identifier(exec, "keyPath"));
+        JSValue keyPathValue = optionsValue.get(exec, Identifier::fromString(exec, "keyPath"));
         if (exec->hadException())
             return jsUndefined();
 
@@ -70,7 +70,7 @@ JSValue JSIDBDatabase::createObjectStore(ExecState* exec)
                 return jsUndefined();
         }
 
-        autoIncrement = optionsValue.get(exec, Identifier(exec, "autoIncrement")).toBoolean(exec);
+        autoIncrement = optionsValue.get(exec, Identifier::fromString(exec, "autoIncrement")).toBoolean(exec);
         if (exec->hadException())
             return jsUndefined();
     }
index 04044d3..8507e49 100644 (file)
@@ -67,11 +67,11 @@ JSValue JSIDBObjectStore::createIndex(ExecState* exec)
     bool unique = false;
     bool multiEntry = false;
     if (!optionsValue.isUndefinedOrNull()) {
-        unique = optionsValue.get(exec, Identifier(exec, "unique")).toBoolean(exec);
+        unique = optionsValue.get(exec, Identifier::fromString(exec, "unique")).toBoolean(exec);
         if (exec->hadException())
             return jsUndefined();
 
-        multiEntry = optionsValue.get(exec, Identifier(exec, "multiEntry")).toBoolean(exec);
+        multiEntry = optionsValue.get(exec, Identifier::fromString(exec, "multiEntry")).toBoolean(exec);
         if (exec->hadException())
             return jsUndefined();
     }
index 05c0cd9..5eb6d58 100644 (file)
@@ -45,7 +45,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD
         return wrapper;
     
     wrapper = CREATE_DOM_WRAPPER(globalObject, ImageData, imageData);
-    Identifier dataName(exec, "data");
+    Identifier dataName = Identifier::fromString(exec, "data");
     wrapper->putDirect(exec->vm(), dataName, toJS(exec, globalObject, imageData->data()), DontDelete | ReadOnly);
     // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
     // https://bugs.webkit.org/show_bug.cgi?id=142595
index d86a480..8550eb4 100644 (file)
@@ -86,12 +86,12 @@ static void populateContextMenuItems(ExecState* exec, JSArray* array, ContextMen
 {
     for (size_t i = 0; i < array->length(); ++i) {
         JSObject* item = asObject(array->getIndex(exec, i));
-        JSValue label = item->get(exec, Identifier(exec, "label"));
-        JSValue type = item->get(exec, Identifier(exec, "type"));
-        JSValue id = item->get(exec, Identifier(exec, "id"));
-        JSValue enabled = item->get(exec, Identifier(exec, "enabled"));
-        JSValue checked = item->get(exec, Identifier(exec, "checked"));
-        JSValue subItems = item->get(exec, Identifier(exec, "subItems"));
+        JSValue label = item->get(exec, Identifier::fromString(exec, "label"));
+        JSValue type = item->get(exec, Identifier::fromString(exec, "type"));
+        JSValue id = item->get(exec, Identifier::fromString(exec, "id"));
+        JSValue enabled = item->get(exec, Identifier::fromString(exec, "enabled"));
+        JSValue checked = item->get(exec, Identifier::fromString(exec, "checked"));
+        JSValue subItems = item->get(exec, Identifier::fromString(exec, "subItems"));
         if (!type.isString())
             continue;
 
index e53776c..cf1337f 100644 (file)
@@ -109,7 +109,7 @@ JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* exec
     int overrideLineNumber = m_position.m_line.oneBasedInt();
 
     JSObject* jsFunction = constructFunctionSkippingEvalEnabledCheck(
-        exec, exec->lexicalGlobalObject(), args, Identifier(exec, m_functionName), 
+        exec, exec->lexicalGlobalObject(), args, Identifier::fromString(exec, m_functionName),
         m_sourceURL, m_position, overrideLineNumber);
 
     if (exec->hadException()) {
index 71726bb..7b4119a 100644 (file)
@@ -52,7 +52,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode)
     CallData callData;
     CallType callType = getCallData(filter, callData);
     if (callType == CallTypeNone) {
-        filter = filter.get(exec, Identifier(exec, "acceptNode"));
+        filter = filter.get(exec, Identifier::fromString(exec, "acceptNode"));
         callType = getCallData(filter, callData);
         if (callType == CallTypeNone) {
             exec->vm().throwException(exec, createTypeError(exec, "NodeFilter object does not have an acceptNode function"));
index 3c92beb..8c9eb8f 100644 (file)
@@ -74,7 +74,7 @@ JSValue JSSQLResultSetRowList::item(ExecState* exec)
               ASSERT_NOT_REACHED();
         }
 
-        object->putDirect(exec->vm(), Identifier(exec, m_impl->columnNames()[i]), jsValue, DontDelete | ReadOnly);
+        object->putDirect(exec->vm(), Identifier::fromString(exec, m_impl->columnNames()[i]), jsValue, DontDelete | ReadOnly);
     }
 
     return object;
index 942c4df..d64603e 100644 (file)
@@ -91,7 +91,7 @@ void JSStorage::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyN
     if (exec->hadException())
         return;
     for (unsigned i = 0; i < length; ++i) {
-        propertyNames.add(Identifier(exec, thisObject->m_impl->key(i, ec)));
+        propertyNames.add(Identifier::fromString(exec, thisObject->m_impl->key(i, ec)));
         setDOMException(exec, ec);
         if (exec->hadException())
             return;
index c904543..1ed0055 100644 (file)
@@ -48,7 +48,7 @@ void setInternalSlotToObject(ExecState* exec, JSValue objectValue, PrivateName&
 {
     JSObject* object = objectValue.toObject(exec);
     PutPropertySlot propertySlot(objectValue);
-    object->put(object, exec, Identifier::from(name), value, propertySlot);
+    object->put(object, exec, Identifier::fromUid(name), value, propertySlot);
 }
 
 JSValue getInternalSlotFromObject(ExecState* exec, JSValue objectValue, PrivateName& name)
@@ -56,7 +56,7 @@ JSValue getInternalSlotFromObject(ExecState* exec, JSValue objectValue, PrivateN
     JSObject* object = objectValue.toObject(exec);
     PropertySlot propertySlot(objectValue);
 
-    Identifier propertyName = Identifier::from(name);
+    Identifier propertyName = Identifier::fromUid(name);
     if (!object->getOwnPropertySlot(object, exec, propertyName, propertySlot))
         return JSValue();
     return propertySlot.getValue(exec, propertyName);
index cb4931d..03d4476 100644 (file)
@@ -53,7 +53,7 @@ static bool handleException(JSC::ExecState* scriptState)
 bool ScriptGlobalObject::set(JSC::ExecState* scriptState, const char* name, const Deprecated::ScriptObject& value)
 {
     JSLockHolder lock(scriptState);
-    scriptState->lexicalGlobalObject()->putDirect(scriptState->vm(), Identifier(scriptState, name), value.jsObject());
+    scriptState->lexicalGlobalObject()->putDirect(scriptState->vm(), Identifier::fromString(scriptState, name), value.jsObject());
     return handleException(scriptState);
 }
 
@@ -61,14 +61,14 @@ bool ScriptGlobalObject::set(JSC::ExecState* scriptState, const char* name, Insp
 {
     JSLockHolder lock(scriptState);
     JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject());
-    globalObject->putDirect(scriptState->vm(), Identifier(scriptState, name), toJS(scriptState, globalObject, value));
+    globalObject->putDirect(scriptState->vm(), Identifier::fromString(scriptState, name), toJS(scriptState, globalObject, value));
     return handleException(scriptState);
 }
 
 bool ScriptGlobalObject::get(JSC::ExecState* scriptState, const char* name, Deprecated::ScriptObject& value)
 {
     JSLockHolder lock(scriptState);
-    JSValue jsValue = scriptState->lexicalGlobalObject()->get(scriptState, Identifier(scriptState, name));
+    JSValue jsValue = scriptState->lexicalGlobalObject()->get(scriptState, Identifier::fromString(scriptState, name));
     if (!jsValue)
         return false;
 
@@ -82,7 +82,7 @@ bool ScriptGlobalObject::get(JSC::ExecState* scriptState, const char* name, Depr
 bool ScriptGlobalObject::remove(JSC::ExecState* scriptState, const char* name)
 {
     JSLockHolder lock(scriptState);
-    scriptState->lexicalGlobalObject()->methodTable()->deleteProperty(scriptState->lexicalGlobalObject(), scriptState, Identifier(scriptState, name));
+    scriptState->lexicalGlobalObject()->methodTable()->deleteProperty(scriptState->lexicalGlobalObject(), scriptState, Identifier::fromString(scriptState, name));
     return handleException(scriptState);
 }
 
index ba2603c..00ea11b 100644 (file)
@@ -527,7 +527,7 @@ private:
         : CloneBase(exec)
         , m_buffer(out)
         , m_blobURLs(blobURLs)
-        , m_emptyIdentifier(exec, emptyString())
+        , m_emptyIdentifier(Identifier::fromString(exec, emptyString()))
     {
         write(CurrentVersion);
         fillTransferMap(messagePorts, m_transferredMessagePorts);
@@ -1020,7 +1020,7 @@ private:
         if (str.isNull())
             write(m_emptyIdentifier);
         else
-            write(Identifier(m_exec, str));
+            write(Identifier::fromString(m_exec, str));
     }
 
     void write(const Vector<uint8_t>& vector)
@@ -2487,11 +2487,11 @@ DeserializationResult CloneDeserializer::deserialize()
             }
 
             if (JSValue terminal = readTerminal()) {
-                putProperty(outputObjectStack.last(), Identifier(m_exec, cachedString->string()), terminal);
+                putProperty(outputObjectStack.last(), Identifier::fromString(m_exec, cachedString->string()), terminal);
                 goto objectStartVisitMember;
             }
             stateStack.append(ObjectEndVisitMember);
-            propertyNameStack.append(Identifier(m_exec, cachedString->string()));
+            propertyNameStack.append(Identifier::fromString(m_exec, cachedString->string()));
             goto stateUnknown;
         }
         case ObjectEndVisitMember: {
index 5d9d8f5..3a93ebf 100644 (file)
@@ -330,7 +330,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     JSLockHolder lock(exec);
     ASSERT(!exec->hadException());
 
-    JSC::JSValue function = [self _imp]->get(exec, Identifier(exec, String(name)));
+    JSC::JSValue function = [self _imp]->get(exec, Identifier::fromString(exec, String(name)));
     CallData callData;
     CallType callType = getCallData(function, callData);
     if (callType == CallTypeNone)
@@ -384,7 +384,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     JSLockHolder lock(exec);
     JSObject* object = JSC::jsDynamicCast<JSObject*>([self _imp]);
     PutPropertySlot slot(object);
-    object->methodTable()->put(object, exec, Identifier(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot);
+    object->methodTable()->put(object, exec, Identifier::fromString(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot);
 
     if (exec->hadException()) {
         addExceptionToConsole(exec);
@@ -407,7 +407,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
         // leaving the lock permanently held
         JSLockHolder lock(exec);
         
-        JSC::JSValue result = [self _imp]->get(exec, Identifier(exec, String(key)));
+        JSC::JSValue result = [self _imp]->get(exec, Identifier::fromString(exec, String(key)));
         
         if (exec->hadException()) {
             addExceptionToConsole(exec);
@@ -433,7 +433,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     ASSERT(!exec->hadException());
 
     JSLockHolder lock(exec);
-    [self _imp]->methodTable()->deleteProperty([self _imp], exec, Identifier(exec, String(key)));
+    [self _imp]->methodTable()->deleteProperty([self _imp], exec, Identifier::fromString(exec, String(key)));
 
     if (exec->hadException()) {
         addExceptionToConsole(exec);
@@ -450,7 +450,7 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root
     ASSERT(!exec->hadException());
 
     JSLockHolder lock(exec);
-    BOOL result = [self _imp]->hasProperty(exec, Identifier(exec, String(key)));
+    BOOL result = [self _imp]->hasProperty(exec, Identifier::fromString(exec, String(key)));
 
     if (exec->hadException()) {
         addExceptionToConsole(exec);
index 14baf4b..5b9f84e 100644 (file)
@@ -1991,7 +1991,7 @@ sub GenerateImplementation
                 my $enable_function = GetRuntimeEnableFunctionName($signature);
                 my $name = $signature->name;
                 push(@implContent, "    if (!${enable_function}()) {\n");
-                push(@implContent, "        Identifier propertyName(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n");
+                push(@implContent, "        Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(\"$name\"), strlen(\"$name\"));\n");
                 push(@implContent, "        removeDirect(vm, propertyName);\n");
                 push(@implContent, "    }\n");
                 push(@implContent, "#endif\n") if $conditionalString;
@@ -2580,10 +2580,10 @@ sub GenerateImplementation
                     AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"});
                 }
                 push(@implContent, "    // Shadowing a built-in constructor.\n");
-                push(@implContent, "    castedThis->putDirect(exec->vm(), Identifier(exec, \"$name\"), value);\n");
+                push(@implContent, "    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, \"$name\"), value);\n");
             } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) {
                 push(@implContent, "    // Shadowing a built-in object.\n");
-                push(@implContent, "    castedThis->putDirect(exec->vm(), Identifier(exec, \"$name\"), value);\n");
+                push(@implContent, "    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, \"$name\"), value);\n");
             } else {
                 if (!$attribute->isStatic) {
                     push(@implContent, "    auto& impl = castedThis->impl();\n");
@@ -2692,7 +2692,7 @@ sub GenerateImplementation
         push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");
         push(@implContent, "    for (unsigned i = 0, count = thisObject->impl().length(); i < count; ++i)\n");
         push(@implContent, "        propertyNames.add(Identifier::from(exec, i));\n");
-        push(@implContent, "     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);\n");
+        push(@implContent, "    Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);\n");
         push(@implContent, "}\n\n");
     }
 
index 1d59189..d24a2ea 100644 (file)
@@ -241,7 +241,7 @@ void JSFloat64Array::getOwnPropertyNames(JSObject* object, ExecState* exec, Prop
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     for (unsigned i = 0; i < static_cast<Float64Array*>(thisObject->impl())->length(); ++i)
         propertyNames.add(Identifier::from(exec, i));
-     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
+    Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
 }
 
 JSValue JSFloat64Array::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
index c30fa80..ab29812 100644 (file)
@@ -224,7 +224,7 @@ void JSTestEventTarget::getOwnPropertyNames(JSObject* object, ExecState* exec, P
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     for (unsigned i = 0, count = thisObject->impl().length(); i < count; ++i)
         propertyNames.add(Identifier::from(exec, i));
-     Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
+    Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
 }
 
 JSValue JSTestEventTarget::getConstructor(VM& vm, JSGlobalObject* globalObject)
index 14a785a..1a274af 100644 (file)
@@ -1897,8 +1897,8 @@ void setJSTestObjTestSubObjEnabledBySettingConstructor(ExecState* exec, JSObject
     auto* castedThis = jsCast<JSTestObj*>(baseObject);
     UNUSED_PARAM(thisValue);
     UNUSED_PARAM(exec);
-    // Shadowing a built-in constructor.
-    castedThis->putDirect(exec->vm(), Identifier(exec, "TestSubObjEnabledBySetting"), value);
+    // Shadowing a built-in constructor
+    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, "TestSubObjEnabledBySetting"), value);
 }
 
 
@@ -2706,8 +2706,8 @@ void setJSTestObjConditionalAttr4Constructor(ExecState* exec, JSObject* baseObje
     auto* castedThis = jsCast<JSTestObj*>(baseObject);
     UNUSED_PARAM(thisValue);
     UNUSED_PARAM(exec);
-    // Shadowing a built-in constructor.
-    castedThis->putDirect(exec->vm(), Identifier(exec, "conditionalAttr4"), value);
+    // Shadowing a built-in constructor
+    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, "conditionalAttr4"), value);
 }
 
 #endif
@@ -2721,8 +2721,8 @@ void setJSTestObjConditionalAttr5Constructor(ExecState* exec, JSObject* baseObje
     auto* castedThis = jsCast<JSTestObj*>(baseObject);
     UNUSED_PARAM(thisValue);
     UNUSED_PARAM(exec);
-    // Shadowing a built-in constructor.
-    castedThis->putDirect(exec->vm(), Identifier(exec, "conditionalAttr5"), value);
+    // Shadowing a built-in constructor
+    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, "conditionalAttr5"), value);
 }
 
 #endif
@@ -2736,8 +2736,8 @@ void setJSTestObjConditionalAttr6Constructor(ExecState* exec, JSObject* baseObje
     auto* castedThis = jsCast<JSTestObj*>(baseObject);
     UNUSED_PARAM(thisValue);
     UNUSED_PARAM(exec);
-    // Shadowing a built-in constructor.
-    castedThis->putDirect(exec->vm(), Identifier(exec, "conditionalAttr6"), value);
+    // Shadowing a built-in constructor
+    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, "conditionalAttr6"), value);
 }
 
 #endif
@@ -2874,8 +2874,8 @@ void setJSTestObjReplaceableAttribute(ExecState* exec, JSObject* baseObject, Enc
             throwSetterTypeError(*exec, "TestObj", "replaceableAttribute");
         return;
     }
-    // Shadowing a built-in object.
-    castedThis->putDirect(exec->vm(), Identifier(exec, "replaceableAttribute"), value);
+    // Shadowing a built-in object
+    castedThis->putDirect(exec->vm(), Identifier::fromString(exec, "replaceableAttribute"), value);
 }
 
 
index 774fdfc..df909dc 100644 (file)
@@ -144,7 +144,7 @@ String convertNPStringToUTF16(const NPString* string)
 
 Identifier identifierFromNPIdentifier(ExecState* exec, const NPUTF8* name)
 {
-    return Identifier(exec, convertUTF8ToUTF16WithLatin1Fallback(name, -1));
+    return Identifier::fromString(exec, convertUTF8ToUTF16WithLatin1Fallback(name, -1));
 }
 
 } }
index cd34e5f..5789158 100644 (file)
@@ -268,7 +268,7 @@ bool ObjcFallbackObjectImp::deleteProperty(JSCell*, ExecState*, PropertyName)
 JSValue ObjcFallbackObjectImp::defaultValue(const JSObject* object, ExecState* exec, PreferredPrimitiveType)
 {
     const ObjcFallbackObjectImp* thisObject = jsCast<const ObjcFallbackObjectImp*>(object);
-    return thisObject->_instance->getValueOfUndefinedField(exec, Identifier(exec, thisObject->m_item));
+    return thisObject->_instance->getValueOfUndefinedField(exec, Identifier::fromString(exec, thisObject->m_item));
 }
 
 bool ObjcFallbackObjectImp::toBoolean(ExecState *) const
index 95730c4..baf247d 100644 (file)
@@ -380,7 +380,7 @@ int main(int argc, char **argv)
         
         MyObject *myObject = (MyObject *)NPN_CreateObject (myFunctionPtrs);
         
-        global.put(exec, Identifier("myInterface"), Instance::createRuntimeObject(Instance::CLanguage, (void *)myObject));
+        global.put(exec, Identifier::fromString(exec, "myInterface"), Instance::createRuntimeObject(Instance::CLanguage, (void *)myObject));
         
         for (int i = 1; i < argc; i++) {
             const char *code = readJavaScriptFromFile(argv[i]);
@@ -394,7 +394,7 @@ int main(int argc, char **argv)
                     char* msg = exVal.toString(exec)->value(exec).ascii();
                     int lineno = -1;
                     if (exVal.type() == ObjectType) {
-                        Value lineVal = Object::dynamicCast(exVal).get(exec,Identifier("line"));
+                        Value lineVal = Object::dynamicCast(exVal).get(exec, Identifier::fromString(exec, "line"));
                         if (lineVal.type() == NumberType)
                             lineno = int(lineVal.toNumber(exec));
                     }
index bfacf21..3532b0a 100644 (file)
@@ -248,7 +248,7 @@ int main(int argc, char **argv)
         
         MyFirstInterface *myInterface = [[MyFirstInterface alloc] init];
         
-        global.put(exec, Identifier("myInterface"), Instance::createRuntimeObject(Instance::ObjectiveCLanguage, (void *)myInterface));
+        global.put(exec, Identifier::fromString(exec, "myInterface"), Instance::createRuntimeObject(Instance::ObjectiveCLanguage, (void *)myInterface));
         
         for (int i = 1; i < argc; i++) {
             const char *code = readJavaScriptFromFile(argv[i]);
@@ -262,7 +262,7 @@ int main(int argc, char **argv)
                     char *msg = exVal.toString(exec).ascii();
                     int lineno = -1;
                     if (exVal.type() == ObjectType) {
-                        Value lineVal = Object::dynamicCast(exVal).get(exec,Identifier("line"));
+                        Value lineVal = Object::dynamicCast(exVal).get(exec, Identifier::fromString(exec, "line"));
                         if (lineVal.type() == NumberType)
                             lineno = int(lineVal.toNumber(exec));
                     }
index 8906cb7..4f7e8fa 100644 (file)
@@ -77,11 +77,11 @@ static std::error_code getTypeFlags(ExecState& exec, const JSValue& typeValue, R
     
 static std::error_code loadTrigger(ExecState& exec, JSObject& ruleObject, Trigger& trigger)
 {
-    JSValue triggerObject = ruleObject.get(&exec, Identifier(&exec, "trigger"));
+    JSValue triggerObject = ruleObject.get(&exec, Identifier::fromString(&exec, "trigger"));
     if (!triggerObject || exec.hadException() || !triggerObject.isObject())
         return ContentExtensionError::JSONInvalidTrigger;
     
-    JSValue urlFilterObject = triggerObject.get(&exec, Identifier(&exec, "url-filter"));
+    JSValue urlFilterObject = triggerObject.get(&exec, Identifier::fromString(&exec, "url-filter"));
     if (!urlFilterObject || exec.hadException() || !urlFilterObject.isString())
         return ContentExtensionError::JSONInvalidURLFilterInTrigger;
 
@@ -91,18 +91,18 @@ static std::error_code loadTrigger(ExecState& exec, JSObject& ruleObject, Trigge
 
     trigger.urlFilter = urlFilter;
 
-    JSValue urlFilterCaseValue = triggerObject.get(&exec, Identifier(&exec, "url-filter-is-case-sensitive"));
+    JSValue urlFilterCaseValue = triggerObject.get(&exec, Identifier::fromString(&exec, "url-filter-is-case-sensitive"));
     if (urlFilterCaseValue && !exec.hadException() && urlFilterCaseValue.isBoolean())
         trigger.urlFilterIsCaseSensitive = urlFilterCaseValue.toBoolean(&exec);
 
-    JSValue resourceTypeValue = triggerObject.get(&exec, Identifier(&exec, "resource-type"));
+    JSValue resourceTypeValue = triggerObject.get(&exec, Identifier::fromString(&exec, "resource-type"));
     if (resourceTypeValue && !exec.hadException()) {
         auto typeFlagsError = getTypeFlags(exec, resourceTypeValue, trigger.flags, readResourceType);
         if (typeFlagsError)
             return typeFlagsError;
     }
 
-    JSValue loadTypeValue = triggerObject.get(&exec, Identifier(&exec, "load-type"));
+    JSValue loadTypeValue = triggerObject.get(&exec, Identifier::fromString(&exec, "load-type"));
     if (loadTypeValue && !exec.hadException()) {
         auto typeFlagsError = getTypeFlags(exec, loadTypeValue, trigger.flags, readLoadType);
         if (typeFlagsError)
@@ -114,11 +114,11 @@ static std::error_code loadTrigger(ExecState& exec, JSObject& ruleObject, Trigge
 
 static std::error_code loadAction(ExecState& exec, JSObject& ruleObject, Action& action)
 {
-    JSValue actionObject = ruleObject.get(&exec, Identifier(&exec, "action"));
+    JSValue actionObject = ruleObject.get(&exec, Identifier::fromString(&exec, "action"));
     if (!actionObject || exec.hadException() || !actionObject.isObject())
         return ContentExtensionError::JSONInvalidAction;
 
-    JSValue typeObject = actionObject.get(&exec, Identifier(&exec, "type"));
+    JSValue typeObject = actionObject.get(&exec, Identifier::fromString(&exec, "type"));
     if (!typeObject || exec.hadException() || !typeObject.isString())
         return ContentExtensionError::JSONInvalidActionType;
 
@@ -131,7 +131,7 @@ static std::error_code loadAction(ExecState& exec, JSObject& ruleObject, Action&
     else if (actionType == "block-cookies")
         action = ActionType::BlockCookies;
     else if (actionType == "css-display-none") {
-        JSValue selector = actionObject.get(&exec, Identifier(&exec, "selector"));
+        JSValue selector = actionObject.get(&exec, Identifier::fromString(&exec, "selector"));
         if (!selector || exec.hadException() || !selector.isString())
             return ContentExtensionError::JSONInvalidCSSDisplayNoneActionType;
 
index 8d9d85b..c4eba5e 100644 (file)
@@ -3659,7 +3659,7 @@ static JSC::JSValue controllerJSValue(JSC::ExecState& exec, JSDOMGlobalObject& g
     if (!mediaJSWrapperObject)
         return JSC::jsNull();
     
-    JSC::Identifier controlsHost(&exec.vm(), "controlsHost");
+    JSC::Identifier controlsHost = JSC::Identifier::fromString(&exec.vm(), "controlsHost");
     JSC::JSValue controlsHostJSWrapper = mediaJSWrapperObject->get(&exec, controlsHost);
     if (exec.hadException())
         return JSC::jsNull();
@@ -3668,7 +3668,7 @@ static JSC::JSValue controllerJSValue(JSC::ExecState& exec, JSDOMGlobalObject& g
     if (!controlsHostJSWrapperObject)
         return JSC::jsNull();
 
-    JSC::Identifier controllerID(&exec.vm(), "controller");
+    JSC::Identifier controllerID = JSC::Identifier::fromString(&exec.vm(), "controller");
     JSC::JSValue controllerJSWrapper = controlsHostJSWrapperObject->get(&exec, controllerID);
     if (exec.hadException())
         return JSC::jsNull();
@@ -3710,7 +3710,7 @@ void HTMLMediaElement::updateCaptionContainer()
     //     None
     // Return value:
     //     None
-    JSC::JSValue methodValue = controllerObject->get(exec, JSC::Identifier(exec, "updateCaptionContainer"));
+    JSC::JSValue methodValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "updateCaptionContainer"));
     JSC::JSObject* methodObject = JSC::jsDynamicCast<JSC::JSObject*>(methodValue);
     if (!methodObject)
         return;
@@ -5851,7 +5851,7 @@ bool HTMLMediaElement::ensureMediaControlsInjectedScript()
     JSC::ExecState* exec = globalObject->globalExec();
     JSC::JSLockHolder lock(exec);
 
-    JSC::JSValue functionValue = globalObject->get(exec, JSC::Identifier(exec, "createControls"));
+    JSC::JSValue functionValue = globalObject->get(exec, JSC::Identifier::fromString(exec, "createControls"));
     if (functionValue.isFunction())
         return true;
 
@@ -5874,7 +5874,7 @@ static void setPageScaleFactorProperty(JSC::ExecState* exec, JSC::JSValue contro
 {
     JSC::PutPropertySlot propertySlot(controllerValue);
     JSC::JSObject* controllerObject = controllerValue.toObject(exec);
-    controllerObject->methodTable()->put(controllerObject, exec, JSC::Identifier(exec, "pageScaleFactor"), JSC::jsNumber(pageScaleFactor), propertySlot);
+    controllerObject->methodTable()->put(controllerObject, exec, JSC::Identifier::fromString(exec, "pageScaleFactor"), JSC::jsNumber(pageScaleFactor), propertySlot);
 }
 
 void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
@@ -5903,7 +5903,7 @@ void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     // Return value:
     //     A reference to the created media controller instance.
 
-    JSC::JSValue functionValue = globalObject->get(exec, JSC::Identifier(exec, "createControls"));
+    JSC::JSValue functionValue = globalObject->get(exec, JSC::Identifier::fromString(exec, "createControls"));
     if (functionValue.isUndefinedOrNull())
         return;
 
@@ -5932,7 +5932,7 @@ void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
 
     // Connect the Media, MediaControllerHost, and Controller so the GC knows about their relationship
     JSC::JSObject* mediaJSWrapperObject = mediaJSWrapper.toObject(exec);
-    JSC::Identifier controlsHost(&exec->vm(), "controlsHost");
+    JSC::Identifier controlsHost = JSC::Identifier::fromString(&exec->vm(), "controlsHost");
     
     ASSERT(!mediaJSWrapperObject->hasProperty(exec, controlsHost));
 
@@ -5942,7 +5942,7 @@ void HTMLMediaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     if (!mediaControlsHostJSWrapperObject)
         return;
     
-    JSC::Identifier controller(&exec->vm(), "controller");
+    JSC::Identifier controller = JSC::Identifier::fromString(&exec->vm(), "controller");
 
     ASSERT(!controllerObject->hasProperty(exec, controller));
 
index 743e996..83f1b7e 100644 (file)
@@ -395,7 +395,7 @@ void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
     argList.append(JSC::jsBoolean(!m_snapshotImage));
 
     // It is expected the JS file provides a createOverlay(shadowRoot, title, subtitle) function.
-    JSC::JSObject* overlay = globalObject->get(exec, JSC::Identifier(exec, "createOverlay")).toObject(exec);
+    JSC::JSObject* overlay = globalObject->get(exec, JSC::Identifier::fromString(exec, "createOverlay")).toObject(exec);
     JSC::CallData callData;
     JSC::CallType callType = overlay->methodTable()->getCallData(overlay, callData);
     if (callType == JSC::CallTypeNone)
index 02e3f49..b52d1e6 100644 (file)
@@ -48,7 +48,7 @@ void injectInternalsObject(JSContextRef context)
     JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
     ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext();
     if (is<Document>(*scriptContext))
-        globalObject->putDirect(exec->vm(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(scriptContext))));
+        globalObject->putDirect(exec->vm(), Identifier::fromString(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(scriptContext))));
 }
 
 void resetInternalsObject(JSContextRef context)
index 91629b6..757ea49 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Clean up Identifier factories to clarify the meaning of StringImpl*
+        https://bugs.webkit.org/show_bug.cgi?id=143146
+
+        Reviewed by Filip Pizlo.
+
+        Just change to Identifier::fromString.
+
+        * Plugins/Hosted/NetscapePluginHostProxy.mm:
+        (identifierFromIdentifierRep):
+        * Plugins/Hosted/ProxyInstance.mm:
+        (WebKit::ProxyInstance::getPropertyNames):
+
 2015-03-28  Anders Carlsson  <andersca@apple.com>
 
         Remove an unused SPI method from WebKitLegacy
index 9cd655c..3441e4f 100644 (file)
@@ -627,7 +627,7 @@ static Identifier identifierFromIdentifierRep(IdentifierRep* identifier)
     ASSERT(identifier->isString());
   
     const char* str = identifier->string();    
-    return Identifier(&JSDOMWindow::commonVM(), String::fromUTF8WithLatin1Fallback(str, strlen(str)));
+    return Identifier::fromString(&JSDOMWindow::commonVM(), String::fromUTF8WithLatin1Fallback(str, strlen(str)));
 }
 
 kern_return_t WKPCInvoke(mach_port_t clientPort, uint32_t pluginID, uint32_t requestID, uint32_t objectID, uint64_t serverIdentifier,
index 0df0dec..751b16a 100644 (file)
@@ -321,7 +321,7 @@ void ProxyInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArr
 
         if (identifier->isString()) {
             const char* str = identifier->string();
-            nameArray.add(Identifier(&JSDOMWindow::commonVM(), String::fromUTF8WithLatin1Fallback(str, strlen(str))));
+            nameArray.add(Identifier::fromString(&JSDOMWindow::commonVM(), String::fromUTF8WithLatin1Fallback(str, strlen(str))));
         } else
             nameArray.add(Identifier::from(exec, identifier->number()));
     }
index c4ca6f7..34e4daf 100644 (file)
@@ -1,3 +1,17 @@
+2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Clean up Identifier factories to clarify the meaning of StringImpl*
+        https://bugs.webkit.org/show_bug.cgi?id=143146
+
+        Reviewed by Filip Pizlo.
+
+        Just change to Identifier::fromString.
+
+        * WebProcess/Plugins/Netscape/JSNPObject.cpp:
+        (WebKit::JSNPObject::getOwnPropertyNames):
+        * WebProcess/Plugins/Netscape/NPJSObject.cpp:
+        (WebKit::identifierFromIdentifierRep):
+
 2015-03-31  Timothy Horton  <timothy_horton@apple.com>
 
         WebKit briefly shows wrong webpage after swiping back (gigaom.com, or any site on a slow network)
index 1ced293..fdbe81a 100644 (file)
@@ -407,7 +407,7 @@ void JSNPObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Property
             const char* string = identifierRep->string();
             int length = strlen(string);
             
-            identifier = Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl());
+            identifier = Identifier::fromString(exec, String::fromUTF8WithLatin1Fallback(string, length));
         } else
             identifier = Identifier::from(exec, identifierRep->number());
 
index 0d16674..ed7d7f6 100644 (file)
@@ -87,7 +87,7 @@ static Identifier identifierFromIdentifierRep(ExecState* exec, IdentifierRep* id
     const char* string = identifierRep->string();
     int length = strlen(string);
 
-    return Identifier(exec, String::fromUTF8WithLatin1Fallback(string, length).impl());
+    return Identifier::fromString(exec, String::fromUTF8WithLatin1Fallback(string, length));
 }
 
 bool NPJSObject::hasMethod(NPIdentifier methodName)
index d32df21..0fee4b2 100644 (file)
@@ -1,3 +1,15 @@
+2015-03-31  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Clean up Identifier factories to clarify the meaning of StringImpl*
+        https://bugs.webkit.org/show_bug.cgi?id=143146
+
+        Reviewed by Filip Pizlo.
+
+        Simple API tests for StringImpl are added.
+
+        * TestWebKitAPI/Tests/WTF/StringImpl.cpp:
+        (TestWebKitAPI::TEST):
+
 2015-03-31  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         [EFL] Add AArch64 builder and tester bot to build.webkit.org
index e9c95db..092cc47 100644 (file)
@@ -481,4 +481,52 @@ TEST(WTF, StringImplEndsWithIgnoringASCIICaseWithEmpty)
     ASSERT_FALSE(empty->endsWithIgnoringASCIICase(*reference.get()));
 }
 
+TEST(WTF, StringImplCreateSymbolEmpty)
+{
+    RefPtr<StringImpl> reference = StringImpl::createSymbolEmpty();
+    ASSERT_TRUE(reference->isSymbol());
+    ASSERT_FALSE(reference->isAtomic());
+    ASSERT_EQ(0u, reference->length());
+    ASSERT_TRUE(equal(reference.get(), ""));
+}
+
+TEST(WTF, StringImplCreateSymbol)
+{
+    RefPtr<StringImpl> original = stringFromUTF8("original");
+    RefPtr<StringImpl> reference = StringImpl::createSymbol(original);
+    ASSERT_TRUE(reference->isSymbol());
+    ASSERT_FALSE(reference->isAtomic());
+    ASSERT_FALSE(original->isSymbol());
+    ASSERT_FALSE(original->isAtomic());
+    ASSERT_EQ(original->length(), reference->length());
+    ASSERT_TRUE(equal(reference.get(), "original"));
+}
+
+TEST(WTF, StringImplSymbolToAtomicString)
+{
+    RefPtr<StringImpl> original = stringFromUTF8("original");
+    RefPtr<StringImpl> reference = StringImpl::createSymbol(original);
+    ASSERT_TRUE(reference->isSymbol());
+    ASSERT_FALSE(reference->isAtomic());
+
+    RefPtr<StringImpl> atomic = AtomicString::add(reference.get());
+    ASSERT_TRUE(atomic->isAtomic());
+    ASSERT_FALSE(atomic->isSymbol());
+    ASSERT_TRUE(reference->isSymbol());
+    ASSERT_FALSE(reference->isAtomic());
+}
+
+TEST(WTF, StringImplSymbolEmptyToAtomicString)
+{
+    RefPtr<StringImpl> reference = StringImpl::createSymbolEmpty();
+    ASSERT_TRUE(reference->isSymbol());
+    ASSERT_FALSE(reference->isAtomic());
+
+    RefPtr<StringImpl> atomic = AtomicString::add(reference.get());
+    ASSERT_TRUE(atomic->isAtomic());
+    ASSERT_FALSE(atomic->isSymbol());
+    ASSERT_TRUE(reference->isSymbol());
+    ASSERT_FALSE(reference->isAtomic());
+}
+
 } // namespace TestWebKitAPI