Changeset 152953 in webkit


Ignore:
Timestamp:
Jul 21, 2013, 2:44:38 PM (12 years ago)
Author:
fpizlo@apple.com
Message:

fourthTier: each DFG node that relies on other nodes to do their type checks should be able to tell you if those type checks happened
https://bugs.webkit.org/show_bug.cgi?id=118866

Reviewed by Sam Weinig.

Adds a safeToExecute() method that takes a node and an abstract state and tells you
if the node will run without crashing under that state.

(JSC::CodeBlock::CodeBlock):

  • dfg/DFGCFAPhase.cpp:

(CFAPhase):
(JSC::DFG::CFAPhase::CFAPhase):
(JSC::DFG::CFAPhase::run):
(JSC::DFG::CFAPhase::performBlockCFA):
(JSC::DFG::CFAPhase::performForwardCFA):

  • dfg/DFGSafeToExecute.h: Added.

(DFG):
(SafeToExecuteEdge):
(JSC::DFG::SafeToExecuteEdge::SafeToExecuteEdge):
(JSC::DFG::SafeToExecuteEdge::operator()):
(JSC::DFG::SafeToExecuteEdge::result):
(JSC::DFG::safeToExecute):

  • dfg/DFGStructureAbstractValue.h:

(JSC::DFG::StructureAbstractValue::isValidOffset):
(StructureAbstractValue):

  • runtime/Options.h:

(JSC):

