[maglev] Use B instead of b on arm64
`MacroAssembler::B` registers its labels with the veneer pool, while `Assembler::b` doesn't. This meant that our JumpIf (used in particular for deopts) could run out of jump distance. As a drive by, also limit the maximum number of deopts according to the limit set by the deoptimizer. This turned out to not be the issue, but we should also do it. Bug: v8:7700 Change-Id: Ic5a8dd3b69c995375d7caab008f31ae91d9c732d Fixed: chromium:1410080 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4224931 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Victor Gomes <victorgomes@chromium.org> Cr-Commit-Position: refs/heads/main@{#85686}
This commit is contained in:
parent
5472313c96
commit
8a6b841721
@ -581,7 +581,7 @@ inline void MaglevAssembler::Jump(Label* target, Label::Distance) { B(target); }
|
|||||||
|
|
||||||
inline void MaglevAssembler::JumpIf(Condition cond, Label* target,
|
inline void MaglevAssembler::JumpIf(Condition cond, Label* target,
|
||||||
Label::Distance) {
|
Label::Distance) {
|
||||||
b(target, cond);
|
B(target, cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void MaglevAssembler::JumpIfRoot(Register with, RootIndex index,
|
inline void MaglevAssembler::JumpIfRoot(Register with, RootIndex index,
|
||||||
|
@ -423,7 +423,7 @@ void MaglevAssembler::Prologue(Graph* graph) {
|
|||||||
Push(xzr, xzr);
|
Push(xzr, xzr);
|
||||||
}
|
}
|
||||||
Subs(count, count, Immediate(1));
|
Subs(count, count, Immediate(1));
|
||||||
b(&loop, gt);
|
B(&loop, gt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (remaining_stack_slots > 0) {
|
if (remaining_stack_slots > 0) {
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "src/common/globals.h"
|
#include "src/common/globals.h"
|
||||||
#include "src/compiler/backend/instruction.h"
|
#include "src/compiler/backend/instruction.h"
|
||||||
#include "src/deoptimizer/deoptimize-reason.h"
|
#include "src/deoptimizer/deoptimize-reason.h"
|
||||||
|
#include "src/deoptimizer/deoptimizer.h"
|
||||||
#include "src/deoptimizer/translation-array.h"
|
#include "src/deoptimizer/translation-array.h"
|
||||||
#include "src/execution/frame-constants.h"
|
#include "src/execution/frame-constants.h"
|
||||||
#include "src/interpreter/bytecode-register.h"
|
#include "src/interpreter/bytecode-register.h"
|
||||||
@ -1240,6 +1241,7 @@ void MaglevCodeGenerator::EmitCode() {
|
|||||||
processor.ProcessGraph(graph_);
|
processor.ProcessGraph(graph_);
|
||||||
EmitDeferredCode();
|
EmitDeferredCode();
|
||||||
EmitDeopts();
|
EmitDeopts();
|
||||||
|
if (code_gen_failed_) return;
|
||||||
EmitExceptionHandlerTrampolines();
|
EmitExceptionHandlerTrampolines();
|
||||||
__ FinishCode();
|
__ FinishCode();
|
||||||
}
|
}
|
||||||
@ -1258,6 +1260,13 @@ void MaglevCodeGenerator::EmitDeferredCode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MaglevCodeGenerator::EmitDeopts() {
|
void MaglevCodeGenerator::EmitDeopts() {
|
||||||
|
const size_t num_deopts = code_gen_state_.eager_deopts().size() +
|
||||||
|
code_gen_state_.lazy_deopts().size();
|
||||||
|
if (num_deopts > Deoptimizer::kMaxNumberOfEntries) {
|
||||||
|
code_gen_failed_ = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MaglevTranslationArrayBuilder translation_builder(
|
MaglevTranslationArrayBuilder translation_builder(
|
||||||
local_isolate_, &masm_, &translation_array_builder_, &deopt_literals_);
|
local_isolate_, &masm_, &translation_array_builder_, &deopt_literals_);
|
||||||
|
|
||||||
@ -1351,6 +1360,8 @@ void MaglevCodeGenerator::EmitMetadata() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MaybeHandle<Code> MaglevCodeGenerator::BuildCodeObject(Isolate* isolate) {
|
MaybeHandle<Code> MaglevCodeGenerator::BuildCodeObject(Isolate* isolate) {
|
||||||
|
if (code_gen_failed_) return {};
|
||||||
|
|
||||||
CodeDesc desc;
|
CodeDesc desc;
|
||||||
masm()->GetCode(isolate, &desc, &safepoint_table_builder_,
|
masm()->GetCode(isolate, &desc, &safepoint_table_builder_,
|
||||||
handler_table_offset_);
|
handler_table_offset_);
|
||||||
|
@ -55,6 +55,8 @@ class MaglevCodeGenerator final {
|
|||||||
IdentityMap<int, base::DefaultAllocationPolicy> deopt_literals_;
|
IdentityMap<int, base::DefaultAllocationPolicy> deopt_literals_;
|
||||||
int deopt_exit_start_offset_ = -1;
|
int deopt_exit_start_offset_ = -1;
|
||||||
int handler_table_offset_ = 0;
|
int handler_table_offset_ = 0;
|
||||||
|
|
||||||
|
bool code_gen_failed_ = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace maglev
|
} // namespace maglev
|
||||||
|
Loading…
Reference in New Issue
Block a user