Changeset 156492 in webkit
- Timestamp:
- Sep 26, 2013 1:44:02 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSClassRef.cpp
r156469 r156492 67 67 String valueName = String::fromUTF8(staticValue->name); 68 68 if (!valueName.isNull()) 69 m_staticValues->set(valueName.impl(), adoptPtr(new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes, valueName)));69 m_staticValues->set(valueName.impl(), std::make_unique<StaticValueEntry>(staticValue->getProperty, staticValue->setProperty, staticValue->attributes, valueName)); 70 70 ++staticValue; 71 71 } … … 77 77 String functionName = String::fromUTF8(staticFunction->name); 78 78 if (!functionName.isNull()) 79 m_staticFunctions->set(functionName.impl(), adoptPtr(new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes)));79 m_staticFunctions->set(functionName.impl(), std::make_unique<StaticFunctionEntry>(staticFunction->callAsFunction, staticFunction->attributes)); 80 80 ++staticFunction; 81 81 } … … 132 132 { 133 133 if (jsClass->m_staticValues) { 134 staticValues = adoptPtr(new OpaqueJSClassStaticValuesTable);134 staticValues = std::make_unique<OpaqueJSClassStaticValuesTable>(); 135 135 OpaqueJSClassStaticValuesTable::const_iterator end = jsClass->m_staticValues->end(); 136 136 for (OpaqueJSClassStaticValuesTable::const_iterator it = jsClass->m_staticValues->begin(); it != end; ++it) { 137 137 ASSERT(!it->key->isIdentifier()); 138 138 String valueName = it->key->isolatedCopy(); 139 staticValues->add(valueName.impl(), adoptPtr(new StaticValueEntry(it->value->getProperty, it->value->setProperty, it->value->attributes, valueName)));139 staticValues->add(valueName.impl(), std::make_unique<StaticValueEntry>(it->value->getProperty, it->value->setProperty, it->value->attributes, valueName)); 140 140 } 141 141 } 142 142 143 143 if (jsClass->m_staticFunctions) { 144 staticFunctions = adoptPtr(new OpaqueJSClassStaticFunctionsTable);144 staticFunctions = std::make_unique<OpaqueJSClassStaticFunctionsTable>(); 145 145 OpaqueJSClassStaticFunctionsTable::const_iterator end = jsClass->m_staticFunctions->end(); 146 146 for (OpaqueJSClassStaticFunctionsTable::const_iterator it = jsClass->m_staticFunctions->begin(); it != end; ++it) { 147 147 ASSERT(!it->key->isIdentifier()); 148 staticFunctions->add(it->key->isolatedCopy(), adoptPtr(new StaticFunctionEntry(it->value->callAsFunction, it->value->attributes)));148 staticFunctions->add(it->key->isolatedCopy(), std::make_unique<StaticFunctionEntry>(it->value->callAsFunction, it->value->attributes)); 149 149 } 150 150 } … … 153 153 OpaqueJSClassContextData& OpaqueJSClass::contextData(ExecState* exec) 154 154 { 155 OwnPtr<OpaqueJSClassContextData>& contextData = exec->lexicalGlobalObject()->opaqueJSClassData().add(this, nullptr).iterator->value;155 std::unique_ptr<OpaqueJSClassContextData>& contextData = exec->lexicalGlobalObject()->opaqueJSClassData().add(this, nullptr).iterator->value; 156 156 if (!contextData) 157 contextData = adoptPtr(new OpaqueJSClassContextData(exec->vm(), this));157 contextData = std::make_unique<OpaqueJSClassContextData>(exec->vm(), this); 158 158 return *contextData; 159 159 } -
trunk/Source/JavaScriptCore/API/JSClassRef.h
r153547 r156492 60 60 }; 61 61 62 typedef HashMap<RefPtr<StringImpl>, OwnPtr<StaticValueEntry>> OpaqueJSClassStaticValuesTable;63 typedef HashMap<RefPtr<StringImpl>, OwnPtr<StaticFunctionEntry>> OpaqueJSClassStaticFunctionsTable;62 typedef HashMap<RefPtr<StringImpl>, std::unique_ptr<StaticValueEntry>> OpaqueJSClassStaticValuesTable; 63 typedef HashMap<RefPtr<StringImpl>, std::unique_ptr<StaticFunctionEntry>> OpaqueJSClassStaticFunctionsTable; 64 64 65 65 struct OpaqueJSClass; … … 80 80 RefPtr<OpaqueJSClass> m_class; 81 81 82 OwnPtr<OpaqueJSClassStaticValuesTable> staticValues;83 OwnPtr<OpaqueJSClassStaticFunctionsTable> staticFunctions;82 std::unique_ptr<OpaqueJSClassStaticValuesTable> staticValues; 83 std::unique_ptr<OpaqueJSClassStaticFunctionsTable> staticFunctions; 84 84 JSC::Weak<JSC::JSObject> cachedPrototype; 85 85 }; -
trunk/Source/JavaScriptCore/ChangeLog
r156490 r156492 1 2013-09-26 Anders Carlsson <andersca@apple.com> 2 3 Change a couple of HashMap value types from OwnPtr to std::unique_ptr 4 https://bugs.webkit.org/show_bug.cgi?id=121973 5 6 Reviewed by Andreas Kling. 7 8 * API/JSClassRef.cpp: 9 (OpaqueJSClassContextData::OpaqueJSClassContextData): 10 (OpaqueJSClass::contextData): 11 * API/JSClassRef.h: 12 * bytecode/SamplingTool.h: 13 * ftl/FTLAbstractHeap.h: 14 * parser/Parser.cpp: 15 (JSC::::parseFunctionInfo): 16 * parser/SourceProviderCache.cpp: 17 (JSC::SourceProviderCache::add): 18 * parser/SourceProviderCache.h: 19 * parser/SourceProviderCacheItem.h: 20 (JSC::SourceProviderCacheItem::create): 21 * profiler/ProfilerCompilation.cpp: 22 (JSC::Profiler::Compilation::executionCounterFor): 23 (JSC::Profiler::Compilation::toJS): 24 * profiler/ProfilerCompilation.h: 25 * runtime/JSGlobalObject.h: 26 1 27 2013-09-26 Mark Lam <mark.lam@apple.com> 2 28 -
trunk/Source/JavaScriptCore/bytecode/SamplingTool.h
r148696 r156492 212 212 }; 213 213 214 typedef HashMap<ScriptExecutable*, OwnPtr<ScriptSampleRecord>> ScriptSampleRecordMap;214 typedef HashMap<ScriptExecutable*, std::unique_ptr<ScriptSampleRecord>> ScriptSampleRecordMap; 215 215 216 216 class SamplingThread { -
trunk/Source/JavaScriptCore/ftl/FTLAbstractHeap.h
r155251 r156492 178 178 static bool isDeletedValue(ptrdiff_t value) { return value == 1; } 179 179 }; 180 typedef HashMap<ptrdiff_t, OwnPtr<AbstractField>, WTF::IntHash<ptrdiff_t>, WithoutZeroOrOneHashTraits> MapType;180 typedef HashMap<ptrdiff_t, std::unique_ptr<AbstractField>, WTF::IntHash<ptrdiff_t>, WithoutZeroOrOneHashTraits> MapType; 181 181 182 182 OwnPtr<MapType> m_largeIndices; -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r156480 r156492 996 996 // Any future reparsing can then skip the function. 997 997 static const int minimumFunctionLengthToCache = 16; 998 OwnPtr<SourceProviderCacheItem> newInfo;998 std::unique_ptr<SourceProviderCacheItem> newInfo; 999 999 int functionLength = closeBraceOffset - openBraceOffset; 1000 1000 if (TreeBuilder::CanUseFunctionCache && m_functionCache && functionLength > minimumFunctionLengthToCache) { … … 1014 1014 1015 1015 if (newInfo) 1016 m_functionCache->add(openBraceOffset, newInfo.release());1016 m_functionCache->add(openBraceOffset, std::move(newInfo)); 1017 1017 1018 1018 next(); -
trunk/Source/JavaScriptCore/parser/SourceProviderCache.cpp
r143279 r156492 39 39 } 40 40 41 void SourceProviderCache::add(int sourcePosition, PassOwnPtr<SourceProviderCacheItem> item)41 void SourceProviderCache::add(int sourcePosition, std::unique_ptr<SourceProviderCacheItem> item) 42 42 { 43 m_map.add(sourcePosition, item);43 m_map.add(sourcePosition, std::move(item)); 44 44 } 45 45 -
trunk/Source/JavaScriptCore/parser/SourceProviderCache.h
r143279 r156492 42 42 43 43 JS_EXPORT_PRIVATE void clear(); 44 void add(int sourcePosition, PassOwnPtr<SourceProviderCacheItem>);44 void add(int sourcePosition, std::unique_ptr<SourceProviderCacheItem>); 45 45 const SourceProviderCacheItem* get(int sourcePosition) const { return m_map.get(sourcePosition); } 46 46 47 47 private: 48 HashMap<int, OwnPtr<SourceProviderCacheItem>> m_map;48 HashMap<int, std::unique_ptr<SourceProviderCacheItem>> m_map; 49 49 }; 50 50 -
trunk/Source/JavaScriptCore/parser/SourceProviderCacheItem.h
r152494 r156492 54 54 WTF_MAKE_FAST_ALLOCATED; 55 55 public: 56 static PassOwnPtr<SourceProviderCacheItem> create(const SourceProviderCacheItemCreationParameters&);56 static std::unique_ptr<SourceProviderCacheItem> create(const SourceProviderCacheItemCreationParameters&); 57 57 ~SourceProviderCacheItem(); 58 58 … … 99 99 } 100 100 101 inline PassOwnPtr<SourceProviderCacheItem> SourceProviderCacheItem::create(const SourceProviderCacheItemCreationParameters& parameters)101 inline std::unique_ptr<SourceProviderCacheItem> SourceProviderCacheItem::create(const SourceProviderCacheItemCreationParameters& parameters) 102 102 { 103 103 size_t variableCount = parameters.writtenVariables.size() + parameters.usedVariables.size(); 104 104 size_t objectSize = sizeof(SourceProviderCacheItem) + sizeof(StringImpl*) * variableCount; 105 105 void* slot = fastMalloc(objectSize); 106 return adoptPtr(new (slot) SourceProviderCacheItem(parameters));106 return std::unique_ptr<SourceProviderCacheItem>(new (slot) SourceProviderCacheItem(parameters)); 107 107 } 108 108 -
trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp
r148696 r156492 70 70 ExecutionCounter* Compilation::executionCounterFor(const OriginStack& origin) 71 71 { 72 HashMap<OriginStack, OwnPtr<ExecutionCounter> >::iterator iter = m_counters.find(origin); 73 if (iter != m_counters.end()) 74 return iter->value.get(); 75 76 OwnPtr<ExecutionCounter> counter = adoptPtr(new ExecutionCounter()); 77 ExecutionCounter* result = counter.get(); 78 m_counters.add(origin, counter.release()); 79 return result; 72 std::unique_ptr<ExecutionCounter>& counter = m_counters.add(origin, nullptr).iterator->value; 73 if (!counter) 74 counter = std::make_unique<ExecutionCounter>(); 75 76 return counter.get(); 80 77 } 81 78 … … 109 106 110 107 JSArray* counters = constructEmptyArray(exec, 0); 111 HashMap<OriginStack, OwnPtr<ExecutionCounter> >::const_iterator end = m_counters.end(); 112 for (HashMap<OriginStack, OwnPtr<ExecutionCounter> >::const_iterator iter = m_counters.begin(); iter != end; ++iter) { 108 for (auto it = m_counters.begin(), end = m_counters.end(); it != end; ++it) { 113 109 JSObject* counterEntry = constructEmptyObject(exec); 114 counterEntry->putDirect(exec->vm(), exec->propertyNames().origin, it er->key.toJS(exec));115 counterEntry->putDirect(exec->vm(), exec->propertyNames().executionCount, jsNumber(it er->value->count()));110 counterEntry->putDirect(exec->vm(), exec->propertyNames().origin, it->key.toJS(exec)); 111 counterEntry->putDirect(exec->vm(), exec->propertyNames().executionCount, jsNumber(it->value->count())); 116 112 counters->push(exec, counterEntry); 117 113 } -
trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.h
r146548 r156492 75 75 Vector<ProfiledBytecodes> m_profiledBytecodes; 76 76 Vector<CompiledBytecode> m_descriptions; 77 HashMap<OriginStack, OwnPtr<ExecutionCounter>> m_counters;77 HashMap<OriginStack, std::unique_ptr<ExecutionCounter>> m_counters; 78 78 Vector<OSRExitSite> m_osrExitSites; 79 79 SegmentedVector<OSRExit> m_osrExits; -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r156017 r156492 124 124 class JSGlobalObject : public JSSegmentedVariableObject { 125 125 private: 126 typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> 127 typedef HashMap<OpaqueJSClass*, OwnPtr<OpaqueJSClassContextData>> OpaqueJSClassDataMap;126 typedef HashSet<RefPtr<OpaqueJSWeakObjectMap>> WeakMapSet; 127 typedef HashMap<OpaqueJSClass*, std::unique_ptr<OpaqueJSClassContextData>> OpaqueJSClassDataMap; 128 128 129 129 struct JSGlobalObjectRareData { -
trunk/Source/WTF/ChangeLog
r156456 r156492 1 2013-09-26 Anders Carlsson <andersca@apple.com> 2 3 Change a couple of HashMap value types from OwnPtr to std::unique_ptr 4 https://bugs.webkit.org/show_bug.cgi?id=121973 5 6 Reviewed by Andreas Kling. 7 8 * wtf/RefPtrHashMap.h: 9 Add a missing std::forward. 10 11 * wtf/StdLibExtras.h: 12 (std::make_unique): 13 Add more overloads. 14 1 15 2013-09-26 Julien Brianceau <jbriance@cisco.com> 2 16 -
trunk/Source/WTF/wtf/RefPtrHashMap.h
r156304 r156492 229 229 auto HashMap<RefPtr<KeyArg>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>::set(RawKeyType key, V&& value) -> AddResult 230 230 { 231 AddResult result = inlineAdd(key, value);231 AddResult result = inlineAdd(key, std::forward<V>(value)); 232 232 if (!result.isNewEntry) { 233 233 // The inlineAdd call above found an existing hash table entry; we need to set the mapped value. -
trunk/Source/WTF/wtf/StdLibExtras.h
r156204 r156492 345 345 return unique_ptr<T>(new T(std::forward<A1>(a1), std::forward<A2>(a2))); 346 346 } 347 348 template<class T, class A1, class A2, class A3> typename _Unique_if<T>::_Single_object 349 make_unique(A1&& a1, A1&& a2, A3&& a3) 350 { 351 return unique_ptr<T>(new T(std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3))); 352 } 353 354 template<class T, class A1, class A2, class A3, class A4> typename _Unique_if<T>::_Single_object 355 make_unique(A1&& a1, A1&& a2, A3&& a3, A4&& a4) 356 { 357 return unique_ptr<T>(new T(std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), std::forward<A4>(a4))); 358 } 359 360 template<class T, class A1, class A2, class A3, class A4, class A5> typename _Unique_if<T>::_Single_object 361 make_unique(A1&& a1, A1&& a2, A3&& a3, A4&& a4, A5&& a5) 362 { 363 return unique_ptr<T>(new T(std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), std::forward<A4>(a4), std::forward<A5>(a5))); 364 } 365 366 template<class T, class A1, class A2, class A3, class A4, class A5, class A6> typename _Unique_if<T>::_Single_object 367 make_unique(A1&& a1, A1&& a2, A3&& a3, A4&& a4, A5&& a5, A6&& a6) 368 { 369 return unique_ptr<T>(new T(std::forward<A1>(a1), std::forward<A2>(a2), std::forward<A3>(a3), std::forward<A4>(a4), std::forward<A5>(a5), std::forward<A6>(a6))); 370 } 371 347 372 #endif 348 373
Note: See TracChangeset
for help on using the changeset viewer.