diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc index 4bf5f20004..4446f81e58 100644 --- a/src/builtins/ppc/builtins-ppc.cc +++ b/src/builtins/ppc/builtins-ppc.cc @@ -2484,10 +2484,11 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); __ bind(&skip); - // Reset the masking register. - if (FLAG_branch_load_poisoning) { - __ ResetSpeculationPoisonRegister(); - } + // Reset the masking register. This is done independent of the underlying + // feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work + // with both configurations. It is safe to always do this, because the + // underlying register is caller-saved and can be arbitrarily clobbered. + __ ResetSpeculationPoisonRegister(); // Compute the handler entry address and jump to it. ConstantPoolUnavailableScope constant_pool_unavailable(masm); diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc index d935e5e562..198ba0971d 100644 --- a/src/builtins/s390/builtins-s390.cc +++ b/src/builtins/s390/builtins-s390.cc @@ -2487,10 +2487,11 @@ void Builtins::Generate_CEntry(MacroAssembler* masm, int result_size, __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); __ bind(&skip); - // Reset the masking register. - if (FLAG_branch_load_poisoning) { - __ ResetSpeculationPoisonRegister(); - } + // Reset the masking register. This is done independent of the underlying + // feature flag {FLAG_untrusted_code_mitigations} to make the snapshot work + // with both configurations. It is safe to always do this, because the + // underlying register is caller-saved and can be arbitrarily clobbered. + __ ResetSpeculationPoisonRegister(); // Compute the handler entry address and jump to it. __ Move(r3, pending_handler_entrypoint_address);