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

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

Issue 701473002: Make generic algorithm less generic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Jaro. Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/typer.h » ('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 <deque> 5 #include <deque>
6 #include <queue> 6 #include <queue>
7 7
8 #include "src/compiler/scheduler.h" 8 #include "src/compiler/scheduler.h"
9 9
10 #include "src/bit-vector.h" 10 #include "src/bit-vector.h"
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 1005
1006 // ----------------------------------------------------------------------------- 1006 // -----------------------------------------------------------------------------
1007 // Phase 3: Prepare use counts for nodes. 1007 // Phase 3: Prepare use counts for nodes.
1008 1008
1009 1009
1010 class PrepareUsesVisitor : public NullNodeVisitor { 1010 class PrepareUsesVisitor : public NullNodeVisitor {
1011 public: 1011 public:
1012 explicit PrepareUsesVisitor(Scheduler* scheduler) 1012 explicit PrepareUsesVisitor(Scheduler* scheduler)
1013 : scheduler_(scheduler), schedule_(scheduler->schedule_) {} 1013 : scheduler_(scheduler), schedule_(scheduler->schedule_) {}
1014 1014
1015 GenericGraphVisit::Control Pre(Node* node) { 1015 void Pre(Node* node) {
1016 if (scheduler_->GetPlacement(node) == Scheduler::kFixed) { 1016 if (scheduler_->GetPlacement(node) == Scheduler::kFixed) {
1017 // Fixed nodes are always roots for schedule late. 1017 // Fixed nodes are always roots for schedule late.
1018 scheduler_->schedule_root_nodes_.push_back(node); 1018 scheduler_->schedule_root_nodes_.push_back(node);
1019 if (!schedule_->IsScheduled(node)) { 1019 if (!schedule_->IsScheduled(node)) {
1020 // Make sure root nodes are scheduled in their respective blocks. 1020 // Make sure root nodes are scheduled in their respective blocks.
1021 Trace("Scheduling fixed position node #%d:%s\n", node->id(), 1021 Trace("Scheduling fixed position node #%d:%s\n", node->id(),
1022 node->op()->mnemonic()); 1022 node->op()->mnemonic());
1023 IrOpcode::Value opcode = node->opcode(); 1023 IrOpcode::Value opcode = node->opcode();
1024 BasicBlock* block = 1024 BasicBlock* block =
1025 opcode == IrOpcode::kParameter 1025 opcode == IrOpcode::kParameter
1026 ? schedule_->start() 1026 ? schedule_->start()
1027 : schedule_->block(NodeProperties::GetControlInput(node)); 1027 : schedule_->block(NodeProperties::GetControlInput(node));
1028 DCHECK(block != NULL); 1028 DCHECK(block != NULL);
1029 schedule_->AddNode(block, node); 1029 schedule_->AddNode(block, node);
1030 } 1030 }
1031 } 1031 }
1032
1033 return GenericGraphVisit::CONTINUE;
1034 } 1032 }
1035 1033
1036 void PostEdge(Node* from, int index, Node* to) { 1034 void PostEdge(Node* from, int index, Node* to) {
1037 // If the edge is from an unscheduled node, then tally it in the use count 1035 // If the edge is from an unscheduled node, then tally it in the use count
1038 // for all of its inputs. The same criterion will be used in ScheduleLate 1036 // for all of its inputs. The same criterion will be used in ScheduleLate
1039 // for decrementing use counts. 1037 // for decrementing use counts.
1040 if (!schedule_->IsScheduled(from)) { 1038 if (!schedule_->IsScheduled(from)) {
1041 DCHECK_NE(Scheduler::kFixed, scheduler_->GetPlacement(from)); 1039 DCHECK_NE(Scheduler::kFixed, scheduler_->GetPlacement(from));
1042 scheduler_->IncrementUnscheduledUseCount(to, index, from); 1040 scheduler_->IncrementUnscheduledUseCount(to, index, from);
1043 } 1041 }
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) { 1373 for (NodeVectorIter i = nodes->begin(); i != nodes->end(); ++i) {
1376 schedule_->SetBlockForNode(to, *i); 1374 schedule_->SetBlockForNode(to, *i);
1377 scheduled_nodes_[to->id().ToSize()].push_back(*i); 1375 scheduled_nodes_[to->id().ToSize()].push_back(*i);
1378 } 1376 }
1379 nodes->clear(); 1377 nodes->clear();
1380 } 1378 }
1381 1379
1382 } // namespace compiler 1380 } // namespace compiler
1383 } // namespace internal 1381 } // namespace internal
1384 } // namespace v8 1382 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/typer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698