Final clean up OwnPtr in JSC - runtime, ftl, and tool directories
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Dec 2014 13:34:59 +0000 (13:34 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Dec 2014 13:34:59 +0000 (13:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139532

Reviewed by Mark Lam.

Final remove OwnPtr, PassOwnPtr in runtime, ftl, and tools directories of JSC.

* builtins/BuiltinExecutables.h:
* bytecode/CodeBlock.h:
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::generateFunctionCodeBlock):
* ftl/FTLAbstractHeap.cpp:
(JSC::FTL::IndexedAbstractHeap::atSlow):
* ftl/FTLAbstractHeap.h:
* ftl/FTLCompile.cpp:
(JSC::FTL::mmAllocateDataSection):
* ftl/FTLJITFinalizer.h:
* jsc.cpp:
(jscmain):
* parser/Lexer.h:
* runtime/PropertyMapHashTable.h:
(JSC::PropertyTable::clearDeletedOffsets):
(JSC::PropertyTable::addDeletedOffset):
* runtime/PropertyTable.cpp:
(JSC::PropertyTable::PropertyTable):
* runtime/RegExpObject.cpp:
* runtime/SmallStrings.cpp:
* runtime/Structure.cpp:
* runtime/StructureIDTable.cpp:
(JSC::StructureIDTable::StructureIDTable):
(JSC::StructureIDTable::resize):
* runtime/StructureIDTable.h:
* runtime/StructureTransitionTable.h:
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::~VM):
* runtime/VM.h:
* tools/CodeProfile.h:
(JSC::CodeProfile::CodeProfile):
(JSC::CodeProfile::addChild):

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

20 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/BuiltinExecutables.h
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
Source/JavaScriptCore/ftl/FTLAbstractHeap.cpp
Source/JavaScriptCore/ftl/FTLAbstractHeap.h
Source/JavaScriptCore/ftl/FTLCompile.cpp
Source/JavaScriptCore/ftl/FTLJITFinalizer.h
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/parser/Lexer.h
Source/JavaScriptCore/runtime/PropertyMapHashTable.h
Source/JavaScriptCore/runtime/PropertyTable.cpp
Source/JavaScriptCore/runtime/RegExpObject.cpp
Source/JavaScriptCore/runtime/SmallStrings.cpp
Source/JavaScriptCore/runtime/StructureIDTable.cpp
Source/JavaScriptCore/runtime/StructureIDTable.h
Source/JavaScriptCore/runtime/StructureTransitionTable.h
Source/JavaScriptCore/runtime/VM.cpp
Source/JavaScriptCore/runtime/VM.h
Source/JavaScriptCore/tools/CodeProfile.h

index cec120b..f0adeb1 100644 (file)
@@ -1,3 +1,46 @@
+2014-12-12  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Final clean up OwnPtr in JSC - runtime, ftl, and tool directories
+        https://bugs.webkit.org/show_bug.cgi?id=139532
+
+        Reviewed by Mark Lam.
+
+        Final remove OwnPtr, PassOwnPtr in runtime, ftl, and tools directories of JSC.
+
+        * builtins/BuiltinExecutables.h:
+        * bytecode/CodeBlock.h:
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::generateFunctionCodeBlock):
+        * ftl/FTLAbstractHeap.cpp:
+        (JSC::FTL::IndexedAbstractHeap::atSlow):
+        * ftl/FTLAbstractHeap.h:
+        * ftl/FTLCompile.cpp:
+        (JSC::FTL::mmAllocateDataSection):
+        * ftl/FTLJITFinalizer.h:
+        * jsc.cpp:
+        (jscmain):
+        * parser/Lexer.h:
+        * runtime/PropertyMapHashTable.h:
+        (JSC::PropertyTable::clearDeletedOffsets):
+        (JSC::PropertyTable::addDeletedOffset):
+        * runtime/PropertyTable.cpp:
+        (JSC::PropertyTable::PropertyTable):
+        * runtime/RegExpObject.cpp:
+        * runtime/SmallStrings.cpp:
+        * runtime/Structure.cpp:
+        * runtime/StructureIDTable.cpp:
+        (JSC::StructureIDTable::StructureIDTable):
+        (JSC::StructureIDTable::resize):
+        * runtime/StructureIDTable.h:
+        * runtime/StructureTransitionTable.h:
+        * runtime/VM.cpp:
+        (JSC::VM::VM):
+        (JSC::VM::~VM):
+        * runtime/VM.h:
+        * tools/CodeProfile.h:
+        (JSC::CodeProfile::CodeProfile):
+        (JSC::CodeProfile::addChild):
+
 2014-12-11  Dan Bernstein  <mitz@apple.com>
 
         iOS Simulator production build fix.
