| 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::kMaxDoubleRegisters]; | 18 double_register_names_[RegisterConfiguration::kMaxFPRegisters]; |
| 19 static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters + | 19 static char register_names_[10 * (RegisterConfiguration::kMaxGeneralRegisters + |
| 20 RegisterConfiguration::kMaxDoubleRegisters)]; | 20 RegisterConfiguration::kMaxFPRegisters)]; |
| 21 | |
| 22 | 21 |
| 23 namespace { | 22 namespace { |
| 24 static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = { | 23 static int allocatable_codes[InstructionSequenceTest::kDefaultNRegs] = { |
| 25 0, 1, 2, 3, 4, 5, 6, 7}; | 24 0, 1, 2, 3, 4, 5, 6, 7}; |
| 26 static int allocatable_double_codes[InstructionSequenceTest::kDefaultNRegs] = { | 25 static int allocatable_double_codes[InstructionSequenceTest::kDefaultNRegs] = { |
| 27 0, 1, 2, 3, 4, 5, 6, 7}; | 26 0, 1, 2, 3, 4, 5, 6, 7}; |
| 28 } | 27 } |
| 29 | 28 |
| 30 | 29 |
| 31 static void InitializeRegisterNames() { | 30 static void InitializeRegisterNames() { |
| 32 char* loc = register_names_; | 31 char* loc = register_names_; |
| 33 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) { | 32 for (int i = 0; i < RegisterConfiguration::kMaxGeneralRegisters; ++i) { |
| 34 general_register_names_[i] = loc; | 33 general_register_names_[i] = loc; |
| 35 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); | 34 loc += base::OS::SNPrintF(loc, 100, "gp_%d", i); |
| 36 *loc++ = 0; | 35 *loc++ = 0; |
| 37 } | 36 } |
| 38 for (int i = 0; i < RegisterConfiguration::kMaxDoubleRegisters; ++i) { | 37 for (int i = 0; i < RegisterConfiguration::kMaxFPRegisters; ++i) { |
| 39 double_register_names_[i] = loc; | 38 double_register_names_[i] = loc; |
| 40 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; | 39 loc += base::OS::SNPrintF(loc, 100, "fp_%d", i) + 1; |
| 41 *loc++ = 0; | 40 *loc++ = 0; |
| 42 } | 41 } |
| 43 } | 42 } |
| 44 | 43 |
| 45 | 44 |
| 46 InstructionSequenceTest::InstructionSequenceTest() | 45 InstructionSequenceTest::InstructionSequenceTest() |
| 47 : sequence_(nullptr), | 46 : sequence_(nullptr), |
| 48 num_general_registers_(kDefaultNRegs), | 47 num_general_registers_(kDefaultNRegs), |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 501 |
| 503 | 502 |
| 504 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { | 503 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { |
| 505 sequence()->AddInstruction(instruction); | 504 sequence()->AddInstruction(instruction); |
| 506 return instruction; | 505 return instruction; |
| 507 } | 506 } |
| 508 | 507 |
| 509 } // namespace compiler | 508 } // namespace compiler |
| 510 } // namespace internal | 509 } // namespace internal |
| 511 } // namespace v8 | 510 } // namespace v8 |
| OLD | NEW |