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

Side by Side Diff: runtime/vm/object.cc

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 unified diff | Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | tests/lib/typed_data/float32x4_test.dart » ('j') | 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 22334 matching lines...) Expand 10 before | Expand all | Expand 10 after
22345 Object::Allocate(Float32x4::kClassId, Float32x4::InstanceSize(), space); 22345 Object::Allocate(Float32x4::kClassId, Float32x4::InstanceSize(), space);
22346 NoSafepointScope no_safepoint; 22346 NoSafepointScope no_safepoint;
22347 result ^= raw; 22347 result ^= raw;
22348 } 22348 }
22349 result.set_value(value); 22349 result.set_value(value);
22350 return result.raw(); 22350 return result.raw();
22351 } 22351 }
22352 22352
22353 22353
22354 simd128_value_t Float32x4::value() const { 22354 simd128_value_t Float32x4::value() const {
22355 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); 22355 return ReadUnaligned(
22356 reinterpret_cast<const simd128_value_t*>(&raw_ptr()->value_));
22356 } 22357 }
22357 22358
22358 22359
22359 void Float32x4::set_value(simd128_value_t value) const { 22360 void Float32x4::set_value(simd128_value_t value) const {
22360 StoreSimd128(&raw_ptr()->value_[0], value); 22361 StoreUnaligned(reinterpret_cast<simd128_value_t*>(&raw()->ptr()->value_),
22362 value);
22361 } 22363 }
22362 22364
22363 22365
22364 void Float32x4::set_x(float value) const { 22366 void Float32x4::set_x(float value) const {
22365 StoreNonPointer(&raw_ptr()->value_[0], value); 22367 StoreNonPointer(&raw_ptr()->value_[0], value);
22366 } 22368 }
22367 22369
22368 22370
22369 void Float32x4::set_y(float value) const { 22371 void Float32x4::set_y(float value) const {
22370 StoreNonPointer(&raw_ptr()->value_[1], value); 22372 StoreNonPointer(&raw_ptr()->value_[1], value);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
22480 return raw_ptr()->value_[2]; 22482 return raw_ptr()->value_[2];
22481 } 22483 }
22482 22484
22483 22485
22484 int32_t Int32x4::w() const { 22486 int32_t Int32x4::w() const {
22485 return raw_ptr()->value_[3]; 22487 return raw_ptr()->value_[3];
22486 } 22488 }
22487 22489
22488 22490
22489 simd128_value_t Int32x4::value() const { 22491 simd128_value_t Int32x4::value() const {
22490 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); 22492 return ReadUnaligned(
22493 reinterpret_cast<const simd128_value_t*>(&raw_ptr()->value_));
22491 } 22494 }
22492 22495
22493 22496
22494 void Int32x4::set_value(simd128_value_t value) const { 22497 void Int32x4::set_value(simd128_value_t value) const {
22495 StoreSimd128(&raw_ptr()->value_[0], value); 22498 StoreUnaligned(reinterpret_cast<simd128_value_t*>(&raw()->ptr()->value_),
22499 value);
22496 } 22500 }
22497 22501
22498 22502
22499 const char* Int32x4::ToCString() const { 22503 const char* Int32x4::ToCString() const {
22500 int32_t _x = x(); 22504 int32_t _x = x();
22501 int32_t _y = y(); 22505 int32_t _y = y();
22502 int32_t _z = z(); 22506 int32_t _z = z();
22503 int32_t _w = w(); 22507 int32_t _w = w();
22504 return OS::SCreate(Thread::Current()->zone(), "[%08x, %08x, %08x, %08x]", _x, 22508 return OS::SCreate(Thread::Current()->zone(), "[%08x, %08x, %08x, %08x]", _x,
22505 _y, _z, _w); 22509 _y, _z, _w);
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
23419 return UserTag::null(); 23423 return UserTag::null();
23420 } 23424 }
23421 23425
23422 23426
23423 const char* UserTag::ToCString() const { 23427 const char* UserTag::ToCString() const {
23424 const String& tag_label = String::Handle(label()); 23428 const String& tag_label = String::Handle(label());
23425 return tag_label.ToCString(); 23429 return tag_label.ToCString();
23426 } 23430 }
23427 23431
23428 } // namespace dart 23432 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | tests/lib/typed_data/float32x4_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698