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 12200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12211 return result.raw(); | 12211 return result.raw(); |
12212 } | 12212 } |
12213 | 12213 |
12214 | 12214 |
12215 const char* GrowableObjectArray::ToCString() const { | 12215 const char* GrowableObjectArray::ToCString() const { |
12216 return "GrowableObjectArray"; | 12216 return "GrowableObjectArray"; |
12217 } | 12217 } |
12218 | 12218 |
12219 | 12219 |
12220 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, | 12220 RawFloat32x4* Float32x4::New(float v0, float v1, float v2, float v3, |
12221 Heap::Space space) { | 12221 Heap::Space space) { |
12222 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 12222 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
12223 Class::null()); | 12223 Class::null()); |
12224 Float32x4& result = Float32x4::Handle(); | 12224 Float32x4& result = Float32x4::Handle(); |
12225 { | 12225 { |
12226 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 12226 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
12227 Float32x4::InstanceSize(), | 12227 Float32x4::InstanceSize(), |
12228 space); | 12228 space); |
12229 NoGCScope no_gc; | 12229 NoGCScope no_gc; |
12230 result ^= raw; | 12230 result ^= raw; |
12231 } | 12231 } |
12232 result.set_x(v0); | 12232 result.set_x(v0); |
12233 result.set_y(v1); | 12233 result.set_y(v1); |
12234 result.set_z(v2); | 12234 result.set_z(v2); |
12235 result.set_w(v3); | 12235 result.set_w(v3); |
12236 return result.raw(); | 12236 return result.raw(); |
12237 } | 12237 } |
12238 | 12238 |
12239 | 12239 |
12240 RawFloat32x4* Float32x4::New(simd_value_t value, Heap::Space space) { | 12240 RawFloat32x4* Float32x4::New(simd128_value_t value, Heap::Space space) { |
12241 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 12241 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
12242 Class::null()); | 12242 Class::null()); |
12243 Float32x4& result = Float32x4::Handle(); | 12243 Float32x4& result = Float32x4::Handle(); |
12244 { | 12244 { |
12245 RawObject* raw = Object::Allocate(Float32x4::kClassId, | 12245 RawObject* raw = Object::Allocate(Float32x4::kClassId, |
12246 Float32x4::InstanceSize(), | 12246 Float32x4::InstanceSize(), |
12247 space); | 12247 space); |
12248 NoGCScope no_gc; | 12248 NoGCScope no_gc; |
12249 result ^= raw; | 12249 result ^= raw; |
12250 } | 12250 } |
12251 result.set_value(value); | 12251 result.set_value(value); |
12252 return result.raw(); | 12252 return result.raw(); |
12253 } | 12253 } |
12254 | 12254 |
12255 | 12255 |
12256 simd_value_t Float32x4::value() const { | 12256 simd128_value_t Float32x4::value() const { |
12257 return simd_value_safe_load(&raw_ptr()->value_[0]); | 12257 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
12258 } | 12258 } |
12259 | 12259 |
12260 | 12260 |
12261 void Float32x4::set_value(simd_value_t value) const { | 12261 void Float32x4::set_value(simd128_value_t value) const { |
12262 simd_value_safe_store(&raw_ptr()->value_[0], value); | 12262 value.writeTo(&raw_ptr()->value_[0]); |
12263 } | 12263 } |
12264 | 12264 |
12265 | 12265 |
12266 void Float32x4::set_x(float value) const { | 12266 void Float32x4::set_x(float value) const { |
12267 raw_ptr()->value_[0] = value; | 12267 raw_ptr()->value_[0] = value; |
12268 } | 12268 } |
12269 | 12269 |
12270 | 12270 |
12271 void Float32x4::set_y(float value) const { | 12271 void Float32x4::set_y(float value) const { |
12272 raw_ptr()->value_[1] = value; | 12272 raw_ptr()->value_[1] = value; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12330 result ^= raw; | 12330 result ^= raw; |
12331 } | 12331 } |
12332 result.set_x(v0); | 12332 result.set_x(v0); |
12333 result.set_y(v1); | 12333 result.set_y(v1); |
12334 result.set_z(v2); | 12334 result.set_z(v2); |
12335 result.set_w(v3); | 12335 result.set_w(v3); |
12336 return result.raw(); | 12336 return result.raw(); |
12337 } | 12337 } |
12338 | 12338 |
12339 | 12339 |
12340 RawUint32x4* Uint32x4::New(simd_value_t value, Heap::Space space) { | 12340 RawUint32x4* Uint32x4::New(simd128_value_t value, Heap::Space space) { |
12341 ASSERT(Isolate::Current()->object_store()->float32x4_class() != | 12341 ASSERT(Isolate::Current()->object_store()->float32x4_class() != |
12342 Class::null()); | 12342 Class::null()); |
12343 Uint32x4& result = Uint32x4::Handle(); | 12343 Uint32x4& result = Uint32x4::Handle(); |
12344 { | 12344 { |
12345 RawObject* raw = Object::Allocate(Uint32x4::kClassId, | 12345 RawObject* raw = Object::Allocate(Uint32x4::kClassId, |
12346 Uint32x4::InstanceSize(), | 12346 Uint32x4::InstanceSize(), |
12347 space); | 12347 space); |
12348 NoGCScope no_gc; | 12348 NoGCScope no_gc; |
12349 result ^= raw; | 12349 result ^= raw; |
12350 } | 12350 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12386 uint32_t Uint32x4::z() const { | 12386 uint32_t Uint32x4::z() const { |
12387 return raw_ptr()->value_[2]; | 12387 return raw_ptr()->value_[2]; |
12388 } | 12388 } |
12389 | 12389 |
12390 | 12390 |
12391 uint32_t Uint32x4::w() const { | 12391 uint32_t Uint32x4::w() const { |
12392 return raw_ptr()->value_[3]; | 12392 return raw_ptr()->value_[3]; |
12393 } | 12393 } |
12394 | 12394 |
12395 | 12395 |
12396 simd_value_t Uint32x4::value() const { | 12396 simd128_value_t Uint32x4::value() const { |
12397 return simd_value_safe_load(&raw_ptr()->value_[0]); | 12397 return simd128_value_t().readFrom(&raw_ptr()->value_[0]); |
12398 } | 12398 } |
12399 | 12399 |
12400 | 12400 |
12401 void Uint32x4::set_value(simd_value_t value) const { | 12401 void Uint32x4::set_value(simd128_value_t value) const { |
12402 simd_value_safe_store(&raw_ptr()->value_[0], value); | 12402 value.writeTo(&raw_ptr()->value_[0]); |
12403 } | 12403 } |
12404 | 12404 |
12405 | 12405 |
12406 const char* Uint32x4::ToCString() const { | 12406 const char* Uint32x4::ToCString() const { |
12407 const char* kFormat = "[%08x, %08x, %08x, %08x]"; | 12407 const char* kFormat = "[%08x, %08x, %08x, %08x]"; |
12408 uint32_t _x = x(); | 12408 uint32_t _x = x(); |
12409 uint32_t _y = y(); | 12409 uint32_t _y = y(); |
12410 uint32_t _z = z(); | 12410 uint32_t _z = z(); |
12411 uint32_t _w = w(); | 12411 uint32_t _w = w(); |
12412 // Calculate the size of the string. | 12412 // Calculate the size of the string. |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12862 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); | 12862 return NewImpl<Uint64Array, RawUint64Array>(kClassId, data, len, space); |
12863 } | 12863 } |
12864 | 12864 |
12865 | 12865 |
12866 const char* Uint64Array::ToCString() const { | 12866 const char* Uint64Array::ToCString() const { |
12867 return "_Uint64Array"; | 12867 return "_Uint64Array"; |
12868 } | 12868 } |
12869 | 12869 |
12870 | 12870 |
12871 RawFloat32x4Array* Float32x4Array::New(intptr_t len, | 12871 RawFloat32x4Array* Float32x4Array::New(intptr_t len, |
12872 Heap::Space space) { | 12872 Heap::Space space) { |
12873 ASSERT(Isolate::Current()->object_store()->float32x4_array_class() != | 12873 ASSERT(Isolate::Current()->object_store()->float32x4_array_class() != |
12874 Class::null()); | 12874 Class::null()); |
12875 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, len, | 12875 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, len, |
12876 space); | 12876 space); |
12877 } | 12877 } |
12878 | 12878 |
12879 | 12879 |
12880 RawFloat32x4Array* Float32x4Array::New(const simd_value_t* data, | 12880 RawFloat32x4Array* Float32x4Array::New(const simd128_value_t* data, |
12881 intptr_t len, | 12881 intptr_t len, |
12882 Heap::Space space) { | 12882 Heap::Space space) { |
12883 ASSERT(Isolate::Current()->object_store()->float32_array_class() != | 12883 ASSERT(Isolate::Current()->object_store()->float32_array_class() != |
12884 Class::null()); | 12884 Class::null()); |
12885 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, data, | 12885 return NewImpl<Float32x4Array, RawFloat32x4Array>(kClassId, data, |
12886 len, space); | 12886 len, space); |
12887 } | 12887 } |
12888 | 12888 |
12889 | 12889 |
12890 const char* Float32x4Array::ToCString() const { | 12890 const char* Float32x4Array::ToCString() const { |
12891 return "_Float32x4Array"; | 12891 return "_Float32x4Array"; |
12892 } | 12892 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13065 return NewExternalImpl<ExternalUint64Array, | 13065 return NewExternalImpl<ExternalUint64Array, |
13066 RawExternalUint64Array>(kClassId, data, len, space); | 13066 RawExternalUint64Array>(kClassId, data, len, space); |
13067 } | 13067 } |
13068 | 13068 |
13069 | 13069 |
13070 const char* ExternalUint64Array::ToCString() const { | 13070 const char* ExternalUint64Array::ToCString() const { |
13071 return "_ExternalUint64Array"; | 13071 return "_ExternalUint64Array"; |
13072 } | 13072 } |
13073 | 13073 |
13074 | 13074 |
13075 RawExternalFloat32x4Array* ExternalFloat32x4Array::New( | 13075 RawExternalFloat32x4Array* ExternalFloat32x4Array::New(simd128_value_t* data, |
13076 simd_value_t* data, | 13076 intptr_t len, |
13077 intptr_t len, | 13077 Heap::Space space) { |
13078 Heap::Space space) { | |
13079 RawClass* cls = | 13078 RawClass* cls = |
13080 Isolate::Current()->object_store()->external_float32x4_array_class(); | 13079 Isolate::Current()->object_store()->external_float32x4_array_class(); |
13081 ASSERT(cls != Class::null()); | 13080 ASSERT(cls != Class::null()); |
13082 return NewExternalImpl<ExternalFloat32x4Array, | 13081 return NewExternalImpl<ExternalFloat32x4Array, |
13083 RawExternalFloat32x4Array>(kClassId, data, len, | 13082 RawExternalFloat32x4Array>(kClassId, data, len, |
13084 space); | 13083 space); |
13085 } | 13084 } |
13086 | 13085 |
13087 | 13086 |
13088 const char* ExternalFloat32x4Array::ToCString() const { | 13087 const char* ExternalFloat32x4Array::ToCString() const { |
13089 return "_ExternalFloat32x4Array"; | 13088 return "_ExternalFloat32x4Array"; |
13090 } | 13089 } |
13091 | 13090 |
13092 | 13091 |
13093 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, | 13092 RawExternalFloat32Array* ExternalFloat32Array::New(float* data, |
13094 intptr_t len, | 13093 intptr_t len, |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13504 } | 13503 } |
13505 return result.raw(); | 13504 return result.raw(); |
13506 } | 13505 } |
13507 | 13506 |
13508 | 13507 |
13509 const char* WeakProperty::ToCString() const { | 13508 const char* WeakProperty::ToCString() const { |
13510 return "_WeakProperty"; | 13509 return "_WeakProperty"; |
13511 } | 13510 } |
13512 | 13511 |
13513 } // namespace dart | 13512 } // namespace dart |
OLD | NEW |