| 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 DEFINE_NATIVE_ENTRY(Uint8Array_getIndexed, 2) { | 336 DEFINE_NATIVE_ENTRY(Uint8Array_getIndexed, 2) { |
| 337 GETTER(Uint8Array, Smi, uint8_t); | 337 GETTER(Uint8Array, Smi, uint8_t); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 DEFINE_NATIVE_ENTRY(Uint8Array_setIndexed, 3) { | 341 DEFINE_NATIVE_ENTRY(Uint8Array_setIndexed, 3) { |
| 342 SETTER(Uint8Array, Smi, Value, uint8_t); | 342 SETTER(Uint8Array, Smi, Value, uint8_t); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 // Uint8ClampedArray |
| 347 |
| 348 DEFINE_NATIVE_ENTRY(Uint8ClampedArray_new, 1) { |
| 349 GET_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); |
| 350 intptr_t len = length.Value(); |
| 351 LengthCheck(len, Uint8ClampedArray::kMaxElements); |
| 352 return Uint8ClampedArray::New(len); |
| 353 } |
| 354 |
| 355 |
| 356 DEFINE_NATIVE_ENTRY(Uint8ClampedArray_newTransferable, 1) { |
| 357 GET_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); |
| 358 intptr_t len = length.Value(); |
| 359 LengthCheck(len, Uint8ClampedArray::kMaxElements); |
| 360 uint8_t* bytes = OS::AllocateAlignedArray<uint8_t>( |
| 361 len, |
| 362 ExternalByteArrayData<uint8_t>::kAlignment); |
| 363 return ExternalUint8ClampedArray::New(bytes, |
| 364 len, |
| 365 bytes, |
| 366 OS::AlignedFree); |
| 367 } |
| 368 |
| 369 |
| 346 // Int16Array | 370 // Int16Array |
| 347 | 371 |
| 348 DEFINE_NATIVE_ENTRY(Int16Array_new, 1) { | 372 DEFINE_NATIVE_ENTRY(Int16Array_new, 1) { |
| 349 GET_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); | 373 GET_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(0)); |
| 350 intptr_t len = length.Value(); | 374 intptr_t len = length.Value(); |
| 351 LengthCheck(len, Int16Array::kMaxElements); | 375 LengthCheck(len, Int16Array::kMaxElements); |
| 352 return Int16Array::New(len); | 376 return Int16Array::New(len); |
| 353 } | 377 } |
| 354 | 378 |
| 355 | 379 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_getIndexed, 2) { | 752 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_getIndexed, 2) { |
| 729 GETTER(ExternalFloat64Array, Double, double); | 753 GETTER(ExternalFloat64Array, Double, double); |
| 730 } | 754 } |
| 731 | 755 |
| 732 | 756 |
| 733 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_setIndexed, 3) { | 757 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_setIndexed, 3) { |
| 734 SETTER(ExternalFloat64Array, Double, value, double); | 758 SETTER(ExternalFloat64Array, Double, value, double); |
| 735 } | 759 } |
| 736 | 760 |
| 737 } // namespace dart | 761 } // namespace dart |
| OLD | NEW |