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

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

Issue 904693002: [turbofan] Remove global InstructionOperand caches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « src/compiler/register-allocator.cc ('k') | src/v8.cc » ('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 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/bit-vector.h" 5 #include "src/bit-vector.h"
6 #include "src/compiler/instruction.h" 6 #include "src/compiler/instruction.h"
7 #include "src/compiler/register-allocator-verifier.h" 7 #include "src/compiler/register-allocator-verifier.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 11 matching lines...) Expand all
22 static_cast<GapInstruction::InnerPosition>(i); 22 static_cast<GapInstruction::InnerPosition>(i);
23 CHECK(!gap->GetParallelMove(inner_pos)); 23 CHECK(!gap->GetParallelMove(inner_pos));
24 } 24 }
25 } 25 }
26 26
27 27
28 void RegisterAllocatorVerifier::VerifyInput( 28 void RegisterAllocatorVerifier::VerifyInput(
29 const OperandConstraint& constraint) { 29 const OperandConstraint& constraint) {
30 CHECK_NE(kSameAsFirst, constraint.type_); 30 CHECK_NE(kSameAsFirst, constraint.type_);
31 if (constraint.type_ != kImmediate) { 31 if (constraint.type_ != kImmediate) {
32 CHECK_NE(UnallocatedOperand::kInvalidVirtualRegister, 32 CHECK_NE(InstructionOperand::kInvalidVirtualRegister,
33 constraint.virtual_register_); 33 constraint.virtual_register_);
34 } 34 }
35 } 35 }
36 36
37 37
38 void RegisterAllocatorVerifier::VerifyTemp( 38 void RegisterAllocatorVerifier::VerifyTemp(
39 const OperandConstraint& constraint) { 39 const OperandConstraint& constraint) {
40 CHECK_NE(kSameAsFirst, constraint.type_); 40 CHECK_NE(kSameAsFirst, constraint.type_);
41 CHECK_NE(kImmediate, constraint.type_); 41 CHECK_NE(kImmediate, constraint.type_);
42 CHECK_NE(kConstant, constraint.type_); 42 CHECK_NE(kConstant, constraint.type_);
43 } 43 }
44 44
45 45
46 void RegisterAllocatorVerifier::VerifyOutput( 46 void RegisterAllocatorVerifier::VerifyOutput(
47 const OperandConstraint& constraint) { 47 const OperandConstraint& constraint) {
48 CHECK_NE(kImmediate, constraint.type_); 48 CHECK_NE(kImmediate, constraint.type_);
49 CHECK_NE(UnallocatedOperand::kInvalidVirtualRegister, 49 CHECK_NE(InstructionOperand::kInvalidVirtualRegister,
50 constraint.virtual_register_); 50 constraint.virtual_register_);
51 } 51 }
52 52
53 53
54 RegisterAllocatorVerifier::RegisterAllocatorVerifier( 54 RegisterAllocatorVerifier::RegisterAllocatorVerifier(
55 Zone* zone, const RegisterConfiguration* config, 55 Zone* zone, const RegisterConfiguration* config,
56 const InstructionSequence* sequence) 56 const InstructionSequence* sequence)
57 : zone_(zone), config_(config), sequence_(sequence), constraints_(zone) { 57 : zone_(zone), config_(config), sequence_(sequence), constraints_(zone) {
58 constraints_.reserve(sequence->instructions().size()); 58 constraints_.reserve(sequence->instructions().size());
59 // TODO(dcarney): model unique constraints. 59 // TODO(dcarney): model unique constraints.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 CheckConstraint(instr->OutputAt(i), &op_constraints[count]); 113 CheckConstraint(instr->OutputAt(i), &op_constraints[count]);
114 } 114 }
115 ++instr_it; 115 ++instr_it;
116 } 116 }
117 } 117 }
118 118
119 119
120 void RegisterAllocatorVerifier::BuildConstraint(const InstructionOperand* op, 120 void RegisterAllocatorVerifier::BuildConstraint(const InstructionOperand* op,
121 OperandConstraint* constraint) { 121 OperandConstraint* constraint) {
122 constraint->value_ = kMinInt; 122 constraint->value_ = kMinInt;
123 constraint->virtual_register_ = UnallocatedOperand::kInvalidVirtualRegister; 123 constraint->virtual_register_ = InstructionOperand::kInvalidVirtualRegister;
124 if (op->IsConstant()) { 124 if (op->IsConstant()) {
125 constraint->type_ = kConstant; 125 constraint->type_ = kConstant;
126 constraint->value_ = ConstantOperand::cast(op)->index(); 126 constraint->value_ = ConstantOperand::cast(op)->index();
127 constraint->virtual_register_ = constraint->value_; 127 constraint->virtual_register_ = constraint->value_;
128 } else if (op->IsImmediate()) { 128 } else if (op->IsImmediate()) {
129 constraint->type_ = kImmediate; 129 constraint->type_ = kImmediate;
130 constraint->value_ = ImmediateOperand::cast(op)->index(); 130 constraint->value_ = ImmediateOperand::cast(op)->index();
131 } else { 131 } else {
132 CHECK(op->IsUnallocated()); 132 CHECK(op->IsUnallocated());
133 const auto* unallocated = UnallocatedOperand::cast(op); 133 const auto* unallocated = UnallocatedOperand::cast(op);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 case kSameAsFirst: 210 case kSameAsFirst:
211 CHECK(false); 211 CHECK(false);
212 return; 212 return;
213 } 213 }
214 } 214 }
215 215
216 namespace { 216 namespace {
217 217
218 typedef BasicBlock::RpoNumber Rpo; 218 typedef BasicBlock::RpoNumber Rpo;
219 219
220 static const int kInvalidVreg = UnallocatedOperand::kInvalidVirtualRegister; 220 static const int kInvalidVreg = InstructionOperand::kInvalidVirtualRegister;
221 221
222 struct PhiData : public ZoneObject { 222 struct PhiData : public ZoneObject {
223 PhiData(Rpo definition_rpo, const PhiInstruction* phi, int first_pred_vreg, 223 PhiData(Rpo definition_rpo, const PhiInstruction* phi, int first_pred_vreg,
224 const PhiData* first_pred_phi, Zone* zone) 224 const PhiData* first_pred_phi, Zone* zone)
225 : definition_rpo(definition_rpo), 225 : definition_rpo(definition_rpo),
226 virtual_register(phi->virtual_register()), 226 virtual_register(phi->virtual_register()),
227 first_pred_vreg(first_pred_vreg), 227 first_pred_vreg(first_pred_vreg),
228 first_pred_phi(first_pred_phi), 228 first_pred_phi(first_pred_phi),
229 operands(zone) { 229 operands(zone) {
230 operands.reserve(phi->operands().size()); 230 operands.reserve(phi->operands().size());
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 int virtual_register = op_constraints[count].virtual_register_; 662 int virtual_register = op_constraints[count].virtual_register_;
663 current->Define(zone(), instr->OutputAt(i), virtual_register); 663 current->Define(zone(), instr->OutputAt(i), virtual_register);
664 } 664 }
665 } 665 }
666 } 666 }
667 } 667 }
668 668
669 } // namespace compiler 669 } // namespace compiler
670 } // namespace internal 670 } // namespace internal
671 } // namespace v8 671 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/register-allocator.cc ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698