Title: [189328] trunk/Source/_javascript_Core
Revision
189328
Author
[email protected]
Date
2015-09-03 18:20:55 -0700 (Thu, 03 Sep 2015)

Log Message

WatchpointsOnStructureStubInfo doesn't need to be reference counted
https://bugs.webkit.org/show_bug.cgi?id=148766

Reviewed by Saam Barati.

It doesn't need to be reference counted because the only RefPtr to it is in
StructureStubInfo. Therefore, it can be a unique_ptr.

* bytecode/StructureStubClearingWatchpoint.cpp:
(JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
(JSC::WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint):
* bytecode/StructureStubClearingWatchpoint.h:
(JSC::WatchpointsOnStructureStubInfo::WatchpointsOnStructureStubInfo):
(JSC::WatchpointsOnStructureStubInfo::codeBlock):
* bytecode/StructureStubInfo.h:
(JSC::getStructureStubInfoCodeOrigin):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (189327 => 189328)


--- trunk/Source/_javascript_Core/ChangeLog	2015-09-04 00:48:26 UTC (rev 189327)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-09-04 01:20:55 UTC (rev 189328)
@@ -1,3 +1,22 @@
+2015-09-03  Filip Pizlo  <[email protected]>
+
+        WatchpointsOnStructureStubInfo doesn't need to be reference counted
+        https://bugs.webkit.org/show_bug.cgi?id=148766
+
+        Reviewed by Saam Barati.
+
+        It doesn't need to be reference counted because the only RefPtr to it is in
+        StructureStubInfo. Therefore, it can be a unique_ptr.
+
+        * bytecode/StructureStubClearingWatchpoint.cpp:
+        (JSC::WatchpointsOnStructureStubInfo::addWatchpoint):
+        (JSC::WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint):
+        * bytecode/StructureStubClearingWatchpoint.h:
+        (JSC::WatchpointsOnStructureStubInfo::WatchpointsOnStructureStubInfo):
+        (JSC::WatchpointsOnStructureStubInfo::codeBlock):
+        * bytecode/StructureStubInfo.h:
+        (JSC::getStructureStubInfoCodeOrigin):
+
 2015-09-03  Basile Clement  <[email protected]>
 
         _javascript_ functions should restore the stack pointer after a call

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubClearingWatchpoint.cpp (189327 => 189328)


--- trunk/Source/_javascript_Core/bytecode/StructureStubClearingWatchpoint.cpp	2015-09-04 00:48:26 UTC (rev 189327)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubClearingWatchpoint.cpp	2015-09-04 01:20:55 UTC (rev 189328)
@@ -76,11 +76,11 @@
 }
 
 StructureStubClearingWatchpoint* WatchpointsOnStructureStubInfo::ensureReferenceAndAddWatchpoint(
-    RefPtr<WatchpointsOnStructureStubInfo>& holderRef, CodeBlock* codeBlock,
+    std::unique_ptr<WatchpointsOnStructureStubInfo>& holderRef, CodeBlock* codeBlock,
     StructureStubInfo* stubInfo, const ObjectPropertyCondition& key)
 {
     if (!holderRef)
-        holderRef = adoptRef(new WatchpointsOnStructureStubInfo(codeBlock, stubInfo));
+        holderRef = std::make_unique<WatchpointsOnStructureStubInfo>(codeBlock, stubInfo);
     else {
         ASSERT(holderRef->m_codeBlock == codeBlock);
         ASSERT(holderRef->m_stubInfo == stubInfo);

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubClearingWatchpoint.h (189327 => 189328)


--- trunk/Source/_javascript_Core/bytecode/StructureStubClearingWatchpoint.h	2015-09-04 00:48:26 UTC (rev 189327)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubClearingWatchpoint.h	2015-09-04 01:20:55 UTC (rev 189328)
@@ -33,8 +33,6 @@
 
 #include <wtf/FastMalloc.h>
 #include <wtf/Noncopyable.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
 
 namespace JSC {
 
@@ -72,7 +70,9 @@
     std::unique_ptr<StructureStubClearingWatchpoint> m_next;
 };
 
-class WatchpointsOnStructureStubInfo : public RefCounted<WatchpointsOnStructureStubInfo> {
+class WatchpointsOnStructureStubInfo {
+    WTF_MAKE_NONCOPYABLE(WatchpointsOnStructureStubInfo);
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     WatchpointsOnStructureStubInfo(CodeBlock* codeBlock, StructureStubInfo* stubInfo)
         : m_codeBlock(codeBlock)
@@ -85,7 +85,7 @@
     StructureStubClearingWatchpoint* addWatchpoint(const ObjectPropertyCondition& key);
     
     static StructureStubClearingWatchpoint* ensureReferenceAndAddWatchpoint(
-        RefPtr<WatchpointsOnStructureStubInfo>& holderRef,
+        std::unique_ptr<WatchpointsOnStructureStubInfo>& holderRef,
         CodeBlock*, StructureStubInfo*, const ObjectPropertyCondition& key);
     
     CodeBlock* codeBlock() const { return m_codeBlock; }

Modified: trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h (189327 => 189328)


--- trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h	2015-09-04 00:48:26 UTC (rev 189327)
+++ trunk/Source/_javascript_Core/bytecode/StructureStubInfo.h	2015-09-04 01:20:55 UTC (rev 189328)
@@ -230,7 +230,7 @@
 
     RefPtr<JITStubRoutine> stubRoutine;
     CodeLocationCall callReturnLocation;
-    RefPtr<WatchpointsOnStructureStubInfo> watchpoints;
+    std::unique_ptr<WatchpointsOnStructureStubInfo> watchpoints;
 };
 
 inline CodeOrigin getStructureStubInfoCodeOrigin(StructureStubInfo& structureStubInfo)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to