Location:
branches/dfgFourthTier/Source/JavaScriptCore
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/dfgFourthTier/Source/JavaScriptCore/ChangeLog

    r152952 r152953  
     12013-07-20  Filip Pizlo  <fpizlo@apple.com>
     2
     3        fourthTier: each DFG node that relies on other nodes to do their type checks should be able to tell you if those type checks happened
     4        https://bugs.webkit.org/show_bug.cgi?id=118866
     5
     6        Reviewed by Sam Weinig.
     7       
     8        Adds a safeToExecute() method that takes a node and an abstract state and tells you
     9        if the node will run without crashing under that state.
     10
     11        * JavaScriptCore.xcodeproj/project.pbxproj:
     12        * bytecode/CodeBlock.cpp:
     13        (JSC::CodeBlock::CodeBlock):
     14        * dfg/DFGCFAPhase.cpp:
     15        (CFAPhase):
     16        (JSC::DFG::CFAPhase::CFAPhase):
     17        (JSC::DFG::CFAPhase::run):
     18        (JSC::DFG::CFAPhase::performBlockCFA):
     19        (JSC::DFG::CFAPhase::performForwardCFA):
     20        * dfg/DFGSafeToExecute.h: Added.
     21        (DFG):
     22        (SafeToExecuteEdge):
     23        (JSC::DFG::SafeToExecuteEdge::SafeToExecuteEdge):
     24        (JSC::DFG::SafeToExecuteEdge::operator()):
     25        (JSC::DFG::SafeToExecuteEdge::result):
     26        (JSC::DFG::safeToExecute):
     27        * dfg/DFGStructureAbstractValue.h:
     28        (JSC::DFG::StructureAbstractValue::isValidOffset):
     29        (StructureAbstractValue):
     30        * runtime/Options.h:
     31        (JSC):
     32
    1332013-07-20  Filip Pizlo  <fpizlo@apple.com>
    234
  • branches/dfgFourthTier/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r152952 r152953  
    376376                0FE50591179A492400B35F8C /* DFGSaneStringGetByValSlowPathGenerator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE50590179A492400B35F8C /* DFGSaneStringGetByValSlowPathGenerator.h */; settings = {ATTRIBUTES = (Private, ); }; };
    377377                0FE50593179A604500B35F8C /* DFGEdgeUsesStructure.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE50592179A604500B35F8C /* DFGEdgeUsesStructure.h */; settings = {ATTRIBUTES = (Private, ); }; };
     378                0FE5059F179B4A2300B35F8C /* DFGSafeToExecute.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5059E179B4A2000B35F8C /* DFGSafeToExecute.h */; settings = {ATTRIBUTES = (Private, ); }; };
    378379                0FE505A2179B60ED00B35F8C /* FTLFail.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE505A0179B60ED00B35F8C /* FTLFail.cpp */; };
    379380                0FE505A3179B60ED00B35F8C /* FTLFail.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE505A1179B60ED00B35F8C /* FTLFail.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    14311432                0FE50590179A492400B35F8C /* DFGSaneStringGetByValSlowPathGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGSaneStringGetByValSlowPathGenerator.h; path = dfg/DFGSaneStringGetByValSlowPathGenerator.h; sourceTree = "<group>"; };
    14321433                0FE50592179A604500B35F8C /* DFGEdgeUsesStructure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGEdgeUsesStructure.h; path = dfg/DFGEdgeUsesStructure.h; sourceTree = "<group>"; };
     1434                0FE5059E179B4A2000B35F8C /* DFGSafeToExecute.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DFGSafeToExecute.h; path = dfg/DFGSafeToExecute.h; sourceTree = "<group>"; };
    14331435                0FE505A0179B60ED00B35F8C /* FTLFail.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FTLFail.cpp; path = ftl/FTLFail.cpp; sourceTree = "<group>"; };
    14341436                0FE505A1179B60ED00B35F8C /* FTLFail.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTLFail.h; path = ftl/FTLFail.h; sourceTree = "<group>"; };
     
    31403142                                86BB09BE138E381B0056702F /* DFGRepatch.cpp */,
    31413143                                86BB09BF138E381B0056702F /* DFGRepatch.h */,
     3144                                0FE5059E179B4A2000B35F8C /* DFGSafeToExecute.h */,
    31423145                                0FE50590179A492400B35F8C /* DFGSaneStringGetByValSlowPathGenerator.h */,
    31433146                                86ECA3F9132DF25A002B2AD7 /* DFGScoreBoard.h */,
     
    39173920                                0F46E6F4177CF0D200E1F755 /* DFGNaturalLoops.h in Headers */,
    39183921                                0F46E6E3177CC36600E1F755 /* LLVMDisassembler.h in Headers */,
     3922                                0FE5059F179B4A2300B35F8C /* DFGSafeToExecute.h in Headers */,
    39193923                                0F46E6E4177CC36600E1F755 /* UDis86Disassembler.h in Headers */,
    39203924                        );
  • branches/dfgFourthTier/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r152872 r152953  
    18241824        || Options::verboseOSR()
    18251825        || Options::verboseCompilationQueue()
    1826         || Options::reportCompileTimes())
     1826        || Options::reportCompileTimes()
     1827        || Options::verboseCFA())
    18271828        hash();
    18281829
  • branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGCFAPhase.cpp

    r152909 r152953  
    3333#include "DFGInPlaceAbstractState.h"
    3434#include "DFGPhase.h"
     35#include "DFGSafeToExecute.h"
    3536#include "Operations.h"
    3637
     
    3940class CFAPhase : public Phase {
    4041public:
    41 #if DFG_ENABLE(DFG_PROPAGATION_VERBOSE)
    42     static const bool verbose = true;
    43 #else
    44     static const bool verbose = false;
    45 #endif
    46 
    4742    CFAPhase(Graph& graph)
    4843        : Phase(graph, "control flow analysis")
    4944        , m_state(graph)
    5045        , m_interpreter(graph, m_state)
     46        , m_verbose(Options::verboseCFA())
    5147    {
    5248    }
     
    5955       
    6056        m_count = 0;
     57       
     58        if (m_verbose && !shouldDumpGraphAtEachPhase()) {
     59            dataLog("Graph before CFA:\n");
     60            m_graph.dump();
     61        }
    6162       
    6263        // This implements a pseudo-worklist-based forward CFA, except that the visit order
     
    8889        if (!block->cfaShouldRevisit)
    8990            return;
    90         if (verbose)
     91        if (m_verbose)
    9192            dataLog("   Block ", *block, ":\n");
    9293        m_state.beginBasicBlock(block);
    93         if (verbose) {
     94        if (m_verbose) {
    9495            dataLogF("      head vars: ");
    9596            dumpOperands(block->valuesAtHead, WTF::dataFile());
     
    9798        }
    9899        for (unsigned i = 0; i < block->size(); ++i) {
    99             if (verbose) {
     100            if (m_verbose) {
    100101                Node* node = block->at(i);
    101102                dataLogF("      %s @%u: ", Graph::opName(node->op()), node->index());
     103               
     104                if (!safeToExecute(m_state, m_graph, node))
     105                    dataLog("(UNSAFE) ");
     106               
    102107                m_interpreter.dump(WTF::dataFile());
     108               
    103109                if (m_state.haveStructures())
    104110                    dataLog(" (Have Structures)");
     
    106112            }
    107113            if (!m_interpreter.execute(i)) {
    108                 if (verbose)
     114                if (m_verbose)
    109115                    dataLogF("         Expect OSR exit.\n");
    110116                break;
    111117            }
    112118        }
    113         if (verbose) {
     119        if (m_verbose) {
    114120            dataLogF("      tail regs: ");
    115121            m_interpreter.dump(WTF::dataFile());
     
    118124        m_changed |= m_state.endBasicBlock(MergeToSuccessors);
    119125       
    120         if (verbose) {
     126        if (m_verbose) {
    121127            dataLogF("      tail vars: ");
    122128            dumpOperands(block->valuesAtTail, WTF::dataFile());
     
    128134    {
    129135        ++m_count;
    130         if (verbose)
     136        if (m_verbose)
    131137            dataLogF("CFA [%u]\n", ++m_count);
    132138       
     
    138144    InPlaceAbstractState m_state;
    139145    AbstractInterpreter<InPlaceAbstractState> m_interpreter;
     146   
     147    bool m_verbose;
    140148   
    141149    bool m_changed;
  • branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h

    r151824 r152953  
    283283    }
    284284   
     285    bool isValidOffset(PropertyOffset offset)
     286    {
     287        if (isTop())
     288            return false;
     289        if (isClear())
     290            return true;
     291        return m_structure->isValidOffset(offset);
     292    }
     293   
    285294    bool hasSingleton() const
    286295    {
  • branches/dfgFourthTier/Source/JavaScriptCore/runtime/Options.h

    r152952 r152953  
    8686    v(bool, verboseCompilationQueue, false) \
    8787    v(bool, reportCompileTimes, false) \
     88    v(bool, verboseCFA, false) \
    8889    \
    8990    v(bool, enableOSREntryInLoops, true) \
Note: See TracChangeset for help on using the changeset viewer.