OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 TYPED_DATA_NATIVES(GetUint8, SetUint8, Smi, Value, 1) | 289 TYPED_DATA_NATIVES(GetUint8, SetUint8, Smi, Value, 1) |
290 TYPED_DATA_NATIVES(GetInt16, SetInt16, Smi, Value, 2) | 290 TYPED_DATA_NATIVES(GetInt16, SetInt16, Smi, Value, 2) |
291 TYPED_DATA_NATIVES(GetUint16, SetUint16, Smi, Value, 2) | 291 TYPED_DATA_NATIVES(GetUint16, SetUint16, Smi, Value, 2) |
292 TYPED_DATA_NATIVES(GetInt32, SetInt32, Integer, AsInt64Value, 4) | 292 TYPED_DATA_NATIVES(GetInt32, SetInt32, Integer, AsInt64Value, 4) |
293 TYPED_DATA_NATIVES(GetUint32, SetUint32, Integer, AsInt64Value, 4) | 293 TYPED_DATA_NATIVES(GetUint32, SetUint32, Integer, AsInt64Value, 4) |
294 TYPED_DATA_NATIVES(GetInt64, SetInt64, Integer, AsInt64Value, 8) | 294 TYPED_DATA_NATIVES(GetInt64, SetInt64, Integer, AsInt64Value, 8) |
295 TYPED_DATA_UINT64_NATIVES(GetUint64, SetUint64, Integer) | 295 TYPED_DATA_UINT64_NATIVES(GetUint64, SetUint64, Integer) |
296 TYPED_DATA_NATIVES(GetFloat32, SetFloat32, Double, value, 4) | 296 TYPED_DATA_NATIVES(GetFloat32, SetFloat32, Double, value, 4) |
297 TYPED_DATA_NATIVES(GetFloat64, SetFloat64, Double, value, 8) | 297 TYPED_DATA_NATIVES(GetFloat64, SetFloat64, Double, value, 8) |
298 TYPED_DATA_NATIVES(GetFloat32x4, SetFloat32x4, Float32x4, value, 16) | 298 TYPED_DATA_NATIVES(GetFloat32x4, SetFloat32x4, Float32x4, value, 16) |
299 TYPED_DATA_NATIVES(GetUint32x4, SetUint32x4, Uint32x4, value, 16) | 299 TYPED_DATA_NATIVES(GetInt32x4, SetInt32x4, Int32x4, value, 16) |
300 | 300 |
301 | 301 |
302 DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt16, 2) { | 302 DEFINE_NATIVE_ENTRY(ByteData_ToEndianInt16, 2) { |
303 GET_NON_NULL_NATIVE_ARGUMENT(Smi, host_value, arguments->NativeArgAt(0)); | 303 GET_NON_NULL_NATIVE_ARGUMENT(Smi, host_value, arguments->NativeArgAt(0)); |
304 GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); | 304 GET_NON_NULL_NATIVE_ARGUMENT(Bool, little_endian, arguments->NativeArgAt(1)); |
305 int16_t value = host_value.Value(); | 305 int16_t value = host_value.Value(); |
306 if (little_endian.value()) { | 306 if (little_endian.value()) { |
307 value = Utils::HostToLittleEndian16(value); | 307 value = Utils::HostToLittleEndian16(value); |
308 } else { | 308 } else { |
309 value = Utils::HostToBigEndian16(value); | 309 value = Utils::HostToBigEndian16(value); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 value = bit_cast<double>( | 408 value = bit_cast<double>( |
409 Utils::HostToLittleEndian64(bit_cast<uint64_t>(value))); | 409 Utils::HostToLittleEndian64(bit_cast<uint64_t>(value))); |
410 } else { | 410 } else { |
411 value = bit_cast<double>( | 411 value = bit_cast<double>( |
412 Utils::HostToBigEndian64(bit_cast<uint64_t>(value))); | 412 Utils::HostToBigEndian64(bit_cast<uint64_t>(value))); |
413 } | 413 } |
414 return Double::New(value); | 414 return Double::New(value); |
415 } | 415 } |
416 | 416 |
417 } // namespace dart | 417 } // namespace dart |
OLD | NEW |