| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/instruction-scheduler.h" | 5 #include "src/compiler/instruction-scheduler.h" |
| 6 | 6 |
| 7 #include "src/base/adapters.h" | 7 #include "src/base/adapters.h" |
| 8 #include "src/base/utils/random-number-generator.h" | 8 #include "src/base/utils/random-number-generator.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace compiler { | 12 namespace compiler { |
| 13 | 13 |
| 14 void InstructionScheduler::SchedulingQueueBase::AddNode( | 14 void InstructionScheduler::SchedulingQueueBase::AddNode( |
| 15 ScheduleGraphNode* node) { | 15 ScheduleGraphNode* node) { |
| 16 // We keep the ready list sorted by total latency so that we can quickly find | 16 // We keep the ready list sorted by total latency so that we can quickly find |
| 17 // the next best candidate to schedule. | 17 // the next best candidate to schedule. |
| 18 auto it = nodes_.begin(); | 18 auto it = nodes_.begin(); |
| 19 while ((it != nodes_.end()) && | 19 while ((it != nodes_.end()) && |
| 20 ((*it)->total_latency() > node->total_latency())) { | 20 ((*it)->total_latency() >= node->total_latency())) { |
| 21 ++it; | 21 ++it; |
| 22 } | 22 } |
| 23 nodes_.insert(it, node); | 23 nodes_.insert(it, node); |
| 24 } | 24 } |
| 25 | 25 |
| 26 | 26 |
| 27 InstructionScheduler::ScheduleGraphNode* | 27 InstructionScheduler::ScheduleGraphNode* |
| 28 InstructionScheduler::CriticalPathFirstQueue::PopBestCandidate(int cycle) { | 28 InstructionScheduler::CriticalPathFirstQueue::PopBestCandidate(int cycle) { |
| 29 DCHECK(!IsEmpty()); | 29 DCHECK(!IsEmpty()); |
| 30 auto candidate = nodes_.end(); | 30 auto candidate = nodes_.end(); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 | 357 |
| 358 node->set_total_latency(max_latency + node->latency()); | 358 node->set_total_latency(max_latency + node->latency()); |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 | 361 |
| 362 } // namespace compiler | 362 } // namespace compiler |
| 363 } // namespace internal | 363 } // namespace internal |
| 364 } // namespace v8 | 364 } // namespace v8 |
| OLD | NEW |