DFG should inline code blocks that use scoped variable access
[WebKit-https.git] / Source / JavaScriptCore / dfg / DFGAbstractState.cpp
index a1dc064a1a97b02fd79f634b75343d2a9826b989..772f97f6dc5c71056dc34a719f2fc389f8c699a6 100644 (file)
@@ -1385,11 +1385,21 @@ bool AbstractState::execute(unsigned indexInBlock)
             
     case GetMyScope:
     case SkipTopScope:
-    case SkipScope:
         node.setCanExit(false);
         forNode(nodeIndex).set(SpecCellOther);
         break;
 
+    case SkipScope: {
+        node.setCanExit(false);
+        JSValue child = forNode(node.child1()).value();
+        if (child && trySetConstant(nodeIndex, JSValue(jsCast<JSScope*>(child.asCell())->next()))) {
+            m_foundConstants = true;
+            break;
+        }
+        forNode(nodeIndex).set(SpecCellOther);
+        break;
+    }
+
     case GetScopeRegisters:
         node.setCanExit(false);
         forNode(node.child1()).filter(SpecCell);