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

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

Issue 809333002: [turbofan] Implement OSR for outer loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 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
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/compiler/linkage.h" 5 #include "src/compiler/linkage.h"
6 #include "src/compiler/register-allocator.h" 6 #include "src/compiler/register-allocator.h"
7 #include "src/string-stream.h" 7 #include "src/string-stream.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 auto output_operand = last_instruction->OutputAt(i); 1075 auto output_operand = last_instruction->OutputAt(i);
1076 DCHECK(!output_operand->IsConstant()); 1076 DCHECK(!output_operand->IsConstant());
1077 auto output = UnallocatedOperand::cast(output_operand); 1077 auto output = UnallocatedOperand::cast(output_operand);
1078 int output_vreg = output->virtual_register(); 1078 int output_vreg = output->virtual_register();
1079 auto range = LiveRangeFor(output_vreg); 1079 auto range = LiveRangeFor(output_vreg);
1080 bool assigned = false; 1080 bool assigned = false;
1081 if (output->HasFixedPolicy()) { 1081 if (output->HasFixedPolicy()) {
1082 AllocateFixed(output, -1, false); 1082 AllocateFixed(output, -1, false);
1083 // This value is produced on the stack, we never need to spill it. 1083 // This value is produced on the stack, we never need to spill it.
1084 if (output->IsStackSlot()) { 1084 if (output->IsStackSlot()) {
1085 DCHECK(output->index() < 0); 1085 DCHECK(output->index() < frame_->GetSpillSlotCount());
1086 range->SetSpillOperand(output); 1086 range->SetSpillOperand(output);
1087 range->SetSpillStartIndex(end); 1087 range->SetSpillStartIndex(end);
1088 assigned = true; 1088 assigned = true;
1089 } 1089 }
1090 1090
1091 for (auto succ : block->successors()) { 1091 for (auto succ : block->successors()) {
1092 const InstructionBlock* successor = code()->InstructionBlockAt(succ); 1092 const InstructionBlock* successor = code()->InstructionBlockAt(succ);
1093 DCHECK(successor->PredecessorCount() == 1); 1093 DCHECK(successor->PredecessorCount() == 1);
1094 int gap_index = successor->first_instruction_index() + 1; 1094 int gap_index = successor->first_instruction_index() + 1;
1095 DCHECK(code()->IsGapAt(gap_index)); 1095 DCHECK(code()->IsGapAt(gap_index));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 auto first_output = UnallocatedOperand::cast(output); 1141 auto first_output = UnallocatedOperand::cast(output);
1142 auto range = LiveRangeFor(first_output->virtual_register()); 1142 auto range = LiveRangeFor(first_output->virtual_register());
1143 bool assigned = false; 1143 bool assigned = false;
1144 if (first_output->HasFixedPolicy()) { 1144 if (first_output->HasFixedPolicy()) {
1145 auto output_copy = first_output->CopyUnconstrained(code_zone()); 1145 auto output_copy = first_output->CopyUnconstrained(code_zone());
1146 bool is_tagged = HasTaggedValue(first_output->virtual_register()); 1146 bool is_tagged = HasTaggedValue(first_output->virtual_register());
1147 AllocateFixed(first_output, gap_index, is_tagged); 1147 AllocateFixed(first_output, gap_index, is_tagged);
1148 1148
1149 // This value is produced on the stack, we never need to spill it. 1149 // This value is produced on the stack, we never need to spill it.
1150 if (first_output->IsStackSlot()) { 1150 if (first_output->IsStackSlot()) {
1151 DCHECK(first_output->index() < 0); 1151 DCHECK(first_output->index() < frame_->GetSpillSlotCount());
1152 range->SetSpillOperand(first_output); 1152 range->SetSpillOperand(first_output);
1153 range->SetSpillStartIndex(gap_index - 1); 1153 range->SetSpillStartIndex(gap_index - 1);
1154 assigned = true; 1154 assigned = true;
1155 } 1155 }
1156 code()->AddGapMove(gap_index, first_output, output_copy); 1156 code()->AddGapMove(gap_index, first_output, output_copy);
1157 } 1157 }
1158 1158
1159 // Make sure we add a gap move for spilling (if we have not done 1159 // Make sure we add a gap move for spilling (if we have not done
1160 // so already). 1160 // so already).
1161 if (!assigned) { 1161 if (!assigned) {
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 } else { 2547 } else {
2548 DCHECK(range->Kind() == GENERAL_REGISTERS); 2548 DCHECK(range->Kind() == GENERAL_REGISTERS);
2549 assigned_registers_->Add(reg); 2549 assigned_registers_->Add(reg);
2550 } 2550 }
2551 range->set_assigned_register(reg, code_zone()); 2551 range->set_assigned_register(reg, code_zone());
2552 } 2552 }
2553 2553
2554 } // namespace compiler 2554 } // namespace compiler
2555 } // namespace internal 2555 } // namespace internal
2556 } // namespace v8 2556 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698