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

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

Issue 2431563002: [turbofan] Track multiple maps for LoadElimination. (Closed)
Patch Set: REBASE. Address comment. Created 3 years, 12 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/js-native-context-specialization.cc ('k') | src/compiler/load-elimination.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/load-elimination.h
diff --git a/src/compiler/load-elimination.h b/src/compiler/load-elimination.h
index 50979e4da8cba8fdd1d802506bdc3f90ec90889e..cd486a2cd780820b291b8fbb88b606392155d9a6 100644
--- a/src/compiler/load-elimination.h
+++ b/src/compiler/load-elimination.h
@@ -8,9 +8,14 @@
#include "src/base/compiler-specific.h"
#include "src/compiler/graph-reducer.h"
#include "src/globals.h"
+#include "src/zone/zone-handle-set.h"
namespace v8 {
namespace internal {
+
+// Forward declarations.
+class Factory;
+
namespace compiler {
// Foward declarations.
@@ -152,6 +157,49 @@ class V8_EXPORT_PRIVATE LoadElimination final
static size_t const kMaxTrackedFields = 32;
+ // Abstract state to approximate the current map of an object along the
+ // effect paths through the graph.
+ class AbstractMaps final : public ZoneObject {
+ public:
+ explicit AbstractMaps(Zone* zone) : info_for_node_(zone) {}
+ AbstractMaps(Node* object, ZoneHandleSet<Map> maps, Zone* zone)
+ : info_for_node_(zone) {
+ info_for_node_.insert(std::make_pair(object, maps));
+ }
+
+ AbstractMaps const* Extend(Node* object, ZoneHandleSet<Map> maps,
+ Zone* zone) const {
+ AbstractMaps* that = new (zone) AbstractMaps(zone);
+ that->info_for_node_ = this->info_for_node_;
+ that->info_for_node_.insert(std::make_pair(object, maps));
+ return that;
+ }
+ bool Lookup(Node* object, ZoneHandleSet<Map>* object_maps) const;
+ AbstractMaps const* Kill(Node* object, Zone* zone) const;
+ bool Equals(AbstractMaps const* that) const {
+ return this == that || this->info_for_node_ == that->info_for_node_;
+ }
+ AbstractMaps const* Merge(AbstractMaps const* that, Zone* zone) const {
+ if (this->Equals(that)) return this;
+ AbstractMaps* copy = new (zone) AbstractMaps(zone);
+ for (auto this_it : this->info_for_node_) {
+ Node* this_object = this_it.first;
+ ZoneHandleSet<Map> this_maps = this_it.second;
+ auto that_it = that->info_for_node_.find(this_object);
+ if (that_it != that->info_for_node_.end() &&
+ that_it->second == this_maps) {
+ copy->info_for_node_.insert(this_it);
+ }
+ }
+ return copy;
+ }
+
+ void Print() const;
+
+ private:
+ ZoneMap<Node*, ZoneHandleSet<Map>> info_for_node_;
+ };
+
class AbstractState final : public ZoneObject {
public:
AbstractState() {
@@ -163,6 +211,11 @@ class V8_EXPORT_PRIVATE LoadElimination final
bool Equals(AbstractState const* that) const;
void Merge(AbstractState const* that, Zone* zone);
+ AbstractState const* AddMaps(Node* object, ZoneHandleSet<Map> maps,
+ Zone* zone) const;
+ AbstractState const* KillMaps(Node* object, Zone* zone) const;
+ bool LookupMaps(Node* object, ZoneHandleSet<Map>* object_maps) const;
+
AbstractState const* AddField(Node* object, size_t index, Node* value,
Zone* zone) const;
AbstractState const* KillField(Node* object, size_t index,
@@ -185,6 +238,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
AbstractChecks const* checks_ = nullptr;
AbstractElements const* elements_ = nullptr;
AbstractField const* fields_[kMaxTrackedFields];
+ AbstractMaps const* maps_ = nullptr;
};
class AbstractStateForEffectNodes final : public ZoneObject {
@@ -223,6 +277,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
CommonOperatorBuilder* common() const;
AbstractState const* empty_state() const { return &empty_state_; }
+ Factory* factory() const;
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
Zone* zone() const { return node_states_.zone(); }
« no previous file with comments | « src/compiler/js-native-context-specialization.cc ('k') | src/compiler/load-elimination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698