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

Side by Side Diff: test/unittests/compiler/instruction-sequence-unittest.cc

Issue 2433093002: MIPS: Fix bad RegisterConfiguration usage in InstructionSequence unit tests. (Closed)
Patch Set: Rebase to master Created 4 years, 1 month 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/base/utils/random-number-generator.h" 5 #include "src/base/utils/random-number-generator.h"
6 #include "src/compiler/pipeline.h" 6 #include "src/compiler/pipeline.h"
7 #include "test/unittests/compiler/instruction-sequence-unittest.h" 7 #include "test/unittests/compiler/instruction-sequence-unittest.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 static const char* 15 static const char*
16 general_register_names_[RegisterConfiguration::kMaxGeneralRegisters]; 16 general_register_names_[RegisterConfiguration::kMaxGeneralRegisters];
17 static const char* 17 static const char*
18 double_register_names_[RegisterConfiguration::kMaxFPRegisters]; 18 double_register_names_[RegisterConfiguration::kMaxFPRegisters];
19 static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters + 19 static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters +
20 RegisterConfiguration::kMaxFPRegisters)]; 20 RegisterConfiguration::kMaxFPRegisters)];
21 21
22 namespace {
23 static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = {
24 0, 1, 2, 3, 4, 5, 6, 7};
25 }
26
27 static void InitializeRegisterNames() { 22 static void InitializeRegisterNames() {
28 char* loc = register_names_; 23 char* loc = register_names_;
29 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) { 24 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) {
30 general_register_names_[i] = loc; 25 general_register_names_[i] = loc;
31 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); 26 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i);
32 *loc++ = 0; 27 *loc++ = 0;
33 } 28 }
34 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) { 29 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) {
35 double_register_names_[i] = loc; 30 double_register_names_[i] = loc;
36 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; 31 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return config()->GetAllocatableFloatCode(index); 73 return config()->GetAllocatableFloatCode(index);
79 case MachineRepresentation::kFloat64: 74 case MachineRepresentation::kFloat64:
80 return config()->GetAllocatableDoubleCode(index); 75 return config()->GetAllocatableDoubleCode(index);
81 case MachineRepresentation::kSimd128: 76 case MachineRepresentation::kSimd128:
82 return config()->GetAllocatableSimd128Code(index); 77 return config()->GetAllocatableSimd128Code(index);
83 default: 78 default:
84 return config()->GetAllocatableGeneralCode(index); 79 return config()->GetAllocatableGeneralCode(index);
85 } 80 }
86 } 81 }
87 82
88 RegisterConfiguration* InstructionSequenceTest::config() { 83 const RegisterConfiguration* InstructionSequenceTest::config() {
89 if (!config_) { 84 return sequence()->GetRegisterConfigurationForTesting();
90 config_.reset(new RegisterConfiguration(
91 num_general_registers_, num_double_registers_, num_general_registers_,
92 num_double_registers_, allocatable_codes, allocatable_codes,
93 kSimpleFPAliasing ? RegisterConfiguration::OVERLAP
94 : RegisterConfiguration::COMBINE,
95 general_register_names_,
96 double_register_names_, // float register names
97 double_register_names_,
98 double_register_names_)); // SIMD 128 register names
99 }
100 return config_.get();
101 } 85 }
102 86
103 87
104 InstructionSequence* InstructionSequenceTest::sequence() { 88 InstructionSequence* InstructionSequenceTest::sequence() {
105 if (sequence_ == nullptr) { 89 if (sequence_ == nullptr) {
106 sequence_ = new (zone()) 90 sequence_ = new (zone())
107 InstructionSequence(isolate(), zone(), &instruction_blocks_); 91 InstructionSequence(isolate(), zone(), &instruction_blocks_);
108 } 92 }
109 return sequence_; 93 return sequence_;
110 } 94 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 539
556 540
557 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { 541 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) {
558 sequence()->AddInstruction(instruction); 542 sequence()->AddInstruction(instruction);
559 return instruction; 543 return instruction;
560 } 544 }
561 545
562 } // namespace compiler 546 } // namespace compiler
563 } // namespace internal 547 } // namespace internal
564 } // namespace v8 548 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.h ('k') | test/unittests/compiler/register-allocator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698