[ia32][builtins] Hoist up common load bytecode code

There is some code common to both wide and extra wide that we are
able to hoist up since they do not affect the flags after testing
to see which version to use.

Port of https://chromium-review.googlesource.com/c/v8/v8/+/1826725

Bug: v8:9771
Change-Id: I2e40a16b784a9666df4cc5ac3ec7e8c8df5fd146
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1847358
Reviewed-by: Dan Elphick <delphick@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64184}
This commit is contained in:
Santiago Aboy Solanes 2019-10-08 14:35:48 +01:00 committed by Commit Bot
parent 73dbe9ac09
commit 1302c93593

View File

@ -884,20 +884,21 @@ static void AdvanceBytecodeOffsetOrReturn(MacroAssembler* masm,
static_cast<int>(interpreter::Bytecode::kDebugBreakExtraWide));
__ cmp(bytecode, Immediate(0x3));
__ j(above, &process_bytecode, Label::kNear);
// The code to load the next bytecode is common to both wide and extra wide.
// We can hoist them up here. inc has to happen before test since it
// modifies the ZF flag.
__ inc(bytecode_offset);
__ test(bytecode, Immediate(0x1));
__ movzx_b(bytecode, Operand(bytecode_array, bytecode_offset, times_1, 0));
__ j(not_equal, &extra_wide, Label::kNear);
// Load the next bytecode and update table to the wide scaled table.
__ inc(bytecode_offset);
__ movzx_b(bytecode, Operand(bytecode_array, bytecode_offset, times_1, 0));
__ add(bytecode_size_table,
Immediate(kIntSize * interpreter::Bytecodes::kBytecodeCount));
__ jmp(&process_bytecode, Label::kNear);
__ bind(&extra_wide);
// Load the next bytecode and update table to the extra wide scaled table.
__ inc(bytecode_offset);
__ movzx_b(bytecode, Operand(bytecode_array, bytecode_offset, times_1, 0));
// Update table to the extra wide scaled table.
__ add(bytecode_size_table,
Immediate(2 * kIntSize * interpreter::Bytecodes::kBytecodeCount));