Commit 3b416c67 authored by Miran.Karic's avatar Miran.Karic Committed by Commit bot

Adjust bytecode operand values for big endian.

Operand values in Bytecodes.DecodeBytecodeAndOperands test are encoded
in little endian format. The test calls Bytecodes::Decode function which
reads the operands but the values are byte swapped on big endian
machines. Added big endian encoded data which decodes correctly on BE
machines.

BUG=

Review URL: https://codereview.chromium.org/1881423002

Cr-Commit-Position: refs/heads/master@{#35447}
parent a5f6daab
......@@ -187,37 +187,73 @@ TEST(Bytecodes, DecodeBytecodeAndOperands) {
#define B(Name) static_cast<uint8_t>(Bytecode::k##Name)
const BytecodesAndResult cases[] = {
{{B(LdaSmi), 0x01}, 2, 0, " LdaSmi [1]"},
{{B(Wide), B(LdaSmi), 0xe8, 0x03}, 4, 0, " LdaSmi.Wide [1000]"},
{{B(ExtraWide), B(LdaSmi), 0xa0, 0x86, 0x01, 0x00},
6,
0,
"LdaSmi.ExtraWide [100000]"},
{{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"},
{{B(Wide), B(LdaSmi), 0x18, 0xfc}, 4, 0, " LdaSmi.Wide [-1000]"},
{{B(ExtraWide), B(LdaSmi), 0x60, 0x79, 0xfe, 0xff},
6,
0,
"LdaSmi.ExtraWide [-100000]"},
{{B(Star), 0xfb}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0x78, 0xff}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0x7a, 0xff, 0x79, 0xff, 0x02, 0x00, 0xb1, 0x00},
10,
0,
"Call.Wide r134, r135, #2, [177]"},
{{B(Ldar),
static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())},
2,
3,
" Ldar a1"},
{{B(Wide), B(CreateObjectLiteral), 0x01, 0x02, 0x03, 0x04, 0xa5},
7,
0,
"CreateObjectLiteral.Wide [513], [1027], #165"},
{{B(ExtraWide), B(JumpIfNull), 0x15, 0xcd, 0x5b, 0x07},
6,
0,
"JumpIfNull.ExtraWide [123456789]"},
#if V8_TARGET_LITTLE_ENDIAN
{{B(LdaSmi), 0x01}, 2, 0, " LdaSmi [1]"},
{{B(Wide), B(LdaSmi), 0xe8, 0x03}, 4, 0, " LdaSmi.Wide [1000]"},
{{B(ExtraWide), B(LdaSmi), 0xa0, 0x86, 0x01, 0x00},
6,
0,
"LdaSmi.ExtraWide [100000]"},
{{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"},
{{B(Wide), B(LdaSmi), 0x18, 0xfc}, 4, 0, " LdaSmi.Wide [-1000]"},
{{B(ExtraWide), B(LdaSmi), 0x60, 0x79, 0xfe, 0xff},
6,
0,
"LdaSmi.ExtraWide [-100000]"},
{{B(Star), 0xfb}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0x78, 0xff}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0x7a, 0xff, 0x79, 0xff, 0x02, 0x00, 0xb1, 0x00},
10,
0,
"Call.Wide r134, r135, #2, [177]"},
{{B(Ldar),
static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())},
2,
3,
" Ldar a1"},
{{B(Wide), B(CreateObjectLiteral), 0x01, 0x02, 0x03, 0x04, 0xa5},
7,
0,
"CreateObjectLiteral.Wide [513], [1027], #165"},
{{B(ExtraWide), B(JumpIfNull), 0x15, 0xcd, 0x5b, 0x07},
6,
0,
"JumpIfNull.ExtraWide [123456789]"},
#elif V8_TARGET_BIG_ENDIAN
{{B(LdaSmi), 0x01}, 2, 0, " LdaSmi [1]"},
{{B(Wide), B(LdaSmi), 0x03, 0xe8}, 4, 0, " LdaSmi.Wide [1000]"},
{{B(ExtraWide), B(LdaSmi), 0x00, 0x01, 0x86, 0xa0},
6,
0,
"LdaSmi.ExtraWide [100000]"},
{{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"},
{{B(Wide), B(LdaSmi), 0xfc, 0x18}, 4, 0, " LdaSmi.Wide [-1000]"},
{{B(ExtraWide), B(LdaSmi), 0xff, 0xfe, 0x79, 0x60},
6,
0,
"LdaSmi.ExtraWide [-100000]"},
{{B(Star), 0xfb}, 2, 0, " Star r5"},
{{B(Wide), B(Star), 0xff, 0x78}, 4, 0, " Star.Wide r136"},
{{B(Wide), B(Call), 0xff, 0x7a, 0xff, 0x79, 0x00, 0x02, 0x00, 0xb1},
10,
0,
"Call.Wide r134, r135, #2, [177]"},
{{B(Ldar),
static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())},
2,
3,
" Ldar a1"},
{{B(Wide), B(CreateObjectLiteral), 0x02, 0x01, 0x04, 0x03, 0xa5},
7,
0,
"CreateObjectLiteral.Wide [513], [1027], #165"},
{{B(ExtraWide), B(JumpIfNull), 0x07, 0x5b, 0xcd, 0x15},
6,
0,
"JumpIfNull.ExtraWide [123456789]"},
#else
#error "Unknown Architecture"
#endif
};
#undef B
......
......@@ -11,6 +11,5 @@
'WasmDecoderTest.AllLoadMemCombinations': [SKIP],
'AstDecoderTest.AllLoadMemCombinations': [SKIP],
'AstDecoderTest.AllStoreMemCombinations': [SKIP],
'Bytecodes.DecodeBytecodeAndOperands': [SKIP],
}], # 'byteorder == big'
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment