Chromium Code Reviews| 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 | 5 |
| 6 // TODO(srdjan): Use shared array implementation. | 6 // TODO(srdjan): Use shared array implementation. |
| 7 class _ObjectArray<E> implements List<E> { | 7 class _ObjectArray<E> implements List<E> { |
| 8 static final int _clCid = (new List(0))._cid; | |
|
siva
2013/05/13 20:38:00
clCid seems redundant 'class class id'
maybe _clas
Ivan Posva
2013/05/13 22:12:37
I really like the suggestion of _classId. Also ple
srdjan
2013/05/14 17:46:31
Done.
srdjan
2013/05/14 17:46:31
Done.
| |
| 8 | 9 |
| 9 factory _ObjectArray(length) native "ObjectArray_allocate"; | 10 factory _ObjectArray(length) native "ObjectArray_allocate"; |
| 10 | 11 |
| 11 E operator [](int index) native "ObjectArray_getIndexed"; | 12 E operator [](int index) native "ObjectArray_getIndexed"; |
| 12 | 13 |
| 13 void operator []=(int index, E value) native "ObjectArray_setIndexed"; | 14 void operator []=(int index, E value) native "ObjectArray_setIndexed"; |
| 14 | 15 |
| 15 String toString() { | 16 String toString() { |
| 16 return ToString.iterableToString(this); | 17 return ToString.iterableToString(this); |
| 17 } | 18 } |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 | 269 |
| 269 | 270 |
| 270 // This is essentially the same class as _ObjectArray, but it does not | 271 // This is essentially the same class as _ObjectArray, but it does not |
| 271 // permit any modification of array elements from Dart code. We use | 272 // permit any modification of array elements from Dart code. We use |
| 272 // this class for arrays constructed from Dart array literals. | 273 // this class for arrays constructed from Dart array literals. |
| 273 // TODO(hausner): We should consider the trade-offs between two | 274 // TODO(hausner): We should consider the trade-offs between two |
| 274 // classes (and inline cache misses) versus a field in the native | 275 // classes (and inline cache misses) versus a field in the native |
| 275 // implementation (checks when modifying). We should keep watching | 276 // implementation (checks when modifying). We should keep watching |
| 276 // the inline cache misses. | 277 // the inline cache misses. |
| 277 class _ImmutableArray<E> implements List<E> { | 278 class _ImmutableArray<E> implements List<E> { |
| 279 static final int _clCid = (const [])._cid; | |
| 278 | 280 |
| 279 factory _ImmutableArray._uninstantiable() { | 281 factory _ImmutableArray._uninstantiable() { |
| 280 throw new UnsupportedError( | 282 throw new UnsupportedError( |
| 281 "ImmutableArray can only be allocated by the VM"); | 283 "ImmutableArray can only be allocated by the VM"); |
| 282 } | 284 } |
| 283 | 285 |
| 284 E operator [](int index) native "ObjectArray_getIndexed"; | 286 E operator [](int index) native "ObjectArray_getIndexed"; |
| 285 | 287 |
| 286 void operator []=(int index, E value) { | 288 void operator []=(int index, E value) { |
| 287 throw new UnsupportedError( | 289 throw new UnsupportedError( |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 } | 545 } |
| 544 _position = _length; | 546 _position = _length; |
| 545 _current = null; | 547 _current = null; |
| 546 return false; | 548 return false; |
| 547 } | 549 } |
| 548 | 550 |
| 549 E get current { | 551 E get current { |
| 550 return _current; | 552 return _current; |
| 551 } | 553 } |
| 552 } | 554 } |
| OLD | NEW |