OLD | NEW |
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 { | 22 namespace { |
23 static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = { | 23 static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = { |
24 0, 1, 2, 3, 4, 5, 6, 7}; | 24 0, 1, 2, 3, 4, 5, 6, 7}; |
25 static int allocatable_double_codes[InstructionSequenceTest::kDefaultNRegs] = { | |
26 0, 1, 2, 3, 4, 5, 6, 7}; | |
27 } | 25 } |
28 | 26 |
29 | |
30 static void InitializeRegisterNames() { | 27 static void InitializeRegisterNames() { |
31 char* loc = register_names_; | 28 char* loc = register_names_; |
32 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) { | 29 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) { |
33 general_register_names_[i] = loc; | 30 general_register_names_[i] = loc; |
34 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); | 31 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); |
35 *loc++ = 0; | 32 *loc++ = 0; |
36 } | 33 } |
37 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) { | 34 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) { |
38 double_register_names_[i] = loc; | 35 double_register_names_[i] = loc; |
39 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; | 36 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return config()->GetAllocatableSimd128Code(index); | 82 return config()->GetAllocatableSimd128Code(index); |
86 default: | 83 default: |
87 return config()->GetAllocatableGeneralCode(index); | 84 return config()->GetAllocatableGeneralCode(index); |
88 } | 85 } |
89 } | 86 } |
90 | 87 |
91 RegisterConfiguration* InstructionSequenceTest::config() { | 88 RegisterConfiguration* InstructionSequenceTest::config() { |
92 if (!config_) { | 89 if (!config_) { |
93 config_.reset(new RegisterConfiguration( | 90 config_.reset(new RegisterConfiguration( |
94 num_general_registers_, num_double_registers_, num_general_registers_, | 91 num_general_registers_, num_double_registers_, num_general_registers_, |
95 num_double_registers_, num_double_registers_, allocatable_codes, | 92 num_double_registers_, allocatable_codes, allocatable_codes, |
96 allocatable_double_codes, | |
97 kSimpleFPAliasing ? RegisterConfiguration::OVERLAP | 93 kSimpleFPAliasing ? RegisterConfiguration::OVERLAP |
98 : RegisterConfiguration::COMBINE, | 94 : RegisterConfiguration::COMBINE, |
99 general_register_names_, | 95 general_register_names_, |
100 double_register_names_, // float register names | 96 double_register_names_, // float register names |
101 double_register_names_, | 97 double_register_names_, |
102 double_register_names_)); // SIMD 128 register names | 98 double_register_names_)); // SIMD 128 register names |
103 } | 99 } |
104 return config_.get(); | 100 return config_.get(); |
105 } | 101 } |
106 | 102 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 | 555 |
560 | 556 |
561 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { | 557 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { |
562 sequence()->AddInstruction(instruction); | 558 sequence()->AddInstruction(instruction); |
563 return instruction; | 559 return instruction; |
564 } | 560 } |
565 | 561 |
566 } // namespace compiler | 562 } // namespace compiler |
567 } // namespace internal | 563 } // namespace internal |
568 } // namespace v8 | 564 } // namespace v8 |
OLD | NEW |