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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/isolate_serialization.dart

Issue 1188713005: Use an ES6 map for a linked identity hash map. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 part of _isolate_helper; 5 part of _isolate_helper;
6 6
7 /// Serialize [message]. 7 /// Serialize [message].
8 _serializeMessage(message) { 8 _serializeMessage(message) {
9 return new _Serializer().serialize(message); 9 return new _Serializer().serialize(message);
10 } 10 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 serializeClosure(Closure x) { 159 serializeClosure(Closure x) {
160 final name = IsolateNatives._getJSFunctionName(x); 160 final name = IsolateNatives._getJSFunctionName(x);
161 if (name == null) { 161 if (name == null) {
162 unsupported(x, "Closures can't be transmitted:"); 162 unsupported(x, "Closures can't be transmitted:");
163 } 163 }
164 return ['function', name]; 164 return ['function', name];
165 } 165 }
166 166
167 serializeDartObject(x) { 167 serializeDartObject(x) {
168 if (!isDartObject(x)) unsupported(x);
168 var classExtractor = JS_EMBEDDED_GLOBAL('', CLASS_ID_EXTRACTOR); 169 var classExtractor = JS_EMBEDDED_GLOBAL('', CLASS_ID_EXTRACTOR);
169 var fieldsExtractor = JS_EMBEDDED_GLOBAL('', CLASS_FIELDS_EXTRACTOR); 170 var fieldsExtractor = JS_EMBEDDED_GLOBAL('', CLASS_FIELDS_EXTRACTOR);
170 String classId = JS('String', '#(#)', classExtractor, x); 171 String classId = JS('String', '#(#)', classExtractor, x);
171 List fields = JS('JSArray', '#(#)', fieldsExtractor, x); 172 List fields = JS('JSArray', '#(#)', fieldsExtractor, x);
172 return ['dart', classId, serializeArrayInPlace(fields)]; 173 return ['dart', classId, serializeArrayInPlace(fields)];
173 } 174 }
174 } 175 }
175 176
176 class _Deserializer { 177 class _Deserializer {
177 /// When `true`, encodes sendports specially so that they can be adjusted on 178 /// When `true`, encodes sendports specially so that they can be adjusted on
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID); 353 var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID);
353 var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE); 354 var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE);
354 355
355 var emptyInstance = JS('', '#(#)', instanceFromClassId, classId); 356 var emptyInstance = JS('', '#(#)', instanceFromClassId, classId);
356 deserializedObjects.add(emptyInstance); 357 deserializedObjects.add(emptyInstance);
357 deserializeArrayInPlace(fields); 358 deserializeArrayInPlace(fields);
358 return JS('', '#(#, #, #)', 359 return JS('', '#(#, #, #)',
359 initializeObject, classId, emptyInstance, fields); 360 initializeObject, classId, emptyInstance, fields);
360 } 361 }
361 } 362 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/isolate_helper.dart ('k') | sdk/lib/_internal/compiler/js_lib/linked_hash_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698