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

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

Issue 2284373002: [turbofan] Instruction scheduler: keep ready nodes with same latency sorted in original order. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698