JSString should remember AtomicString
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jun 2013 03:48:12 +0000 (03:48 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jun 2013 03:48:12 +0000 (03:48 +0000)
commit32dc7f0d883afc0f4e5f5cc8b3edc7d5d69da627
tree8bfad3b2156cd9cea0cbbab33cbe5c9255de480c
parent7f1aabec0df028ec1006795f6803a2b058a010b1
JSString should remember AtomicString
https://bugs.webkit.org/show_bug.cgi?id=117386

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Added JSValue::toAtomicString and JSString::atomicString. These two functions allow WebCore to update
JSString's m_value to set isAtomic flag and avoid the AtomicStringTable lookups in subsequent attempts
to obtain the AtomicString of the same value.

* runtime/JSCJSValue.h:
* runtime/JSString.h:
(JSC::JSString::atomicString):
(JSC::JSValue::toAtomicString):

Source/WebCore:

Added "Atomic" attribute as a WebKit extension to WebIDL, and deployed it in Element.idl and Node.idl so that
the binding code can use newly added JSValue::toAtomic to update JSString's m_value.

* bindings/js/JSDOMBinding.cpp:
(WebCore::valueToAtomicStringWithNullCheck): Added.
(WebCore::valueToAtomicStringWithUndefinedOrNullCheck): Added.

* bindings/js/JSDOMBinding.h:

* bindings/scripts/CodeGeneratorJS.pm:
(GetNativeTypeFromSignature): Return const AtomicString& when either Atomic attribute is specified or the type is
Reflect. Note that setAttribute and getAttribute both use AtomicString for all arguments.
(JSValueToNative): Use AtomicString equivalents when possible when converting DOMString to a WebCore object.

* bindings/scripts/IDLAttributes.txt: Added "Atomic" attribute.

* bindings/scripts/test/JS/JSTestObj.cpp: Baselined test cases.
(WebCore::setJSTestObjReflectedStringAttr):
(WebCore::setJSTestObjReflectedURLAttr):
(WebCore::setJSTestObjReflectedCustomURLAttr):

* dom/Document.idl:
* dom/Element.idl:
* dom/Node.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSCJSValue.h
Source/JavaScriptCore/runtime/JSString.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLAttributes.txt
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.idl
Source/WebCore/dom/Node.idl