Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/compiler/loop-analysis.h b/src/compiler/loop-analysis.h
index 8c8d19a..2ed5bc2 100644
--- a/src/compiler/loop-analysis.h
+++ b/src/compiler/loop-analysis.h
@@ -14,6 +14,9 @@
namespace internal {
namespace compiler {
+// TODO(titzer): don't assume entry edges have a particular index.
+static const int kAssumedLoopEntryIndex = 0; // assume loops are entered here.
+
class LoopFinderImpl;
typedef base::iterator_range<Node**> NodeRange;
@@ -25,7 +28,7 @@
: zone_(zone),
outer_loops_(zone),
all_loops_(zone),
- node_to_loop_num_(static_cast<int>(num_nodes), 0, zone),
+ node_to_loop_num_(static_cast<int>(num_nodes), -1, zone),
loop_nodes_(zone) {}
// Represents a loop in the tree of loops, including the header nodes,
@@ -37,6 +40,7 @@
size_t HeaderSize() const { return body_start_ - header_start_; }
size_t BodySize() const { return body_end_ - body_start_; }
size_t TotalSize() const { return body_end_ - header_start_; }
+ size_t depth() const { return static_cast<size_t>(depth_); }
private:
friend class LoopTree;
@@ -59,9 +63,8 @@
// Return the innermost nested loop, if any, that contains {node}.
Loop* ContainingLoop(Node* node) {
- if (node->id() >= static_cast<int>(node_to_loop_num_.size()))
- return nullptr;
- uint8_t num = node_to_loop_num_[node->id()];
+ if (node->id() >= node_to_loop_num_.size()) return nullptr;
+ int num = node_to_loop_num_[node->id()];
return num > 0 ? &all_loops_[num - 1] : nullptr;
}
@@ -88,12 +91,31 @@
&loop_nodes_[0] + loop->body_start_);
}
+ // Return the header control node for a loop.
+ Node* HeaderNode(Loop* loop);
+
// Return a range which can iterate over the body nodes of {loop}.
NodeRange BodyNodes(Loop* loop) {
return NodeRange(&loop_nodes_[0] + loop->body_start_,
&loop_nodes_[0] + loop->body_end_);
}
+ // Return a range which can iterate over the nodes of {loop}.
+ NodeRange LoopNodes(Loop* loop) {
+ return NodeRange(&loop_nodes_[0] + loop->header_start_,
+ &loop_nodes_[0] + loop->body_end_);
+ }
+
+ // Return the node that represents the control, i.e. the loop node itself.
+ Node* GetLoopControl(Loop* loop) {
+ // TODO(turbofan): make the loop control node always first?
+ for (Node* node : HeaderNodes(loop)) {
+ if (node->opcode() == IrOpcode::kLoop) return node;
+ }
+ UNREACHABLE();
+ return nullptr;
+ }
+
private:
friend class LoopFinderImpl;
@@ -116,18 +138,17 @@
Zone* zone_;
ZoneVector<Loop*> outer_loops_;
ZoneVector<Loop> all_loops_;
- // TODO(titzer): lift loop count restriction.
- ZoneVector<uint8_t> node_to_loop_num_;
+ ZoneVector<int> node_to_loop_num_;
ZoneVector<Node*> loop_nodes_;
};
-
class LoopFinder {
public:
// Build a loop tree for the entire graph.
static LoopTree* BuildLoopTree(Graph* graph, Zone* temp_zone);
};
+
} // namespace compiler
} // namespace internal
} // namespace v8