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

Side by Side Diff: src/compiler/scheduler.cc

Issue 1020873002: [turbofan] Fix GVN of projections and add verification for projection uniqueness. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/scheduler.h" 5 #include "src/compiler/scheduler.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/bit-vector.h" 9 #include "src/bit-vector.h"
10 #include "src/compiler/common-operator.h" 10 #include "src/compiler/common-operator.h"
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 for (BasicBlock* pred_block : block->predecessors()) { 1394 for (BasicBlock* pred_block : block->predecessors()) {
1395 DCHECK_LT(pred_block->id().ToSize(), marked_.size()); 1395 DCHECK_LT(pred_block->id().ToSize(), marked_.size());
1396 if (marked_[pred_block->id().ToSize()]) continue; 1396 if (marked_[pred_block->id().ToSize()]) continue;
1397 marking_queue_.push_back(pred_block); 1397 marking_queue_.push_back(pred_block);
1398 } 1398 }
1399 } 1399 }
1400 1400
1401 BasicBlock* SplitNode(BasicBlock* block, Node* node) { 1401 BasicBlock* SplitNode(BasicBlock* block, Node* node) {
1402 // For now, we limit splitting to pure nodes. 1402 // For now, we limit splitting to pure nodes.
1403 if (!node->op()->HasProperty(Operator::kPure)) return block; 1403 if (!node->op()->HasProperty(Operator::kPure)) return block;
1404 // TODO(titzer): fix the special case of splitting of projections.
1405 if (node->opcode() == IrOpcode::kProjection) return block;
1404 1406
1405 // The {block} is common dominator of all uses of {node}, so we cannot 1407 // The {block} is common dominator of all uses of {node}, so we cannot
1406 // split anything unless the {block} has at least two successors. 1408 // split anything unless the {block} has at least two successors.
1407 DCHECK_EQ(block, GetCommonDominatorOfUses(node)); 1409 DCHECK_EQ(block, GetCommonDominatorOfUses(node));
1408 if (block->SuccessorCount() < 2) return block; 1410 if (block->SuccessorCount() < 2) return block;
1409 1411
1410 // Clear marking bits. 1412 // Clear marking bits.
1411 DCHECK(marking_queue_.empty()); 1413 DCHECK(marking_queue_.empty());
1412 std::fill(marked_.begin(), marked_.end(), false); 1414 std::fill(marked_.begin(), marked_.end(), false);
1413 marked_.resize(schedule_->BasicBlockCount() + 1, false); 1415 marked_.resize(schedule_->BasicBlockCount() + 1, false);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 1568
1567 Node* CloneNode(Node* node) { 1569 Node* CloneNode(Node* node) {
1568 int const input_count = node->InputCount(); 1570 int const input_count = node->InputCount();
1569 Node** const inputs = scheduler_->zone_->NewArray<Node*>(input_count); 1571 Node** const inputs = scheduler_->zone_->NewArray<Node*>(input_count);
1570 for (int index = 0; index < input_count; ++index) { 1572 for (int index = 0; index < input_count; ++index) {
1571 Node* const input = node->InputAt(index); 1573 Node* const input = node->InputAt(index);
1572 scheduler_->IncrementUnscheduledUseCount(input, index, node); 1574 scheduler_->IncrementUnscheduledUseCount(input, index, node);
1573 inputs[index] = input; 1575 inputs[index] = input;
1574 } 1576 }
1575 Node* copy = scheduler_->graph_->NewNode(node->op(), input_count, inputs); 1577 Node* copy = scheduler_->graph_->NewNode(node->op(), input_count, inputs);
1578 TRACE(("clone #%d:%s -> #%d\n"), node->id(), node->op()->mnemonic(),
1579 copy->id());
1576 scheduler_->node_data_.resize(copy->id() + 1, 1580 scheduler_->node_data_.resize(copy->id() + 1,
1577 scheduler_->DefaultSchedulerData()); 1581 scheduler_->DefaultSchedulerData());
1578 scheduler_->node_data_[copy->id()] = scheduler_->node_data_[node->id()]; 1582 scheduler_->node_data_[copy->id()] = scheduler_->node_data_[node->id()];
1579 return copy; 1583 return copy;
1580 } 1584 }
1581 1585
1582 Scheduler* scheduler_; 1586 Scheduler* scheduler_;
1583 Schedule* schedule_; 1587 Schedule* schedule_;
1584 BoolVector marked_; 1588 BoolVector marked_;
1585 ZoneDeque<BasicBlock*> marking_queue_; 1589 ZoneDeque<BasicBlock*> marking_queue_;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 for (Node* const node : *nodes) { 1690 for (Node* const node : *nodes) {
1687 schedule_->SetBlockForNode(to, node); 1691 schedule_->SetBlockForNode(to, node);
1688 scheduled_nodes_[to->id().ToSize()].push_back(node); 1692 scheduled_nodes_[to->id().ToSize()].push_back(node);
1689 } 1693 }
1690 nodes->clear(); 1694 nodes->clear();
1691 } 1695 }
1692 1696
1693 } // namespace compiler 1697 } // namespace compiler
1694 } // namespace internal 1698 } // namespace internal
1695 } // namespace v8 1699 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/common-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698