Title: [186705] trunk/Source/_javascript_Core
Revision
186705
Author
[email protected]
Date
2015-07-10 22:52:37 -0700 (Fri, 10 Jul 2015)

Log Message

Watchpoints should be allocated with FastMalloc
https://bugs.webkit.org/show_bug.cgi?id=146874

Reviewed by Dan Bernstein.
        
This is in preparation for adding new subclasses of Watchpoint. While starting to do this
I realized that the way Watchpoints allocated themselves was unusual.

* bytecode/CodeBlockJettisoningWatchpoint.h:
(JSC::CodeBlockJettisoningWatchpoint::CodeBlockJettisoningWatchpoint): No need for the default constructor.
* bytecode/Watchpoint.h:
(JSC::Watchpoint::Watchpoint): This should be noncopyable and fast-allocated.
* dfg/DFGCommonData.h: Use a Bag<> instead of SegmentedVector<>. Bag means "malloc things but allow me to free them all at once", which is what we are doing here.
* dfg/DFGDesiredWatchpoints.h:
(JSC::DFG::GenericDesiredWatchpoints::reallyAdd): Use the Bag<> API rather than the very awkward SegmentedVector<> API.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (186704 => 186705)


--- trunk/Source/_javascript_Core/ChangeLog	2015-07-11 03:45:19 UTC (rev 186704)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-07-11 05:52:37 UTC (rev 186705)
@@ -1,5 +1,23 @@
 2015-07-10  Filip Pizlo  <[email protected]>
 
+        Watchpoints should be allocated with FastMalloc
+        https://bugs.webkit.org/show_bug.cgi?id=146874
+
+        Reviewed by Dan Bernstein.
+        
+        This is in preparation for adding new subclasses of Watchpoint. While starting to do this
+        I realized that the way Watchpoints allocated themselves was unusual.
+
+        * bytecode/CodeBlockJettisoningWatchpoint.h:
+        (JSC::CodeBlockJettisoningWatchpoint::CodeBlockJettisoningWatchpoint): No need for the default constructor.
+        * bytecode/Watchpoint.h:
+        (JSC::Watchpoint::Watchpoint): This should be noncopyable and fast-allocated.
+        * dfg/DFGCommonData.h: Use a Bag<> instead of SegmentedVector<>. Bag means "malloc things but allow me to free them all at once", which is what we are doing here.
+        * dfg/DFGDesiredWatchpoints.h:
+        (JSC::DFG::GenericDesiredWatchpoints::reallyAdd): Use the Bag<> API rather than the very awkward SegmentedVector<> API.
+
+2015-07-10  Filip Pizlo  <[email protected]>
+
         AI folding of IsObjectOrNull is broken for non-object types that may be null
         https://bugs.webkit.org/show_bug.cgi?id=146867
 

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlockJettisoningWatchpoint.h (186704 => 186705)


--- trunk/Source/_javascript_Core/bytecode/CodeBlockJettisoningWatchpoint.h	2015-07-11 03:45:19 UTC (rev 186704)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlockJettisoningWatchpoint.h	2015-07-11 05:52:37 UTC (rev 186705)
@@ -34,11 +34,6 @@
 
 class CodeBlockJettisoningWatchpoint : public Watchpoint {
 public:
-    CodeBlockJettisoningWatchpoint()
-        : m_codeBlock(0)
-    {
-    }
-    
     CodeBlockJettisoningWatchpoint(CodeBlock* codeBlock)
         : m_codeBlock(codeBlock)
     {

Modified: trunk/Source/_javascript_Core/bytecode/Watchpoint.h (186704 => 186705)


--- trunk/Source/_javascript_Core/bytecode/Watchpoint.h	2015-07-11 03:45:19 UTC (rev 186704)
+++ trunk/Source/_javascript_Core/bytecode/Watchpoint.h	2015-07-11 05:52:37 UTC (rev 186705)
@@ -27,6 +27,8 @@
 #define Watchpoint_h
 
 #include <wtf/Atomics.h>
+#include <wtf/FastMalloc.h>
+#include <wtf/Noncopyable.h>
 #include <wtf/PrintStream.h>
 #include <wtf/SentinelLinkedList.h>
 #include <wtf/ThreadSafeRefCounted.h>
@@ -62,6 +64,8 @@
 };
 
 class Watchpoint : public BasicRawSentinelNode<Watchpoint> {
+    WTF_MAKE_NONCOPYABLE(Watchpoint);
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     Watchpoint()
     {

Modified: trunk/Source/_javascript_Core/dfg/DFGCommonData.h (186704 => 186705)


--- trunk/Source/_javascript_Core/dfg/DFGCommonData.h	2015-07-11 03:45:19 UTC (rev 186704)
+++ trunk/Source/_javascript_Core/dfg/DFGCommonData.h	2015-07-11 05:52:37 UTC (rev 186705)
@@ -97,7 +97,7 @@
     Vector<WeakReferenceTransition> transitions;
     Vector<WriteBarrier<JSCell>> weakReferences;
     Vector<WriteBarrier<Structure>> weakStructureReferences;
-    SegmentedVector<CodeBlockJettisoningWatchpoint, 1> watchpoints;
+    Bag<CodeBlockJettisoningWatchpoint> watchpoints;
     Vector<JumpReplacement> jumpReplacements;
     
     RefPtr<Profiler::Compilation> compilation;

Modified: trunk/Source/_javascript_Core/dfg/DFGDesiredWatchpoints.h (186704 => 186705)


--- trunk/Source/_javascript_Core/dfg/DFGDesiredWatchpoints.h	2015-07-11 03:45:19 UTC (rev 186704)
+++ trunk/Source/_javascript_Core/dfg/DFGDesiredWatchpoints.h	2015-07-11 05:52:37 UTC (rev 186705)
@@ -91,10 +91,8 @@
         
         typename HashSet<WatchpointSetType*>::iterator iter = m_sets.begin();
         typename HashSet<WatchpointSetType*>::iterator end = m_sets.end();
-        for (; iter != end; ++iter) {
-            common.watchpoints.append(CodeBlockJettisoningWatchpoint(codeBlock));
-            Adaptor::add(codeBlock, *iter, &common.watchpoints.last());
-        }
+        for (; iter != end; ++iter)
+            Adaptor::add(codeBlock, *iter, common.watchpoints.add(codeBlock));
         
         m_reallyAdded = true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to