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

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

Issue 2067443004: Fix struct alignment for SIMD objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/atomic.h" 9 #include "vm/atomic.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 } 1989 }
1990 1990
1991 1991
1992 friend class SnapshotReader; 1992 friend class SnapshotReader;
1993 }; 1993 };
1994 1994
1995 1995
1996 class RawFloat32x4 : public RawInstance { 1996 class RawFloat32x4 : public RawInstance {
1997 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4); 1997 RAW_HEAP_OBJECT_IMPLEMENTATION(Float32x4);
1998 1998
1999 float value_[4]; 1999 ALIGN8 float value_[4];
2000 2000
2001 friend class SnapshotReader; 2001 friend class SnapshotReader;
2002 public: 2002 public:
2003 float x() const { return value_[0]; } 2003 float x() const { return value_[0]; }
2004 float y() const { return value_[1]; } 2004 float y() const { return value_[1]; }
2005 float z() const { return value_[2]; } 2005 float z() const { return value_[2]; }
2006 float w() const { return value_[3]; } 2006 float w() const { return value_[3]; }
2007 }; 2007 };
2008 COMPILE_ASSERT(sizeof(RawFloat32x4) == 24);
2008 2009
2009 2010
2010 class RawInt32x4 : public RawInstance { 2011 class RawInt32x4 : public RawInstance {
2011 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4); 2012 RAW_HEAP_OBJECT_IMPLEMENTATION(Int32x4);
2012 2013
2013 int32_t value_[4]; 2014 ALIGN8 int32_t value_[4];
2014 2015
2015 friend class SnapshotReader; 2016 friend class SnapshotReader;
2016 public: 2017 public:
2017 int32_t x() const { return value_[0]; } 2018 int32_t x() const { return value_[0]; }
2018 int32_t y() const { return value_[1]; } 2019 int32_t y() const { return value_[1]; }
2019 int32_t z() const { return value_[2]; } 2020 int32_t z() const { return value_[2]; }
2020 int32_t w() const { return value_[3]; } 2021 int32_t w() const { return value_[3]; }
2021 }; 2022 };
2023 COMPILE_ASSERT(sizeof(RawInt32x4) == 24);
2022 2024
2023 2025
2024 class RawFloat64x2 : public RawInstance { 2026 class RawFloat64x2 : public RawInstance {
2025 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2); 2027 RAW_HEAP_OBJECT_IMPLEMENTATION(Float64x2);
2026 2028
2027 double value_[2]; 2029 ALIGN8 double value_[2];
2028 2030
2029 friend class SnapshotReader; 2031 friend class SnapshotReader;
2030 public: 2032 public:
2031 double x() const { return value_[0]; } 2033 double x() const { return value_[0]; }
2032 double y() const { return value_[1]; } 2034 double y() const { return value_[1]; }
2033 }; 2035 };
2036 COMPILE_ASSERT(sizeof(RawFloat64x2) == 24);
2034 2037
2035 2038
2036 // Define an aliases for intptr_t. 2039 // Define an aliases for intptr_t.
2037 #if defined(ARCH_IS_32_BIT) 2040 #if defined(ARCH_IS_32_BIT)
2038 #define kIntPtrCid kTypedDataInt32ArrayCid 2041 #define kIntPtrCid kTypedDataInt32ArrayCid
2039 #define SetIntPtr SetInt32 2042 #define SetIntPtr SetInt32
2040 #elif defined(ARCH_IS_64_BIT) 2043 #elif defined(ARCH_IS_64_BIT)
2041 #define kIntPtrCid kTypedDataInt64ArrayCid 2044 #define kIntPtrCid kTypedDataInt64ArrayCid
2042 #define SetIntPtr SetInt64 2045 #define SetIntPtr SetInt64
2043 #else 2046 #else
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == 2432 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid ==
2430 kTypedDataInt8ArrayViewCid + 15); 2433 kTypedDataInt8ArrayViewCid + 15);
2431 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); 2434 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14);
2432 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); 2435 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1);
2433 return (kNullCid - kTypedDataInt8ArrayCid); 2436 return (kNullCid - kTypedDataInt8ArrayCid);
2434 } 2437 }
2435 2438
2436 } // namespace dart 2439 } // namespace dart
2437 2440
2438 #endif // VM_RAW_OBJECT_H_ 2441 #endif // VM_RAW_OBJECT_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