| 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 25 matching lines...) Expand all Loading... |
| 36 static void LengthCheck(intptr_t len, intptr_t max) { | 36 static void LengthCheck(intptr_t len, intptr_t max) { |
| 37 if (len < 0 || len > max) { | 37 if (len < 0 || len > max) { |
| 38 const String& error = String::Handle(String::NewFormatted( | 38 const String& error = String::Handle(String::NewFormatted( |
| 39 "Length (%" Pd ") of object must be in range [0..%" Pd "]", | 39 "Length (%" Pd ") of object must be in range [0..%" Pd "]", |
| 40 len, max)); | 40 len, max)); |
| 41 Exceptions::ThrowArgumentError(error); | 41 Exceptions::ThrowArgumentError(error); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 |
| 46 static void PeerFinalizer(Dart_Isolate isolate, | 46 static void PeerFinalizer(void* isolate_callback_data, |
| 47 Dart_WeakPersistentHandle handle, | 47 Dart_WeakPersistentHandle handle, |
| 48 void* peer) { | 48 void* peer) { |
| 49 Dart_DeleteWeakPersistentHandle(isolate, handle); | |
| 50 OS::AlignedFree(peer); | 49 OS::AlignedFree(peer); |
| 51 } | 50 } |
| 52 | 51 |
| 53 | 52 |
| 54 DEFINE_NATIVE_ENTRY(TypedData_length, 1) { | 53 DEFINE_NATIVE_ENTRY(TypedData_length, 1) { |
| 55 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); | 54 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); |
| 56 if (instance.IsTypedData()) { | 55 if (instance.IsTypedData()) { |
| 57 const TypedData& array = TypedData::Cast(instance); | 56 const TypedData& array = TypedData::Cast(instance); |
| 58 return Smi::New(array.Length()); | 57 return Smi::New(array.Length()); |
| 59 } | 58 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 value = bit_cast<double>( | 454 value = bit_cast<double>( |
| 456 Utils::HostToLittleEndian64(bit_cast<uint64_t>(value))); | 455 Utils::HostToLittleEndian64(bit_cast<uint64_t>(value))); |
| 457 } else { | 456 } else { |
| 458 value = bit_cast<double>( | 457 value = bit_cast<double>( |
| 459 Utils::HostToBigEndian64(bit_cast<uint64_t>(value))); | 458 Utils::HostToBigEndian64(bit_cast<uint64_t>(value))); |
| 460 } | 459 } |
| 461 return Double::New(value); | 460 return Double::New(value); |
| 462 } | 461 } |
| 463 | 462 |
| 464 } // namespace dart | 463 } // namespace dart |
| OLD | NEW |