[JSC] Clean up StructureStubClearingWatchpoint
authoryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2018 04:24:19 +0000 (04:24 +0000)
committeryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2018 04:24:19 +0000 (04:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189156

Reviewed by Saam Barati.

Cleaning up StructureStubClearingWatchpoint by holding StructureStubClearingWatchpoint in Bag
in WatchpointsOnStructureStubInfo. This removes hacky linked list code for StructureStubClearingWatchpoint.

* bytecode/StructureStubClearingWatchpoint.cpp:
(JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
(JSC::StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint): Deleted.
(JSC::StructureStubClearingWatchpoint::push): Deleted.
(JSC::WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo): Deleted.
* bytecode/StructureStubClearingWatchpoint.h:
(JSC::StructureStubClearingWatchpoint::StructureStubClearingWatchpoint):

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp
Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h

index 829c8d2..7b8dbd5 100644 (file)
@@ -1,3 +1,21 @@
+2018-08-31  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
+
+        [JSC] Clean up StructureStubClearingWatchpoint
+        https://bugs.webkit.org/show_bug.cgi?id=189156
+
+        Reviewed by Saam Barati.
+
+        Cleaning up StructureStubClearingWatchpoint by holding StructureStubClearingWatchpoint in Bag
+        in WatchpointsOnStructureStubInfo. This removes hacky linked list code for StructureStubClearingWatchpoint.
+
+        * bytecode/StructureStubClearingWatchpoint.cpp:
+        (JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
+        (JSC::StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint): Deleted.
+        (JSC::StructureStubClearingWatchpoint::push): Deleted.
+        (JSC::WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo): Deleted.
+        * bytecode/StructureStubClearingWatchpoint.h:
+        (JSC::StructureStubClearingWatchpoint::StructureStubClearingWatchpoint):
+
 2018-09-06  Michael Saboff  <msaboff@apple.com>
 
         Improper speculation type for Math.pow(NaN, 0) in Abstract Interpreter
 2018-09-06  Michael Saboff  <msaboff@apple.com>
 
         Improper speculation type for Math.pow(NaN, 0) in Abstract Interpreter
index 7816357..648b1e8 100644 (file)
 
 namespace JSC {
 
 
 namespace JSC {
 
-StructureStubClearingWatchpoint::~StructureStubClearingWatchpoint()
-{
-    for (auto current = WTFMove(m_next); current; current = WTFMove(current->m_next)) { }
-}
-
-StructureStubClearingWatchpoint* StructureStubClearingWatchpoint::push(
-    const ObjectPropertyCondition& key,
-    WatchpointsOnStructureStubInfo& holder,
-    std::unique_ptr<StructureStubClearingWatchpoint>& head)
-{
-    head = std::make_unique<StructureStubClearingWatchpoint>(key, holder, WTFMove(head));
-    return head.get();
-}
-
 void StructureStubClearingWatchpoint::fireInternal(VM& vm, const FireDetail&)
 {
     if (!m_key || !m_key.isWatchable(PropertyCondition::EnsureWatchability)) {
 void StructureStubClearingWatchpoint::fireInternal(VM& vm, const FireDetail&)
 {
     if (!m_key || !m_key.isWatchable(PropertyCondition::EnsureWatchability)) {
@@ -68,13 +54,9 @@ void StructureStubClearingWatchpoint::fireInternal(VM& vm, const FireDetail&)
     m_key.object()->structure(vm)->addTransitionWatchpoint(this);
 }
 
     m_key.object()->structure(vm)->addTransitionWatchpoint(this);
 }
 
-WatchpointsOnStructureStubInfo::~WatchpointsOnStructureStubInfo()
-{
-}
-
 StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::addWatchpoint(const ObjectPropertyCondition& key)
 {
 StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::addWatchpoint(const ObjectPropertyCondition& key)
 {
-    return StructureStubClearingWatchpoint::push(key, *this, m_head);
+    return m_watchpoints.add(key, *this);
 }
 
 StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint(
 }
 
 StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint(
index 3c0a7fb..07e1f74 100644 (file)
@@ -30,6 +30,7 @@
 
 #if ENABLE(JIT)
 
 
 #if ENABLE(JIT)
 
+#include <wtf/Bag.h>
 #include <wtf/FastMalloc.h>
 #include <wtf/Noncopyable.h>
 
 #include <wtf/FastMalloc.h>
 #include <wtf/Noncopyable.h>
 
@@ -45,20 +46,11 @@ class StructureStubClearingWatchpoint : public Watchpoint {
 public:
     StructureStubClearingWatchpoint(
         const ObjectPropertyCondition& key,
 public:
     StructureStubClearingWatchpoint(
         const ObjectPropertyCondition& key,
-        WatchpointsOnStructureStubInfo& holder,
-        std::unique_ptr<StructureStubClearingWatchpoint> next)
+        WatchpointsOnStructureStubInfo& holder)
         : m_key(key)
         , m_holder(holder)
         : m_key(key)
         , m_holder(holder)
-        , m_next(WTFMove(next))
     {
     }
     {
     }
-    
-    virtual ~StructureStubClearingWatchpoint();
-    
-    static StructureStubClearingWatchpoint* push(
-        const ObjectPropertyCondition& key,
-        WatchpointsOnStructureStubInfo& holder,
-        std::unique_ptr<StructureStubClearingWatchpoint>& head);
 
 protected:
     void fireInternal(VM&, const FireDetail&) override;
 
 protected:
     void fireInternal(VM&, const FireDetail&) override;
@@ -66,7 +58,6 @@ protected:
 private:
     ObjectPropertyCondition m_key;
     WatchpointsOnStructureStubInfo& m_holder;
 private:
     ObjectPropertyCondition m_key;
     WatchpointsOnStructureStubInfo& m_holder;
-    std::unique_ptr<StructureStubClearingWatchpoint> m_next;
 };
 
 class WatchpointsOnStructureStubInfo {
 };
 
 class WatchpointsOnStructureStubInfo {
@@ -79,8 +70,6 @@ public:
     {
     }
     
     {
     }
     
-    ~WatchpointsOnStructureStubInfo();
-    
     StructureStubClearingWatchpoint* addWatchpoint(const ObjectPropertyCondition& key);
     
     static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint(
     StructureStubClearingWatchpoint* addWatchpoint(const ObjectPropertyCondition& key);
     
     static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint(
@@ -93,7 +82,7 @@ public:
 private:
     CodeBlock* m_codeBlock;
     StructureStubInfo* m_stubInfo;
 private:
     CodeBlock* m_codeBlock;
     StructureStubInfo* m_stubInfo;
-    std::unique_ptr<StructureStubClearingWatchpoint> m_head;
+    Bag<StructureStubClearingWatchpoint> m_watchpoints;
 };
 
 } // namespace JSC
 };
 
 } // namespace JSC