diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index e6d929fdb4..2695bafc1b 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -385,10 +385,11 @@ void CEntryStub::Generate(MacroAssembler* masm) { __ cmp(cp, Operand(0)); __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); - // Reset the masking register. - if (FLAG_branch_load_poisoning) { - __ ResetSpeculationPoisonRegister(); - } + // Reset the masking register. This is done independent of the underlying + // feature flag {FLAG_branch_load_poisoning} 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/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index ee8b05f223..6b7b90daa9 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -425,10 +425,11 @@ void CEntryStub::Generate(MacroAssembler* masm) { __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); __ 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_branch_load_poisoning} 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. __ movp(rdi, masm->ExternalOperand(pending_handler_entrypoint_address));