| 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_BITMAP_H_ | 5 #ifndef VM_BITMAP_H_ |
| 6 #define VM_BITMAP_H_ | 6 #define VM_BITMAP_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/zone.h" | 10 #include "vm/zone.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Return the bit offset of the highest bit set. | 41 // Return the bit offset of the highest bit set. |
| 42 intptr_t Maximum() const; | 42 intptr_t Maximum() const; |
| 43 | 43 |
| 44 // Return the bit offset of the lowest bit set. | 44 // Return the bit offset of the lowest bit set. |
| 45 intptr_t Minimum() const; | 45 intptr_t Minimum() const; |
| 46 | 46 |
| 47 // Sets min..max (inclusive) to value. | 47 // Sets min..max (inclusive) to value. |
| 48 void SetRange(intptr_t min, intptr_t max, bool value); | 48 void SetRange(intptr_t min, intptr_t max, bool value); |
| 49 | 49 |
| 50 void Print() const; |
| 51 |
| 50 private: | 52 private: |
| 51 static const intptr_t kInitialSizeInBytes = 16; | 53 static const intptr_t kInitialSizeInBytes = 16; |
| 52 static const intptr_t kIncrementSizeInBytes = 16; | 54 static const intptr_t kIncrementSizeInBytes = 16; |
| 53 | 55 |
| 54 bool InRange(intptr_t offset) const { | 56 bool InRange(intptr_t offset) const { |
| 55 if (offset < 0) { | 57 if (offset < 0) { |
| 56 FATAL1("Fatal error in BitmapBuilder::InRange :" | 58 FATAL1("Fatal error in BitmapBuilder::InRange :" |
| 57 " invalid bit_offset, %" Pd "\n", offset); | 59 " invalid bit_offset, %" Pd "\n", offset); |
| 58 } | 60 } |
| 59 return (offset < length_); | 61 return (offset < length_); |
| 60 } | 62 } |
| 61 | 63 |
| 62 // Get/Set a bit that is known to be covered by the backing store. | 64 // Get/Set a bit that is known to be covered by the backing store. |
| 63 bool GetBit(intptr_t bit_offset) const; | 65 bool GetBit(intptr_t bit_offset) const; |
| 64 void SetBit(intptr_t bit_offset, bool value); | 66 void SetBit(intptr_t bit_offset, bool value); |
| 65 | 67 |
| 66 intptr_t length_; | 68 intptr_t length_; |
| 67 | 69 |
| 68 // Backing store for the bitmap. Reading bits beyond the backing store | 70 // Backing store for the bitmap. Reading bits beyond the backing store |
| 69 // (up to length_) is allowed and they are assumed to be false. | 71 // (up to length_) is allowed and they are assumed to be false. |
| 70 intptr_t data_size_in_bytes_; | 72 intptr_t data_size_in_bytes_; |
| 71 uint8_t* data_; | 73 uint8_t* data_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(BitmapBuilder); | 75 DISALLOW_COPY_AND_ASSIGN(BitmapBuilder); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace dart | 78 } // namespace dart |
| 77 | 79 |
| 78 #endif // VM_BITMAP_H_ | 80 #endif // VM_BITMAP_H_ |
| OLD | NEW |