Chromium Code Reviews| Index: runtime/lib/growable_array.dart |
| =================================================================== |
| --- runtime/lib/growable_array.dart (revision 43118) |
| +++ runtime/lib/growable_array.dart (working copy) |
| @@ -152,7 +152,12 @@ |
| void addAll(Iterable<T> iterable) { |
| var len = length; |
| - if (iterable is EfficientLength) { |
| + final cid = ClassID.getID(iterable); |
| + final isList = |
|
Cutch
2015/01/26 20:56:38
maybe rename isBuiltinList, isVMList?
srdjan
2015/01/26 21:34:09
isVMList.
|
| + (cid == ClassID.cidArray) || |
| + (cid == ClassID.cidGrowableObjectArray) || |
| + (cid == ClassID.cidImmutableArray); |
| + if (isList || iterable is EfficientLength) { |
| var cap = _capacity; |
| // Pregrow if we know iterable.length. |
| var iterLen = iterable.length; |
| @@ -163,6 +168,16 @@ |
| } while (newLen > cap); |
| _grow(cap); |
| } |
| + if (isList) { |
|
Cutch
2015/01/26 20:56:38
Should this block (171-180) be moved down to 182?
srdjan
2015/01/26 21:34:09
This code can be executed only if isVMList is true
|
| + if (identical(iterable, this)) { |
| + throw new ConcurrentModificationError(this); |
| + } |
| + this._setLength(newLen); |
| + for (int i = 0; i < iterLen; i++) { |
| + this[len++] = iterable[i]; |
| + } |
| + return; |
| + } |
| } |
| Iterator it = iterable.iterator; |
| if (!it.moveNext()) return; |