OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/interpreter/bytecodes.h" | 9 #include "src/interpreter/bytecodes.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 Register s = Register::FromOperand(operand_value); | 35 Register s = Register::FromOperand(operand_value); |
36 CHECK_EQ(i, s.ToParameterIndex(parameter_count)); | 36 CHECK_EQ(i, s.ToParameterIndex(parameter_count)); |
37 } | 37 } |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 TEST(OperandConversion, RegistersParametersNoOverlap) { | 42 TEST(OperandConversion, RegistersParametersNoOverlap) { |
43 std::vector<uint8_t> operand_count(256); | 43 std::vector<uint8_t> operand_count(256); |
44 | 44 |
45 for (int i = 0; i <= Register::kMaxRegisterIndex; i++) { | 45 for (int i = 0; i <= kMaxInt8; i++) { |
46 Register r = Register(i); | 46 Register r = Register(i); |
47 uint8_t operand = r.ToOperand(); | 47 uint8_t operand = r.ToOperand(); |
48 operand_count[operand] += 1; | 48 operand_count[operand] += 1; |
49 CHECK_EQ(operand_count[operand], 1); | 49 CHECK_EQ(operand_count[operand], 1); |
50 } | 50 } |
51 | 51 |
52 int parameter_count = Register::MaxParameterIndex() + 1; | 52 int parameter_count = Register::MaxParameterIndex() + 1; |
53 for (int i = 0; i < parameter_count; i++) { | 53 for (int i = 0; i < parameter_count; i++) { |
54 Register r = Register::FromParameterIndex(i, parameter_count); | 54 Register r = Register::FromParameterIndex(i, parameter_count); |
55 uint8_t operand = r.ToOperand(); | 55 uint8_t operand = r.ToOperand(); |
56 operand_count[operand] += 1; | 56 operand_count[operand] += 1; |
57 CHECK_EQ(operand_count[operand], 1); | 57 CHECK_EQ(operand_count[operand], 1); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 } // namespace interpreter | 61 } // namespace interpreter |
62 } // namespace internal | 62 } // namespace internal |
63 } // namespace v8 | 63 } // namespace v8 |
OLD | NEW |