| 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 AbstractTypeArguments& type_arguments = | 16 const TypeArguments& type_arguments = |
| 17 AbstractTypeArguments::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 const Integer& index = Integer::Handle(Integer::New(data.Length())); | 20 const Integer& index = Integer::Handle(Integer::New(data.Length())); |
| 21 const Array& args = Array::Handle(Array::New(1)); | 21 const Array& args = Array::Handle(Array::New(1)); |
| 22 args.SetAt(0, index); | 22 args.SetAt(0, index); |
| 23 Exceptions::ThrowByType(Exceptions::kRange, args); | 23 Exceptions::ThrowByType(Exceptions::kRange, args); |
| 24 } | 24 } |
| 25 const GrowableObjectArray& new_array = | 25 const GrowableObjectArray& new_array = |
| 26 GrowableObjectArray::Handle(GrowableObjectArray::New(data)); | 26 GrowableObjectArray::Handle(GrowableObjectArray::New(data)); |
| 27 new_array.SetTypeArguments(type_arguments); | 27 new_array.SetTypeArguments(type_arguments); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 DEFINE_NATIVE_ENTRY(GrowableList_setData, 2) { | 85 DEFINE_NATIVE_ENTRY(GrowableList_setData, 2) { |
| 86 const GrowableObjectArray& array = | 86 const GrowableObjectArray& array = |
| 87 GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); | 87 GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); |
| 88 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1)); | 88 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1)); |
| 89 ASSERT(data.Length() > 0); | 89 ASSERT(data.Length() > 0); |
| 90 array.SetData(data); | 90 array.SetData(data); |
| 91 return Object::null(); | 91 return Object::null(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace dart | 94 } // namespace dart |
| OLD | NEW |