| 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 "test/unittests/compiler/interpreter-assembler-unittest.h" | 5 #include "test/unittests/compiler/interpreter-assembler-unittest.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
| 10 #include "src/interface-descriptors.h" | 10 #include "src/interface-descriptors.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 #elif V8_TARGET_BIG_ENDIAN | 133 #elif V8_TARGET_BIG_ENDIAN |
| 134 return IsWordOr(IsWordShl(first_byte, IsInt32Constant(kBitsPerByte)), | 134 return IsWordOr(IsWordShl(first_byte, IsInt32Constant(kBitsPerByte)), |
| 135 second_byte); | 135 second_byte); |
| 136 #else | 136 #else |
| 137 #error "Unknown Architecture" | 137 #error "Unknown Architecture" |
| 138 #endif | 138 #endif |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 | 142 |
| 143 Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest:: |
| 144 IsBytecodeOperandShortSignExtended(int offset) { |
| 145 Matcher<Node*> load_matcher; |
| 146 if (TargetSupportsUnalignedAccess()) { |
| 147 load_matcher = IsLoad( |
| 148 MachineType::Int16(), |
| 149 IsParameter(Linkage::kInterpreterBytecodeArrayParameter), |
| 150 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), |
| 151 IsInt32Constant(offset))); |
| 152 } else { |
| 153 #if V8_TARGET_LITTLE_ENDIAN |
| 154 int hi_byte_offset = offset + 1; |
| 155 int lo_byte_offset = offset; |
| 156 |
| 157 #elif V8_TARGET_BIG_ENDIAN |
| 158 int hi_byte_offset = offset; |
| 159 int lo_byte_offset = offset + 1; |
| 160 #else |
| 161 #error "Unknown Architecture" |
| 162 #endif |
| 163 Matcher<Node*> hi_byte = IsLoad( |
| 164 MachineType::Int8(), |
| 165 IsParameter(Linkage::kInterpreterBytecodeArrayParameter), |
| 166 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), |
| 167 IsInt32Constant(hi_byte_offset))); |
| 168 hi_byte = IsWord32Shl(hi_byte, IsInt32Constant(kBitsPerByte)); |
| 169 Matcher<Node*> lo_byte = IsLoad( |
| 170 MachineType::Uint8(), |
| 171 IsParameter(Linkage::kInterpreterBytecodeArrayParameter), |
| 172 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), |
| 173 IsInt32Constant(lo_byte_offset))); |
| 174 load_matcher = IsWord32Or(hi_byte, lo_byte); |
| 175 } |
| 176 |
| 177 if (kPointerSize == 8) { |
| 178 load_matcher = IsChangeInt32ToInt64(load_matcher); |
| 179 } |
| 180 return load_matcher; |
| 181 } |
| 182 |
| 183 |
| 143 TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) { | 184 TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) { |
| 144 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { | 185 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
| 145 InterpreterAssemblerForTest m(this, bytecode); | 186 InterpreterAssemblerForTest m(this, bytecode); |
| 146 m.Dispatch(); | 187 m.Dispatch(); |
| 147 Graph* graph = m.graph(); | 188 Graph* graph = m.graph(); |
| 148 | 189 |
| 149 Node* end = graph->end(); | 190 Node* end = graph->end(); |
| 150 EXPECT_EQ(1, end->InputCount()); | 191 EXPECT_EQ(1, end->InputCount()); |
| 151 Node* tail_call_node = end->InputAt(0); | 192 Node* tail_call_node = end->InputAt(0); |
| 152 | 193 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 m.IsBytecodeOperandSignExtended(offset)); | 354 m.IsBytecodeOperandSignExtended(offset)); |
| 314 break; | 355 break; |
| 315 case interpreter::OperandType::kCount16: | 356 case interpreter::OperandType::kCount16: |
| 316 EXPECT_THAT(m.BytecodeOperandCount(i), | 357 EXPECT_THAT(m.BytecodeOperandCount(i), |
| 317 m.IsBytecodeOperandShort(offset)); | 358 m.IsBytecodeOperandShort(offset)); |
| 318 break; | 359 break; |
| 319 case interpreter::OperandType::kIdx16: | 360 case interpreter::OperandType::kIdx16: |
| 320 EXPECT_THAT(m.BytecodeOperandIdx(i), | 361 EXPECT_THAT(m.BytecodeOperandIdx(i), |
| 321 m.IsBytecodeOperandShort(offset)); | 362 m.IsBytecodeOperandShort(offset)); |
| 322 break; | 363 break; |
| 364 case interpreter::OperandType::kReg16: |
| 365 EXPECT_THAT(m.BytecodeOperandReg(i), |
| 366 m.IsBytecodeOperandShortSignExtended(offset)); |
| 367 break; |
| 323 case interpreter::OperandType::kNone: | 368 case interpreter::OperandType::kNone: |
| 324 UNREACHABLE(); | 369 UNREACHABLE(); |
| 325 break; | 370 break; |
| 326 } | 371 } |
| 327 } | 372 } |
| 328 } | 373 } |
| 329 } | 374 } |
| 330 | 375 |
| 331 | 376 |
| 332 TARGET_TEST_F(InterpreterAssemblerTest, GetSetAccumulator) { | 377 TARGET_TEST_F(InterpreterAssemblerTest, GetSetAccumulator) { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 feedback_vector, | 673 feedback_vector, |
| 629 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, | 674 m.IsLoad(MachineType::AnyTagged(), load_shared_function_info_matcher, |
| 630 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - | 675 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - |
| 631 kHeapObjectTag))); | 676 kHeapObjectTag))); |
| 632 } | 677 } |
| 633 } | 678 } |
| 634 | 679 |
| 635 } // namespace compiler | 680 } // namespace compiler |
| 636 } // namespace internal | 681 } // namespace internal |
| 637 } // namespace v8 | 682 } // namespace v8 |
| OLD | NEW |