| OLD | NEW |
| 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/dart_api_message.h" | 5 #include "vm/dart_api_message.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 } | 397 } |
| 398 | 398 |
| 399 | 399 |
| 400 bool ApiMessageWriter::IsCObjectMarked(Dart_CObject* object) { | 400 bool ApiMessageWriter::IsCObjectMarked(Dart_CObject* object) { |
| 401 return (object->type & kDartCObjectMarkMask) != 0; | 401 return (object->type & kDartCObjectMarkMask) != 0; |
| 402 } | 402 } |
| 403 | 403 |
| 404 | 404 |
| 405 intptr_t ApiMessageWriter::GetMarkedCObjectMark(Dart_CObject* object) { | 405 intptr_t ApiMessageWriter::GetMarkedCObjectMark(Dart_CObject* object) { |
| 406 ASSERT(IsCObjectMarked(object)); | 406 ASSERT(IsCObjectMarked(object)); |
| 407 intptr_t mark_value = ((object->type & kDartCObjectMarkMask) >> 3); | 407 intptr_t mark_value = |
| 408 ((object->type & kDartCObjectMarkMask) >> kDartCObjectTypeBits); |
| 408 // An offset was added to object id for making marking object id 0 possible. | 409 // An offset was added to object id for making marking object id 0 possible. |
| 409 return mark_value - kDartCObjectMarkOffset; | 410 return mark_value - kDartCObjectMarkOffset; |
| 410 } | 411 } |
| 411 | 412 |
| 412 | 413 |
| 413 void ApiMessageWriter::UnmarkAllCObjects(Dart_CObject* object) { | 414 void ApiMessageWriter::UnmarkAllCObjects(Dart_CObject* object) { |
| 414 if (!IsCObjectMarked(object)) return; | 415 if (!IsCObjectMarked(object)) return; |
| 415 UnmarkCObject(object); | 416 UnmarkCObject(object); |
| 416 if (object->type == Dart_CObject::kArray) { | 417 if (object->type == Dart_CObject::kArray) { |
| 417 for (int i = 0; i < object->value.as_array.length; i++) { | 418 for (int i = 0; i < object->value.as_array.length; i++) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 564 } |
| 564 | 565 |
| 565 | 566 |
| 566 void ApiMessageWriter::WriteCMessage(Dart_CObject* object) { | 567 void ApiMessageWriter::WriteCMessage(Dart_CObject* object) { |
| 567 WriteCObject(object); | 568 WriteCObject(object); |
| 568 UnmarkAllCObjects(object); | 569 UnmarkAllCObjects(object); |
| 569 FinalizeBuffer(); | 570 FinalizeBuffer(); |
| 570 } | 571 } |
| 571 | 572 |
| 572 } // namespace dart | 573 } // namespace dart |
| OLD | NEW |