Title: [171153] branches/ftlopt/Source/_javascript_Core
Revision
171153
Author
[email protected]
Date
2014-07-16 14:33:05 -0700 (Wed, 16 Jul 2014)

Log Message

[ftlopt] Constant fold GetGetter and GetSetter if the GetterSetter is a constant
https://bugs.webkit.org/show_bug.cgi?id=134962

Reviewed by Oliver Hunt.
        
This removes yet another steady-state-throughput implication of using getters and setters:
if your accessor call is monomorphic then you'll just get a structure check, nothing more.
No more loads to get to the GetterSetter object or the accessor function object.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* runtime/GetterSetter.h:
(JSC::GetterSetter::getterConcurrently):
(JSC::GetterSetter::setGetter):
(JSC::GetterSetter::setterConcurrently):
(JSC::GetterSetter::setSetter):

Modified Paths

Diff

Modified: branches/ftlopt/Source/_javascript_Core/ChangeLog (171152 => 171153)


--- branches/ftlopt/Source/_javascript_Core/ChangeLog	2014-07-16 21:31:39 UTC (rev 171152)
+++ branches/ftlopt/Source/_javascript_Core/ChangeLog	2014-07-16 21:33:05 UTC (rev 171153)
@@ -1,5 +1,24 @@
 2014-07-15  Filip Pizlo  <[email protected]>
 
+        [ftlopt] Constant fold GetGetter and GetSetter if the GetterSetter is a constant
+        https://bugs.webkit.org/show_bug.cgi?id=134962
+
+        Reviewed by Oliver Hunt.
+        
+        This removes yet another steady-state-throughput implication of using getters and setters:
+        if your accessor call is monomorphic then you'll just get a structure check, nothing more.
+        No more loads to get to the GetterSetter object or the accessor function object.
+
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+        * runtime/GetterSetter.h:
+        (JSC::GetterSetter::getterConcurrently):
+        (JSC::GetterSetter::setGetter):
+        (JSC::GetterSetter::setterConcurrently):
+        (JSC::GetterSetter::setSetter):
+
+2014-07-15  Filip Pizlo  <[email protected]>
+
         [ftlopt] Identity replacement in CSE shouldn't create a Phantom over the Identity's children
         https://bugs.webkit.org/show_bug.cgi?id=134893
 

Modified: branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (171152 => 171153)


--- branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2014-07-16 21:31:39 UTC (rev 171152)
+++ branches/ftlopt/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h	2014-07-16 21:33:05 UTC (rev 171153)
@@ -1337,11 +1337,35 @@
         break;
         
     case GetCallee:
-    case GetGetter:
-    case GetSetter:
         forNode(node).setType(SpecFunction);
         break;
         
+    case GetGetter: {
+        JSValue base = forNode(node->child1()).m_value;
+        if (base) {
+            if (JSObject* getter = jsCast<GetterSetter*>(base)->getterConcurrently()) {
+                setConstant(node, *m_graph.freeze(getter));
+                break;
+            }
+        }
+        
+        forNode(node).setType(SpecObject);
+        break;
+    }
+        
+    case GetSetter: {
+        JSValue base = forNode(node->child1()).m_value;
+        if (base) {
+            if (JSObject* setter = jsCast<GetterSetter*>(base)->setterConcurrently()) {
+                setConstant(node, *m_graph.freeze(setter));
+                break;
+            }
+        }
+        
+        forNode(node).setType(SpecObject);
+        break;
+    }
+        
     case GetScope: // FIXME: We could get rid of these if we know that the JSFunction is a constant. https://bugs.webkit.org/show_bug.cgi?id=106202
     case GetMyScope:
     case SkipTopScope:

Modified: branches/ftlopt/Source/_javascript_Core/runtime/GetterSetter.h (171152 => 171153)


--- branches/ftlopt/Source/_javascript_Core/runtime/GetterSetter.h	2014-07-16 21:31:39 UTC (rev 171152)
+++ branches/ftlopt/Source/_javascript_Core/runtime/GetterSetter.h	2014-07-16 21:33:05 UTC (rev 171153)
@@ -61,21 +61,37 @@
 
         JSObject* getter() const { return m_getter.get(); }
         
+        JSObject* getterConcurrently() const
+        {
+            JSObject* result = getter();
+            WTF::loadLoadFence();
+            return result;
+        }
+        
         // Set the getter. It's only valid to call this if you've never set the getter on this
         // object.
         void setGetter(VM& vm, JSObject* getter)
         {
             RELEASE_ASSERT(!m_getter);
+            WTF::storeStoreFence();
             m_getter.setMayBeNull(vm, this, getter);
         }
         
         JSObject* setter() const { return m_setter.get(); }
         
+        JSObject* setterConcurrently() const
+        {
+            JSObject* result = setter();
+            WTF::loadLoadFence();
+            return result;
+        }
+        
         // Set the setter. It's only valid to call this if you've never set the setter on this
         // object.
         void setSetter(VM& vm, JSObject* setter)
         {
             RELEASE_ASSERT(!m_setter);
+            WTF::storeStoreFence();
             m_setter.setMayBeNull(vm, this, setter);
         }
         
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to