| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 + 1 * scale); | 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::IsRegisterOperandType(OperandType::kRegPair)); |
| 98 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::kReg)); | 99 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::kReg)); |
| 100 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::kRegPair)); |
| 101 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::kRegList)); |
| 99 CHECK(!Bytecodes::IsRegisterOutputOperandType(OperandType::kReg)); | 102 CHECK(!Bytecodes::IsRegisterOutputOperandType(OperandType::kReg)); |
| 100 CHECK(!Bytecodes::IsRegisterInputOperandType(OperandType::kRegOut)); | 103 CHECK(!Bytecodes::IsRegisterInputOperandType(OperandType::kRegOut)); |
| 101 CHECK(Bytecodes::IsRegisterOutputOperandType(OperandType::kRegOut)); | 104 CHECK(Bytecodes::IsRegisterOutputOperandType(OperandType::kRegOut)); |
| 102 | 105 CHECK(Bytecodes::IsRegisterOutputOperandType(OperandType::kRegOutPair)); |
| 103 #define IS_REGISTER_OPERAND_TYPE(Name, _) \ | |
| 104 CHECK(Bytecodes::IsRegisterOperandType(OperandType::k##Name)); | |
| 105 REGISTER_OPERAND_TYPE_LIST(IS_REGISTER_OPERAND_TYPE) | |
| 106 #undef IS_REGISTER_OPERAND_TYPE | |
| 107 | |
| 108 #define IS_NOT_REGISTER_OPERAND_TYPE(Name, _) \ | |
| 109 CHECK(!Bytecodes::IsRegisterOperandType(OperandType::k##Name)); | |
| 110 NON_REGISTER_OPERAND_TYPE_LIST(IS_NOT_REGISTER_OPERAND_TYPE) | |
| 111 #undef IS_NOT_REGISTER_OPERAND_TYPE | |
| 112 | |
| 113 #define IS_REGISTER_INPUT_OPERAND_TYPE(Name, _) \ | |
| 114 CHECK(Bytecodes::IsRegisterInputOperandType(OperandType::k##Name)); | |
| 115 REGISTER_INPUT_OPERAND_TYPE_LIST(IS_REGISTER_INPUT_OPERAND_TYPE) | |
| 116 #undef IS_REGISTER_INPUT_OPERAND_TYPE | |
| 117 | |
| 118 #define IS_NOT_REGISTER_INPUT_OPERAND_TYPE(Name, _) \ | |
| 119 CHECK(!Bytecodes::IsRegisterInputOperandType(OperandType::k##Name)); | |
| 120 NON_REGISTER_OPERAND_TYPE_LIST(IS_NOT_REGISTER_INPUT_OPERAND_TYPE); | |
| 121 REGISTER_OUTPUT_OPERAND_TYPE_LIST(IS_NOT_REGISTER_INPUT_OPERAND_TYPE) | |
| 122 #undef IS_NOT_REGISTER_INPUT_OPERAND_TYPE | |
| 123 | |
| 124 #define IS_REGISTER_OUTPUT_OPERAND_TYPE(Name, _) \ | |
| 125 CHECK(Bytecodes::IsRegisterOutputOperandType(OperandType::k##Name)); | |
| 126 REGISTER_OUTPUT_OPERAND_TYPE_LIST(IS_REGISTER_OUTPUT_OPERAND_TYPE) | |
| 127 #undef IS_REGISTER_OUTPUT_OPERAND_TYPE | |
| 128 | |
| 129 #define IS_NOT_REGISTER_OUTPUT_OPERAND_TYPE(Name, _) \ | |
| 130 CHECK(!Bytecodes::IsRegisterOutputOperandType(OperandType::k##Name)); | |
| 131 NON_REGISTER_OPERAND_TYPE_LIST(IS_NOT_REGISTER_OUTPUT_OPERAND_TYPE) | |
| 132 REGISTER_INPUT_OPERAND_TYPE_LIST(IS_NOT_REGISTER_OUTPUT_OPERAND_TYPE) | |
| 133 #undef IS_NOT_REGISTER_INPUT_OPERAND_TYPE | |
| 134 } | 106 } |
| 135 | 107 |
| 136 TEST(Bytecodes, DebugBreakExistForEachBytecode) { | 108 TEST(Bytecodes, DebugBreakExistForEachBytecode) { |
| 137 static const OperandScale kOperandScale = OperandScale::kSingle; | 109 static const OperandScale kOperandScale = OperandScale::kSingle; |
| 138 #define CHECK_DEBUG_BREAK_SIZE(Name, ...) \ | 110 #define CHECK_DEBUG_BREAK_SIZE(Name, ...) \ |
| 139 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name) && \ | 111 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name) && \ |
| 140 !Bytecodes::IsPrefixScalingBytecode(Bytecode::k##Name)) { \ | 112 !Bytecodes::IsPrefixScalingBytecode(Bytecode::k##Name)) { \ |
| 141 Bytecode debug_bytecode = Bytecodes::GetDebugBreak(Bytecode::k##Name); \ | 113 Bytecode debug_bytecode = Bytecodes::GetDebugBreak(Bytecode::k##Name); \ |
| 142 CHECK_EQ(Bytecodes::Size(Bytecode::k##Name, kOperandScale), \ | 114 CHECK_EQ(Bytecodes::Size(Bytecode::k##Name, kOperandScale), \ |
| 143 Bytecodes::Size(debug_bytecode, kOperandScale)); \ | 115 Bytecodes::Size(debug_bytecode, kOperandScale)); \ |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 AccumulatorUse::kWrite); | 233 AccumulatorUse::kWrite); |
| 262 CHECK(Bytecodes::ReadsAccumulator(Bytecode::kAdd)); | 234 CHECK(Bytecodes::ReadsAccumulator(Bytecode::kAdd)); |
| 263 CHECK(Bytecodes::WritesAccumulator(Bytecode::kAdd)); | 235 CHECK(Bytecodes::WritesAccumulator(Bytecode::kAdd)); |
| 264 CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kAdd), | 236 CHECK_EQ(Bytecodes::GetAccumulatorUse(Bytecode::kAdd), |
| 265 AccumulatorUse::kReadWrite); | 237 AccumulatorUse::kReadWrite); |
| 266 } | 238 } |
| 267 | 239 |
| 268 } // namespace interpreter | 240 } // namespace interpreter |
| 269 } // namespace internal | 241 } // namespace internal |
| 270 } // namespace v8 | 242 } // namespace v8 |
| OLD | NEW |