Commit e8ac1ae4 authored by Ng Zhi An's avatar Ng Zhi An Committed by V8 LUCI CQ

[compiler] Use ElementSizeInPointers

Small refactoring to use an existing ElementSizeInPointers (which has
the same implementation). LinkageLocation::GetSize is now not called
anywhere else, so remove it. The instruction selector can then call
LinkageLocation::GetSizeInPointers instead of calculating it.

Bug: v8:11879
Change-Id: I6f717db1c4047e7847f00cf2bf96c6ec8ea52bda
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2997924Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75520}
parent 106fff02
......@@ -1154,9 +1154,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
// This can insert empty slots before stack_index and will insert enough
// slots after stack_index to store the parameter.
if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) {
int num_slots = std::max(
1, (ElementSizeInBytes(location.GetType().representation()) /
kSystemPointerSize));
int num_slots = location.GetSizeInPointers();
buffer->pushed_nodes.resize(stack_index + num_slots);
}
PushParameter param = {*iter, location};
......
......@@ -127,13 +127,8 @@ class LinkageLocation {
MachineType GetType() const { return machine_type_; }
int GetSize() const {
return 1 << ElementSizeLog2Of(GetType().representation());
}
int GetSizeInPointers() const {
// Round up
return (GetSize() + kSystemPointerSize - 1) / kSystemPointerSize;
return ElementSizeInPointers(GetType().representation());
}
int32_t GetLocation() const {
......
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