index 1f4b08f..b053a0e 100644 (file)
@@ -29,7 +29,6 @@
 #include "JSCBuiltins.h"
 #include "SourceCode.h"
 #include "Weak.h"
-#include <wtf/PassOwnPtr.h>
 
 namespace JSC {
 
index f978483..2767bd2 100644 (file)
@@ -70,7 +70,6 @@
 #include "Watchpoint.h"
 #include <wtf/Bag.h>
 #include <wtf/FastMalloc.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RefCountedArray.h>
 #include <wtf/RefPtr.h>
 #include <wtf/SegmentedVector.h>
index 1aee8eb..740a244 100644 (file)
@@ -62,7 +62,7 @@ static UnlinkedFunctionCodeBlock* generateFunctionCodeBlock(VM& vm, UnlinkedFunc
     executable->recordParse(function->features(), function->hasCapturedVariables());
     
     UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&vm, FunctionCode, ExecutableInfo(function->needsActivation(), function->usesEval(), function->isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction));
-    OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(vm, function.get(), result, debuggerMode, profilerMode)));
+    auto generator(std::make_unique<BytecodeGenerator>(vm, function.get(), result, debuggerMode, profilerMode));
     error = generator->generate();
     if (error.m_type != ParserError::ErrorNone)
         return 0;
index dfbbeb1..0037a7a 100644 (file)
@@ -102,7 +102,7 @@ const AbstractField& IndexedAbstractHeap::atSlow(ptrdiff_t index)
     ASSERT(static_cast<size_t>(index) >= m_smallIndices.size());
     
     if (UNLIKELY(!m_largeIndices))
-        m_largeIndices = adoptPtr(new MapType());
+        m_largeIndices = std::make_unique<MapType>();
 
     std::unique_ptr<AbstractField>& field = m_largeIndices->add(index, nullptr).iterator->value;
     if (!field) {
index 0731eed..eb163c1 100644 (file)
@@ -34,7 +34,6 @@
 #include <wtf/FastMalloc.h>
 #include <wtf/HashMap.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/CString.h>
 
@@ -183,7 +182,7 @@ private:
     };
     typedef HashMap<ptrdiff_t, std::unique_ptr<AbstractField>, WTF::IntHash<ptrdiff_t>, WithoutZeroOrOneHashTraits> MapType;
     
-    OwnPtr<MapType> m_largeIndices;
+    std::unique_ptr<MapType> m_largeIndices;
     Vector<CString, 16> m_largeIndexNames;
 };
 
index 8b28c9a..dc69943 100644 (file)
@@ -322,8 +322,8 @@ static void fixFunctionBasedOnStackMaps(
         RELEASE_ASSERT(state.finalizer->osrExit.size());
         RELEASE_ASSERT(didSeeUnwindInfo);
         
-        OwnPtr<LinkBuffer> linkBuffer = adoptPtr(new LinkBuffer(
-            vm, exitThunkGenerator, codeBlock, JITCompilationMustSucceed));
+        auto linkBuffer = std::make_unique<LinkBuffer>(
+            vm, exitThunkGenerator, codeBlock, JITCompilationMustSucceed);
         
         RELEASE_ASSERT(state.finalizer->osrExit.size() == state.jitCode->osrExit.size());
         
@@ -359,7 +359,7 @@ static void fixFunctionBasedOnStackMaps(
             }
         }
         
