diff --git a/src/maglev/arm64/maglev-assembler-arm64-inl.h b/src/maglev/arm64/maglev-assembler-arm64-inl.h index 893738b5ad..ac9d48f1f6 100644 --- a/src/maglev/arm64/maglev-assembler-arm64-inl.h +++ b/src/maglev/arm64/maglev-assembler-arm64-inl.h @@ -581,7 +581,7 @@ inline void MaglevAssembler::Jump(Label* target, Label::Distance) { B(target); } inline void MaglevAssembler::JumpIf(Condition cond, Label* target, Label::Distance) { - b(target, cond); + B(target, cond); } inline void MaglevAssembler::JumpIfRoot(Register with, RootIndex index, diff --git a/src/maglev/arm64/maglev-assembler-arm64.cc b/src/maglev/arm64/maglev-assembler-arm64.cc index 77fef9a488..0a06876a12 100644 --- a/src/maglev/arm64/maglev-assembler-arm64.cc +++ b/src/maglev/arm64/maglev-assembler-arm64.cc @@ -423,7 +423,7 @@ void MaglevAssembler::Prologue(Graph* graph) { Push(xzr, xzr); } Subs(count, count, Immediate(1)); - b(&loop, gt); + B(&loop, gt); } } if (remaining_stack_slots > 0) { diff --git a/src/maglev/maglev-code-generator.cc b/src/maglev/maglev-code-generator.cc index e9706c7387..166fb886a9 100644 --- a/src/maglev/maglev-code-generator.cc +++ b/src/maglev/maglev-code-generator.cc @@ -17,6 +17,7 @@ #include "src/common/globals.h" #include "src/compiler/backend/instruction.h" #include "src/deoptimizer/deoptimize-reason.h" +#include "src/deoptimizer/deoptimizer.h" #include "src/deoptimizer/translation-array.h" #include "src/execution/frame-constants.h" #include "src/interpreter/bytecode-register.h" @@ -1240,6 +1241,7 @@ void MaglevCodeGenerator::EmitCode() { processor.ProcessGraph(graph_); EmitDeferredCode(); EmitDeopts(); + if (code_gen_failed_) return; EmitExceptionHandlerTrampolines(); __ FinishCode(); } @@ -1258,6 +1260,13 @@ void MaglevCodeGenerator::EmitDeferredCode() { } 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( local_isolate_, &masm_, &translation_array_builder_, &deopt_literals_); @@ -1351,6 +1360,8 @@ void MaglevCodeGenerator::EmitMetadata() { } MaybeHandle MaglevCodeGenerator::BuildCodeObject(Isolate* isolate) { + if (code_gen_failed_) return {}; + CodeDesc desc; masm()->GetCode(isolate, &desc, &safepoint_table_builder_, handler_table_offset_); diff --git a/src/maglev/maglev-code-generator.h b/src/maglev/maglev-code-generator.h index 719e2d1154..5966903d41 100644 --- a/src/maglev/maglev-code-generator.h +++ b/src/maglev/maglev-code-generator.h @@ -55,6 +55,8 @@ class MaglevCodeGenerator final { IdentityMap deopt_literals_; int deopt_exit_start_offset_ = -1; int handler_table_offset_ = 0; + + bool code_gen_failed_ = false; }; } // namespace maglev