Commit 0afe5051 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Reland "[Assembler][x64] Make immediates immutable"

This is a reland of 01db326c.

Original change's description:
> [Assembler][x64] Make immediates immutable
> 
> On x64, we already pass immediates by value. This CL ensures that this
> is indeed cheap, and it makes immediates immutable.
> 
> R=mstarzinger@chromium.org
> 
> Bug: v8:7310
> Change-Id: I53a0666d53b9de69d390621298798c03b5190497
> Reviewed-on: https://chromium-review.googlesource.com/934341
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#51613}

Bug: v8:7310
Change-Id: I37f1bd1528c742e8df11b7f524316935dd289f00
Reviewed-on: https://chromium-review.googlesource.com/941621Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51655}
parent 80447cff
......@@ -301,23 +301,25 @@ enum RoundingMode {
// -----------------------------------------------------------------------------
// Machine instruction Immediates
class Immediate BASE_EMBEDDED {
class Immediate {
public:
explicit Immediate(int32_t value) : value_(value) {}
explicit Immediate(int32_t value, RelocInfo::Mode rmode)
explicit constexpr Immediate(int32_t value) : value_(value) {}
explicit constexpr Immediate(int32_t value, RelocInfo::Mode rmode)
: value_(value), rmode_(rmode) {}
explicit Immediate(Smi* value) {
explicit Immediate(Smi* value)
: value_(static_cast<int32_t>(reinterpret_cast<intptr_t>(value))) {
DCHECK(SmiValuesAre31Bits()); // Only available for 31-bit SMI.
value_ = static_cast<int32_t>(reinterpret_cast<intptr_t>(value));
}
private:
int32_t value_;
RelocInfo::Mode rmode_ = RelocInfo::NONE;
const int32_t value_;
const RelocInfo::Mode rmode_ = RelocInfo::NONE;
friend class Assembler;
};
ASSERT_TRIVIALLY_COPYABLE(Immediate);
static_assert(sizeof(Immediate) <= kPointerSize,
"Immediate must be small enough to pass it by value");
// -----------------------------------------------------------------------------
// Machine instruction Operands
......
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