-        state.finalizer->exitThunksLinkBuffer = linkBuffer.release();
+        state.finalizer->exitThunksLinkBuffer = WTF::move(linkBuffer);
     }
 
     if (!state.getByIds.isEmpty() || !state.putByIds.isEmpty() || !state.checkIns.isEmpty()) {
@@ -483,8 +483,7 @@ static void fixFunctionBasedOnStackMaps(
         exceptionTarget.link(&slowPathJIT);
         MacroAssembler::Jump exceptionJump = slowPathJIT.jump();
         
-        state.finalizer->sideCodeLinkBuffer = adoptPtr(
-            new LinkBuffer(vm, slowPathJIT, codeBlock, JITCompilationMustSucceed));
+        state.finalizer->sideCodeLinkBuffer = std::make_unique<LinkBuffer>(vm, slowPathJIT, codeBlock, JITCompilationMustSucceed);
         state.finalizer->sideCodeLinkBuffer->link(
             exceptionJump, state.finalizer->handleExceptionsLinkBuffer->entrypoint());
         
index 4dffdaa..c0df579 100644 (file)
@@ -48,9 +48,9 @@ public:
     bool finalize() override;
     bool finalizeFunction() override;
 
-    OwnPtr<LinkBuffer> exitThunksLinkBuffer;
+    std::unique_ptr<LinkBuffer> exitThunksLinkBuffer;
     std::unique_ptr<LinkBuffer> entrypointLinkBuffer;
-    OwnPtr<LinkBuffer> sideCodeLinkBuffer;
+    std::unique_ptr<LinkBuffer> sideCodeLinkBuffer;
     std::unique_ptr<LinkBuffer> handleExceptionsLinkBuffer;
     Vector<SlowPathCall> slowPathCalls; // Calls inside the side code.
     Vector<OSRExitCompilationInfo> osrExit;
index 39cdcf4..506bd0c 100644 (file)
@@ -1451,7 +1451,7 @@ int jscmain(int argc, char** argv)
         JSLockHolder locker(vm);
 
         if (options.m_profile && !vm->m_perBytecodeProfiler)
-            vm->m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*vm));
+            vm->m_perBytecodeProfiler = std::make_unique<Profiler::Database>(*vm);
     
         GlobalObject* globalObject = GlobalObject::create(*vm, GlobalObject::createStructure(*vm, jsNull()), options.m_arguments);
         bool success = runWithScripts(globalObject, options.m_scripts, options.m_dump);
index 3fdd661..81b4334 100644 (file)
@@ -44,7 +44,9 @@ public:
     {
         return m_keywordTable.entry(ident);
     }
-    
+
+    explicit Keywords(VM&);
+
     ~Keywords()
     {
         m_keywordTable.deleteTable();
@@ -53,8 +55,6 @@ public:
 private:
     friend class VM;
     
-    explicit Keywords(VM&);
-    
     VM& m_vm;
     const HashTable m_keywordTable;
 };
index cabe554..d7334c0 100644 (file)
@@ -28,7 +28,6 @@
 #include <wtf/CryptographicallyRandomNumber.h>
 #include <wtf/HashTable.h>
 #include <wtf/MathExtras.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 #include <wtf/text/AtomicStringImpl.h>
 
@@ -243,7 +242,7 @@ private:
     unsigned* m_index;
     unsigned m_keyCount;
     unsigned m_deletedCount;
-    OwnPtr< Vector<PropertyOffset>> m_deletedOffsets;
+    std::unique_ptr<Vector<PropertyOffset>> m_deletedOffsets;
 
     static const unsigned MinimumTableSize = 16;
     static const unsigned EmptyEntryIndex = 0;
@@ -421,7 +420,7 @@ inline unsigned PropertyTable::propertyStorageSize() const
 
 inline void PropertyTable::clearDeletedOffsets()
 {
-    m_deletedOffsets.clear();
+    m_deletedOffsets = nullptr;
 }
 
 inline bool PropertyTable::hasDeletedOffset()
@@ -439,7 +438,7 @@ inline PropertyOffset PropertyTable::getDeletedOffset()
 inline void PropertyTable::addDeletedOffset(PropertyOffset offset)
 {
     if (!m_deletedOffsets)
-        m_deletedOffsets = adoptPtr(new Vector<PropertyOffset>);
+        m_deletedOffsets = std::make_unique<Vector<PropertyOffset>>();
     m_deletedOffsets->append(offset);
 }
 
index 570e5f9..74474c6 100644 (file)
@@ -88,7 +88,7 @@ PropertyTable::PropertyTable(VM& vm, const PropertyTable& other)
     // Copy the m_deletedOffsets vector.
     Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
     if (otherDeletedOffsets)
-        m_deletedOffsets = adoptPtr(new Vector<PropertyOffset>(*otherDeletedOffsets));
+        m_deletedOffsets = std::make_unique<Vector<PropertyOffset>>(*otherDeletedOffsets);
 }
 
 PropertyTable::PropertyTable(VM& vm, unsigned initialCapacity, const PropertyTable& other)
