Title: [226956] trunk
Revision
226956
Author
[email protected]
Date
2018-01-15 14:02:45 -0800 (Mon, 15 Jan 2018)

Log Message

Remove makePoisonedUnique
https://bugs.webkit.org/show_bug.cgi?id=181630
<rdar://problem/36498623>

Reviewed by Mark Lam.

Source/_javascript_Core:

I added a conversion from std::unique_ptr, so we can just use
std::make_unique and it'll auto-poison when converted.

* bytecode/CodeBlock.h:
(JSC::CodeBlock::makePoisonedUnique): Deleted.
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::makePoisonedUnique): Deleted.

Source/WTF:

I added a conversion from std::unique_ptr, so we can just use
std::make_unique and it'll auto-poison when converted.

* wtf/PoisonedUniquePtr.h:
(WTF::makePoisonedUnique): Deleted.

Tools:

Update tests.

* TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (226955 => 226956)


--- trunk/Source/_javascript_Core/ChangeLog	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-01-15 22:02:45 UTC (rev 226956)
@@ -1,3 +1,21 @@
+2018-01-15  JF Bastien  <[email protected]>
+
+        Remove makePoisonedUnique
+        https://bugs.webkit.org/show_bug.cgi?id=181630
+        <rdar://problem/36498623>
+
+        Reviewed by Mark Lam.
+
+        I added a conversion from std::unique_ptr, so we can just use
+        std::make_unique and it'll auto-poison when converted.
+
+        * bytecode/CodeBlock.h:
+        (JSC::CodeBlock::makePoisonedUnique): Deleted.
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::makePoisonedUnique): Deleted.
+
 2018-01-15  Michael Catanzaro  <[email protected]>
 
         REGRESSION(r226266): [GTK] RELEASE_ASSERT(reservedZoneSize >= minimumReservedZoneSize) in JSC::VM::updateStackLimits

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (226955 => 226956)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2018-01-15 22:02:45 UTC (rev 226956)
@@ -946,12 +946,6 @@
     void insertBasicBlockBoundariesForControlFlowProfiler(RefCountedArray<Instruction>&);
     void ensureCatchLivenessIsComputedForBytecodeOffsetSlow(unsigned);
 
-    template<typename T, typename... Arguments, typename Enable = void>
-    static PoisonedUniquePtr<POISON(CodeBlock), T> makePoisonedUnique(Arguments&&... arguments)
-    {
-        return WTF::makePoisonedUnique<POISON(CodeBlock), T>(std::forward<Arguments>(arguments)...);
-    }
-
     WriteBarrier<UnlinkedCodeBlock> m_unlinkedCode;
     int m_numParameters;
     int m_numberOfArgumentsToSkip { 0 };

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (226955 => 226956)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp	2018-01-15 22:02:45 UTC (rev 226956)
@@ -401,8 +401,8 @@
     m_debugger = 0;
 
 #if ENABLE(REMOTE_INSPECTOR)
-    m_inspectorController = makePoisonedUnique<Inspector::JSGlobalObjectInspectorController>(*this);
-    m_inspectorDebuggable = makePoisonedUnique<JSGlobalObjectDebuggable>(*this);
+    m_inspectorController = std::make_unique<Inspector::JSGlobalObjectInspectorController>(*this);
+    m_inspectorDebuggable = std::make_unique<JSGlobalObjectDebuggable>(*this);
     m_inspectorDebuggable->init();
     m_consoleClient = m_inspectorController->consoleClient();
 #endif
