| 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 #ifndef VM_DART_API_MESSAGE_H_ | 5 #ifndef VM_DART_API_MESSAGE_H_ |
| 6 #define VM_DART_API_MESSAGE_H_ | 6 #define VM_DART_API_MESSAGE_H_ |
| 7 | 7 |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/snapshot.h" | 9 #include "vm/snapshot.h" |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1); | 124 ASSERT(kDartCObjectTypeMask >= Dart_CObject::kNumberOfTypes - 1); |
| 125 } | 125 } |
| 126 ~ApiMessageWriter() { | 126 ~ApiMessageWriter() { |
| 127 ::free(forward_list_); | 127 ::free(forward_list_); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Writes a message of integers. | 130 // Writes a message of integers. |
| 131 void WriteMessage(intptr_t field_count, intptr_t *data); | 131 void WriteMessage(intptr_t field_count, intptr_t *data); |
| 132 | 132 |
| 133 // Writes a message with a single object. | 133 // Writes a message with a single object. |
| 134 void WriteCMessage(Dart_CObject* object); | 134 bool WriteCMessage(Dart_CObject* object); |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 static const intptr_t kDartCObjectTypeBits = 4; | 137 static const intptr_t kDartCObjectTypeBits = 4; |
| 138 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1; | 138 static const intptr_t kDartCObjectTypeMask = (1 << kDartCObjectTypeBits) - 1; |
| 139 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask; | 139 static const intptr_t kDartCObjectMarkMask = ~kDartCObjectTypeMask; |
| 140 static const intptr_t kDartCObjectMarkOffset = 1; | 140 static const intptr_t kDartCObjectMarkOffset = 1; |
| 141 | 141 |
| 142 void MarkCObject(Dart_CObject* object, intptr_t object_id); | 142 void MarkCObject(Dart_CObject* object, intptr_t object_id); |
| 143 void UnmarkCObject(Dart_CObject* object); | 143 void UnmarkCObject(Dart_CObject* object); |
| 144 bool IsCObjectMarked(Dart_CObject* object); | 144 bool IsCObjectMarked(Dart_CObject* object); |
| 145 intptr_t GetMarkedCObjectMark(Dart_CObject* object); | 145 intptr_t GetMarkedCObjectMark(Dart_CObject* object); |
| 146 void UnmarkAllCObjects(Dart_CObject* object); | 146 void UnmarkAllCObjects(Dart_CObject* object); |
| 147 void AddToForwardList(Dart_CObject* object); | 147 void AddToForwardList(Dart_CObject* object); |
| 148 | 148 |
| 149 void WriteSmi(int64_t value); | 149 void WriteSmi(int64_t value); |
| 150 void WriteNullObject(); | 150 void WriteNullObject(); |
| 151 void WriteMint(Dart_CObject* object, int64_t value); | 151 void WriteMint(Dart_CObject* object, int64_t value); |
| 152 void WriteInt32(Dart_CObject* object); | 152 void WriteInt32(Dart_CObject* object); |
| 153 void WriteInt64(Dart_CObject* object); | 153 void WriteInt64(Dart_CObject* object); |
| 154 void WriteInlinedHeader(Dart_CObject* object); | 154 void WriteInlinedHeader(Dart_CObject* object); |
| 155 void WriteCObject(Dart_CObject* object); | 155 bool WriteCObject(Dart_CObject* object); |
| 156 void WriteCObjectRef(Dart_CObject* object); | 156 bool WriteCObjectRef(Dart_CObject* object); |
| 157 void WriteForwardedCObject(Dart_CObject* object); | 157 bool WriteForwardedCObject(Dart_CObject* object); |
| 158 void WriteCObjectInlined(Dart_CObject* object, Dart_CObject::Type type); | 158 bool WriteCObjectInlined(Dart_CObject* object, Dart_CObject::Type type); |
| 159 | 159 |
| 160 intptr_t object_id_; | 160 intptr_t object_id_; |
| 161 Dart_CObject** forward_list_; | 161 Dart_CObject** forward_list_; |
| 162 intptr_t forward_list_length_; | 162 intptr_t forward_list_length_; |
| 163 intptr_t forward_id_; | 163 intptr_t forward_id_; |
| 164 | 164 |
| 165 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); | 165 DISALLOW_COPY_AND_ASSIGN(ApiMessageWriter); |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 } // namespace dart | 168 } // namespace dart |
| 169 | 169 |
| 170 #endif // VM_DART_API_MESSAGE_H_ | 170 #endif // VM_DART_API_MESSAGE_H_ |
| OLD | NEW |