Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (205334 => 205335)
--- trunk/Source/_javascript_Core/ChangeLog 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-09-02 03:42:09 UTC (rev 205335)
@@ -1,3 +1,36 @@
+2016-09-01 Yusuke Suzuki <[email protected]>
+
+ Add toJS for JSC::PrivateName
+ https://bugs.webkit.org/show_bug.cgi?id=161522
+
+ Reviewed by Ryosuke Niwa.
+
+ Add the export annotation.
+ And we perform refactoring RefPtr<SymbolImpl> => Ref<SymbolImpl> for PrivateName,
+ since PrivateName never holds null SymbolImpl pointer. And along with this change,
+ we changed SymbolImpl* to SymbolImpl& in PrivateName::uid() callers.
+
+ * runtime/Completion.cpp:
+ (JSC::createSymbolForEntryPointModule):
+ * runtime/IdentifierInlines.h:
+ (JSC::Identifier::fromUid):
+ * runtime/JSFunction.cpp:
+ (JSC::JSFunction::setFunctionName):
+ * runtime/PrivateName.h:
+ (JSC::PrivateName::PrivateName):
+ (JSC::PrivateName::uid): Ugly const_cast. But const annotation is meaningless for SymbolImpl.
+ StringImpl should be observed as an immutable object. (Of course, its hash members etc. are mutable.
+ But most of the users (One of the exceptions is the concurrent JIT compiling thread!) should not care about this.)
+ (JSC::PrivateName::operator==):
+ (JSC::PrivateName::operator!=):
+ * runtime/PropertyName.h:
+ (JSC::PropertyName::PropertyName):
+ * runtime/Symbol.cpp:
+ (JSC::Symbol::finishCreation):
+ * runtime/Symbol.h:
+ * runtime/SymbolConstructor.cpp:
+ (JSC::symbolConstructorKeyFor):
+
2016-09-01 Dan Bernstein <[email protected]>
Build fix.
Modified: trunk/Source/_javascript_Core/runtime/Completion.cpp (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/Completion.cpp 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/Completion.cpp 2016-09-02 03:42:09 UTC (rev 205335)
@@ -142,7 +142,7 @@
{
// Generate the unique key for the source-provided module.
PrivateName privateName(PrivateName::Description, "EntryPointModule");
- return Symbol::create(vm, *privateName.uid());
+ return Symbol::create(vm, privateName.uid());
}
static JSInternalPromise* rejectPromise(ExecState* exec, JSGlobalObject* globalObject)
Modified: trunk/Source/_javascript_Core/runtime/IdentifierInlines.h (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/IdentifierInlines.h 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/IdentifierInlines.h 2016-09-02 03:42:09 UTC (rev 205335)
@@ -85,7 +85,7 @@
inline Identifier Identifier::fromUid(const PrivateName& name)
{
- return *name.uid();
+ return name.uid();
}
template<unsigned charactersCount>
Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp 2016-09-02 03:42:09 UTC (rev 205335)
@@ -599,11 +599,11 @@
ASSERT(jsExecutable()->ecmaName().isNull());
String name;
if (value.isSymbol()) {
- SymbolImpl* uid = asSymbol(value)->privateName().uid();
- if (uid->isNullSymbol())
+ SymbolImpl& uid = asSymbol(value)->privateName().uid();
+ if (uid.isNullSymbol())
name = emptyString();
else
- name = makeString('[', String(uid), ']');
+ name = makeString('[', String(&uid), ']');
} else {
VM& vm = exec->vm();
JSString* jsStr = value.toString(exec);
Modified: trunk/Source/_javascript_Core/runtime/PrivateName.h (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/PrivateName.h 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/PrivateName.h 2016-09-02 03:42:09 UTC (rev 205335)
@@ -38,7 +38,7 @@
}
explicit PrivateName(SymbolImpl& uid)
- : m_uid(&uid)
+ : m_uid(uid)
{
}
@@ -48,13 +48,13 @@
{
}
- SymbolImpl* uid() const { return m_uid.get(); }
+ SymbolImpl& uid() const { return const_cast<SymbolImpl&>(m_uid.get()); }
- bool operator==(const PrivateName& other) const { return uid() == other.uid(); }
- bool operator!=(const PrivateName& other) const { return uid() != other.uid(); }
+ bool operator==(const PrivateName& other) const { return &uid() == &other.uid(); }
+ bool operator!=(const PrivateName& other) const { return &uid() != &other.uid(); }
private:
- RefPtr<SymbolImpl> m_uid;
+ Ref<SymbolImpl> m_uid;
};
}
Modified: trunk/Source/_javascript_Core/runtime/PropertyName.h (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/PropertyName.h 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/PropertyName.h 2016-09-02 03:42:09 UTC (rev 205335)
@@ -45,7 +45,7 @@
}
PropertyName(const PrivateName& propertyName)
- : m_impl(propertyName.uid())
+ : m_impl(&propertyName.uid())
{
ASSERT(m_impl);
ASSERT(m_impl->isSymbol());
Modified: trunk/Source/_javascript_Core/runtime/Symbol.cpp (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/Symbol.cpp 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/Symbol.cpp 2016-09-02 03:42:09 UTC (rev 205335)
@@ -58,7 +58,7 @@
Base::finishCreation(vm);
ASSERT(inherits(info()));
- vm.symbolImplToSymbolMap.set(m_privateName.uid(), this);
+ vm.symbolImplToSymbolMap.set(&m_privateName.uid(), this);
}
inline SymbolObject* SymbolObject::create(VM& vm, JSGlobalObject* globalObject, Symbol* symbol)
Modified: trunk/Source/_javascript_Core/runtime/Symbol.h (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/Symbol.h 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/Symbol.h 2016-09-02 03:42:09 UTC (rev 205335)
@@ -49,7 +49,7 @@
static Symbol* create(VM&);
static Symbol* create(ExecState*, JSString* description);
- static Symbol* create(VM&, SymbolImpl& uid);
+ JS_EXPORT_PRIVATE static Symbol* create(VM&, SymbolImpl& uid);
const PrivateName& privateName() const { return m_privateName; }
String descriptiveString() const;
Modified: trunk/Source/_javascript_Core/runtime/SymbolConstructor.cpp (205334 => 205335)
--- trunk/Source/_javascript_Core/runtime/SymbolConstructor.cpp 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/_javascript_Core/runtime/SymbolConstructor.cpp 2016-09-02 03:42:09 UTC (rev 205335)
@@ -117,12 +117,12 @@
if (!symbolValue.isSymbol())
return JSValue::encode(throwTypeError(exec, scope, SymbolKeyForTypeError));
- SymbolImpl* uid = asSymbol(symbolValue)->privateName().uid();
- if (!uid->symbolRegistry())
+ SymbolImpl& uid = asSymbol(symbolValue)->privateName().uid();
+ if (!uid.symbolRegistry())
return JSValue::encode(jsUndefined());
- ASSERT(uid->symbolRegistry() == &vm.symbolRegistry());
- return JSValue::encode(jsString(exec, vm.symbolRegistry().keyForSymbol(*uid)));
+ ASSERT(uid.symbolRegistry() == &vm.symbolRegistry());
+ return JSValue::encode(jsString(exec, vm.symbolRegistry().keyForSymbol(uid)));
}
} // namespace JSC
Modified: trunk/Source/WebCore/ChangeLog (205334 => 205335)
--- trunk/Source/WebCore/ChangeLog 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/WebCore/ChangeLog 2016-09-02 03:42:09 UTC (rev 205335)
@@ -1,3 +1,18 @@
+2016-09-01 Yusuke Suzuki <[email protected]>
+
+ Add toJS for JSC::PrivateName
+ https://bugs.webkit.org/show_bug.cgi?id=161522
+
+ Reviewed by Ryosuke Niwa.
+
+ JSC::PrivateName is the wrapper to create and hold the ES6 Symbol instance.
+ This patch adds toJS support for JSC::PrivateName.
+ Later, the module integration patch will use this feature to call
+ DeferredWrapper::{resolve,reject} with JSC::PrivateName.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::toJS):
+
2016-09-01 Dan Bernstein <[email protected]>
Build fix.
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (205334 => 205335)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-09-02 03:37:58 UTC (rev 205334)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2016-09-02 03:42:09 UTC (rev 205335)
@@ -264,6 +264,7 @@
template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const Vector<T>&);
template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const Vector<RefPtr<T>>&);
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const String&);
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const JSC::PrivateName&);
JSC::JSValue toJSIterator(JSC::ExecState&, JSDOMGlobalObject&, JSC::JSValue);
template<typename T> JSC::JSValue toJSIterator(JSC::ExecState&, JSDOMGlobalObject&, const T&);
@@ -576,6 +577,11 @@
return jsStringOrNull(exec, value);
}
+inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject*, const JSC::PrivateName& privateName)
+{
+ return JSC::Symbol::create(exec->vm(), privateName.uid());
+}
+
inline JSC::JSValue toJSIterator(JSC::ExecState& state, JSDOMGlobalObject&, JSC::JSValue value)
{
return createIteratorResultObject(&state, value, false);