| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_BASE_MACROS_H_ | 5 #ifndef V8_BASE_MACROS_H_ |
| 6 #define V8_BASE_MACROS_H_ | 6 #define V8_BASE_MACROS_H_ |
| 7 | 7 |
| 8 #include "include/v8stdint.h" | 8 #include "include/v8stdint.h" |
| 9 #include "src/base/build_config.h" | 9 #include "src/base/build_config.h" |
| 10 #include "src/base/logging.h" | 10 #include "src/base/logging.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return x + 1; | 239 return x + 1; |
| 240 } | 240 } |
| 241 | 241 |
| 242 | 242 |
| 243 inline uint32_t RoundDownToPowerOf2(uint32_t x) { | 243 inline uint32_t RoundDownToPowerOf2(uint32_t x) { |
| 244 uint32_t rounded_up = RoundUpToPowerOf2(x); | 244 uint32_t rounded_up = RoundUpToPowerOf2(x); |
| 245 if (rounded_up > x) return rounded_up >> 1; | 245 if (rounded_up > x) return rounded_up >> 1; |
| 246 return rounded_up; | 246 return rounded_up; |
| 247 } | 247 } |
| 248 | 248 |
| 249 |
| 250 // Returns current value of top of the stack. Works correctly with ASAN. |
| 251 DISABLE_ASAN |
| 252 inline uintptr_t GetCurrentStackPosition() { |
| 253 // Takes the address of the limit variable in order to find out where |
| 254 // the top of stack is right now. |
| 255 uintptr_t limit = reinterpret_cast<uintptr_t>(&limit); |
| 256 return limit; |
| 257 } |
| 258 |
| 249 #endif // V8_BASE_MACROS_H_ | 259 #endif // V8_BASE_MACROS_H_ |
| OLD | NEW |