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

Side by Side Diff: dart/runtime/vm/dart_api_message.cc

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | « dart/runtime/vm/bootstrap_natives.h ('k') | dart/runtime/vm/debugger.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) 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 #include "vm/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/dart_api_message.h" 6 #include "vm/dart_api_message.h"
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/snapshot_ids.h" 8 #include "vm/snapshot_ids.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/unicode.h" 10 #include "vm/unicode.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 object->cls->internal.as_class.library_url->value.as_string; 284 object->cls->internal.as_class.library_url->value.as_string;
285 char* class_name = 285 char* class_name =
286 object->cls->internal.as_class.class_name->value.as_string; 286 object->cls->internal.as_class.class_name->value.as_string;
287 287
288 // Handle typed data views. 288 // Handle typed data views.
289 if (strcmp("dart:typed_data", library_uri) == 0) { 289 if (strcmp("dart:typed_data", library_uri) == 0) {
290 Dart_TypedData_Type type = GetTypedDataTypeFromView(object, class_name); 290 Dart_TypedData_Type type = GetTypedDataTypeFromView(object, class_name);
291 if (type != Dart_TypedData_kInvalid) { 291 if (type != Dart_TypedData_kInvalid) {
292 object->type = 292 object->type =
293 static_cast<Dart_CObject_Type>(Dart_CObject_Internal::kView); 293 static_cast<Dart_CObject_Type>(Dart_CObject_Internal::kView);
294 ReadObjectImpl(); // Skip type arguments. 294 Dart_CObject_Internal* cls =
295 reinterpret_cast<Dart_CObject_Internal*>(ReadObjectImpl());
296 ASSERT(cls == object->cls);
295 object->internal.as_view.buffer = ReadObjectImpl(); 297 object->internal.as_view.buffer = ReadObjectImpl();
296 object->internal.as_view.offset_in_bytes = ReadSmiValue(); 298 object->internal.as_view.offset_in_bytes = ReadSmiValue();
297 object->internal.as_view.length = ReadSmiValue(); 299 object->internal.as_view.length = ReadSmiValue();
298 ReadObjectImpl(); // Skip last field.
299 300
300 // The buffer is fully read now as typed data objects are 301 // The buffer is fully read now as typed data objects are
301 // serialized in-line. 302 // serialized in-line.
302 Dart_CObject* buffer = object->internal.as_view.buffer; 303 Dart_CObject* buffer = object->internal.as_view.buffer;
303 ASSERT(buffer->type == Dart_CObject_kTypedData); 304 ASSERT(buffer->type == Dart_CObject_kTypedData);
304 305
305 // Now turn the view into a byte array. 306 // Now turn the view into a byte array.
306 object->type = Dart_CObject_kTypedData; 307 object->type = Dart_CObject_kTypedData;
307 object->value.as_typed_data.type = type; 308 object->value.as_typed_data.type = type;
308 object->value.as_typed_data.length = 309 object->value.as_typed_data.length =
309 object->internal.as_view.length * 310 object->internal.as_view.length *
310 GetTypedDataSizeInBytes(type); 311 GetTypedDataSizeInBytes(type);
311 object->value.as_typed_data.values = 312 object->value.as_typed_data.values =
312 buffer->value.as_typed_data.values + 313 buffer->value.as_typed_data.values +
313 object->internal.as_view.offset_in_bytes; 314 object->internal.as_view.offset_in_bytes;
314 } else { 315 } else {
315 // TODO(sgjesse): Handle other instances. Currently this will 316 // TODO(sgjesse): Handle other instances. Currently this will
316 // skew the reading as the fields of the instance is not read. 317 // skew the reading as the fields of the instance is not read.
317 } 318 }
318 } else if (strcmp("dart:isolate", library_uri) == 0 && 319 } else if (strcmp("dart:isolate", library_uri) == 0 &&
319 strncmp("_SendPortImpl@", class_name, 14) == 0) { 320 strncmp("_SendPortImpl@", class_name, 14) == 0) {
320 ReadObjectImpl(); // Skip type arguments. 321 Dart_CObject_Internal* cls =
322 reinterpret_cast<Dart_CObject_Internal*>(ReadObjectImpl());
323 ASSERT(cls == object->cls);
321 // Read the port id. 324 // Read the port id.
322 Dart_CObject* port = ReadObjectImpl(); 325 Dart_CObject* port = ReadObjectImpl();
323 if (port->type == Dart_CObject_kInt32) { 326 if (port->type == Dart_CObject_kInt32) {
324 object->type = Dart_CObject_kSendPort; 327 object->type = Dart_CObject_kSendPort;
325 object->value.as_send_port = port->value.as_int32; 328 object->value.as_send_port = port->value.as_int32;
326 } else if (port->type == Dart_CObject_kInt64) { 329 } else if (port->type == Dart_CObject_kInt64) {
327 object->type = Dart_CObject_kSendPort; 330 object->type = Dart_CObject_kSendPort;
328 object->value.as_send_port = port->value.as_int64; 331 object->value.as_send_port = port->value.as_int64;
329 } 332 }
330 ReadObjectImpl(); // Skip last field.
331 } else { 333 } else {
332 // TODO(sgjesse): Handle other instances. Currently this will 334 // TODO(sgjesse): Handle other instances. Currently this will
333 // skew the reading as the fields of the instance is not read. 335 // skew the reading as the fields of the instance is not read.
334 } 336 }
335 return object; 337 return object;
336 } 338 }
337 339
338 ASSERT((class_header & kSmiTagMask) != 0); 340 ASSERT((class_header & kSmiTagMask) != 0);
339 class_id = LookupInternalClass(class_header); 341 class_id = LookupInternalClass(class_header);
340 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) { 342 if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) {
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 if (!success) { 1170 if (!success) {
1169 UnmarkAllCObjects(object); 1171 UnmarkAllCObjects(object);
1170 return false; 1172 return false;
1171 } 1173 }
1172 } 1174 }
1173 UnmarkAllCObjects(object); 1175 UnmarkAllCObjects(object);
1174 return true; 1176 return true;
1175 } 1177 }
1176 1178
1177 } // namespace dart 1179 } // namespace dart
OLDNEW
« no previous file with comments | « dart/runtime/vm/bootstrap_natives.h ('k') | dart/runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698