Index: test/unittests/compiler/interpreter-assembler-unittest.cc |
diff --git a/test/unittests/compiler/interpreter-assembler-unittest.cc b/test/unittests/compiler/interpreter-assembler-unittest.cc |
index d0816da476620a2087ae734996b62b287afae16f..1e49b08e80d46b07c67aee6d2d3a861b41beb09f 100644 |
--- a/test/unittests/compiler/interpreter-assembler-unittest.cc |
+++ b/test/unittests/compiler/interpreter-assembler-unittest.cc |
@@ -140,6 +140,47 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperandShort( |
} |
+Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest:: |
+ IsBytecodeOperandShortSignExtended(int offset) { |
+ Matcher<Node*> load_matcher; |
+ if (TargetSupportsUnalignedAccess()) { |
+ load_matcher = IsLoad( |
+ MachineType::Int16(), |
+ IsParameter(Linkage::kInterpreterBytecodeArrayParameter), |
+ IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), |
+ IsInt32Constant(offset))); |
+ } else { |
+#if V8_TARGET_LITTLE_ENDIAN |
+ int hi_byte_offset = offset + 1; |
+ int lo_byte_offset = offset; |
+ |
+#elif V8_TARGET_BIG_ENDIAN |
+ int hi_byte_offset = offset; |
+ int lo_byte_offset = offset + 1; |
+#else |
+#error "Unknown Architecture" |
+#endif |
+ Matcher<Node*> hi_byte = IsLoad( |
+ MachineType::Int8(), |
+ IsParameter(Linkage::kInterpreterBytecodeArrayParameter), |
+ IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), |
+ IsInt32Constant(hi_byte_offset))); |
+ hi_byte = IsWord32Shl(hi_byte, IsInt32Constant(kBitsPerByte)); |
+ Matcher<Node*> lo_byte = IsLoad( |
+ MachineType::Uint8(), |
+ IsParameter(Linkage::kInterpreterBytecodeArrayParameter), |
+ IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), |
+ IsInt32Constant(lo_byte_offset))); |
+ load_matcher = IsWord32Or(hi_byte, lo_byte); |
+ } |
+ |
+ if (kPointerSize == 8) { |
+ load_matcher = IsChangeInt32ToInt64(load_matcher); |
+ } |
+ return load_matcher; |
+} |
+ |
+ |
TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) { |
TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { |
InterpreterAssemblerForTest m(this, bytecode); |
@@ -320,6 +361,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { |
EXPECT_THAT(m.BytecodeOperandIdx(i), |
m.IsBytecodeOperandShort(offset)); |
break; |
+ case interpreter::OperandType::kReg16: |
+ EXPECT_THAT(m.BytecodeOperandReg(i), |
+ m.IsBytecodeOperandShortSignExtended(offset)); |
+ break; |
case interpreter::OperandType::kNone: |
UNREACHABLE(); |
break; |