summaryrefslogtreecommitdiffstats
path: root/js/src/jit/FlowAliasAnalysis.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit/FlowAliasAnalysis.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit/FlowAliasAnalysis.h')
-rw-r--r--js/src/jit/FlowAliasAnalysis.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/js/src/jit/FlowAliasAnalysis.h b/js/src/jit/FlowAliasAnalysis.h
new file mode 100644
index 000000000..d4c8c0f5f
--- /dev/null
+++ b/js/src/jit/FlowAliasAnalysis.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * vim: set ts=8 sts=4 et sw=4 tw=99:
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef jit_FlowAliasAnalysis_h
+#define jit_FlowAliasAnalysis_h
+
+#include "jit/AliasAnalysisShared.h"
+#include "jit/MIR.h"
+#include "jit/MIRGraph.h"
+
+namespace js {
+namespace jit {
+
+class LoopInfo;
+class MIRGraph;
+class GraphStoreInfo;
+
+typedef MDefinitionVector BlockStoreInfo;
+typedef Vector<BlockStoreInfo*, 50, JitAllocPolicy> GraphStoreVector;
+
+class FlowAliasAnalysis : public AliasAnalysisShared
+{
+ // Info on the graph.
+ LoopInfo* loop_;
+ GraphStoreInfo* stores_;
+
+ // Helper vectors. In order to not have to recreate them the whole time.
+ MDefinitionVector output_;
+ MDefinitionVector worklist_;
+
+ public:
+ FlowAliasAnalysis(MIRGenerator* mir, MIRGraph& graph);
+ MOZ_MUST_USE bool analyze() override;
+
+ protected:
+ /* Process instructions. */
+ MOZ_MUST_USE bool processStore(BlockStoreInfo& stores, MDefinition* store);
+ MOZ_MUST_USE bool processLoad(BlockStoreInfo& stores, MDefinition* load);
+ MOZ_MUST_USE bool processDeferredLoads(LoopInfo* info);
+
+ /* Improve dependency and helpers. */
+ MOZ_MUST_USE bool improveDependency(MDefinition* load, MDefinitionVector& inputStores,
+ MDefinitionVector& outputStores);
+ MOZ_MUST_USE bool improveNonAliasedStores(MDefinition* load, MDefinitionVector& inputStores,
+ MDefinitionVector& outputStores, bool* improved,
+ bool onlyControlInstructions = false);
+ MOZ_MUST_USE bool improveStoresInFinishedLoops(MDefinition* load, MDefinitionVector& stores,
+ bool* improved);
+
+ MOZ_MUST_USE bool improveLoopDependency(MDefinition* load, MDefinitionVector& inputStores,
+ MDefinitionVector& outputStores);
+ MOZ_MUST_USE bool deferImproveDependency(MDefinitionVector& stores);
+
+ /* Save dependency info. */
+ void saveLoadDependency(MDefinition* load, MDefinitionVector& dependencies);
+ MOZ_MUST_USE bool saveStoreDependency(MDefinition* store, BlockStoreInfo& prevStores);
+
+ /* Helper functions. */
+ MOZ_MUST_USE bool computeBlockStores(MBasicBlock* block);
+ MOZ_MUST_USE bool isLoopInvariant(MDefinition* load, MDefinition* store, bool* loopinvariant);
+ bool loopIsFinished(MBasicBlock* loopheader);
+
+};
+
+} // namespace jit
+} // namespace js
+
+#endif /* jit_FlowAliasAnalysis_h */