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

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

Issue 2587593002: Revert of MIPS: Fix bad RegisterConfiguration usage in InstructionSequence unit tests. (Closed)
Patch Set: Created 4 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/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
22 static void InitializeRegisterNames() { 27 static void InitializeRegisterNames() {
23 char* loc = register_names_; 28 char* loc = register_names_;
24 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) { 29 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) {
25 general_register_names_[i] = loc; 30 general_register_names_[i] = loc;
26 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); 31 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i);
27 *loc++ = 0; 32 *loc++ = 0;
28 } 33 }
29 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) { 34 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) {
30 double_register_names_[i] = loc; 35 double_register_names_[i] = loc;
31 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; 36 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return config()->GetAllocatableFloatCode(index); 78 return config()->GetAllocatableFloatCode(index);
74 case MachineRepresentation::kFloat64: 79 case MachineRepresentation::kFloat64:
75 return config()->GetAllocatableDoubleCode(index); 80 return config()->GetAllocatableDoubleCode(index);
76 case MachineRepresentation::kSimd128: 81 case MachineRepresentation::kSimd128:
77 return config()->GetAllocatableSimd128Code(index); 82 return config()->GetAllocatableSimd128Code(index);
78 default: 83 default:
79 return config()->GetAllocatableGeneralCode(index); 84 return config()->GetAllocatableGeneralCode(index);
80 } 85 }
81 } 86 }
82 87
83 const RegisterConfiguration* InstructionSequenceTest::config() { 88 RegisterConfiguration* InstructionSequenceTest::config() {
84 return sequence()->GetRegisterConfigurationForTesting(); 89 if (!config_) {
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();
85 } 101 }
86 102
87 103
88 InstructionSequence* InstructionSequenceTest::sequence() { 104 InstructionSequence* InstructionSequenceTest::sequence() {
89 if (sequence_ == nullptr) { 105 if (sequence_ == nullptr) {
90 sequence_ = new (zone()) 106 sequence_ = new (zone())
91 InstructionSequence(isolate(), zone(), &instruction_blocks_); 107 InstructionSequence(isolate(), zone(), &instruction_blocks_);
92 } 108 }
93 return sequence_; 109 return sequence_;
94 } 110 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 555
540 556
541 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { 557 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) {
542 sequence()->AddInstruction(instruction); 558 sequence()->AddInstruction(instruction);
543 return instruction; 559 return instruction;
544 } 560 }
545 561
546 } // namespace compiler 562 } // namespace compiler
547 } // namespace internal 563 } // namespace internal
548 } // namespace v8 564 } // 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