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

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

Issue 345223003: Add VM internal Dart class 'ClassID' used to manage class-ids of known classes. Next CL: add consta… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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/class_id.cc » ('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 _List<E> implements List<E> { 7 class _List<E> implements List<E> {
8 static final int _classId = (new _List(0))._cid; 8 static final int _classId = ClassID.getID(new _List(0));
9 9
10 factory _List(length) native "List_allocate"; 10 factory _List(length) native "List_allocate";
11 11
12 E operator [](int index) native "List_getIndexed"; 12 E operator [](int index) native "List_getIndexed";
13 13
14 void operator []=(int index, E value) native "List_setIndexed"; 14 void operator []=(int index, E value) native "List_setIndexed";
15 15
16 String toString() { 16 String toString() {
17 return ListBase.listToString(this); 17 return ListBase.listToString(this);
18 } 18 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 264
265 265
266 // This is essentially the same class as _List, but it does not 266 // This is essentially the same class as _List, but it does not
267 // permit any modification of array elements from Dart code. We use 267 // permit any modification of array elements from Dart code. We use
268 // this class for arrays constructed from Dart array literals. 268 // this class for arrays constructed from Dart array literals.
269 // TODO(hausner): We should consider the trade-offs between two 269 // TODO(hausner): We should consider the trade-offs between two
270 // classes (and inline cache misses) versus a field in the native 270 // classes (and inline cache misses) versus a field in the native
271 // implementation (checks when modifying). We should keep watching 271 // implementation (checks when modifying). We should keep watching
272 // the inline cache misses. 272 // the inline cache misses.
273 class _ImmutableList<E> implements List<E> { 273 class _ImmutableList<E> implements List<E> {
274 static final int _classId = (const [])._cid; 274 static final int _classId = ClassID.getID(const []);
275 275
276 factory _ImmutableList._uninstantiable() { 276 factory _ImmutableList._uninstantiable() {
277 throw new UnsupportedError( 277 throw new UnsupportedError(
278 "ImmutableArray can only be allocated by the VM"); 278 "ImmutableArray can only be allocated by the VM");
279 } 279 }
280 280
281 factory _ImmutableList._from(List from, int offset, int length) 281 factory _ImmutableList._from(List from, int offset, int length)
282 native "ImmutableList_from"; 282 native "ImmutableList_from";
283 283
284 E operator [](int index) native "List_getIndexed"; 284 E operator [](int index) native "List_getIndexed";
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 530 }
531 _position = _length; 531 _position = _length;
532 _current = null; 532 _current = null;
533 return false; 533 return false;
534 } 534 }
535 535
536 E get current { 536 E get current {
537 return _current; 537 return _current;
538 } 538 }
539 } 539 }
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/class_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698