OLD | NEW |
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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 12346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12357 return result.raw(); | 12357 return result.raw(); |
12358 } | 12358 } |
12359 | 12359 |
12360 | 12360 |
12361 const char* GrowableObjectArray::ToCString() const { | 12361 const char* GrowableObjectArray::ToCString() const { |
12362 return "GrowableObjectArray"; | 12362 return "GrowableObjectArray"; |
12363 } | 12363 } |
12364 | 12364 |
12365 | 12365 |
12366 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, | 12366 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
12367 Heap::Space space) { | 12367 Heap::Space space) { |
12368 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 12368 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
12369 Class::null()); | 12369 Class::null()); |
12370 Float32x4& result = Float32x4::Handle(); | 12370 Float32x4& result = Float32x4::Handle(); |
12371 { | 12371 { |
12372 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 12372 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
12373 Float32x4::InstanceSize(), | 12373 Float32x4::InstanceSize(), |
12374 space); | 12374 space); |
12375 NoGCScope no_gc; | 12375 NoGCScope no_gc; |
12376 result ^= raw; | 12376 result ^= raw; |
12377 } | 12377 } |
12378 result.set_x(v0); | 12378 result.set_x(v0); |
12379 result.set_y(v1); | 12379 result.set_y(v1); |
12380 result.set_z(v2); | 12380 result.set_z(v2); |
12381 result.set_w(v3); | 12381 result.set_w(v3); |
12382 return result.raw(); | 12382 return result.raw(); |
12383 } | 12383 } |
12384 | 12384 |
12385 | 12385 |
12386 RawFloat32x4* Float32x4::New(simd_value_t value, Heap::Space space) { | 12386 RawFloat32x4* Float32x4::New(simd128_value_t value, Heap::Space space) { |
12387 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 12387 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
12388 Class::null()); | 12388 Class::null()); |
12389 Float32x4& result = Float32x4::Handle(); | 12389 Float32x4& result = Float32x4::Handle(); |
12390 { | 12390 { |
12391 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 12391 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
12392 Float32x4::InstanceSize(), | 12392 Float32x4::InstanceSize(), |
12393 space); | 12393 space); |
12394 NoGCScope no_gc; | 12394 NoGCScope no_gc; |
12395 result ^= raw; | 12395 result ^= raw; |
12396 } | 12396 } |
12397 result.set_value(value); | 12397 result.set_value(value); |
12398 return result.raw(); | 12398 return result.raw(); |
12399 } | 12399 } |
12400 | 12400 |
12401 | 12401 |
12402 simd_value_t Float32x4::value() const { | 12402 simd128_value_t Float32x4::value() const { |
12403 return simd_value_safe_load(&raw_ptr()->value_[0]); | 12403 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
12404 } | 12404 } |
12405 | 12405 |
12406 | 12406 |
12407 void Float32x4::set_value(simd_value_t value) const { | 12407 void Float32x4::set_value(simd128_value_t value) const { |
12408 simd_value_safe_store(&raw_ptr()->value_[0], value); | 12408 value.writeTo(&raw_ptr()->value_[0]); |
12409 } | 12409 } |
12410 | 12410 |
12411 | 12411 |
12412 void Float32x4::set_x(float value) const { | 12412 void Float32x4::set_x(float value) const { |
12413 raw_ptr()->value_[0] = value; | 12413 raw_ptr()->value_[0] = value; |
12414 } | 12414 } |
12415 | 12415 |
12416 | 12416 |
12417 void Float32x4::set_y(float value) const { | 12417 void Float32x4::set_y(float value) const { |
12418 raw_ptr()->value_[1] = value; | 12418 raw_ptr()->value_[1] = value; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12476 result ^= raw; | 12476 result ^= raw; |
12477 } | 12477 } |
12478 result.set_x(v0); | 12478 result.set_x(v0); |
12479 result.set_y(v1); | 12479 result.set_y(v1); |
12480 result.set_z(v2); | 12480 result.set_z(v2); |
12481 result.set_w(v3); | 12481 result.set_w(v3); |
12482 return result.raw(); | 12482 return result.raw(); |
12483 } | 12483 } |
12484 | 12484 |
12485 | 12485 |
12486 RawUint32x4* Uint32x4::New(simd_value_t value, Heap::Space space) { | 12486 RawUint32x4* Uint32x4::New(simd128_value_t value, Heap::Space space) { |
12487 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 12487 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
12488 Class::null()); | 12488 Class::null()); |
12489 Uint32x4& result = Uint32x4::Handle(); | 12489 Uint32x4& result = Uint32x4::Handle(); |
12490 { | 12490 { |
12491 RawObject* raw = Object::Allocate(Uint32x4::kClassId, | 12491 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
12492 Uint32x4::InstanceSize(), | 12492 Uint32x4::InstanceSize(), |
12493 space); | 12493 space); |
12494 NoGCScope no_gc; | 12494 NoGCScope no_gc; |
12495 result ^= raw; | 12495 result ^= raw; |
12496 } | 12496 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12532 uint32_t Uint32x4::z() const { | 12532 uint32_t Uint32x4::z() const { |
12533 return raw_ptr()->value_[2]; | 12533 return raw_ptr()->value_[2]; |
12534 } | 12534 } |
12535 | 12535 |
12536 | 12536 |
12537 uint32_t Uint32x4::w() const { | 12537 uint32_t Uint32x4::w() const { |
12538 return raw_ptr()->value_[3]; | 12538 return raw_ptr()->value_[3]; |
12539 } | 12539 } |
12540 | 12540 |
12541 | 12541 |
12542 simd_value_t Uint32x4::value() const { | 12542 simd128_value_t Uint32x4::value() const { |
12543 return simd_value_safe_load(&raw_ptr()->value_[0]); | 12543 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
12544 } | 12544 } |
12545 | 12545 |
12546 | 12546 |
12547 void Uint32x4::set_value(simd_value_t value) const { | 12547 void Uint32x4::set_value(simd128_value_t value) const { |
12548 simd_value_safe_store(&raw_ptr()->value_[0], value); | 12548 value.writeTo(&raw_ptr()->value_[0]); |
12549 } | 12549 } |
12550 | 12550 |
12551 | 12551 |
12552 const char* Uint32x4::ToCString() const { | 12552 const char* Uint32x4::ToCString() const { |
12553 const char* kFormat = "[%08x, %08x, %08x, %08x]"; | 12553 const char* kFormat = "[%08x, %08x, %08x, %08x]"; |
12554 uint32_t _x = x(); | 12554 uint32_t _x = x(); |
12555 uint32_t _y = y(); | 12555 uint32_t _y = y(); |
12556 uint32_t _z = z(); | 12556 uint32_t _z = z(); |
12557 uint32_t _w = w(); | 12557 uint32_t _w = w(); |
12558 // Calculate the size of the string. | 12558 // Calculate the size of the string. |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13008 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); | 13008 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); |
13009 } | 13009 } |
13010 | 13010 |
13011 | 13011 |
13012 const char* Uint64Array::ToCString() const { | 13012 const char* Uint64Array::ToCString() const { |
13013 return "_Uint64Array"; | 13013 return "_Uint64Array"; |
13014 } | 13014 } |
13015 | 13015 |
13016 | 13016 |
13017 RawFloat32x4Array* Float32x4Array::New(intptr_t len, | 13017 RawFloat32x4Array* Float32x4Array::New(intptr_t len, |
13018 Heap::Space space) { | 13018 Heap::Space space) { |
13019 ASSERT(Isolate::Current()->object_store()->float32x4_array_class() != | 13019 ASSERT(Isolate::Current()->object_store()->float32x4_array_class() != |
13020 Class::null()); | 13020 Class::null()); |
13021 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, len, | 13021 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, len, |
13022 space); | 13022 space); |
13023 } | 13023 } |
13024 | 13024 |
13025 | 13025 |
13026 RawFloat32x4Array* Float32x4Array::New(const simd_value_t* data, | 13026 RawFloat32x4Array* Float32x4Array::New(const simd128_value_t* data, |
13027 intptr_t len, | 13027 intptr_t len, |
13028 Heap::Space space) { | 13028 Heap::Space space) { |
13029 ASSERT(Isolate::Current()->object_store()->float32_array_class() != | 13029 ASSERT(Isolate::Current()->object_store()->float32_array_class() != |
13030 Class::null()); | 13030 Class::null()); |
13031 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, data, | 13031 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, data, |
13032 len, space); | 13032 len, space); |
13033 } | 13033 } |
13034 | 13034 |
13035 | 13035 |
13036 const char* Float32x4Array::ToCString() const { | 13036 const char* Float32x4Array::ToCString() const { |
13037 return "_Float32x4Array"; | 13037 return "_Float32x4Array"; |
13038 } | 13038 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13211 return NewExternalImpl<ExternalUint64Array, | 13211 return NewExternalImpl<ExternalUint64Array, |
13212 RawExternalUint64Array>(kClassId, data, len, space); | 13212 RawExternalUint64Array>(kClassId, data, len, space); |
13213 } | 13213 } |
13214 | 13214 |
13215 | 13215 |
13216 const char* ExternalUint64Array::ToCString() const { | 13216 const char* ExternalUint64Array::ToCString() const { |
13217 return "_ExternalUint64Array"; | 13217 return "_ExternalUint64Array"; |
13218 } | 13218 } |
13219 | 13219 |
13220 | 13220 |
13221 RawExternalFloat32x4Array* ExternalFloat32x4Array::New( | 13221 RawExternalFloat32x4Array* ExternalFloat32x4Array::New(simd128_value_t* data, |
13222 simd_value_t* data, | 13222 intptr_t len, |
13223 intptr_t len, | 13223 Heap::Space space) { |
13224 Heap::Space space) { | |
13225 RawClass* cls = | 13224 RawClass* cls = |
13226 Isolate::Current()->object_store()->external_float32x4_array_class(); | 13225 Isolate::Current()->object_store()->external_float32x4_array_class(); |
13227 ASSERT(cls != Class::null()); | 13226 ASSERT(cls != Class::null()); |
13228 return NewExternalImpl<ExternalFloat32x4Array, | 13227 return NewExternalImpl<ExternalFloat32x4Array, |
13229 RawExternalFloat32x4Array>(kClassId, data, len, | 13228 RawExternalFloat32x4Array>(kClassId, data, len, |
13230 space); | 13229 space); |
13231 } | 13230 } |
13232 | 13231 |
13233 | 13232 |
13234 const char* ExternalFloat32x4Array::ToCString() const { | 13233 const char* ExternalFloat32x4Array::ToCString() const { |
13235 return "_ExternalFloat32x4Array"; | 13234 return "_ExternalFloat32x4Array"; |
13236 } | 13235 } |
13237 | 13236 |
13238 | 13237 |
13239 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, | 13238 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, |
13240 intptr_t len, | 13239 intptr_t len, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13650 } | 13649 } |
13651 return result.raw(); | 13650 return result.raw(); |
13652 } | 13651 } |
13653 | 13652 |
13654 | 13653 |
13655 const char* WeakProperty::ToCString() const { | 13654 const char* WeakProperty::ToCString() const { |
13656 return "_WeakProperty"; | 13655 return "_WeakProperty"; |
13657 } | 13656 } |
13658 | 13657 |
13659 } // namespace dart | 13658 } // namespace dart |
OLD | NEW |