Title: [127643] trunk/Source/_javascript_Core
Revision
127643
Author
[email protected]
Date
2012-09-05 13:50:22 -0700 (Wed, 05 Sep 2012)

Log Message

Refactored callee access in the DFG to support it in the general case
https://bugs.webkit.org/show_bug.cgi?id=95887

Reviewed by Phil Pizlo and Gavin Barraclough.

To support named function expressions, the DFG needs to understand the
callee register being used in arbitrary expressions, and not just
create_this.

* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::getDirect): 
(JSC::DFG::ByteCodeParser::getCallee): Remap access to the callee register
into a GetCallee node. Otherwise, we get confused and think we have a
negatively indexed argument.

(ByteCodeParser):
(JSC::DFG::ByteCodeParser::InlineStackEntry::remapOperand): Inlining also
needs to remap, but to the callee in the inline frame, and not the caller's
callee.

(JSC::DFG::ByteCodeParser::parseBlock): Since we support the callee in
the general case now, there's no need to handle it in a special way for
create_this.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (127642 => 127643)


--- trunk/Source/_javascript_Core/ChangeLog	2012-09-05 20:48:23 UTC (rev 127642)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-09-05 20:50:22 UTC (rev 127643)
@@ -1,3 +1,29 @@
+2012-09-05  Geoffrey Garen  <[email protected]>
+
+        Refactored callee access in the DFG to support it in the general case
+        https://bugs.webkit.org/show_bug.cgi?id=95887
+
+        Reviewed by Phil Pizlo and Gavin Barraclough.
+
+        To support named function expressions, the DFG needs to understand the
+        callee register being used in arbitrary expressions, and not just
+        create_this.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::getDirect): 
+        (JSC::DFG::ByteCodeParser::getCallee): Remap access to the callee register
+        into a GetCallee node. Otherwise, we get confused and think we have a
+        negatively indexed argument.
+
+        (ByteCodeParser):
+        (JSC::DFG::ByteCodeParser::InlineStackEntry::remapOperand): Inlining also
+        needs to remap, but to the callee in the inline frame, and not the caller's
+        callee.
+
+        (JSC::DFG::ByteCodeParser::parseBlock): Since we support the callee in
+        the general case now, there's no need to handle it in a special way for
+        create_this.
+
 2012-09-05  Mark Hahnenberg  <[email protected]>
 
         Remove use of JSCell::classInfoOffset() from virtualForThunkGenerator

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (127642 => 127643)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-09-05 20:48:23 UTC (rev 127642)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-09-05 20:50:22 UTC (rev 127643)
@@ -142,6 +142,9 @@
             return getJSConstant(constant);
         }
 
+        if (operand == RegisterFile::Callee)
+            return getCallee();
+
         // Is this an argument?
         if (operandIsArgument(operand))
             return getArgument(operand);
@@ -521,6 +524,11 @@
         return resultIndex;
     }
 
+    NodeIndex getCallee()
+    {
+        return addToGraph(GetCallee);
+    }
+
     // Helper functions to get/set the this value.
     NodeIndex getThis()
     {
@@ -1126,7 +1134,10 @@
                 ASSERT(result >= FirstConstantRegisterIndex);
                 return result;
             }
-            
+
+            if (operand == RegisterFile::Callee)
+                return m_calleeVR;
+
             return operand + m_inlineCallFrame->stackOffset;
         }
     };
@@ -1835,10 +1846,7 @@
         }
 
         case op_create_this: {
-            if (m_inlineStackTop->m_inlineCallFrame)
-                set(currentInstruction[1].u.operand, addToGraph(CreateThis, getDirect(m_inlineStackTop->m_calleeVR)));
-            else
-                set(currentInstruction[1].u.operand, addToGraph(CreateThis, addToGraph(GetCallee)));
+            set(currentInstruction[1].u.operand, addToGraph(CreateThis, get(RegisterFile::Callee)));
             NEXT_OPCODE(op_create_this);
         }
             
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to