| 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_STATE_H_ | 5 #ifndef VM_DART_API_STATE_H_ |
| 6 #define VM_DART_API_STATE_H_ | 6 #define VM_DART_API_STATE_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 private: | 255 private: |
| 256 enum { | 256 enum { |
| 257 kExternalNewSpaceBit = 0, | 257 kExternalNewSpaceBit = 0, |
| 258 kExternalSizeBits = 1, | 258 kExternalSizeBits = 1, |
| 259 kExternalSizeBitsSize = (kBitsPerWord - 1), | 259 kExternalSizeBitsSize = (kBitsPerWord - 1), |
| 260 }; | 260 }; |
| 261 | 261 |
| 262 // This part of external_data_ is the number of externally allocated bytes. | 262 // This part of external_data_ is the number of externally allocated bytes. |
| 263 // TODO(koda): Measure size in words instead. | 263 // TODO(koda): Measure size in words instead. |
| 264 class ExternalSizeBits : public BitField<intptr_t, | 264 class ExternalSizeBits : public BitField<uword, |
| 265 intptr_t, |
| 265 kExternalSizeBits, | 266 kExternalSizeBits, |
| 266 kExternalSizeBitsSize> {}; // NOLINT | 267 kExternalSizeBitsSize> {}; |
| 267 // This bit of external_data_ is true if the referent was created in new | 268 // This bit of external_data_ is true if the referent was created in new |
| 268 // space and UpdateRelocated has not yet detected any promotion. | 269 // space and UpdateRelocated has not yet detected any promotion. |
| 269 class ExternalNewSpaceBit : public BitField<bool, kExternalNewSpaceBit, 1> {}; | 270 class ExternalNewSpaceBit : |
| 271 public BitField<uword, bool, kExternalNewSpaceBit, 1> {}; |
| 270 | 272 |
| 271 friend class FinalizablePersistentHandles; | 273 friend class FinalizablePersistentHandles; |
| 272 | 274 |
| 273 FinalizablePersistentHandle() | 275 FinalizablePersistentHandle() |
| 274 : raw_(NULL), | 276 : raw_(NULL), |
| 275 peer_(NULL), | 277 peer_(NULL), |
| 276 external_data_(0), | 278 external_data_(0), |
| 277 callback_(NULL) { } | 279 callback_(NULL) { } |
| 278 ~FinalizablePersistentHandle() { } | 280 ~FinalizablePersistentHandle() { } |
| 279 | 281 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 ref->set_peer(peer); | 770 ref->set_peer(peer); |
| 769 ref->set_callback(callback); | 771 ref->set_callback(callback); |
| 770 // This may trigger GC, so it must be called last. | 772 // This may trigger GC, so it must be called last. |
| 771 ref->SetExternalSize(external_size, isolate); | 773 ref->SetExternalSize(external_size, isolate); |
| 772 return ref; | 774 return ref; |
| 773 } | 775 } |
| 774 | 776 |
| 775 } // namespace dart | 777 } // namespace dart |
| 776 | 778 |
| 777 #endif // VM_DART_API_STATE_H_ | 779 #endif // VM_DART_API_STATE_H_ |
| OLD | NEW |