Commit 8f5f5c68 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[sparkplug] Add missing SaveAccumulatorScopes

Some baseline implementations of non-accumulator-writing bytecodes
would call builtins without saving the accumulator. This clobbers the
accumulator. This was particularly observable with IncBlockCounter.

Bug: v8:11420
Change-Id: I1e8a06526ea6ed018da0d6213775cce130c72aee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2786847
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73664}
parent bb3794c7
......@@ -13,6 +13,7 @@
#include <type_traits>
#include "src/baseline/baseline-assembler-inl.h"
#include "src/baseline/baseline-assembler.h"
#include "src/builtins/builtins-constructor.h"
#include "src/builtins/builtins-descriptors.h"
#include "src/builtins/builtins.h"
......@@ -956,6 +957,7 @@ void BaselineCompiler::VisitStaDataPropertyInLiteral() {
}
void BaselineCompiler::VisitCollectTypeProfile() {
SaveAccumulatorScope accumulator_scope(&basm_);
CallRuntime(Runtime::kCollectTypeProfile,
IntAsSmi(0), // position
kInterpreterAccumulatorRegister, // value
......@@ -1241,6 +1243,7 @@ void BaselineCompiler::VisitCallRuntime() {
}
void BaselineCompiler::VisitCallRuntimeForPair() {
SaveAccumulatorScope accumulator_scope(&basm_);
CallRuntime(iterator().GetRuntimeIdOperand(0),
iterator().GetRegisterListOperand(1));
StoreRegisterPair(3, kReturnRegister0, kReturnRegister1);
......@@ -2330,10 +2333,12 @@ void BaselineCompiler::VisitGetIterator() {
}
void BaselineCompiler::VisitDebugger() {
SaveAccumulatorScope accumulator_scope(&basm_);
CallBuiltin(Builtins::kHandleDebuggerStatement);
}
void BaselineCompiler::VisitIncBlockCounter() {
SaveAccumulatorScope accumulator_scope(&basm_);
CallBuiltin(Builtins::kIncBlockCounter, __ FunctionOperand(),
IndexAsSmi(0)); // coverage array slot
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment