diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h')
-rw-r--r-- | Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h | 92 |
1 files changed, 53 insertions, 39 deletions
diff --git a/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h b/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h index eb4e5219f..66bf69b0d 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h +++ b/Source/JavaScriptCore/dfg/DFGAbstractInterpreter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,10 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef DFGAbstractInterpreter_h -#define DFGAbstractInterpreter_h - -#include <wtf/Platform.h> +#pragma once #if ENABLE(DFG_JIT) @@ -34,16 +31,18 @@ #include "DFGBranchDirection.h" #include "DFGGraph.h" #include "DFGNode.h" +#include "DFGNodeFlowProjection.h" +#include "DFGPhiChildren.h" namespace JSC { namespace DFG { template<typename AbstractStateType> class AbstractInterpreter { public: - AbstractInterpreter(Graph&, AbstractStateType& state); + AbstractInterpreter(Graph&, AbstractStateType&); ~AbstractInterpreter(); - AbstractValue& forNode(Node* node) + AbstractValue& forNode(NodeFlowProjection node) { return m_state.forNode(node); } @@ -82,33 +81,26 @@ public: // // 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(node); + // 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 // filterEdgeByUse() (or some equivalent) on each edge. void executeEdges(Node*); - void executeEdges(unsigned indexInBlock); + + void executeKnownEdgeTypes(Node*); - 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())); } // Abstractly execute the effects of the given node. This changes the abstract @@ -116,12 +108,13 @@ 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) + FiltrationResult filter(T node, const RegisteredStructureSet& set, SpeculatedType admittedTypes = SpecNone) { - return filter(forNode(node), set); + return filter(forNode(node), set, admittedTypes); } template<typename T> @@ -137,20 +130,35 @@ public: } 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&); + template<typename T> + FiltrationResult filterClassInfo(T node, const ClassInfo* classInfo) + { + return filterClassInfo(forNode(node), classInfo); + } + + FiltrationResult filter(AbstractValue&, const RegisteredStructureSet&, SpeculatedType admittedTypes = SpecNone); FiltrationResult filterArrayModes(AbstractValue&, ArrayModes); FiltrationResult filter(AbstractValue&, SpeculatedType); - FiltrationResult filterByValue(AbstractValue&, JSValue); + FiltrationResult filterByValue(AbstractValue&, FrozenValue); + FiltrationResult filterClassInfo(AbstractValue&, const ClassInfo*); + + 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, RegisteredStructure from, RegisteredStructure to); + void observeTransitions(unsigned indexInBlock, const TransitionVector&); + void setDidClobber(); enum BooleanResult { UnknownBooleanResult, @@ -159,19 +167,25 @@ private: }; BooleanResult booleanResult(Node*, AbstractValue&); - void setConstant(Node* node, JSValue value) + void setBuiltInConstant(Node* node, FrozenValue value) { - forNode(node).set(m_graph, value); + AbstractValue& abstractValue = forNode(node); + abstractValue.set(m_graph, value, m_state.structureClobberState()); + abstractValue.fixTypeForRepresentation(m_graph, node); + } + + 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); @@ -179,15 +193,15 @@ private: void verifyEdge(Node*, Edge); void verifyEdges(Node*); + void executeDoubleUnaryOpEffects(Node*, double(*equivalentFunction)(double)); CodeBlock* m_codeBlock; Graph& m_graph; + VM& m_vm; AbstractStateType& m_state; + std::unique_ptr<PhiChildren> m_phiChildren; }; } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT) - -#endif // DFGAbstractInterpreter_h - |