| 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 DEFINE_NATIVE_ENTRY(GrowableList_allocate, 2) { | 15 DEFINE_NATIVE_ENTRY(GrowableList_allocate, 2) { |
| 16 const TypeArguments& type_arguments = | 16 const TypeArguments& type_arguments = |
| 17 TypeArguments::CheckedHandle(arguments->NativeArgAt(0)); | 17 TypeArguments::CheckedHandle(arguments->NativeArgAt(0)); |
| 18 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1)); | 18 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1)); |
| 19 if (data.Length() <= 0) { | 19 if (data.Length() <= 0) { |
| 20 Exceptions::ThrowRangeError( | 20 Exceptions::ThrowRangeError("length", |
| 21 "length", | 21 Integer::Handle(Integer::New(data.Length())), |
| 22 Integer::Handle(Integer::New(data.Length())), | 22 0, // This is the limit the user sees. |
| 23 0, // This is the limit the user sees. | 23 Array::kMaxElements); |
| 24 Array::kMaxElements); | |
| 25 } | 24 } |
| 26 const GrowableObjectArray& new_array = | 25 const GrowableObjectArray& new_array = |
| 27 GrowableObjectArray::Handle(GrowableObjectArray::New(data)); | 26 GrowableObjectArray::Handle(GrowableObjectArray::New(data)); |
| 28 new_array.SetTypeArguments(type_arguments); | 27 new_array.SetTypeArguments(type_arguments); |
| 29 return new_array.raw(); | 28 return new_array.raw(); |
| 30 } | 29 } |
| 31 | 30 |
| 32 | 31 |
| 33 DEFINE_NATIVE_ENTRY(GrowableList_getIndexed, 2) { | 32 DEFINE_NATIVE_ENTRY(GrowableList_getIndexed, 2) { |
| 34 const GrowableObjectArray& array = | 33 const GrowableObjectArray& array = |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 95 } |
| 97 | 96 |
| 98 | 97 |
| 99 DEFINE_NATIVE_ENTRY(Internal_makeFixedListUnmodifiable, 1) { | 98 DEFINE_NATIVE_ENTRY(Internal_makeFixedListUnmodifiable, 1) { |
| 100 GET_NON_NULL_NATIVE_ARGUMENT(Array, array, arguments->NativeArgAt(0)); | 99 GET_NON_NULL_NATIVE_ARGUMENT(Array, array, arguments->NativeArgAt(0)); |
| 101 array.MakeImmutable(); | 100 array.MakeImmutable(); |
| 102 return array.raw(); | 101 return array.raw(); |
| 103 } | 102 } |
| 104 | 103 |
| 105 } // namespace dart | 104 } // namespace dart |
| OLD | NEW |