[interpreter] Encode BytecodeSizes as uint8_t for better cache locality
This very slightly improves the performance of bytecode array visitors. Change-Id: I39df381a26106b5576df74c8c204279b224a92af Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2653227 Auto-Submit: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#72387}
This commit is contained in:
parent
9784c52d69
commit
3965dcd5cb
@ -942,11 +942,11 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
// Update table to the wide scaled table.
|
||||
__ add(bytecode_size_table, bytecode_size_table,
|
||||
Operand(kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Operand(kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
// Conditionally update table to the extra wide scaled table. We are taking
|
||||
// advantage of the fact that the extra wide follows the wide one.
|
||||
__ add(bytecode_size_table, bytecode_size_table,
|
||||
Operand(kIntSize * interpreter::Bytecodes::kBytecodeCount), LeaveCC,
|
||||
Operand(kByteSize * interpreter::Bytecodes::kBytecodeCount), LeaveCC,
|
||||
ne);
|
||||
|
||||
__ bind(&process_bytecode);
|
||||
@ -976,7 +976,7 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
__ bind(¬_jump_loop);
|
||||
// Otherwise, load the size of the current bytecode and advance the offset.
|
||||
__ ldr(scratch1, MemOperand(bytecode_size_table, bytecode, LSL, 2));
|
||||
__ ldrb(scratch1, MemOperand(bytecode_size_table, bytecode));
|
||||
__ add(bytecode_offset, bytecode_offset, scratch1);
|
||||
|
||||
__ bind(&end);
|
||||
|
@ -1112,13 +1112,13 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
// Update table to the wide scaled table.
|
||||
__ Add(bytecode_size_table, bytecode_size_table,
|
||||
Operand(kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Operand(kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
__ B(&process_bytecode);
|
||||
|
||||
__ Bind(&extra_wide);
|
||||
// Update table to the extra wide scaled table.
|
||||
__ Add(bytecode_size_table, bytecode_size_table,
|
||||
Operand(2 * kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Operand(2 * kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
|
||||
__ Bind(&process_bytecode);
|
||||
|
||||
@ -1141,7 +1141,7 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
__ bind(¬_jump_loop);
|
||||
// Otherwise, load the size of the current bytecode and advance the offset.
|
||||
__ Ldr(scratch1.W(), MemOperand(bytecode_size_table, bytecode, LSL, 2));
|
||||
__ Ldrb(scratch1.W(), MemOperand(bytecode_size_table, bytecode));
|
||||
__ Add(bytecode_offset, bytecode_offset, scratch1);
|
||||
|
||||
__ Bind(&end);
|
||||
|
@ -874,13 +874,13 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
// Load the next bytecode and update table to the wide scaled table.
|
||||
__ add(bytecode_size_table,
|
||||
Immediate(kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Immediate(kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
__ jmp(&process_bytecode, Label::kNear);
|
||||
|
||||
__ bind(&extra_wide);
|
||||
// Update table to the extra wide scaled table.
|
||||
__ add(bytecode_size_table,
|
||||
Immediate(2 * kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Immediate(2 * kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
|
||||
__ bind(&process_bytecode);
|
||||
|
||||
@ -906,8 +906,9 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
__ bind(¬_jump_loop);
|
||||
// Otherwise, load the size of the current bytecode and advance the offset.
|
||||
__ add(bytecode_offset,
|
||||
Operand(bytecode_size_table, bytecode, times_int_size, 0));
|
||||
__ movzx_b(bytecode_size_table,
|
||||
Operand(bytecode_size_table, bytecode, times_1, 0));
|
||||
__ add(bytecode_offset, bytecode_size_table);
|
||||
|
||||
__ bind(&end);
|
||||
}
|
||||
|
@ -976,13 +976,13 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
// Update table to the wide scaled table.
|
||||
__ addq(bytecode_size_table,
|
||||
Immediate(kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Immediate(kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
__ jmp(&process_bytecode, Label::kNear);
|
||||
|
||||
__ bind(&extra_wide);
|
||||
// Update table to the extra wide scaled table.
|
||||
__ addq(bytecode_size_table,
|
||||
Immediate(2 * kIntSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
Immediate(2 * kByteSize * interpreter::Bytecodes::kBytecodeCount));
|
||||
|
||||
__ bind(&process_bytecode);
|
||||
|
||||
@ -1007,8 +1007,9 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
|
||||
|
||||
__ bind(¬_jump_loop);
|
||||
// Otherwise, load the size of the current bytecode and advance the offset.
|
||||
__ addl(bytecode_offset,
|
||||
Operand(bytecode_size_table, bytecode, times_int_size, 0));
|
||||
__ movzxbl(kScratchRegister,
|
||||
Operand(bytecode_size_table, bytecode, times_1, 0));
|
||||
__ addl(bytecode_offset, kScratchRegister);
|
||||
|
||||
__ bind(&end);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ const AccumulatorUse Bytecodes::kAccumulatorUse[] = {
|
||||
#undef ENTRY
|
||||
};
|
||||
|
||||
const int Bytecodes::kBytecodeSizes[3][kBytecodeCount] = {
|
||||
const uint8_t Bytecodes::kBytecodeSizes[3][kBytecodeCount] = {
|
||||
{
|
||||
#define ENTRY(Name, ...) BytecodeTraits<__VA_ARGS__>::kSingleScaleSize,
|
||||
BYTECODE_LIST(ENTRY)
|
||||
|
@ -934,7 +934,8 @@ class V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
|
||||
}
|
||||
|
||||
static Address bytecode_size_table_address() {
|
||||
return reinterpret_cast<Address>(const_cast<int*>(&kBytecodeSizes[0][0]));
|
||||
return reinterpret_cast<Address>(
|
||||
const_cast<uint8_t*>(&kBytecodeSizes[0][0]));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -944,7 +945,7 @@ class V8_EXPORT_PRIVATE Bytecodes final : public AllStatic {
|
||||
static const int kNumberOfRegisterOperands[];
|
||||
static const AccumulatorUse kAccumulatorUse[];
|
||||
static const bool kIsScalable[];
|
||||
static const int kBytecodeSizes[3][kBytecodeCount];
|
||||
static const uint8_t kBytecodeSizes[3][kBytecodeCount];
|
||||
static const OperandSize* const kOperandSizes[3][kBytecodeCount];
|
||||
static OperandSize const
|
||||
kOperandKindSizes[3][BytecodeOperands::kOperandTypeCount];
|
||||
|
Loading…
Reference in New Issue
Block a user