diff options
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGAbstractState.h')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGAbstractState.h | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.h b/Source/JavaScriptCore/dfg/DFGAbstractState.h index 0e33140c0..ec1a06231 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.h +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,7 +31,6 @@ #if ENABLE(DFG_JIT) #include "DFGAbstractValue.h" -#include "DFGBranchDirection.h" #include "DFGGraph.h" #include "DFGNode.h" #include <wtf/Vector.h> @@ -93,6 +92,36 @@ public: MergeToSuccessors }; + enum BranchDirection { + // This is not a branch and so there is no branch direction, or + // the branch direction has yet to be set. + InvalidBranchDirection, + + // The branch takes the true case. + TakeTrue, + + // The branch takes the false case. + TakeFalse, + + // For all we know, the branch could go either direction, so we + // have to assume the worst. + TakeBoth + }; + + static const char* branchDirectionToString(BranchDirection branchDirection) + { + switch (branchDirection) { + case InvalidBranchDirection: + return "Invalid"; + case TakeTrue: + return "TakeTrue"; + case TakeFalse: + return "TakeFalse"; + case TakeBoth: + return "TakeBoth"; + } + } + AbstractState(Graph&); ~AbstractState(); @@ -145,7 +174,11 @@ public: // A true return means that you must revisit (at least) the successor // blocks. This also sets cfaShouldRevisit to true for basic blocks // that must be visited next. - bool endBasicBlock(MergeMode); + // + // If you'd like to know what direction the branch at the end of the + // basic block is thought to have taken, you can pass a non-0 pointer + // for BranchDirection. + bool endBasicBlock(MergeMode, BranchDirection* = 0); // Reset the AbstractState. This throws away any results, and at this point // you can safely call beginBasicBlock() on any basic block. @@ -178,8 +211,8 @@ public: // successors. Returns true if any of the successors' states changed. Note // that this is automatically called in endBasicBlock() if MergeMode is // MergeToSuccessors. - bool mergeToSuccessors(Graph&, BasicBlock*); - + bool mergeToSuccessors(Graph&, BasicBlock*, BranchDirection); + void dump(FILE* out); private: |