diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h b/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h index e1969179e..eb4e5219f 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h +++ b/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2015 Apple Inc. All rights reserved. + * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,20 +26,21 @@ #ifndef DFGAbstractInterpreter_h #define DFGAbstractInterpreter_h +#include <wtf/Platform.h> + #if ENABLE(DFG_JIT) #include "DFGAbstractValue.h" #include "DFGBranchDirection.h" #include "DFGGraph.h" #include "DFGNode.h" -#include "DFGPhiChildren.h" namespace JSC { namespace DFG { template<typename AbstractStateType> class AbstractInterpreter { public: - AbstractInterpreter(Graph&, AbstractStateType&); + AbstractInterpreter(Graph&, AbstractStateType& state); ~AbstractInterpreter(); AbstractValue& forNode(Node* node) @@ -81,15 +82,22 @@ public: // // This is guaranteed to be equivalent to doing: // - // state.startExecuting() - // state.executeEdges(index); - // result = state.executeEffects(index); + // if (state.startExecuting(index)) { + // state.executeEdges(index); + // result = state.executeEffects(index); + // } else + // result = true; bool execute(unsigned indexInBlock); bool execute(Node*); - // 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(); + // 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); // 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 @@ -97,14 +105,10 @@ public: void executeEdges(Node*); void executeEdges(unsigned indexInBlock); - ALWAYS_INLINE void filterEdgeByUse(Edge& edge) + ALWAYS_INLINE void filterEdgeByUse(Node* node, Edge& edge) { ASSERT(mayHaveTypeCheck(edge.useKind()) || !needsTypeCheck(edge)); - filterByType(edge, typeFilterFor(edge.useKind())); - } - ALWAYS_INLINE void filterEdgeByUse(Node*, Edge& edge) - { - filterEdgeByUse(edge); + filterByType(node, edge, typeFilterFor(edge.useKind())); } // Abstractly execute the effects of the given node. This changes the abstract @@ -112,13 +116,12 @@ public: bool executeEffects(unsigned indexInBlock); bool executeEffects(unsigned clobberLimit, Node*); - void dump(PrintStream& out) const; void dump(PrintStream& out); template<typename T> - FiltrationResult filter(T node, const StructureSet& set, SpeculatedType admittedTypes = SpecNone) + FiltrationResult filter(T node, const StructureSet& set) { - return filter(forNode(node), set, admittedTypes); + return filter(forNode(node), set); } template<typename T> @@ -134,28 +137,20 @@ public: } template<typename T> - FiltrationResult filterByValue(T node, FrozenValue value) + FiltrationResult filterByValue(T node, JSValue value) { return filterByValue(forNode(node), value); } - FiltrationResult filter(AbstractValue&, const StructureSet&, SpeculatedType admittedTypes = SpecNone); + FiltrationResult filter(AbstractValue&, const StructureSet&); FiltrationResult filterArrayModes(AbstractValue&, ArrayModes); FiltrationResult filter(AbstractValue&, SpeculatedType); - FiltrationResult filterByValue(AbstractValue&, FrozenValue); - - PhiChildren* phiChildren() { return m_phiChildren.get(); } + FiltrationResult filterByValue(AbstractValue&, JSValue); private: void clobberWorld(const CodeOrigin&, unsigned indexInBlock); - - template<typename Functor> - void forAllValues(unsigned indexInBlock, Functor&); - + void clobberCapturedVars(const CodeOrigin&); void clobberStructures(unsigned indexInBlock); - void observeTransition(unsigned indexInBlock, Structure* from, Structure* to); - void observeTransitions(unsigned indexInBlock, const TransitionVector&); - void setDidClobber(); enum BooleanResult { UnknownBooleanResult, @@ -164,25 +159,19 @@ private: }; BooleanResult booleanResult(Node*, AbstractValue&); - void setBuiltInConstant(Node* node, FrozenValue value) - { - AbstractValue& abstractValue = forNode(node); - abstractValue.set(m_graph, value, m_state.structureClobberState()); - abstractValue.fixTypeForRepresentation(m_graph, node); - } - - void setConstant(Node* node, FrozenValue value) + void setConstant(Node* node, JSValue value) { - setBuiltInConstant(node, value); + forNode(node).set(m_graph, value); m_state.setFoundConstants(true); } - ALWAYS_INLINE void filterByType(Edge& edge, SpeculatedType type) + ALWAYS_INLINE void filterByType(Node* node, Edge& edge, SpeculatedType type) { AbstractValue& value = forNode(edge); - if (!value.isType(type)) + if (!value.isType(type)) { + node->setCanExit(true); edge.setProofStatus(NeedsCheck); - else + } else edge.setProofStatus(IsProved); filter(value, type); @@ -194,7 +183,6 @@ private: CodeBlock* m_codeBlock; Graph& m_graph; AbstractStateType& m_state; - std::unique_ptr<PhiChildren> m_phiChildren; }; } } // namespace JSC::DFG |