[backend] Add proper Label::kNear hints

This saves some bytes here and there. Whenever the label is bound just a
few instructions after, we can use a near jump.

R=ahaas@chromium.org

Bug: v8:10005
Change-Id: If2ec596575e1bd88d09fde3fa96ffa8187de542f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1930898
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65145}
This commit is contained in:
Clemens Backes 2019-11-22 16:01:40 +01:00 committed by Commit Bot
parent 784a48b3ec
commit a377d23187
2 changed files with 12 additions and 12 deletions

View File

@ -641,7 +641,7 @@ void CodeGenerator::BailoutIfDeoptimized() {
__ pop(eax); // Restore eax. __ pop(eax); // Restore eax.
Label skip; Label skip;
__ j(zero, &skip); __ j(zero, &skip, Label::kNear);
__ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode), __ Jump(BUILTIN_CODE(isolate(), CompileLazyDeoptimizedCode),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
__ bind(&skip); __ bind(&skip);
@ -4365,7 +4365,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Label end; Label end;
if (condition == kUnorderedEqual) { if (condition == kUnorderedEqual) {
__ j(parity_even, &end); __ j(parity_even, &end, Label::kNear);
} else if (condition == kUnorderedNotEqual) { } else if (condition == kUnorderedNotEqual) {
__ j(parity_even, tlabel); __ j(parity_even, tlabel);
} }
@ -4667,7 +4667,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ add(scratch, Immediate(required_slots * kSystemPointerSize)); __ add(scratch, Immediate(required_slots * kSystemPointerSize));
__ cmp(esp, scratch); __ cmp(esp, scratch);
__ pop(scratch); __ pop(scratch);
__ j(above_equal, &done); __ j(above_equal, &done, Label::kNear);
} }
__ wasm_call(wasm::WasmCode::kWasmStackOverflow, __ wasm_call(wasm::WasmCode::kWasmStackOverflow,

View File

@ -1627,13 +1627,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ucomiss(kScratchDoubleReg, i.InputOperand(0)); __ Ucomiss(kScratchDoubleReg, i.InputOperand(0));
} }
// If the input is NaN, then the conversion fails. // If the input is NaN, then the conversion fails.
__ j(parity_even, &fail); __ j(parity_even, &fail, Label::kNear);
// If the input is INT64_MIN, then the conversion succeeds. // If the input is INT64_MIN, then the conversion succeeds.
__ j(equal, &done); __ j(equal, &done, Label::kNear);
__ cmpq(i.OutputRegister(0), Immediate(1)); __ cmpq(i.OutputRegister(0), Immediate(1));
// If the conversion results in INT64_MIN, but the input was not // If the conversion results in INT64_MIN, but the input was not
// INT64_MIN, then the conversion fails. // INT64_MIN, then the conversion fails.
__ j(no_overflow, &done); __ j(no_overflow, &done, Label::kNear);
__ bind(&fail); __ bind(&fail);
__ Set(i.OutputRegister(1), 0); __ Set(i.OutputRegister(1), 0);
__ bind(&done); __ bind(&done);
@ -1656,13 +1656,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Ucomisd(kScratchDoubleReg, i.InputOperand(0)); __ Ucomisd(kScratchDoubleReg, i.InputOperand(0));
} }
// If the input is NaN, then the conversion fails. // If the input is NaN, then the conversion fails.
__ j(parity_even, &fail); __ j(parity_even, &fail, Label::kNear);
// If the input is INT64_MIN, then the conversion succeeds. // If the input is INT64_MIN, then the conversion succeeds.
__ j(equal, &done); __ j(equal, &done, Label::kNear);
__ cmpq(i.OutputRegister(0), Immediate(1)); __ cmpq(i.OutputRegister(0), Immediate(1));
// If the conversion results in INT64_MIN, but the input was not // If the conversion results in INT64_MIN, but the input was not
// INT64_MIN, then the conversion fails. // INT64_MIN, then the conversion fails.
__ j(no_overflow, &done); __ j(no_overflow, &done, Label::kNear);
__ bind(&fail); __ bind(&fail);
__ Set(i.OutputRegister(1), 0); __ Set(i.OutputRegister(1), 0);
__ bind(&done); __ bind(&done);
@ -4230,7 +4230,7 @@ void CodeGenerator::AssembleArchDeoptBranch(Instruction* instr,
__ pushq(rax); __ pushq(rax);
__ load_rax(counter); __ load_rax(counter);
__ decl(rax); __ decl(rax);
__ j(not_zero, &nodeopt); __ j(not_zero, &nodeopt, Label::kNear);
__ Set(rax, FLAG_deopt_every_n_times); __ Set(rax, FLAG_deopt_every_n_times);
__ store_rax(counter); __ store_rax(counter);
@ -4259,7 +4259,7 @@ void CodeGenerator::AssembleArchTrap(Instruction* instr,
Label* tlabel = ool->entry(); Label* tlabel = ool->entry();
Label end; Label end;
if (condition == kUnorderedEqual) { if (condition == kUnorderedEqual) {
__ j(parity_even, &end); __ j(parity_even, &end, Label::kNear);
} else if (condition == kUnorderedNotEqual) { } else if (condition == kUnorderedNotEqual) {
__ j(parity_even, tlabel); __ j(parity_even, tlabel);
} }
@ -4443,7 +4443,7 @@ void CodeGenerator::AssembleConstructFrame() {
__ addq(kScratchRegister, __ addq(kScratchRegister,
Immediate(required_slots * kSystemPointerSize)); Immediate(required_slots * kSystemPointerSize));
__ cmpq(rsp, kScratchRegister); __ cmpq(rsp, kScratchRegister);
__ j(above_equal, &done); __ j(above_equal, &done, Label::kNear);
} }
__ near_call(wasm::WasmCode::kWasmStackOverflow, __ near_call(wasm::WasmCode::kWasmStackOverflow,