Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: src/compiler/redundancy-elimination.h

Issue 2091503003: [turbofan] Initial version of RedundancyElimination. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/redundancy-elimination.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/redundancy-elimination.h
diff --git a/src/compiler/redundancy-elimination.h b/src/compiler/redundancy-elimination.h
new file mode 100644
index 0000000000000000000000000000000000000000..a4886e4b919ec296186106a502828a4076fbb185
--- /dev/null
+++ b/src/compiler/redundancy-elimination.h
@@ -0,0 +1,76 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_COMPILER_REDUNDANCY_ELIMINATION_H_
+#define V8_COMPILER_REDUNDANCY_ELIMINATION_H_
+
+#include "src/compiler/graph-reducer.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+class RedundancyElimination final : public AdvancedReducer {
+ public:
+ RedundancyElimination(Editor* editor, Zone* zone);
+ ~RedundancyElimination() final;
+
+ Reduction Reduce(Node* node) final;
+
+ private:
+ struct Check {
+ Check(Node* node, Check* next) : node(node), next(next) {}
+ Node* node;
+ Check* next;
+ };
+
+ class EffectPathChecks final {
+ public:
+ static EffectPathChecks* Copy(Zone* zone, EffectPathChecks const* checks);
+ static EffectPathChecks const* Empty(Zone* zone);
+ void Merge(EffectPathChecks const* that);
+
+ EffectPathChecks const* AddCheck(Zone* zone, Node* node) const;
+ Node* LookupCheck(Node* node) const;
+
+ private:
+ EffectPathChecks(Check* head, size_t size) : head_(head), size_(size) {}
+
+ // We keep track of the list length so that we can find the longest
+ // common tail easily.
+ Check* head_;
+ size_t size_;
+ };
+
+ class PathChecksForEffectNodes final {
+ public:
+ explicit PathChecksForEffectNodes(Zone* zone) : info_for_node_(zone) {}
+ EffectPathChecks const* Get(Node* node) const;
+ void Set(Node* node, EffectPathChecks const* checks);
+
+ private:
+ ZoneVector<EffectPathChecks const*> info_for_node_;
+ };
+
+ Reduction ReduceCheckNode(Node* node);
+ Reduction ReduceEffectPhi(Node* node);
+ Reduction ReduceStart(Node* node);
+ Reduction ReduceOtherNode(Node* node);
+
+ Reduction TakeChecksFromFirstEffect(Node* node);
+ Reduction UpdateChecks(Node* node, EffectPathChecks const* checks);
+
+ Zone* zone() const { return zone_; }
+
+ PathChecksForEffectNodes node_checks_;
+ Zone* const zone_;
+
+ DISALLOW_COPY_AND_ASSIGN(RedundancyElimination);
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_REDUNDANCY_ELIMINATION_H_
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/compiler/redundancy-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698