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

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

Issue 197873005: Recognize _TypedListBase._cid native. Use Lists.copy instead of native _setRange if list is small. … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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/vm/flow_graph_builder.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 import "dart:_internal"; 7 import "dart:_internal";
8 import 'dart:math' show Random; 8 import 'dart:math' show Random;
9 9
10 patch class Int8List { 10 patch class Int8List {
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 throw new ArgumentError(skipCount); 541 throw new ArgumentError(skipCount);
542 } 542 }
543 543
544 final count = end - start; 544 final count = end - start;
545 if ((from.length - skipCount) < count) { 545 if ((from.length - skipCount) < count) {
546 throw new StateError("Not enough elements"); 546 throw new StateError("Not enough elements");
547 } 547 }
548 548
549 if (from is _TypedListBase) { 549 if (from is _TypedListBase) {
550 if (this.elementSizeInBytes == from.elementSizeInBytes) { 550 if (this.elementSizeInBytes == from.elementSizeInBytes) {
551 if (this.buffer._setRange( 551 if ((count < 10) && (from.buffer != this.buffer)) {
552 Lists.copy(from, skipCount, this, start, count);
553 return;
554 } else if (this.buffer._setRange(
552 start * elementSizeInBytes + this.offsetInBytes, 555 start * elementSizeInBytes + this.offsetInBytes,
553 count * elementSizeInBytes, 556 count * elementSizeInBytes,
554 from.buffer, 557 from.buffer,
555 skipCount * elementSizeInBytes + from.offsetInBytes, 558 skipCount * elementSizeInBytes + from.offsetInBytes,
556 this._cid, from._cid)) { 559 this._cid, from._cid)) {
557 return; 560 return;
558 } 561 }
559 } else if (from.buffer == this.buffer) { 562 } else if (from.buffer == this.buffer) {
560 // Different element sizes, but same buffer means that we need 563 // Different element sizes, but same buffer means that we need
561 // an intermediate structure. 564 // an intermediate structure.
(...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after
3631 return value; 3634 return value;
3632 } 3635 }
3633 return object; 3636 return object;
3634 } 3637 }
3635 3638
3636 3639
3637 void _throwRangeError(int index, int length) { 3640 void _throwRangeError(int index, int length) {
3638 String message = "$index must be in the range [0..$length)"; 3641 String message = "$index must be in the range [0..$length)";
3639 throw new RangeError(message); 3642 throw new RangeError(message);
3640 } 3643 }
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698