Index: src/arm64/macro-assembler-arm64.cc |
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc |
index d7d0ab7502308f2687beb126076c70e4e3ca1905..011f5b8e86ecf296d0e6613a863f9cd656fcca4a 100644 |
--- a/src/arm64/macro-assembler-arm64.cc |
+++ b/src/arm64/macro-assembler-arm64.cc |
@@ -2024,11 +2024,16 @@ void MacroAssembler::Call(Address target, RelocInfo::Mode rmode) { |
Register temp = temps.AcquireX(); |
if (rmode == RelocInfo::NONE64) { |
+ // Addresses are 48 bits so we never need to load the upper 16 bits. |
ulan
2014/03/24 12:45:54
ASSERT_EQ(0, ((imm >> 48) & 0xffff));
|
uint64_t imm = reinterpret_cast<uint64_t>(target); |
movz(temp, (imm >> 0) & 0xffff, 0); |
- movk(temp, (imm >> 16) & 0xffff, 16); |
- movk(temp, (imm >> 32) & 0xffff, 32); |
- movk(temp, (imm >> 48) & 0xffff, 48); |
+ if (predictable_code_size()) { |
+ movk(temp, (imm >> 16) & 0xffff, 16); |
+ movk(temp, (imm >> 32) & 0xffff, 32); |
+ } else { |
+ if (((imm >> 16) & 0xffff) != 0) movk(temp, (imm >> 16) & 0xffff, 16); |
+ if (((imm >> 32) & 0xffff) != 0) movk(temp, (imm >> 32) & 0xffff, 32); |
ulan
2014/03/24 12:45:54
v8/test/mjsunit and v8/benchmarks did not hit the
|
+ } |
} else { |
LoadRelocated(temp, Operand(reinterpret_cast<intptr_t>(target), rmode)); |
} |
@@ -2075,13 +2080,17 @@ int MacroAssembler::CallSize(Label* target) { |
int MacroAssembler::CallSize(Address target, RelocInfo::Mode rmode) { |
- USE(target); |
- |
// Addresses always have 64 bits, so we shouldn't encounter NONE32. |
ASSERT(rmode != RelocInfo::NONE32); |
if (rmode == RelocInfo::NONE64) { |
- return kCallSizeWithoutRelocation; |
+ int result = kMaxCallSizeWithoutRelocation; |
+ if (!predictable_code_size()) { |
+ uint64_t imm = reinterpret_cast<uint64_t>(target); |
+ if (((imm >> 16) & 0xffff) == 0) result -= kInstructionSize; |
+ if (((imm >> 32) & 0xffff) == 0) result -= kInstructionSize; |
+ } |
+ return result; |
} else { |
return kCallSizeWithRelocation; |
} |
@@ -2091,17 +2100,9 @@ int MacroAssembler::CallSize(Address target, RelocInfo::Mode rmode) { |
int MacroAssembler::CallSize(Handle<Code> code, |
RelocInfo::Mode rmode, |
TypeFeedbackId ast_id) { |
- USE(code); |
USE(ast_id); |
- |
- // Addresses always have 64 bits, so we shouldn't encounter NONE32. |
- ASSERT(rmode != RelocInfo::NONE32); |
- |
- if (rmode == RelocInfo::NONE64) { |
- return kCallSizeWithoutRelocation; |
- } else { |
- return kCallSizeWithRelocation; |
- } |
+ AllowDeferredHandleDereference embedding_raw_address; |
+ return CallSize(reinterpret_cast<Address>(code.location()), rmode); |
} |