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

Side by Side Diff: src/compiler/register-allocator.cc

Issue 1529293002: [turbofan] remove non-linearity in PopulateReferenceMaps (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/linkage.h" 6 #include "src/compiler/linkage.h"
7 #include "src/compiler/register-allocator.h" 7 #include "src/compiler/register-allocator.h"
8 #include "src/string-stream.h" 8 #include "src/string-stream.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after
3100 if (range->HasSpillOperand()) { 3100 if (range->HasSpillOperand()) {
3101 spill_operand = *range->GetSpillOperand(); 3101 spill_operand = *range->GetSpillOperand();
3102 } else { 3102 } else {
3103 spill_operand = range->GetSpillRangeOperand(); 3103 spill_operand = range->GetSpillRangeOperand();
3104 } 3104 }
3105 DCHECK(spill_operand.IsStackSlot()); 3105 DCHECK(spill_operand.IsStackSlot());
3106 DCHECK_EQ(MachineRepresentation::kTagged, 3106 DCHECK_EQ(MachineRepresentation::kTagged,
3107 AllocatedOperand::cast(spill_operand).representation()); 3107 AllocatedOperand::cast(spill_operand).representation());
3108 } 3108 }
3109 3109
3110 LiveRange* cur = range;
3110 // Step through the safe points to see whether they are in the range. 3111 // Step through the safe points to see whether they are in the range.
3111 for (auto it = first_it; it != reference_maps->end(); ++it) { 3112 for (auto it = first_it; it != reference_maps->end(); ++it) {
3112 auto map = *it; 3113 auto map = *it;
3113 int safe_point = map->instruction_position(); 3114 int safe_point = map->instruction_position();
3114 3115
3115 // The safe points are sorted so we can stop searching here. 3116 // The safe points are sorted so we can stop searching here.
3116 if (safe_point - 1 > end) break; 3117 if (safe_point - 1 > end) break;
3117 3118
3118 // Advance to the next active range that covers the current 3119 // Advance to the next active range that covers the current
3119 // safe point position. 3120 // safe point position.
3120 auto safe_point_pos = 3121 auto safe_point_pos =
3121 LifetimePosition::InstructionFromInstructionIndex(safe_point); 3122 LifetimePosition::InstructionFromInstructionIndex(safe_point);
3122 LiveRange* cur = range; 3123
3123 while (cur != nullptr && !cur->Covers(safe_point_pos)) { 3124 // Search for the child range (cur) that covers safe_point_pos. If we
3124 cur = cur->next(); 3125 // don't find it before the children pass safe_point_pos, keep cur at
3126 // the last child, because the next safe_point_pos may be covered by cur.
3127 // This may happen if cur has more than one interval, and the current
3128 // safe_point_pos is in between intervals.
3129 // For that reason, cur may be at most the last child.
3130 DCHECK_NOT_NULL(cur);
Jarin 2015/12/17 08:51:37 I am wondering whether we could nopt do some sanit
Mircea Trofin 2015/12/17 16:50:57 Done.
3131 bool found = false;
3132 while (!found) {
3133 if (cur->Covers(safe_point_pos)) {
3134 found = true;
3135 } else {
3136 LiveRange* next = cur->next();
3137 if (next == nullptr || next->Start() > safe_point_pos) {
3138 break;
3139 }
3140 cur = next;
3141 }
3125 } 3142 }
3126 if (cur == nullptr) continue; 3143
3144 if (!found) {
3145 continue;
3146 }
3127 3147
3128 // Check if the live range is spilled and the safe point is after 3148 // Check if the live range is spilled and the safe point is after
3129 // the spill position. 3149 // the spill position.
3130 int spill_index = range->IsSpilledOnlyInDeferredBlocks() 3150 int spill_index = range->IsSpilledOnlyInDeferredBlocks()
3131 ? cur->Start().ToInstructionIndex() 3151 ? cur->Start().ToInstructionIndex()
3132 : range->spill_start_index(); 3152 : range->spill_start_index();
3133 3153
3134 if (!spill_operand.IsInvalid() && safe_point >= spill_index) { 3154 if (!spill_operand.IsInvalid() && safe_point >= spill_index) {
3135 TRACE("Pointer for range %d (spilled at %d) at safe point %d\n", 3155 TRACE("Pointer for range %d (spilled at %d) at safe point %d\n",
3136 range->vreg(), spill_index, safe_point); 3156 range->vreg(), spill_index, safe_point);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3449 auto eliminate = moves->PrepareInsertAfter(move); 3469 auto eliminate = moves->PrepareInsertAfter(move);
3450 to_insert.push_back(move); 3470 to_insert.push_back(move);
3451 if (eliminate != nullptr) to_eliminate.push_back(eliminate); 3471 if (eliminate != nullptr) to_eliminate.push_back(eliminate);
3452 } 3472 }
3453 } 3473 }
3454 3474
3455 3475
3456 } // namespace compiler 3476 } // namespace compiler
3457 } // namespace internal 3477 } // namespace internal
3458 } // namespace v8 3478 } // 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