Changeset 205335 in webkit
- Timestamp:
- Sep 1, 2016 8:42:09 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r205333 r205335 1 2016-09-01 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Add toJS for JSC::PrivateName 4 https://bugs.webkit.org/show_bug.cgi?id=161522 5 6 Reviewed by Ryosuke Niwa. 7 8 Add the export annotation. 9 And we perform refactoring RefPtr<SymbolImpl> => Ref<SymbolImpl> for PrivateName, 10 since PrivateName never holds null SymbolImpl pointer. And along with this change, 11 we changed SymbolImpl* to SymbolImpl& in PrivateName::uid() callers. 12 13 * runtime/Completion.cpp: 14 (JSC::createSymbolForEntryPointModule): 15 * runtime/IdentifierInlines.h: 16 (JSC::Identifier::fromUid): 17 * runtime/JSFunction.cpp: 18 (JSC::JSFunction::setFunctionName): 19 * runtime/PrivateName.h: 20 (JSC::PrivateName::PrivateName): 21 (JSC::PrivateName::uid): Ugly const_cast. But const annotation is meaningless for SymbolImpl. 22 StringImpl should be observed as an immutable object. (Of course, its hash members etc. are mutable. 23 But most of the users (One of the exceptions is the concurrent JIT compiling thread!) should not care about this.) 24 (JSC::PrivateName::operator==): 25 (JSC::PrivateName::operator!=): 26 * runtime/PropertyName.h: 27 (JSC::PropertyName::PropertyName): 28 * runtime/Symbol.cpp: 29 (JSC::Symbol::finishCreation): 30 * runtime/Symbol.h: 31 * runtime/SymbolConstructor.cpp: 32 (JSC::symbolConstructorKeyFor): 33 1 34 2016-09-01 Dan Bernstein <mitz@apple.com> 2 35 -
trunk/Source/JavaScriptCore/runtime/Completion.cpp
r205278 r205335 143 143 // Generate the unique key for the source-provided module. 144 144 PrivateName privateName(PrivateName::Description, "EntryPointModule"); 145 return Symbol::create(vm, *privateName.uid());145 return Symbol::create(vm, privateName.uid()); 146 146 } 147 147 -
trunk/Source/JavaScriptCore/runtime/IdentifierInlines.h
r196785 r205335 86 86 inline Identifier Identifier::fromUid(const PrivateName& name) 87 87 { 88 return *name.uid();88 return name.uid(); 89 89 } 90 90 -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r205198 r205335 600 600 String name; 601 601 if (value.isSymbol()) { 602 SymbolImpl *uid = asSymbol(value)->privateName().uid();603 if (uid ->isNullSymbol())602 SymbolImpl& uid = asSymbol(value)->privateName().uid(); 603 if (uid.isNullSymbol()) 604 604 name = emptyString(); 605 605 else 606 name = makeString('[', String( uid), ']');606 name = makeString('[', String(&uid), ']'); 607 607 } else { 608 608 VM& vm = exec->vm(); -
trunk/Source/JavaScriptCore/runtime/PrivateName.h
r201782 r205335 39 39 40 40 explicit PrivateName(SymbolImpl& uid) 41 : m_uid( &uid)41 : m_uid(uid) 42 42 { 43 43 } … … 49 49 } 50 50 51 SymbolImpl * uid() const { return m_uid.get(); }51 SymbolImpl& uid() const { return const_cast<SymbolImpl&>(m_uid.get()); } 52 52 53 bool operator==(const PrivateName& other) const { return uid() ==other.uid(); }54 bool operator!=(const PrivateName& other) const { return uid() !=other.uid(); }53 bool operator==(const PrivateName& other) const { return &uid() == &other.uid(); } 54 bool operator!=(const PrivateName& other) const { return &uid() != &other.uid(); } 55 55 56 56 private: 57 Ref Ptr<SymbolImpl> m_uid;57 Ref<SymbolImpl> m_uid; 58 58 }; 59 59 -
trunk/Source/JavaScriptCore/runtime/PropertyName.h
r189154 r205335 46 46 47 47 PropertyName(const PrivateName& propertyName) 48 : m_impl( propertyName.uid())48 : m_impl(&propertyName.uid()) 49 49 { 50 50 ASSERT(m_impl); -
trunk/Source/JavaScriptCore/runtime/Symbol.cpp
r205198 r205335 59 59 ASSERT(inherits(info())); 60 60 61 vm.symbolImplToSymbolMap.set( m_privateName.uid(), this);61 vm.symbolImplToSymbolMap.set(&m_privateName.uid(), this); 62 62 } 63 63 -
trunk/Source/JavaScriptCore/runtime/Symbol.h
r203895 r205335 50 50 static Symbol* create(VM&); 51 51 static Symbol* create(ExecState*, JSString* description); 52 static Symbol* create(VM&, SymbolImpl& uid);52 JS_EXPORT_PRIVATE static Symbol* create(VM&, SymbolImpl& uid); 53 53 54 54 const PrivateName& privateName() const { return m_privateName; } -
trunk/Source/JavaScriptCore/runtime/SymbolConstructor.cpp
r205198 r205335 118 118 return JSValue::encode(throwTypeError(exec, scope, SymbolKeyForTypeError)); 119 119 120 SymbolImpl *uid = asSymbol(symbolValue)->privateName().uid();121 if (!uid ->symbolRegistry())120 SymbolImpl& uid = asSymbol(symbolValue)->privateName().uid(); 121 if (!uid.symbolRegistry()) 122 122 return JSValue::encode(jsUndefined()); 123 123 124 ASSERT(uid ->symbolRegistry() == &vm.symbolRegistry());125 return JSValue::encode(jsString(exec, vm.symbolRegistry().keyForSymbol( *uid)));124 ASSERT(uid.symbolRegistry() == &vm.symbolRegistry()); 125 return JSValue::encode(jsString(exec, vm.symbolRegistry().keyForSymbol(uid))); 126 126 } 127 127 -
trunk/Source/WebCore/ChangeLog
r205333 r205335 1 2016-09-01 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Add toJS for JSC::PrivateName 4 https://bugs.webkit.org/show_bug.cgi?id=161522 5 6 Reviewed by Ryosuke Niwa. 7 8 JSC::PrivateName is the wrapper to create and hold the ES6 Symbol instance. 9 This patch adds toJS support for JSC::PrivateName. 10 Later, the module integration patch will use this feature to call 11 DeferredWrapper::{resolve,reject} with JSC::PrivateName. 12 13 * bindings/js/JSDOMBinding.h: 14 (WebCore::toJS): 15 1 16 2016-09-01 Dan Bernstein <mitz@apple.com> 2 17 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r205324 r205335 265 265 template<typename T> JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const Vector<RefPtr<T>>&); 266 266 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const String&); 267 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, const JSC::PrivateName&); 267 268 268 269 JSC::JSValue toJSIterator(JSC::ExecState&, JSDOMGlobalObject&, JSC::JSValue); … … 577 578 } 578 579 580 inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject*, const JSC::PrivateName& privateName) 581 { 582 return JSC::Symbol::create(exec->vm(), privateName.uid()); 583 } 584 579 585 inline JSC::JSValue toJSIterator(JSC::ExecState& state, JSDOMGlobalObject&, JSC::JSValue value) 580 586 {
Note: See TracChangeset
for help on using the changeset viewer.