Title: [119343] trunk/Source/_javascript_Core
Revision
119343
Author
[email protected]
Date
2012-06-02 17:41:08 -0700 (Sat, 02 Jun 2012)

Log Message

If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
shouldn't revert all the way to GetById/GetByIdFlush
https://bugs.webkit.org/show_bug.cgi?id=88176

Reviewed by Geoffrey Garen.
        
Refactored the code so that the op_method_check case of the parser gracefully falls
through to all of the goodness of the normal op_get_by_id case.

* dfg/DFGByteCodeParser.cpp:
(ByteCodeParser):
(JSC::DFG::ByteCodeParser::handleGetById):
(DFG):
(JSC::DFG::ByteCodeParser::parseBlock):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (119342 => 119343)


--- trunk/Source/_javascript_Core/ChangeLog	2012-06-02 22:58:48 UTC (rev 119342)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-06-03 00:41:08 UTC (rev 119343)
@@ -1,5 +1,22 @@
 2012-06-02  Filip Pizlo  <[email protected]>
 
+        If the DFG bytecode parser detects that op_method_check has gone polymorphic, it
+        shouldn't revert all the way to GetById/GetByIdFlush
+        https://bugs.webkit.org/show_bug.cgi?id=88176
+
+        Reviewed by Geoffrey Garen.
+        
+        Refactored the code so that the op_method_check case of the parser gracefully falls
+        through to all of the goodness of the normal op_get_by_id case.
+
+        * dfg/DFGByteCodeParser.cpp:
+        (ByteCodeParser):
+        (JSC::DFG::ByteCodeParser::handleGetById):
+        (DFG):
+        (JSC::DFG::ByteCodeParser::parseBlock):
+
+2012-06-02  Filip Pizlo  <[email protected]>
+
         DFG CSE should be able to eliminate unnecessary flushes of arguments and captured variables
         https://bugs.webkit.org/show_bug.cgi?id=87929
 

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (119342 => 119343)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-06-02 22:58:48 UTC (rev 119342)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-06-03 00:41:08 UTC (rev 119343)
@@ -94,6 +94,9 @@
     void setIntrinsicResult(bool usesResult, int resultOperand, NodeIndex);
     // Handle intrinsic functions. Return true if it succeeded, false if we need to plant a call.
     bool handleIntrinsic(bool usesResult, int resultOperand, Intrinsic, int registerOffset, int argumentCountIncludingThis, PredictedType prediction);
+    void handleGetById(
+        int destinationOperand, PredictedType, NodeIndex base, unsigned identifierNumber,
+        const GetByIdStatus&);
     // Prepare to parse a block.
     void prepareToParseBlock();
     // Parse a single basic block of bytecode instructions.
@@ -1540,6 +1543,47 @@
     }
 }
 
+void ByteCodeParser::handleGetById(
+    int destinationOperand, PredictedType prediction, NodeIndex base, unsigned identifierNumber,
+    const GetByIdStatus& getByIdStatus)
+{
+    if (getByIdStatus.isSimpleDirect()
+        && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache)) {
+        ASSERT(getByIdStatus.structureSet().size());
+                
+        // The implementation of GetByOffset does not know to terminate speculative
+        // execution if it doesn't have a prediction, so we do it manually.
+        if (prediction == PredictNone)
+            addToGraph(ForceOSRExit);
+                
+        addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(getByIdStatus.structureSet())), base);
+        NodeIndex propertyStorage;
+        size_t offsetOffset;
+        if (getByIdStatus.structureSet().allAreUsingInlinePropertyStorage()) {
+            propertyStorage = base;
+            ASSERT(!(sizeof(JSObject) % sizeof(EncodedJSValue)));
+            offsetOffset = sizeof(JSObject) / sizeof(EncodedJSValue);
+        } else {
+            propertyStorage = addToGraph(GetPropertyStorage, base);
+            offsetOffset = 0;
+        }
+        set(destinationOperand,
+            addToGraph(
+                GetByOffset, OpInfo(m_graph.m_storageAccessData.size()), OpInfo(prediction),
+                propertyStorage));
+        
+        StorageAccessData storageAccessData;
+        storageAccessData.offset = getByIdStatus.offset() + offsetOffset;
+        storageAccessData.identifierNumber = identifierNumber;
+        m_graph.m_storageAccessData.append(storageAccessData);
+    } else {
+        set(destinationOperand,
+            addToGraph(
+                getByIdStatus.makesCalls() ? GetByIdFlush : GetById,
+                OpInfo(identifierNumber), OpInfo(prediction), base));
+    }
+}
+
 void ByteCodeParser::prepareToParseBlock()
 {
     for (unsigned i = 0; i < m_constants.size(); ++i)
@@ -2026,8 +2070,10 @@
                     addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(methodCallStatus.prototypeStructure())), cellConstant(methodCallStatus.prototype()));
                 
                 set(getInstruction[1].u.operand, cellConstant(methodCallStatus.function()));
-            } else
-                set(getInstruction[1].u.operand, addToGraph(getByIdStatus.makesCalls() ? GetByIdFlush : GetById, OpInfo(identifier), OpInfo(prediction), base));
+            } else {
+                handleGetById(
+                    getInstruction[1].u.operand, prediction, base, identifier, getByIdStatus);
+            }
             
             m_currentIndex += OPCODE_LENGTH(op_method_check) + OPCODE_LENGTH(op_get_by_id);
             continue;
@@ -2060,34 +2106,8 @@
             GetByIdStatus getByIdStatus = GetByIdStatus::computeFor(
                 m_inlineStackTop->m_profiledBlock, m_currentIndex, identifier);
             
-            if (getByIdStatus.isSimpleDirect()
-                && !m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, BadCache)) {
-                ASSERT(getByIdStatus.structureSet().size());
-                
-                // The implementation of GetByOffset does not know to terminate speculative
-                // execution if it doesn't have a prediction, so we do it manually.
-                if (prediction == PredictNone)
-                    addToGraph(ForceOSRExit);
-                
-                addToGraph(CheckStructure, OpInfo(m_graph.addStructureSet(getByIdStatus.structureSet())), base);
-                NodeIndex propertyStorage;
-                size_t offsetOffset;
-                if (getByIdStatus.structureSet().allAreUsingInlinePropertyStorage()) {
-                    propertyStorage = base;
-                    ASSERT(!(sizeof(JSObject) % sizeof(EncodedJSValue)));
-                    offsetOffset = sizeof(JSObject) / sizeof(EncodedJSValue);
-                } else {
-                    propertyStorage = addToGraph(GetPropertyStorage, base);
-                    offsetOffset = 0;
-                }
-                set(currentInstruction[1].u.operand, addToGraph(GetByOffset, OpInfo(m_graph.m_storageAccessData.size()), OpInfo(prediction), propertyStorage));
-                
-                StorageAccessData storageAccessData;
-                storageAccessData.offset = getByIdStatus.offset() + offsetOffset;
-                storageAccessData.identifierNumber = identifierNumber;
-                m_graph.m_storageAccessData.append(storageAccessData);
-            } else
-                set(currentInstruction[1].u.operand, addToGraph(getByIdStatus.makesCalls() ? GetByIdFlush : GetById, OpInfo(identifierNumber), OpInfo(prediction), base));
+            handleGetById(
+                currentInstruction[1].u.operand, prediction, base, identifierNumber, getByIdStatus);
 
             NEXT_OPCODE(op_get_by_id);
         }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to