Commit 02a51d7f authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Check representation for secondary parameter locations

A previous CL (https://chromium-review.googlesource.com/c/v8/v8/+/1075056)
introduced an optimization the spill slot where the WASM instance
is stored using the "secondary parameter location" mechanism used for
JS functions and contexts. However the optimization checked the full
machine type of the parameter, which was too narrow. As a result,
the optimization never activated. This CL fixes that by only
checking the machine representation.

R=mstarzinger@chromium.org

Change-Id: I60813935c8d119d2ddf794c797dad314b99ea867
Reviewed-on: https://chromium-review.googlesource.com/1076008Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53403}
parent f4b23239
......@@ -500,10 +500,10 @@ LinkageLocation Linkage::GetOsrValueLocation(int index) const {
}
namespace {
inline bool MatchesRegisterAndType(const LinkageLocation& loc, Register reg,
MachineType machine_type) {
inline bool IsTaggedReg(const LinkageLocation& loc, Register reg) {
return loc.IsRegister() && loc.AsRegister() == reg.code() &&
loc.GetType() == machine_type;
loc.GetType().representation() ==
MachineRepresentation::kTaggedPointer;
}
} // namespace
......@@ -511,15 +511,12 @@ bool Linkage::ParameterHasSecondaryLocation(int index) const {
// TODO(titzer): this should be configurable, not call-type specific.
if (incoming_->IsJSFunctionCall()) {
LinkageLocation loc = GetParameterLocation(index);
return MatchesRegisterAndType(loc, kJSFunctionRegister,
MachineType::AnyTagged()) ||
MatchesRegisterAndType(loc, kContextRegister,
MachineType::AnyTagged());
return IsTaggedReg(loc, kJSFunctionRegister) ||
IsTaggedReg(loc, kContextRegister);
}
if (incoming_->IsWasmFunctionCall()) {
LinkageLocation loc = GetParameterLocation(index);
return MatchesRegisterAndType(loc, kWasmInstanceRegister,
MachineType::AnyTagged());
return IsTaggedReg(loc, kWasmInstanceRegister);
}
return false;
}
......@@ -535,20 +532,17 @@ LinkageLocation Linkage::GetParameterSecondaryLocation(int index) const {
// TODO(titzer): this should be configurable, not call-type specific.
if (incoming_->IsJSFunctionCall()) {
if (MatchesRegisterAndType(loc, kJSFunctionRegister,
MachineType::AnyTagged())) {
if (IsTaggedReg(loc, kJSFunctionRegister)) {
return LinkageLocation::ForCalleeFrameSlot(kJSFunctionSlot,
MachineType::AnyTagged());
} else {
DCHECK(MatchesRegisterAndType(loc, kContextRegister,
MachineType::AnyTagged()));
DCHECK(IsTaggedReg(loc, kContextRegister));
return LinkageLocation::ForCalleeFrameSlot(kJSContextSlot,
MachineType::AnyTagged());
}
}
if (incoming_->IsWasmFunctionCall()) {
DCHECK(MatchesRegisterAndType(loc, kWasmInstanceRegister,
MachineType::AnyTagged()));
DCHECK(IsTaggedReg(loc, kWasmInstanceRegister));
return LinkageLocation::ForCalleeFrameSlot(kWasmInstanceSlot,
MachineType::AnyTagged());
}
......
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