@@ -1011,63 +1011,63 @@
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(arrayIteratorPrototype, m_vm.propertyNames->next);
-            m_arrayIteratorPrototypeNext = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_arrayIteratorProtocolWatchpoint);
+            m_arrayIteratorPrototypeNext = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_arrayIteratorProtocolWatchpoint);
             m_arrayIteratorPrototypeNext->install();
         }
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(this->arrayPrototype(), m_vm.propertyNames->iteratorSymbol);
-            m_arrayPrototypeSymbolIteratorWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_arrayIteratorProtocolWatchpoint);
+            m_arrayPrototypeSymbolIteratorWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_arrayIteratorProtocolWatchpoint);
             m_arrayPrototypeSymbolIteratorWatchpoint->install();
         }
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(mapIteratorPrototype, m_vm.propertyNames->next);
-            m_mapIteratorPrototypeNextWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_mapIteratorProtocolWatchpoint);
+            m_mapIteratorPrototypeNextWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_mapIteratorProtocolWatchpoint);
             m_mapIteratorPrototypeNextWatchpoint->install();
         }
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_mapPrototype.get(), m_vm.propertyNames->iteratorSymbol);
-            m_mapPrototypeSymbolIteratorWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_mapIteratorProtocolWatchpoint);
+            m_mapPrototypeSymbolIteratorWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_mapIteratorProtocolWatchpoint);
             m_mapPrototypeSymbolIteratorWatchpoint->install();
         }
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(setIteratorPrototype, m_vm.propertyNames->next);
-            m_setIteratorPrototypeNextWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_setIteratorProtocolWatchpoint);
+            m_setIteratorPrototypeNextWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_setIteratorProtocolWatchpoint);
             m_setIteratorPrototypeNextWatchpoint->install();
         }
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_setPrototype.get(), m_vm.propertyNames->iteratorSymbol);
-            m_setPrototypeSymbolIteratorWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_setIteratorProtocolWatchpoint);
+            m_setPrototypeSymbolIteratorWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_setIteratorProtocolWatchpoint);
             m_setPrototypeSymbolIteratorWatchpoint->install();
         }
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_stringIteratorPrototype.get(), m_vm.propertyNames->next);
-            m_stringIteratorPrototypeNextWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_stringIteratorProtocolWatchpoint);
+            m_stringIteratorPrototypeNextWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_stringIteratorProtocolWatchpoint);
             m_stringIteratorPrototypeNextWatchpoint->install();
         }
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_stringPrototype.get(), m_vm.propertyNames->iteratorSymbol);
-            m_stringPrototypeSymbolIteratorWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_stringIteratorProtocolWatchpoint);
+            m_stringPrototypeSymbolIteratorWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_stringIteratorProtocolWatchpoint);
             m_stringPrototypeSymbolIteratorWatchpoint->install();
         }
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_mapPrototype.get(), m_vm.propertyNames->set);
-            m_mapPrototypeSetWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_mapSetWatchpoint);
+            m_mapPrototypeSetWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_mapSetWatchpoint);
             m_mapPrototypeSetWatchpoint->install();
         }
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(m_setPrototype.get(), m_vm.propertyNames->add);
-            m_setPrototypeAddWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_setAddWatchpoint);
+            m_setPrototypeAddWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_setAddWatchpoint);
             m_setPrototypeAddWatchpoint->install();
         }
 
         {
             ObjectPropertyCondition condition = setupAdaptiveWatchpoint(numberPrototype(), m_vm.propertyNames->toString);
-            m_numberPrototypeToStringWatchpoint = makePoisonedUnique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_numberToStringWatchpoint);
+            m_numberPrototypeToStringWatchpoint = std::make_unique<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>>(vm, condition, m_numberToStringWatchpoint);
             m_numberPrototypeToStringWatchpoint->install();
             m_numberProtoToStringFunction.set(vm, this, jsCast<JSFunction*>(numberPrototype()->getDirect(vm, vm.propertyNames->toString)));
         }

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (226955 => 226956)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2018-01-15 22:02:45 UTC (rev 226956)
@@ -920,12 +920,6 @@
 
     JS_EXPORT_PRIVATE static void clearRareData(JSCell*);
 
-    template<typename T, typename... Arguments, typename Enable = void>
-    static JSGlobalObject::PoisonedUniquePtr<T> makePoisonedUnique(Arguments&&... arguments)
-    {
-        return WTF::makePoisonedUnique<POISON(JSGlobalObject), T>(std::forward<Arguments>(arguments)...);
-    }
-
     bool m_needsSiteSpecificQuirks { false };
 #if JSC_OBJC_API_ENABLED
     RetainPtr<JSWrapperMap> m_wrapperMap;

Modified: trunk/Source/WTF/ChangeLog (226955 => 226956)


--- trunk/Source/WTF/ChangeLog	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Source/WTF/ChangeLog	2018-01-15 22:02:45 UTC (rev 226956)
@@ -1,3 +1,17 @@
+2018-01-15  JF Bastien  <[email protected]>
+
+        Remove makePoisonedUnique
+        https://bugs.webkit.org/show_bug.cgi?id=181630
+        <rdar://problem/36498623>
+
+        Reviewed by Mark Lam.
+
+        I added a conversion from std::unique_ptr, so we can just use
+        std::make_unique and it'll auto-poison when converted.
+
+        * wtf/PoisonedUniquePtr.h:
+        (WTF::makePoisonedUnique): Deleted.
+
 2018-01-13  Mark Lam  <[email protected]>
 
         Replace all use of ConstExprPoisoned with Poisoned.

Modified: trunk/Source/WTF/wtf/PoisonedUniquePtr.h (226955 => 226956)


--- trunk/Source/WTF/wtf/PoisonedUniquePtr.h	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Source/WTF/wtf/PoisonedUniquePtr.h	2018-01-15 22:02:45 UTC (rev 226956)
@@ -128,12 +128,6 @@
     template<uintptr_t&, typename, typename> friend class PoisonedUniquePtr;
 };
 
