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

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, 3 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | 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 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 ASSERT((value64 <= kIntptrMax) && (value64 >= kIntptrMin)); 398 ASSERT((value64 <= kIntptrMax) && (value64 >= kIntptrMin));
399 intptr_t value = static_cast<intptr_t>(value64); 399 intptr_t value = static_cast<intptr_t>(value64);
400 if (IsVMIsolateObject(value)) { 400 if (IsVMIsolateObject(value)) {
401 return ReadVMIsolateObject(value); 401 return ReadVMIsolateObject(value);
402 } 402 }
403 if (SerializedHeaderTag::decode(value) == kObjectId) { 403 if (SerializedHeaderTag::decode(value) == kObjectId) {
404 return ReadIndexedObject(SerializedHeaderData::decode(value)); 404 return ReadIndexedObject(SerializedHeaderData::decode(value));
405 } 405 }
406 ASSERT(SerializedHeaderTag::decode(value) == kInlined); 406 ASSERT(SerializedHeaderTag::decode(value) == kInlined);
407 // Read the class header information and lookup the class. 407 // Read the class header information and lookup the class.
408 intptr_t class_header = ReadIntptrValue(); 408 intptr_t class_header = Read<int32_t>();
409 409
410 intptr_t object_id = SerializedHeaderData::decode(value); 410 intptr_t object_id = SerializedHeaderData::decode(value);
411 if (object_id == kOmittedObjectId) { 411 if (object_id == kOmittedObjectId) {
412 object_id = NextAvailableObjectId(); 412 object_id = NextAvailableObjectId();
413 } 413 }
414 414
415 // Reading of regular dart instances has limited support in order to 415 // Reading of regular dart instances has limited support in order to
416 // read typed data views. 416 // read typed data views.
417 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) { 417 if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) {
418 Dart_CObject_Internal* object = 418 Dart_CObject_Internal* object =
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 if (type != &dynamic_type_marker) { 490 if (type != &dynamic_type_marker) {
491 return AllocateDartCObjectUnsupported(); 491 return AllocateDartCObjectUnsupported();
492 } 492 }
493 } 493 }
494 return value; 494 return value;
495 } 495 }
496 case kTypeParameterCid: { 496 case kTypeParameterCid: {
497 // TODO(sgjesse): Fix this workaround ignoring the type parameter. 497 // TODO(sgjesse): Fix this workaround ignoring the type parameter.
498 Dart_CObject* value = &dynamic_type_marker; 498 Dart_CObject* value = &dynamic_type_marker;
499 AddBackRef(object_id, value, kIsDeserialized); 499 AddBackRef(object_id, value, kIsDeserialized);
500 intptr_t index = ReadIntptrValue(); 500 intptr_t index = Read<int32_t>();
501 USE(index); 501 USE(index);
502 intptr_t token_index = ReadIntptrValue(); 502 intptr_t token_index = Read<int32_t>();
503 USE(token_index); 503 USE(token_index);
504 int8_t type_state = Read<int8_t>(); 504 int8_t type_state = Read<int8_t>();
505 USE(type_state); 505 USE(type_state);
506 Dart_CObject* parameterized_class = ReadObjectImpl(); 506 Dart_CObject* parameterized_class = ReadObjectImpl();
507 // The type parameter is finalized, therefore parameterized_class is null. 507 // The type parameter is finalized, therefore parameterized_class is null.
508 ASSERT(parameterized_class->type == Dart_CObject_kNull); 508 ASSERT(parameterized_class->type == Dart_CObject_kNull);
509 Dart_CObject* name = ReadObjectImpl(); 509 Dart_CObject* name = ReadObjectImpl();
510 ASSERT(name->type == Dart_CObject_kString); 510 ASSERT(name->type == Dart_CObject_kString);
511 return value; 511 return value;
512 } 512 }
513 case kMintCid: { 513 case kMintCid: {
514 int64_t value64 = Read<int64_t>(); 514 int64_t value64 = Read<int64_t>();
515 Dart_CObject* object; 515 Dart_CObject* object;
516 if ((kMinInt32 <= value64) && (value64 <= kMaxInt32)) { 516 if ((kMinInt32 <= value64) && (value64 <= kMaxInt32)) {
517 object = AllocateDartCObjectInt32(static_cast<int32_t>(value64)); 517 object = AllocateDartCObjectInt32(static_cast<int32_t>(value64));
518 } else { 518 } else {
519 object = AllocateDartCObjectInt64(value64); 519 object = AllocateDartCObjectInt64(value64);
520 } 520 }
521 AddBackRef(object_id, object, kIsDeserialized); 521 AddBackRef(object_id, object, kIsDeserialized);
522 return object; 522 return object;
523 } 523 }
524 case kBigintCid: { 524 case kBigintCid: {
525 // Read in the hex string representation of the bigint. 525 // Read in the hex string representation of the bigint.
526 intptr_t len = ReadIntptrValue(); 526 intptr_t len = Read<int32_t>();
527 Dart_CObject* object = AllocateDartCObjectBigint(len); 527 Dart_CObject* object = AllocateDartCObjectBigint(len);
528 AddBackRef(object_id, object, kIsDeserialized); 528 AddBackRef(object_id, object, kIsDeserialized);
529 char* p = object->value.as_bigint; 529 char* p = object->value.as_bigint;
530 for (intptr_t i = 0; i < len; i++) { 530 for (intptr_t i = 0; i < len; i++) {
531 p[i] = Read<uint8_t>(); 531 p[i] = Read<uint8_t>();
532 } 532 }
533 p[len] = '\0'; 533 p[len] = '\0';
534 return object; 534 return object;
535 } 535 }
536 case kDoubleCid: { 536 case kDoubleCid: {
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 chunk_len > Bigint::kMaxElements) { 1047 chunk_len > Bigint::kMaxElements) {
1048 return false; 1048 return false;
1049 } 1049 }
1050 // Write out the serialization header value for this object. 1050 // Write out the serialization header value for this object.
1051 WriteInlinedHeader(object); 1051 WriteInlinedHeader(object);
1052 // Write out the class and tags information. 1052 // Write out the class and tags information.
1053 WriteIndexedObject(kBigintCid); 1053 WriteIndexedObject(kBigintCid);
1054 WriteTags(0); 1054 WriteTags(0);
1055 // Write hex string length and content 1055 // Write hex string length and content
1056 intptr_t len = strlen(hex_string); 1056 intptr_t len = strlen(hex_string);
1057 WriteIntptrValue(len); 1057 Write<int32_t>(len);
1058 for (intptr_t i = 0; i < len; i++) { 1058 for (intptr_t i = 0; i < len; i++) {
1059 Write<uint8_t>(hex_string[i]); 1059 Write<uint8_t>(hex_string[i]);
1060 } 1060 }
1061 break; 1061 break;
1062 } 1062 }
1063 case Dart_CObject_kDouble: 1063 case Dart_CObject_kDouble:
1064 WriteVMIsolateObject(kDoubleObject); 1064 WriteVMIsolateObject(kDoubleObject);
1065 WriteDouble(object->value.as_double); 1065 WriteDouble(object->value.as_double);
1066 break; 1066 break;
1067 case Dart_CObject_kString: { 1067 case Dart_CObject_kString: {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 if (!success) { 1194 if (!success) {
1195 UnmarkAllCObjects(object); 1195 UnmarkAllCObjects(object);
1196 return false; 1196 return false;
1197 } 1197 }
1198 } 1198 }
1199 UnmarkAllCObjects(object); 1199 UnmarkAllCObjects(object);
1200 return true; 1200 return true;
1201 } 1201 }
1202 1202
1203 } // namespace dart 1203 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698