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

Side by Side Diff: sdk/lib/isolate/mangler.dart

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload. Adapt code for List.fixedLength. Created 8 years 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 | « sdk/lib/io/file_impl.dart ('k') | tests/compiler/dart2js/value_range_test.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 class _IsolateEncoder { 5 class _IsolateEncoder {
6 final manglingToken; 6 final manglingToken;
7 // TODO(floitsch): switch to identity set. 7 // TODO(floitsch): switch to identity set.
8 final Map _encoded = new Map(); 8 final Map _encoded = new Map();
9 final Map _visiting = new Map(); 9 final Map _visiting = new Map();
10 final Function _mangle; 10 final Function _mangle;
(...skipping 24 matching lines...) Expand all
35 _visiting[data] = data; 35 _visiting[data] = data;
36 36
37 var result; 37 var result;
38 38
39 if (data is List) { 39 if (data is List) {
40 bool hasBeenDuplicated = false; 40 bool hasBeenDuplicated = false;
41 result = data; 41 result = data;
42 for (int i = 0; i < data.length; i++) { 42 for (int i = 0; i < data.length; i++) {
43 var mangled = encode(data[i]); 43 var mangled = encode(data[i]);
44 if (mangled != data[i] && !hasBeenDuplicated) { 44 if (mangled != data[i] && !hasBeenDuplicated) {
45 result = new List(data.length); 45 result = new List.fixedLength(data.length);
46 for (int j = 0; j < i; j++) { 46 for (int j = 0; j < i; j++) {
47 result[j] = data[j]; 47 result[j] = data[j];
48 } 48 }
49 hasBeenDuplicated = true; 49 hasBeenDuplicated = true;
50 } 50 }
51 if (hasBeenDuplicated) { 51 if (hasBeenDuplicated) {
52 result[i] = mangled; 52 result[i] = mangled;
53 } 53 }
54 } 54 }
55 result = _escapeIfNecessary(result); 55 result = _escapeIfNecessary(result);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 _extractMangled(wrappedMangled) { 260 _extractMangled(wrappedMangled) {
261 assert(_isMangled(wrappedMangled)); 261 assert(_isMangled(wrappedMangled));
262 return wrappedMangled[2]; 262 return wrappedMangled[2];
263 } 263 }
264 _extractEscaped(data) { 264 _extractEscaped(data) {
265 assert(_isEscaped(data)); 265 assert(_isEscaped(data));
266 return data[2]; 266 return data[2];
267 } 267 }
268 } 268 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | tests/compiler/dart2js/value_range_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698