Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: runtime/vm/globals.h

Issue 2829913002: Use __builtin_frame_address instead of inline assembly on non-Windows platforms. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_GLOBALS_H_ 5 #ifndef RUNTIME_VM_GLOBALS_H_
6 #define RUNTIME_VM_GLOBALS_H_ 6 #define RUNTIME_VM_GLOBALS_H_
7 7
8 // This file contains global definitions for the VM library only. Anything that 8 // This file contains global definitions for the VM library only. Anything that
9 // is more globally useful should be added to 'vm/globals.h'. 9 // is more globally useful should be added to 'vm/globals.h'.
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #elif defined(HOST_ARCH_X64) 109 #elif defined(HOST_ARCH_X64)
110 // We don't have the asm equivalent to get at the frame pointer on 110 // We don't have the asm equivalent to get at the frame pointer on
111 // windows x64, return the stack pointer instead. 111 // windows x64, return the stack pointer instead.
112 #define COPY_FP_REGISTER(fp) fp = Thread::GetCurrentStackPointer(); 112 #define COPY_FP_REGISTER(fp) fp = Thread::GetCurrentStackPointer();
113 #else 113 #else
114 #error Unknown host architecture. 114 #error Unknown host architecture.
115 #endif 115 #endif
116 116
117 #else // !defined(HOST_OS_WINDOWS)) 117 #else // !defined(HOST_OS_WINDOWS))
118 118
119 // Assume GCC-like inline syntax is valid. 119 // Assume GCC-compatible builtins.
120 #if defined(HOST_ARCH_IA32) 120 #define COPY_FP_REGISTER(fp) \
121 #define COPY_FP_REGISTER(fp) asm volatile("movl %%ebp, %0" : "=r"(fp)); 121 fp = reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
122 #elif defined(HOST_ARCH_X64)
123 #define COPY_FP_REGISTER(fp) asm volatile("movq %%rbp, %0" : "=r"(fp));
124 #elif defined(HOST_ARCH_ARM)
125 #if defined(HOST_OS_MAC)
126 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, r7" : "=r"(fp));
127 #else
128 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, r11" : "=r"(fp));
129 #endif
130 #elif defined(HOST_ARCH_ARM64)
131 #define COPY_FP_REGISTER(fp) asm volatile("mov %0, x29" : "=r"(fp));
132 #elif defined(HOST_ARCH_MIPS)
133 #define COPY_FP_REGISTER(fp) asm volatile("move %0, $fp" : "=r"(fp));
134 #else
135 #error Unknown host architecture.
136 #endif
137 122
138 #endif // !defined(HOST_OS_WINDOWS)) 123 #endif // !defined(HOST_OS_WINDOWS))
139 124
140 } // namespace dart 125 } // namespace dart
141 126
142 #endif // RUNTIME_VM_GLOBALS_H_ 127 #endif // RUNTIME_VM_GLOBALS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698