OLD | NEW |
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 dart._isolate_helper; | 5 part of dart._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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 x[i] = deserialize(x[i]); | 256 x[i] = deserialize(x[i]); |
257 } | 257 } |
258 return x; | 258 return x; |
259 } | 259 } |
260 | 260 |
261 // ['fixed', <array>]. | 261 // ['fixed', <array>]. |
262 List deserializeFixed(x) { | 262 List deserializeFixed(x) { |
263 assert(x[0] == 'fixed'); | 263 assert(x[0] == 'fixed'); |
264 List result = x[1]; | 264 List result = x[1]; |
265 deserializedObjects.add(result); | 265 deserializedObjects.add(result); |
266 return new JSArray.markFixed(deserializeArrayInPlace(result)); | 266 return new JSArray.fixed(deserializeArrayInPlace(result)); |
267 } | 267 } |
268 | 268 |
269 // ['extendable', <array>]. | 269 // ['extendable', <array>]. |
270 List deserializeExtendable(x) { | 270 List deserializeExtendable(x) { |
271 assert(x[0] == 'extendable'); | 271 assert(x[0] == 'extendable'); |
272 List result = x[1]; | 272 List result = x[1]; |
273 deserializedObjects.add(result); | 273 deserializedObjects.add(result); |
274 return new JSArray.markGrowable(deserializeArrayInPlace(result)); | 274 return new JSArray.of(deserializeArrayInPlace(result)); |
275 } | 275 } |
276 | 276 |
277 // ['mutable', <array>]. | 277 // ['mutable', <array>]. |
278 List deserializeMutable(x) { | 278 List deserializeMutable(x) { |
279 assert(x[0] == 'mutable'); | 279 assert(x[0] == 'mutable'); |
280 List result = x[1]; | 280 List result = x[1]; |
281 deserializedObjects.add(result); | 281 deserializedObjects.add(result); |
282 return deserializeArrayInPlace(result); | 282 return deserializeArrayInPlace(result); |
283 } | 283 } |
284 | 284 |
285 // ['const', <array>]. | 285 // ['const', <array>]. |
286 List deserializeConst(x) { | 286 List deserializeConst(x) { |
287 assert(x[0] == 'const'); | 287 assert(x[0] == 'const'); |
288 List result = x[1]; | 288 List result = x[1]; |
289 deserializedObjects.add(result); | 289 deserializedObjects.add(result); |
290 // TODO(floitsch): need to mark list as non-changeable. | 290 // TODO(floitsch): need to mark list as non-changeable. |
291 return new JSArray.markFixed(deserializeArrayInPlace(result)); | 291 return new JSArray.unmodifiable(deserializeArrayInPlace(result)); |
292 } | 292 } |
293 | 293 |
294 // ['map', <key-list>, <value-list>]. | 294 // ['map', <key-list>, <value-list>]. |
295 Map deserializeMap(InternalMap x) { | 295 Map deserializeMap(InternalMap x) { |
296 assert(x[0] == 'map'); | 296 assert(x[0] == 'map'); |
297 List keys = x[1]; | 297 List keys = x[1]; |
298 List values = x[2]; | 298 List values = x[2]; |
299 Map result = {}; | 299 Map result = {}; |
300 deserializedObjects.add(result); | 300 deserializedObjects.add(result); |
301 // We need to keep the order of how objects were serialized. | 301 // We need to keep the order of how objects were serialized. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID); | 368 var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID); |
369 var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE); | 369 var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE); |
370 | 370 |
371 var emptyInstance = JS('', '#(#)', instanceFromClassId, classId); | 371 var emptyInstance = JS('', '#(#)', instanceFromClassId, classId); |
372 deserializedObjects.add(emptyInstance); | 372 deserializedObjects.add(emptyInstance); |
373 deserializeArrayInPlace(fields); | 373 deserializeArrayInPlace(fields); |
374 return JS( | 374 return JS( |
375 '', '#(#, #, #)', initializeObject, classId, emptyInstance, fields); | 375 '', '#(#, #, #)', initializeObject, classId, emptyInstance, fields); |
376 } | 376 } |
377 } | 377 } |
OLD | NEW |