Bug 1524419 - Incrementally touch stack on arm64 r=tcampbell a=lizzard
authorMatthew Gaudet <mgaudet@mozilla.com>
Mon, 25 Feb 2019 13:58:15 +0000
changeset 516187 73317ecccd48354ebf0047a7a0d019783d7b70ee
parent 516186 eccb1f5d6a0720aebc8f00172d72cf5254b3f2e5
child 516188 b1350573ac7c6c294c8d5cae275e6cc45b9ffa43
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell, lizzard
bugs1524419
milestone66.0
Bug 1524419 - Incrementally touch stack on arm64 r=tcampbell a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D19992
js/src/jit/arm64/Trampoline-arm64.cpp
--- a/js/src/jit/arm64/Trampoline-arm64.cpp
+++ b/js/src/jit/arm64/Trampoline-arm64.cpp
@@ -95,16 +95,31 @@ void JitRuntime::generateEnterJIT(JSCont
 
   // JitFrameLayout is as follows (higher is higher in memory):
   //  N*8  - [ JS argument vector ] (base 16-byte aligned)
   //  8    - numActualArgs
   //  8    - calleeToken (16-byte aligned)
   //  8    - frameDescriptor
   //  8    - returnAddress (16-byte aligned, pushed by callee)
 
+  // Touch frame incrementally (a requirement for Windows).
+  //
+  // Use already saved callee-save registers r20 and r21 as temps.
+  //
+  // This has to be done outside the ScratchRegisterScope, as the temps are
+  // under demand inside the touchFrameValues call.
+
+  // Give sp 16-byte alignment and sync stack pointers.
+  masm.andToStackPtr(Imm32(~0xff));
+  // We needn't worry about the Gecko Profiler mark because touchFrameValues
+  // touches in large increments.
+  masm.touchFrameValues(reg_argc, r20, r21);
+  // Restore stack pointer, preserved above.
+  masm.moveToStackPtr(r19);
+
   // Push the argument vector onto the stack.
   // WARNING: destructively modifies reg_argv
   {
     vixl::UseScratchRegisterScope temps(&masm.asVIXL());
 
     const ARMRegister tmp_argc = temps.AcquireX();
     const ARMRegister tmp_sp = temps.AcquireX();