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

Unified Diff: runtime/vm/object.h

Issue 2947783002: Avoid unaligned access fault in Int32x4/Float32x4::value() on ARM. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/platform/globals.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index d5062633402b9c66a7b4e20c46a5eb4e109c01be..894b59bdcb4579a654871a345dcd4c7f2cc62a98 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -7961,29 +7961,15 @@ class TypedData : public Instance {
virtual bool CanonicalizeEquals(const Instance& other) const;
virtual uword ComputeCanonicalTableHash() const;
-#if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
#define TYPED_GETTER_SETTER(name, type) \
type Get##name(intptr_t byte_offset) const { \
NoSafepointScope no_safepoint; \
- return *reinterpret_cast<type*>(DataAddr(byte_offset)); \
- } \
- void Set##name(intptr_t byte_offset, type value) const { \
- NoSafepointScope no_safepoint; \
- *reinterpret_cast<type*>(DataAddr(byte_offset)) = value; \
- }
-#else // defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
-#define TYPED_GETTER_SETTER(name, type) \
- type Get##name(intptr_t byte_offset) const { \
- NoSafepointScope no_safepoint; \
- type result; \
- memmove(&result, DataAddr(byte_offset), sizeof(type)); \
- return result; \
+ return ReadUnaligned(reinterpret_cast<type*>(DataAddr(byte_offset))); \
} \
void Set##name(intptr_t byte_offset, type value) const { \
NoSafepointScope no_safepoint; \
- memmove(DataAddr(byte_offset), &value, sizeof(type)); \
+ StoreUnaligned(reinterpret_cast<type*>(DataAddr(byte_offset)), value); \
}
-#endif // defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
TYPED_GETTER_SETTER(Int8, int8_t)
TYPED_GETTER_SETTER(Uint8, uint8_t)
« no previous file with comments | « runtime/platform/globals.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698