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

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

Issue 343803002: Finishes removing intptr_t from raw object fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return view_class_names[i].type; 250 return view_class_names[i].type;
251 } 251 }
252 i++; 252 i++;
253 } 253 }
254 return Dart_TypedData_kInvalid; 254 return Dart_TypedData_kInvalid;
255 } 255 }
256 256
257 257
258 Dart_CObject* ApiMessageReader::ReadInlinedObject(intptr_t object_id) { 258 Dart_CObject* ApiMessageReader::ReadInlinedObject(intptr_t object_id) {
259 // Read the class header information and lookup the class. 259 // Read the class header information and lookup the class.
260 intptr_t class_header = ReadIntptrValue(); 260 intptr_t class_header = Read<int32_t>();
261 intptr_t tags = ReadTags(); 261 intptr_t tags = ReadTags();
262 USE(tags); 262 USE(tags);
263 intptr_t class_id; 263 intptr_t class_id;
264 264
265 // There is limited support for reading regular dart instances. Only 265 // There is limited support for reading regular dart instances. Only
266 // typed data views are currently handled. 266 // typed data views are currently handled.
267 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { 267 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) {
268 Dart_CObject_Internal* object = 268 Dart_CObject_Internal* object =
269 reinterpret_cast<Dart_CObject_Internal*>(GetBackRef(object_id)); 269 reinterpret_cast<Dart_CObject_Internal*>(GetBackRef(object_id));
270 if (object == NULL) { 270 if (object == NULL) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 ASSERT((value64 <= kIntptrMax) && (value64 >= kIntptrMin)); 393 ASSERT((value64 <= kIntptrMax) && (value64 >= kIntptrMin));
394 intptr_t value = static_cast<intptr_t>(value64); 394 intptr_t value = static_cast<intptr_t>(value64);
395 if (IsVMIsolateObject(value)) { 395 if (IsVMIsolateObject(value)) {
396 return ReadVMIsolateObject(value); 396 return ReadVMIsolateObject(value);
397 } 397 }
398 if (SerializedHeaderTag::decode(value) == kObjectId) { 398 if (SerializedHeaderTag::decode(value) == kObjectId) {
399 return ReadIndexedObject(SerializedHeaderData::decode(value)); 399 return ReadIndexedObject(SerializedHeaderData::decode(value));
400 } 400 }
401 ASSERT(SerializedHeaderTag::decode(value) == kInlined); 401 ASSERT(SerializedHeaderTag::decode(value) == kInlined);
402 // Read the class header information and lookup the class. 402 // Read the class header information and lookup the class.
403 intptr_t class_header = ReadIntptrValue(); 403 intptr_t class_header = Read<int32_t>();
404 404
405 // Reading of regular dart instances has limited support in order to 405 // Reading of regular dart instances has limited support in order to
406 // read typed data views. 406 // read typed data views.
407 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { 407 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) {
408 intptr_t object_id = SerializedHeaderData::decode(value); 408 intptr_t object_id = SerializedHeaderData::decode(value);
409 Dart_CObject_Internal* object = 409 Dart_CObject_Internal* object =
410 AllocateDartCObjectInternal(Dart_CObject_Internal::kUninitialized); 410 AllocateDartCObjectInternal(Dart_CObject_Internal::kUninitialized);
411 AddBackRef(object_id, object, kIsNotDeserialized); 411 AddBackRef(object_id, object, kIsNotDeserialized);
412 // Read class of object. 412 // Read class of object.
413 object->cls = reinterpret_cast<Dart_CObject_Internal*>(ReadObjectImpl()); 413 object->cls = reinterpret_cast<Dart_CObject_Internal*>(ReadObjectImpl());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 if (type != &dynamic_type_marker) { 482 if (type != &dynamic_type_marker) {
483 return AllocateDartCObjectUnsupported(); 483 return AllocateDartCObjectUnsupported();
484 } 484 }
485 } 485 }
486 return value; 486 return value;
487 } 487 }
488 case kTypeParameterCid: { 488 case kTypeParameterCid: {
489 // TODO(sgjesse): Fix this workaround ignoring the type parameter. 489 // TODO(sgjesse): Fix this workaround ignoring the type parameter.
490 Dart_CObject* value = &dynamic_type_marker; 490 Dart_CObject* value = &dynamic_type_marker;
491 AddBackRef(object_id, value, kIsDeserialized); 491 AddBackRef(object_id, value, kIsDeserialized);
492 intptr_t index = ReadIntptrValue(); 492 intptr_t index = Read<int32_t>();
493 USE(index); 493 USE(index);
494 intptr_t token_index = ReadIntptrValue(); 494 intptr_t token_index = Read<int32_t>();
495 USE(token_index); 495 USE(token_index);
496 int8_t type_state = Read<int8_t>(); 496 int8_t type_state = Read<int8_t>();
497 USE(type_state); 497 USE(type_state);
498 Dart_CObject* parameterized_class = ReadObjectImpl(); 498 Dart_CObject* parameterized_class = ReadObjectImpl();
499 // The type parameter is finalized, therefore parameterized_class is null. 499 // The type parameter is finalized, therefore parameterized_class is null.
500 ASSERT(parameterized_class->type == Dart_CObject_kNull); 500 ASSERT(parameterized_class->type == Dart_CObject_kNull);
501 Dart_CObject* name = ReadObjectImpl(); 501 Dart_CObject* name = ReadObjectImpl();
502 ASSERT(name->type == Dart_CObject_kString); 502 ASSERT(name->type == Dart_CObject_kString);
503 return value; 503 return value;
504 } 504 }
505 case kMintCid: { 505 case kMintCid: {
506 int64_t value64 = Read<int64_t>(); 506 int64_t value64 = Read<int64_t>();
507 Dart_CObject* object; 507 Dart_CObject* object;
508 if ((kMinInt32 <= value64) && (value64 <= kMaxInt32)) { 508 if ((kMinInt32 <= value64) && (value64 <= kMaxInt32)) {
509 object = AllocateDartCObjectInt32(static_cast<int32_t>(value64)); 509 object = AllocateDartCObjectInt32(static_cast<int32_t>(value64));
510 } else { 510 } else {
511 object = AllocateDartCObjectInt64(value64); 511 object = AllocateDartCObjectInt64(value64);
512 } 512 }
513 AddBackRef(object_id, object, kIsDeserialized); 513 AddBackRef(object_id, object, kIsDeserialized);
514 return object; 514 return object;
515 } 515 }
516 case kBigintCid: { 516 case kBigintCid: {
517 // Read in the hex string representation of the bigint. 517 // Read in the hex string representation of the bigint.
518 intptr_t len = ReadIntptrValue(); 518 intptr_t len = Read<int32_t>();
519 Dart_CObject* object = AllocateDartCObjectBigint(len); 519 Dart_CObject* object = AllocateDartCObjectBigint(len);
520 AddBackRef(object_id, object, kIsDeserialized); 520 AddBackRef(object_id, object, kIsDeserialized);
521 char* p = object->value.as_bigint; 521 char* p = object->value.as_bigint;
522 for (intptr_t i = 0; i < len; i++) { 522 for (intptr_t i = 0; i < len; i++) {
523 p[i] = Read<uint8_t>(); 523 p[i] = Read<uint8_t>();
524 } 524 }
525 p[len] = '\0'; 525 p[len] = '\0';
526 return object; 526 return object;
527 } 527 }
528 case kDoubleCid: { 528 case kDoubleCid: {
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 chunk_len > Bigint::kMaxElements) { 1034 chunk_len > Bigint::kMaxElements) {
1035 return false; 1035 return false;
1036 } 1036 }
1037 // Write out the serialization header value for this object. 1037 // Write out the serialization header value for this object.
1038 WriteInlinedHeader(object); 1038 WriteInlinedHeader(object);
1039 // Write out the class and tags information. 1039 // Write out the class and tags information.
1040 WriteIndexedObject(kBigintCid); 1040 WriteIndexedObject(kBigintCid);
1041 WriteTags(0); 1041 WriteTags(0);
1042 // Write hex string length and content 1042 // Write hex string length and content
1043 intptr_t len = strlen(hex_string); 1043 intptr_t len = strlen(hex_string);
1044 WriteIntptrValue(len); 1044 Write<int32_t>(len);
1045 for (intptr_t i = 0; i < len; i++) { 1045 for (intptr_t i = 0; i < len; i++) {
1046 Write<uint8_t>(hex_string[i]); 1046 Write<uint8_t>(hex_string[i]);
1047 } 1047 }
1048 break; 1048 break;
1049 } 1049 }
1050 case Dart_CObject_kDouble: 1050 case Dart_CObject_kDouble:
1051 WriteVMIsolateObject(kDoubleObject); 1051 WriteVMIsolateObject(kDoubleObject);
1052 WriteDouble(object->value.as_double); 1052 WriteDouble(object->value.as_double);
1053 break; 1053 break;
1054 case Dart_CObject_kString: { 1054 case Dart_CObject_kString: {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 if (!success) { 1181 if (!success) {
1182 UnmarkAllCObjects(object); 1182 UnmarkAllCObjects(object);
1183 return false; 1183 return false;
1184 } 1184 }
1185 } 1185 }
1186 UnmarkAllCObjects(object); 1186 UnmarkAllCObjects(object);
1187 return true; 1187 return true;
1188 } 1188 }
1189 1189
1190 } // namespace dart 1190 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/debugger.cc » ('j') | runtime/vm/debugger.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698