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

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

Issue 2953653002: [arm, arm64] Convince the Android toolchain not to bypass memcpy in Read/StoreUnaligned. (Closed)
Patch Set: Created 3 years, 6 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_PLATFORM_GLOBALS_H_ 5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_
6 #define RUNTIME_PLATFORM_GLOBALS_H_ 6 #define RUNTIME_PLATFORM_GLOBALS_H_
7 7
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to
9 // enable platform independent printf format specifiers. 9 // enable platform independent printf format specifiers.
10 #ifndef __STDC_FORMAT_MACROS 10 #ifndef __STDC_FORMAT_MACROS
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 return destination; 662 return destination;
663 } 663 }
664 664
665 665
666 #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) || \ 666 #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) || \
667 defined(HOST_ARCH_ARM64) 667 defined(HOST_ARCH_ARM64)
668 // Similar to bit_copy and bit_cast, but does take the type from the argument. 668 // Similar to bit_copy and bit_cast, but does take the type from the argument.
669 template <typename T> 669 template <typename T>
670 static inline T ReadUnaligned(const T* ptr) { 670 static inline T ReadUnaligned(const T* ptr) {
671 T value; 671 T value;
672 memcpy(&value, ptr, sizeof(value)); 672 memcpy(reinterpret_cast<void*>(&value), reinterpret_cast<const void*>(ptr),
673 sizeof(value));
673 return value; 674 return value;
674 } 675 }
675 676
676 677
677 // Similar to bit_copy and bit_cast, but does take the type from the argument. 678 // Similar to bit_copy and bit_cast, but does take the type from the argument.
678 template <typename T> 679 template <typename T>
679 static inline void StoreUnaligned(T* ptr, T value) { 680 static inline void StoreUnaligned(T* ptr, T value) {
680 memcpy(ptr, &value, sizeof(value)); 681 memcpy(reinterpret_cast<void*>(ptr), reinterpret_cast<const void*>(&value),
682 sizeof(value));
681 } 683 }
682 #else // !(HOST_ARCH_ARM || HOST_ARCH_MIPS || HOST_ARCH_ARM64) 684 #else // !(HOST_ARCH_ARM || HOST_ARCH_MIPS || HOST_ARCH_ARM64)
683 // Similar to bit_copy and bit_cast, but does take the type from the argument. 685 // Similar to bit_copy and bit_cast, but does take the type from the argument.
684 template <typename T> 686 template <typename T>
685 static inline T ReadUnaligned(const T* ptr) { 687 static inline T ReadUnaligned(const T* ptr) {
686 return *ptr; 688 return *ptr;
687 } 689 }
688 690
689 691
690 // Similar to bit_copy and bit_cast, but does take the type from the argument. 692 // Similar to bit_copy and bit_cast, but does take the type from the argument.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 // tag in the ICData and check it when recreating the flow graph in 737 // tag in the ICData and check it when recreating the flow graph in
736 // optimizing compiler. Enable it for other modes (product, release) if needed 738 // optimizing compiler. Enable it for other modes (product, release) if needed
737 // for debugging. 739 // for debugging.
738 #if defined(DEBUG) 740 #if defined(DEBUG)
739 #define TAG_IC_DATA 741 #define TAG_IC_DATA
740 #endif 742 #endif
741 743
742 } // namespace dart 744 } // namespace dart
743 745
744 #endif // RUNTIME_PLATFORM_GLOBALS_H_ 746 #endif // RUNTIME_PLATFORM_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