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/bytecode-register.h" | 9 #include "src/interpreter/bytecode-register.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 #define VALUE(Name, _) OperandScale::k##Name, | 81 #define VALUE(Name, _) OperandScale::k##Name, |
82 OPERAND_SCALE_LIST(VALUE) | 82 OPERAND_SCALE_LIST(VALUE) |
83 #undef VALUE | 83 #undef VALUE |
84 }; | 84 }; |
85 | 85 |
86 for (OperandScale operand_scale : kOperandScales) { | 86 for (OperandScale operand_scale : kOperandScales) { |
87 int scale = static_cast<int>(operand_scale); | 87 int scale = static_cast<int>(operand_scale); |
88 CHECK_EQ(Bytecodes::Size(Bytecode::kCallRuntime, operand_scale), | 88 CHECK_EQ(Bytecodes::Size(Bytecode::kCallRuntime, operand_scale), |
89 1 + 2 + 2 * scale); | 89 1 + 2 + 2 * scale); |
90 CHECK_EQ(Bytecodes::Size(Bytecode::kCreateObjectLiteral, operand_scale), | 90 CHECK_EQ(Bytecodes::Size(Bytecode::kCreateObjectLiteral, operand_scale), |
91 1 + 2 * scale + 1); | 91 1 + 2 * scale + 1 + 1 * scale); |
92 CHECK_EQ(Bytecodes::Size(Bytecode::kTestIn, operand_scale), 1 + scale); | 92 CHECK_EQ(Bytecodes::Size(Bytecode::kTestIn, operand_scale), 1 + scale); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 TEST(Bytecodes, RegisterOperands) { | 96 TEST(Bytecodes, RegisterOperands) { |
97 CHECK(Bytecodes::IsRegisterOperandType(OperandType::kReg)); | 97 CHECK(Bytecodes::IsRegisterOperandType(OperandType::kReg)); |
98 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::kReg)); | 98 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::kReg)); |
99 CHECK(!Bytecodes::IsRegisterOutputOperandType(OperandType::kReg)); | 99 CHECK(!Bytecodes::IsRegisterOutputOperandType(OperandType::kReg)); |
100 CHECK(!Bytecodes::IsRegisterInputOperandType(OperandType::kRegOut)); | 100 CHECK(!Bytecodes::IsRegisterInputOperandType(OperandType::kRegOut)); |
101 CHECK(Bytecodes::IsRegisterOutputOperandType(OperandType::kRegOut)); | 101 CHECK(Bytecodes::IsRegisterOutputOperandType(OperandType::kRegOut)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 std::set<std::string> names; | 240 std::set<std::string> names; |
241 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone)); | 241 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone)); |
242 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead)); | 242 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead)); |
243 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite)); | 243 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite)); |
244 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite)); | 244 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite)); |
245 CHECK_EQ(names.size(), 4); | 245 CHECK_EQ(names.size(), 4); |
246 } | 246 } |
247 } // namespace interpreter | 247 } // namespace interpreter |
248 } // namespace internal | 248 } // namespace internal |
249 } // namespace v8 | 249 } // namespace v8 |
OLD | NEW |