1 // Copyright 2020 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Push all callee-saved registers to get them on the stack for conservative 6 // stack scanning. 7 // 8 // See asm/x64/push_registers_clang.cc for why the function is not generated 9 // using clang. 10 // 11 // Do not depend on V8_TARGET_OS_* defines as some embedders may override the 12 // GN toolchain (e.g. ChromeOS) and not provide them. 13 14 // We maintain 8-byte alignment at calls by pushing an additional 15 // non-callee-saved register (r3). 16 // 17 // Calling convention source: 18 // https://en.wikipedia.org/wiki/Calling_convention#ARM_(A32) 19 // http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka4127.html 20 asm(".globl PushAllRegistersAndIterateStack \n" 21 ".type PushAllRegistersAndIterateStack, %function \n" 22 ".hidden PushAllRegistersAndIterateStack \n" 23 "PushAllRegistersAndIterateStack: \n" 24 // Push all callee-saved registers and save return address. 25 // Only {r4-r11} are callee-saved registers. Push r3 in addition to align 26 // the stack back to 8 bytes. 27 " push {r3-r11, lr} \n" 28 // Pass 1st parameter (r0) unchanged (Stack*). 29 // Pass 2nd parameter (r1) unchanged (StackVisitor*). 30 // Save 3rd parameter (r2; IterateStackCallback). 31 " mov r3, r2 \n" 32 // Pass 3rd parameter as sp (stack pointer). 33 " mov r2, sp \n" 34 // Call the callback. 35 " blx r3 \n" 36 // Discard all the registers. 37 " add sp, sp, #36 \n" 38 // Pop lr into pc which returns and switches mode if needed. 39 " pop {pc} \n"); 40