/*
- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "DFGBranchDirection.h"
#include "DFGGraph.h"
#include "DFGNode.h"
+#include "DFGPhiChildren.h"
namespace JSC { namespace DFG {
//
// This is guaranteed to be equivalent to doing:
//
- // if (state.startExecuting(index)) {
- // state.executeEdges(index);
- // result = state.executeEffects(index);
- // } else
- // result = true;
+ // state.startExecuting()
+ // state.executeEdges(index);
+ // result = state.executeEffects(index);
bool execute(unsigned indexInBlock);
bool execute(Node*);
- // Indicate the start of execution of the node. It resets any state in the node,
- // that is progressively built up by executeEdges() and executeEffects(). In
- // particular, this resets canExit(), so if you want to "know" between calls of
- // startExecuting() and executeEdges()/Effects() whether the last run of the
- // analysis concluded that the node can exit, you should probably set that
- // information aside prior to calling startExecuting().
- bool startExecuting(Node*);
- bool startExecuting(unsigned indexInBlock);
+ // Indicate the start of execution of a node. It resets any state in the node
+ // that is progressively built up by executeEdges() and executeEffects().
+ void startExecuting();
// Abstractly execute the edges of the given node. This runs filterEdgeByUse()
// on all edges of the node. You can skip this step, if you have already used
void executeEdges(Node*);
void executeEdges(unsigned indexInBlock);
- ALWAYS_INLINE void filterEdgeByUse(Node* node, Edge& edge)
+ ALWAYS_INLINE void filterEdgeByUse(Edge& edge)
{
ASSERT(mayHaveTypeCheck(edge.useKind()) || !needsTypeCheck(edge));
- filterByType(node, edge, typeFilterFor(edge.useKind()));
+ filterByType(edge, typeFilterFor(edge.useKind()));
+ }
+ ALWAYS_INLINE void filterEdgeByUse(Node*, Edge& edge)
+ {
+ filterEdgeByUse(edge);
}
// Abstractly execute the effects of the given node. This changes the abstract
bool executeEffects(unsigned indexInBlock);
bool executeEffects(unsigned clobberLimit, Node*);
+ void dump(PrintStream& out) const;
void dump(PrintStream& out);
template<typename T>
}
template<typename T>
- FiltrationResult filterByValue(T node, JSValue value)
+ FiltrationResult filterByValue(T node, FrozenValue value)
{
return filterByValue(forNode(node), value);
}
FiltrationResult filter(AbstractValue&, const StructureSet&);
FiltrationResult filterArrayModes(AbstractValue&, ArrayModes);
FiltrationResult filter(AbstractValue&, SpeculatedType);
- FiltrationResult filterByValue(AbstractValue&, JSValue);
+ FiltrationResult filterByValue(AbstractValue&, FrozenValue);
+
+ PhiChildren* phiChildren() { return m_phiChildren.get(); }
private:
void clobberWorld(const CodeOrigin&, unsigned indexInBlock);
- void clobberCapturedVars(const CodeOrigin&);
+
+ template<typename Functor>
+ void forAllValues(unsigned indexInBlock, Functor&);
+
void clobberStructures(unsigned indexInBlock);
+ void observeTransition(unsigned indexInBlock, Structure* from, Structure* to);
+ void observeTransitions(unsigned indexInBlock, const TransitionVector&);
+ void setDidClobber();
enum BooleanResult {
UnknownBooleanResult,
};
BooleanResult booleanResult(Node*, AbstractValue&);
- void setBuiltInConstant(Node* node, JSValue value)
+ void setBuiltInConstant(Node* node, FrozenValue value)
{
AbstractValue& abstractValue = forNode(node);
- abstractValue.set(m_graph, value);
- abstractValue.fixTypeForRepresentation(node);
+ abstractValue.set(m_graph, value, m_state.structureClobberState());
+ abstractValue.fixTypeForRepresentation(m_graph, node);
}
- void setConstant(Node* node, JSValue value)
+ void setConstant(Node* node, FrozenValue value)
{
setBuiltInConstant(node, value);
m_state.setFoundConstants(true);
}
- ALWAYS_INLINE void filterByType(Node* node, Edge& edge, SpeculatedType type)
+ ALWAYS_INLINE void filterByType(Edge& edge, SpeculatedType type)
{
AbstractValue& value = forNode(edge);
- if (!value.isType(type)) {
- node->setCanExit(true);
+ if (!value.isType(type))
edge.setProofStatus(NeedsCheck);
- } else
+ else
edge.setProofStatus(IsProved);
filter(value, type);
CodeBlock* m_codeBlock;
Graph& m_graph;
AbstractStateType& m_state;
+ std::unique_ptr<PhiChildren> m_phiChildren;
};
} } // namespace JSC::DFG