[turbofan] Preserve Bounds when cloning nodes in the scheduler.
R=jarin@chromium.org Review URL: https://codereview.chromium.org/1196613003 Cr-Commit-Position: refs/heads/master@{#29149}
This commit is contained in:
parent
4e6c956abf
commit
a8a844da1c
@ -51,6 +51,14 @@ Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs,
|
||||
}
|
||||
|
||||
|
||||
Node* Graph::CloneNode(const Node* node) {
|
||||
DCHECK_NOT_NULL(node);
|
||||
Node* const clone = Node::Clone(zone(), NextNodeId(), node);
|
||||
Decorate(clone);
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
NodeId Graph::NextNodeId() {
|
||||
NodeId const id = next_node_id_;
|
||||
CHECK(!base::bits::UnsignedAddOverflow32(id, 1, &next_node_id_));
|
||||
|
@ -80,6 +80,9 @@ class Graph : public ZoneObject {
|
||||
return NewNode(op, arraysize(nodes), nodes);
|
||||
}
|
||||
|
||||
// Clone the {node}, and assign a new node id to the copy.
|
||||
Node* CloneNode(const Node* node);
|
||||
|
||||
template <class Visitor>
|
||||
inline void VisitNodeInputsFromEnd(Visitor* visitor);
|
||||
|
||||
|
@ -50,7 +50,7 @@ void Node::OutOfLineInputs::ExtractFrom(Use* old_use_ptr, Node** old_input_ptr,
|
||||
|
||||
|
||||
Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count,
|
||||
Node** inputs, bool has_extensible_inputs) {
|
||||
Node* const* inputs, bool has_extensible_inputs) {
|
||||
Node** input_ptr;
|
||||
Use* use_ptr;
|
||||
Node* node;
|
||||
@ -106,6 +106,17 @@ Node* Node::New(Zone* zone, NodeId id, const Operator* op, int input_count,
|
||||
}
|
||||
|
||||
|
||||
Node* Node::Clone(Zone* zone, NodeId id, const Node* node) {
|
||||
int const input_count = node->InputCount();
|
||||
Node* const* const inputs = node->has_inline_inputs()
|
||||
? node->inputs_.inline_
|
||||
: node->inputs_.outline_->inputs_;
|
||||
Node* const clone = New(zone, id, node->op(), input_count, inputs, false);
|
||||
clone->set_bounds(node->bounds());
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
void Node::Kill() {
|
||||
DCHECK_NOT_NULL(op());
|
||||
NullAllInputs();
|
||||
|
@ -42,7 +42,8 @@ typedef uint32_t NodeId;
|
||||
class Node final {
|
||||
public:
|
||||
static Node* New(Zone* zone, NodeId id, const Operator* op, int input_count,
|
||||
Node** inputs, bool has_extensible_inputs);
|
||||
Node* const* inputs, bool has_extensible_inputs);
|
||||
static Node* Clone(Zone* zone, NodeId id, const Node* node);
|
||||
|
||||
bool IsDead() const { return InputCount() > 0 && !InputAt(0); }
|
||||
void Kill();
|
||||
@ -284,7 +285,7 @@ class Node final {
|
||||
void* operator new(size_t, void* location) { return location; }
|
||||
|
||||
// Only NodeProperties should manipulate the bounds.
|
||||
Bounds bounds() { return bounds_; }
|
||||
Bounds bounds() const { return bounds_; }
|
||||
void set_bounds(Bounds b) { bounds_ = b; }
|
||||
|
||||
// Only NodeMarkers should manipulate the marks on nodes.
|
||||
|
@ -1580,13 +1580,11 @@ class ScheduleLateNodeVisitor {
|
||||
|
||||
Node* CloneNode(Node* node) {
|
||||
int const input_count = node->InputCount();
|
||||
Node** const inputs = scheduler_->zone_->NewArray<Node*>(input_count);
|
||||
for (int index = 0; index < input_count; ++index) {
|
||||
Node* const input = node->InputAt(index);
|
||||
scheduler_->IncrementUnscheduledUseCount(input, index, node);
|
||||
inputs[index] = input;
|
||||
}
|
||||
Node* copy = scheduler_->graph_->NewNode(node->op(), input_count, inputs);
|
||||
Node* const copy = scheduler_->graph_->CloneNode(node);
|
||||
TRACE(("clone #%d:%s -> #%d\n"), node->id(), node->op()->mnemonic(),
|
||||
copy->id());
|
||||
scheduler_->node_data_.resize(copy->id() + 1,
|
||||
|
Loading…
Reference in New Issue
Block a user