@@ -112,7 +112,7 @@ PropertyTable::PropertyTable(VM& vm, unsigned initialCapacity, const PropertyTab
     // Copy the m_deletedOffsets vector.
     Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
     if (otherDeletedOffsets)
-        m_deletedOffsets = adoptPtr(new Vector<PropertyOffset>(*otherDeletedOffsets));
+        m_deletedOffsets = std::make_unique<Vector<PropertyOffset>>(*otherDeletedOffsets);
 }
 
 void PropertyTable::destroy(JSCell* cell)
index 5f4e76e..4d9d0b2 100644 (file)
@@ -34,7 +34,6 @@
 #include "RegExpConstructor.h"
 #include "RegExpMatchesArray.h"
 #include "RegExpPrototype.h"
-#include <wtf/PassOwnPtr.h>
 #include <wtf/text/StringBuilder.h>
 
 namespace JSC {
index 1df9f63..43b2958 100644 (file)
@@ -31,7 +31,6 @@
 #include "JSString.h"
 #include "JSCInlines.h"
 #include <wtf/Noncopyable.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/text/StringImpl.h>
 
 namespace JSC {
index 57acd29..8aa89b0 100644 (file)
 #include <limits.h>
 #include <wtf/Atomics.h>
 #include <wtf/DataLog.h>
-#include <wtf/PassOwnPtr.h>
 
 namespace JSC {
 
 StructureIDTable::StructureIDTable()
     : m_firstFreeOffset(0)
-    , m_table(adoptPtr(new StructureOrOffset[s_initialSize]))
+    , m_table(std::make_unique<StructureOrOffset[]>(s_initialSize))
     , m_size(0)
     , m_capacity(s_initialSize)
 {
@@ -47,7 +46,7 @@ StructureIDTable::StructureIDTable()
 void StructureIDTable::resize(size_t newCapacity)
 {
     // Create the new table.
-    OwnPtr<StructureOrOffset> newTable = adoptPtr(new StructureOrOffset[newCapacity]);
+    auto newTable = std::make_unique<StructureOrOffset[]>(newCapacity);
 
     // Copy the contents of the old table to the new table.
     memcpy(newTable.get(), table(), m_capacity * sizeof(StructureOrOffset));
@@ -59,7 +58,7 @@ void StructureIDTable::resize(size_t newCapacity)
     swap(m_table, newTable);
 
     // Put the old table (now labeled as new) into the list of old tables.
-    m_oldTables.append(newTable.release());
+    m_oldTables.append(WTF::move(newTable));
 
     // Update the capacity.
     m_capacity = newCapacity;
index cfac3ad..630333f 100644 (file)
@@ -27,7 +27,6 @@
 #define StructureIDTable_h
 
 #include "UnusedPointer.h"
-#include <wtf/OwnPtr.h>
 #include <wtf/Vector.h>
 
 namespace JSC {
@@ -67,10 +66,10 @@ private:
     
     static const size_t s_initialSize = 256;
 
-    Vector<OwnPtr<StructureOrOffset>> m_oldTables;
+    Vector<std::unique_ptr<StructureOrOffset[]>> m_oldTables;
 
     uint32_t m_firstFreeOffset;
-    OwnPtr<StructureOrOffset> m_table;
+    std::unique_ptr<StructureOrOffset[]> m_table;
 
     size_t m_size;
     size_t m_capacity;
index 130efda..23c6ca3 100644 (file)
@@ -29,7 +29,6 @@
 #include "IndexingType.h"
 #include "WeakGCMap.h"
 #include <wtf/HashFunctions.h>
-#include <wtf/OwnPtr.h>
 #include <wtf/text/AtomicStringImpl.h>
 
 namespace JSC {
index ba0e0b4..7a88344 100644 (file)
@@ -153,7 +153,7 @@ VM::VM(VMType vmType, HeapType heapType)
     , m_atomicStringTable(vmType == Default ? wtfThreadData().atomicStringTable() : new AtomicStringTable)
     , propertyNames(nullptr)
     , emptyList(new MarkedArgumentBuffer)
-    , keywords(adoptPtr(new Keywords(*this)))
+    , keywords(std::make_unique<Keywords>(*this))
     , interpreter(0)
     , jsArrayClassInfo(JSArray::info())
     , jsFinalObjectClassInfo(JSFinalObject::info())
@@ -241,7 +241,7 @@ VM::VM(VMType vmType, HeapType heapType)
     wtfThreadData().setCurrentAtomicStringTable(existingEntryAtomicStringTable);
 
 #if ENABLE(JIT)
-    jitStubs = adoptPtr(new JITThunks());
+    jitStubs = std::make_unique<JITThunks>();
     arityCheckFailReturnThunks = std::make_unique<ArityCheckFailReturnThunks>();
 #endif
     arityCheckData = std::make_unique<CommonSlowPaths::ArityCheckData>();
@@ -261,7 +261,7 @@ VM::VM(VMType vmType, HeapType heapType)
     LLInt::Data::performAssertions(*this);
     
     if (Options::enableProfiler()) {
-        m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*this));
+        m_perBytecodeProfiler = std::make_unique<Profiler::Database>(*this);
 
         StringPrintStream pathOut;
         const char* profilerPath = getenv("JSC_PROFILER_PATH");
@@ -273,7 +273,7 @@ VM::VM(VMType vmType, HeapType heapType)
 
 #if ENABLE(DFG_JIT)
     if (canUseJIT())
-        dfgState = adoptPtr(new DFG::LongLivedState());
+        dfgState = std::make_unique<DFG::LongLivedState>();
 #endif
     
     // Initialize this last, as a free way of asserting that VM initialization itself
@@ -303,8 +303,8 @@ VM::~VM()
 #endif // ENABLE(DFG_JIT)
     
     // Clear this first to ensure that nobody tries to remove themselves from it.
-    m_perBytecodeProfiler.clear();
-    
+    m_perBytecodeProfiler = nullptr;
+
     ASSERT(m_apiLock->currentThreadIsHoldingLock());
     m_apiLock->willDestroyVM(this);
     heap.lastChanceToFinalize();
index c118b9b..f884282 100644 (file)
@@ -235,7 +235,7 @@ public:
     Heap heap;
 
 #if ENABLE(DFG_JIT)
-    OwnPtr<DFG::LongLivedState> dfgState;
+    std::unique_ptr<DFG::LongLivedState> dfgState;
 #endif // ENABLE(DFG_JIT)
 
     std::unique_ptr<CallEdgeLog> callEdgeLog;
@@ -328,10 +328,10 @@ public:
 
     typedef HashMap<RefPtr<SourceProvider>, RefPtr<SourceProviderCache>> SourceProviderCacheMap;
     SourceProviderCacheMap sourceProviderCacheMap;
-    OwnPtr<Keywords> keywords;
+    std::unique_ptr<Keywords> keywords;
     Interpreter* interpreter;
 #if ENABLE(JIT)
-    OwnPtr<JITThunks> jitStubs;
+    std::unique_ptr<JITThunks> jitStubs;
     MacroAssemblerCodeRef getCTIStub(ThunkGenerator generator)
     {
         return jitStubs->ctiStub(this, generator);
@@ -458,7 +458,7 @@ public:
     String cachedDateString;
     double cachedDateStringValue;
 
-    OwnPtr<Profiler::Database> m_perBytecodeProfiler;
+    std::unique_ptr<Profiler::Database> m_perBytecodeProfiler;
     RefPtr<TypedArrayController> m_typedArrayController;
     RegExpCache* m_regExpCache;
     BumpPointerAllocator m_regExpAllocator;
index 6b0a306..0c6d684 100644 (file)
@@ -41,7 +41,7 @@ public:
         , m_parent(parent)
     {
         if (parent)
-            parent->addChild(this);
+            parent->addChild(std::unique_ptr<CodeProfile>(this));
     }
 
     void sample(void* pc, void** framePointer);
@@ -52,9 +52,9 @@ public:
         return m_parent;
     }
     
-    void addChild(CodeProfile* child)
+    void addChild(std::unique_ptr<CodeProfile> child)
     {
-        m_children.append(adoptPtr(child));
+        m_children.append(WTF::move(child));
     }
 
 private:
@@ -82,7 +82,7 @@ private:
     CString m_file;
     unsigned m_lineNo;
     CodeProfile* m_parent;
-    Vector< OwnPtr<CodeProfile>> m_children;
+    Vector<std::unique_ptr<CodeProfile>> m_children;
     TieredMMapArray<CodeRecord> m_samples;
 
     static const char* s_codeTypeNames[NumberOfCodeTypes];