Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(767)

Unified Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1370893002: [Interpreter] Add support for short (16 bit) operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/unittests/compiler/interpreter-assembler-unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index 14ec093b5ade4e03544ebf68c052728117596b15..3c50bea829c429e9b83d0d5e2824542f47027040 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -130,22 +130,37 @@ static void CheckBytecodeArrayEqual(struct ExpectedSnippet<T> expected,
<< " but got " << Bytecodes::ToString(bytecode);
FATAL(stream.str().c_str());
}
- for (int j = 0; j < Bytecodes::NumberOfOperands(bytecode); ++j, ++i) {
- uint8_t raw_operand =
- iterator.GetRawOperand(j, Bytecodes::GetOperandType(bytecode, j));
+ for (int j = 0; j < Bytecodes::NumberOfOperands(bytecode); ++j) {
+ OperandType operand_type = Bytecodes::GetOperandType(bytecode, j);
+ int operand_index = i;
+ i += static_cast<int>(Bytecodes::SizeOfOperand(operand_type));
+ uint32_t raw_operand = iterator.GetRawOperand(j, operand_type);
if (has_unknown) {
// Check actual bytecode array doesn't have the same byte as the
// one we use to specify an unknown byte.
CHECK_NE(raw_operand, _);
- if (expected.bytecode[i] == _) {
+ if (expected.bytecode[operand_index] == _) {
continue;
}
}
- if (raw_operand != expected.bytecode[i]) {
+ uint32_t expected_operand;
+ switch (Bytecodes::SizeOfOperand(operand_type)) {
+ case OperandSize::kNone:
+ UNREACHABLE();
+ case OperandSize::kByte:
+ expected_operand =
+ static_cast<uint32_t>(expected.bytecode[operand_index]);
+ break;
+ case OperandSize::kShort:
+ expected_operand = Bytecodes::ShortOperandFromBytes(
+ &expected.bytecode[operand_index]);
+ break;
+ }
+ if (raw_operand != expected_operand) {
std::ostringstream stream;
stream << "Check failed: expected operand [" << j << "] for bytecode ["
<< bytecode_index << "] to be "
- << static_cast<unsigned int>(expected.bytecode[i]) << " but got "
+ << static_cast<unsigned int>(expected_operand) << " but got "
<< static_cast<unsigned int>(raw_operand);
FATAL(stream.str().c_str());
}
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/unittests/compiler/interpreter-assembler-unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698