-template<uintptr_t& key, typename T, typename... Arguments, typename Enable = void>
-PoisonedUniquePtr<key, T> makePoisonedUnique(Arguments&&... arguments)
-{
-    return PoisonedUniquePtr<key, T>::create(std::forward<Arguments>(arguments)...);
-}
-
 template<uintptr_t& key, typename T>
 class PoisonedUniquePtr<key, T[]> : public Poisoned<key, T*> {
     WTF_MAKE_FAST_ALLOCATED;
@@ -220,14 +214,7 @@
     template<uintptr_t&, typename, typename> friend class PoisonedUniquePtr;
 };
 
-template<uintptr_t& key, typename T, typename... Arguments>
-PoisonedUniquePtr<key, T[]> makePoisonedUnique(size_t count, Arguments&&... arguments)
-{
-    return PoisonedUniquePtr<key, T[]>::create(count, std::forward<Arguments>(arguments)...);
-}
-
 } // namespace WTF
 
 using WTF::PoisonedUniquePtr;
-using WTF::makePoisonedUnique;
 

Modified: trunk/Tools/ChangeLog (226955 => 226956)


--- trunk/Tools/ChangeLog	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Tools/ChangeLog	2018-01-15 22:02:45 UTC (rev 226956)
@@ -1,3 +1,18 @@
+2018-01-15  JF Bastien  <[email protected]>
+
+        Remove makePoisonedUnique
+        https://bugs.webkit.org/show_bug.cgi?id=181630
+        <rdar://problem/36498623>
+
+        Reviewed by Mark Lam.
+
+        Update tests.
+
+        * TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp:
+        (TestWebKitAPI::TEST):
+
 2018-01-15  Adrian Perez de Castro  <[email protected]>
 
         [GTK][JHBuild] Tools/gtk/install-dependencies: Package libxfont does not exist anymore in Arch Linux

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp (226955 => 226956)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp	2018-01-15 22:02:45 UTC (rev 226956)
@@ -165,7 +165,7 @@
         int aDestructCount = 0;
         const char* aName = "a";
         {
-            PoisonedUniquePtr<g_poisonA, Logger> ptr = makePoisonedUnique<g_poisonA, Logger>(aName, aDestructCount);
+            PoisonedUniquePtr<g_poisonA, Logger> ptr = std::make_unique<Logger>(aName, aDestructCount);
             ASSERT_EQ(0, aDestructCount);
             ASSERT_TRUE(nullptr != ptr.unpoisoned());
             ASSERT_EQ(aName, &ptr->name);
@@ -175,7 +175,7 @@
         int bDestructCount = 0;
         const char* bName = "b";
         {
-            PoisonedUniquePtr<g_poisonA, Logger> ptr = makePoisonedUnique<g_poisonA, DerivedLogger>(bName, bDestructCount);
+            PoisonedUniquePtr<g_poisonA, Logger> ptr = std::make_unique<DerivedLogger>(bName, bDestructCount);
             ASSERT_EQ(0, bDestructCount);
             ASSERT_TRUE(nullptr != ptr.unpoisoned());
             ASSERT_EQ(bName, &ptr->name);

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp (226955 => 226956)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp	2018-01-15 21:24:54 UTC (rev 226955)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp	2018-01-15 22:02:45 UTC (rev 226956)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -133,32 +133,6 @@
 
     {
         int aDestructCount = 0;
-        const char* aName = "a";
-        {
-            PoisonedUniquePtr<g_poisonA, Logger[]> ptr = makePoisonedUnique<g_poisonA, Logger[]>(arraySize, aName, aDestructCount);
-            ASSERT_EQ(0, aDestructCount);
-            ASSERT_TRUE(nullptr != ptr.unpoisoned());
-            for (auto i = 0; i < arraySize; ++i)
-                ASSERT_EQ(aName, ptr[i].name);
-        }
-        ASSERT_EQ(arraySize, aDestructCount);
-    }
-
-    {
-        int aDestructCount = 0;
-        const char* aName = "a";
-        {
-            PoisonedUniquePtr<g_poisonA, Logger[]> ptr = makePoisonedUnique<g_poisonA, Logger[]>(arraySize, aName, aDestructCount);
-            ASSERT_EQ(0, aDestructCount);
-            ASSERT_TRUE(nullptr != ptr.unpoisoned());
-            for (auto i = 0; i < arraySize; ++i)
-                ASSERT_EQ(aName, ptr[i].name);
-        }
-        ASSERT_EQ(arraySize, aDestructCount);
-    }
-
-    {
-        int aDestructCount = 0;
         int bDestructCount = 0;
         Logger* a = makeArray<Logger>(arraySize, "a", aDestructCount);
         Logger* b = makeArray<Logger>(arraySize, "b", bDestructCount);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to