FTL: Optimize IsString(@2<String>) -> JSConst(true) + Phantom()
https://bugs.webkit.org/show_bug.cgi?id=122363

Patch by Nadav Rotem <nrotem@apple.com> on 2013-10-07
Reviewed by Filip Pizlo.

* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@157059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 013d11b..1dca07b 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,13 @@
+2013-10-07  Nadav Rotem  <nrotem@apple.com>
+
+        FTL: Optimize IsString(@2<String>) -> JSConst(true) + Phantom()
+        https://bugs.webkit.org/show_bug.cgi?id=122363
+
+        Reviewed by Filip Pizlo.
+
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode):
+
 2013-10-04  Michael Saboff  <msaboff@apple.com>
 
         Transition stack check JITStubs to CCallHelper functions
diff --git a/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp b/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
index 499f56f..59128d4 100644
--- a/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
+++ b/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
@@ -884,8 +884,17 @@
         case Int52ToValue:
             RELEASE_ASSERT_NOT_REACHED();
             break;
-        
-#if !ASSERT_DISABLED    
+
+        case IsString:
+            if (node->child1()->shouldSpeculateString()) {
+                m_insertionSet.insertNode(m_indexInBlock, SpecNone, Phantom, node->codeOrigin,
+                    Edge(node->child1().node(), StringUse));
+                m_graph.convertToConstant(node, jsBoolean(true));
+                observeUseKindOnNode<StringUse>(node);
+            }
+            break;
+
+#if !ASSERT_DISABLED
         // Have these no-op cases here to ensure that nobody forgets to add handlers for new opcodes.
         case SetArgument:
         case JSConstant:
@@ -912,7 +921,6 @@
         case IsUndefined:
         case IsBoolean:
         case IsNumber:
-        case IsString:
         case IsObject:
         case IsFunction:
         case CreateActivation: