Bug 1535848 - Define JumpImmediateRange on ARM64. r=nbp
authorLars T Hansen <lhansen@mozilla.com>
Mon, 18 Mar 2019 17:52:49 +0100
changeset 523882 c13b55d67ea264ba37de9c52375597e2c73cb164
parent 523737 7a76a71448ff98dd6705f38dda0ad06a6da9e032
child 523883 1f4a7dc7cfe6db12c549cc4d388d2a2c100eb369
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1535848
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535848 - Define JumpImmediateRange on ARM64. r=nbp There are comments in the code suggesting that we've made plans at some point to handle very far jumps via patching + indirect jumps, but all of those comments are TODO/FIXME. Absent such a strategy, the furthest jump is 2^27-1 bytes, and we need to define JumpImmediateRange to reflect that. Differential Revision: https://phabricator.services.mozilla.com/D23883
js/src/jit/arm64/Architecture-arm64.h
--- a/js/src/jit/arm64/Architecture-arm64.h
+++ b/js/src/jit/arm64/Architecture-arm64.h
@@ -389,20 +389,22 @@ class FloatRegisters {
 // In bytes: slots needed for potential memory->memory move spills.
 //   +8 for cycles
 //   +8 for gpr spills
 //   +8 for double spills
 static const uint32_t ION_FRAME_SLACK_SIZE = 24;
 
 static const uint32_t ShadowStackSpace = 0;
 
-// TODO:
-// This constant needs to be updated to account for whatever near/far branching
-// strategy is used by ARM64.
-static const uint32_t JumpImmediateRange = UINT32_MAX;
+// When our only strategy for far jumps is to encode the offset directly, and
+// not insert any jump islands during assembly for even further jumps, then the
+// architecture restricts us to -2^27 .. 2^27-4, to fit into a signed 28-bit
+// value.  We further reduce this range to allow the far-jump inserting code to
+// have some breathing room.
+static const uint32_t JumpImmediateRange = ((1 << 27) - (20 * 1024 * 1024));
 
 static const uint32_t ABIStackAlignment = 16;
 static const uint32_t CodeAlignment = 16;
 static const bool StackKeptAligned = false;
 
 // Although sp is only usable if 16-byte alignment is kept,
 // the Pseudo-StackPointer enables use of 8-byte alignment.
 static const uint32_t StackAlignment = 8;