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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } else if (len < 0) { | 52 } else if (len < 0) { |
53 const String& error = String::Handle(String::NewFormatted( | 53 const String& error = String::Handle(String::NewFormatted( |
54 "%"Pd" must be greater than 0", len)); | 54 "%"Pd" must be greater than 0", len)); |
55 const Array& args = Array::Handle(Array::New(1)); | 55 const Array& args = Array::Handle(Array::New(1)); |
56 args.SetAt(0, error); | 56 args.SetAt(0, error); |
57 Exceptions::ThrowByType(Exceptions::kArgument, args); | 57 Exceptions::ThrowByType(Exceptions::kArgument, args); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 static void PeerFinalizer(Dart_Handle handle, void* peer) { | 62 static void PeerFinalizer(Dart_WeakPersistentHandle handle, void* peer) { |
63 Dart_DeletePersistentHandle(handle); | 63 Dart_DeleteWeakPersistentHandle(handle); |
64 OS::AlignedFree(peer); | 64 OS::AlignedFree(peer); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 DEFINE_NATIVE_ENTRY(TypedData_length, 1) { | 68 DEFINE_NATIVE_ENTRY(TypedData_length, 1) { |
69 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); | 69 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0)); |
70 if (instance.IsTypedData()) { | 70 if (instance.IsTypedData()) { |
71 const TypedData& array = TypedData::Cast(instance); | 71 const TypedData& array = TypedData::Cast(instance); |
72 return Smi::New(array.Length()); | 72 return Smi::New(array.Length()); |
73 } | 73 } |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 value = bit_cast<double>( | 435 value = bit_cast<double>( |
436 Utils::HostToLittleEndian64(bit_cast<uint64_t>(value))); | 436 Utils::HostToLittleEndian64(bit_cast<uint64_t>(value))); |
437 } else { | 437 } else { |
438 value = bit_cast<double>( | 438 value = bit_cast<double>( |
439 Utils::HostToBigEndian64(bit_cast<uint64_t>(value))); | 439 Utils::HostToBigEndian64(bit_cast<uint64_t>(value))); |
440 } | 440 } |
441 return Double::New(value); | 441 return Double::New(value); |
442 } | 442 } |
443 | 443 |
444 } // namespace dart | 444 } // namespace dart |
OLD | NEW |