summaryrefslogtreecommitdiff
path: root/chromium/v8/src/compiler/control-equivalence.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-12 14:07:37 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 10:29:26 +0000
commitec02ee4181c49b61fce1c8fb99292dbb8139cc90 (patch)
tree25cde714b2b71eb639d1cd53f5a22e9ba76e14ef /chromium/v8/src/compiler/control-equivalence.h
parentbb09965444b5bb20b096a291445170876225268d (diff)
downloadqtwebengine-chromium-ec02ee4181c49b61fce1c8fb99292dbb8139cc90.tar.gz
BASELINE: Update Chromium to 59.0.3071.134
Change-Id: Id02ef6fb2204c5fd21668a1c3e6911c83b17585a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/v8/src/compiler/control-equivalence.h')
-rw-r--r--chromium/v8/src/compiler/control-equivalence.h46
1 files changed, 26 insertions, 20 deletions
diff --git a/chromium/v8/src/compiler/control-equivalence.h b/chromium/v8/src/compiler/control-equivalence.h
index b76e04fe435..e6aa7f50728 100644
--- a/chromium/v8/src/compiler/control-equivalence.h
+++ b/chromium/v8/src/compiler/control-equivalence.h
@@ -38,7 +38,7 @@ class V8_EXPORT_PRIVATE ControlEquivalence final
graph_(graph),
dfs_number_(0),
class_number_(1),
- node_data_(graph->NodeCount(), EmptyData(), zone) {}
+ node_data_(graph->NodeCount(), zone) {}
// Run the main algorithm starting from the {exit} control node. This causes
// the following iterations over control edges of the graph:
@@ -80,17 +80,21 @@ class V8_EXPORT_PRIVATE ControlEquivalence final
// The stack is used during the undirected DFS walk.
typedef ZoneStack<DFSStackEntry> DFSStack;
- struct NodeData {
+ struct NodeData : ZoneObject {
+ explicit NodeData(Zone* zone)
+ : class_number(kInvalidClass),
+ blist(BracketList(zone)),
+ visited(false),
+ on_stack(false) {}
+
size_t class_number; // Equivalence class number assigned to node.
- size_t dfs_number; // Pre-order DFS number assigned to node.
- bool visited; // Indicates node has already been visited.
- bool on_stack; // Indicates node is on DFS stack during walk.
- bool participates; // Indicates node participates in DFS walk.
BracketList blist; // List of brackets per node.
+ bool visited : 1; // Indicates node has already been visited.
+ bool on_stack : 1; // Indicates node is on DFS stack during walk.
};
// The per-node data computed during the DFS walk.
- typedef ZoneVector<NodeData> Data;
+ typedef ZoneVector<NodeData*> Data;
// Called at pre-visit during DFS walk.
void VisitPre(Node* node);
@@ -126,32 +130,34 @@ class V8_EXPORT_PRIVATE ControlEquivalence final
private:
NodeData* GetData(Node* node) {
size_t const index = node->id();
- if (index >= node_data_.size()) node_data_.resize(index + 1, EmptyData());
- return &node_data_[index];
+ if (index >= node_data_.size()) node_data_.resize(index + 1);
+ return node_data_[index];
+ }
+ void AllocateData(Node* node) {
+ size_t const index = node->id();
+ if (index >= node_data_.size()) node_data_.resize(index + 1);
+ node_data_[index] = new (zone_) NodeData(zone_);
}
+
int NewClassNumber() { return class_number_++; }
int NewDFSNumber() { return dfs_number_++; }
- // Template used to initialize per-node data.
- NodeData EmptyData() {
- return {kInvalidClass, 0, false, false, false, BracketList(zone_)};
- }
-
- // Accessors for the DFS number stored within the per-node data.
- size_t GetNumber(Node* node) { return GetData(node)->dfs_number; }
- void SetNumber(Node* node, size_t number) {
- GetData(node)->dfs_number = number;
- }
+ bool Participates(Node* node) { return GetData(node) != nullptr; }
// Accessors for the equivalence class stored within the per-node data.
size_t GetClass(Node* node) { return GetData(node)->class_number; }
void SetClass(Node* node, size_t number) {
+ DCHECK(Participates(node));
GetData(node)->class_number = number;
}
// Accessors for the bracket list stored within the per-node data.
- BracketList& GetBracketList(Node* node) { return GetData(node)->blist; }
+ BracketList& GetBracketList(Node* node) {
+ DCHECK(Participates(node));
+ return GetData(node)->blist;
+ }
void SetBracketList(Node* node, BracketList& list) {
+ DCHECK(Participates(node));
GetData(node)->blist = list;
}