Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: runtime/lib/array.dart

Issue 14703005: Added Object._cid getter, optimized it. Added to (some) classes a static final _clCid. Use those to… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/lib/growable_array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 _classId = (new _ObjectArray(0))._cid;
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
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 _classId = (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
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 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698